Updated code samples

This commit is contained in:
Christophe Riccio 2010-05-24 17:30:56 +01:00
parent d066a02b7c
commit 31857276cf
6 changed files with 961 additions and 360 deletions

View File

@ -12,6 +12,12 @@ table
margin-right:auto; margin-right:auto;
} }
ul
{
padding:0px;
margin:0px;
}
table.principale table.principale
{ {
background-color:#ff8000; background-color:#ff8000;
@ -200,3 +206,99 @@ div.issue-title
{ {
font-weight:bold; font-weight:bold;
} }
span.progword
{
color:#000000;
font-family:"Courier New";
font-size:11px;
}
span.bold
{
font-weight:bold;
}
span.code-title
{
padding-left:0px;
color:#803300;
}
span.code-line-content
{
display:inline;
color:#000000;
border-left-style:solid;
border-left-width:1px;
border-left-color:#ffdac1;
margin-left:0px;
padding-left:8px;
}
ul.code-list
{
border-style:solid;
border-width:1px;
border-color:#ffdac1;
color:#803300;
margin-bottom:16px;
margin-left:0px;
margin-right:0px;
}
li.code-line
{
color:#008080;
font-family:"Courier New";
font-size:11px;
clear:both;
width:100%;
list-style-position:inside;
list-style-type:decimal-leading-zero;
margin:0px;
padding:0px;
padding-left:0px;
}
li.code-line:after
{
clear:both;
}
span.code-line-content
{
display:inline;
color:#000000;
border-left-style:solid;
border-left-width:1px;
border-left-color:#ffdac1;
margin-left:0px;
padding-left:8px;
}
span.userword
{
color:#ff8000;
}
span.keyword
{
color:#0000ff;
}
span.comment
{
color:#008000;
}
span.string
{
color:#800000;
}
span.codeword
{
color:#000000;
font-family:"Courier New";
}

View File

@ -35,19 +35,6 @@
</html> </html>
</xsl:template> </xsl:template>
<xsl:template match="code">
<div>
<div class="title4">
<xsl:value-of select="./@date" /> | <xsl:value-of select="./@title" />
</div>
<div>
<xsl:apply-templates />
</div>
<div class="news-separator">_________________</div>
<br />
</div>
</xsl:template>
<!-- <!--
<xsl:template match="code"> <xsl:template match="code">
<div> <div>

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,42 @@
#include "../../glm/glm.hpp" // glm::vec3, glm::vec4, glm::ivec4, glm::mat4
struct triangle
{
glm::vec3 Position[3];
glm::vec3 Normal;
};
void computeNormal(triangle & Triangle)
{
glm::vec3 const & a = Triangle.Position[0];
glm::vec3 const & b = Triangle.Position[1];
glm::vec3 const & c = Triangle.Position[2];
Triangle.Normal = glm::normalize(glm::cross(c - a, b - a));
}
#include "../../glm/gtc/matrix_projection.hpp" // glm::perspective
#include "../../glm/gtc/matrix_transform.hpp" // glm::translate, glm::rotate, glm::scale
#include "../../glm/gtc/type_ptr.hpp" // glm::value_ptr
glm::vec4 const ClearColor = glm::vec4(glm::vec3(0.0f), 1.0f);
glm::ivec4 const Viewport = glm::ivec4(0, 0, 640, 480);
void glUniformMatrix4fv(int location, int count, bool transpose, const float * value);
int main() int main()
{ {
//triangle Triangle;
//computeNormal(Triangle);
float Translate = 1.0f;
glm::vec2 Rotate;
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
glm::mat4 MVP = Projection * View * Model;
glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP));
} }

View File

@ -53,24 +53,12 @@
<xsl:if test="./list"> <xsl:if test="./list">
<xsl:apply-templates select="./list" /> <xsl:apply-templates select="./list" />
</xsl:if> </xsl:if>
<xsl:if test="./code">
<xsl:apply-templates select="./code" />
</xsl:if>
<xsl:apply-templates select="./source" /> <xsl:apply-templates select="./source" />
<!--table style="width:100%;"> <!--xsl:apply-templates select="/" /-->
<tr style="width:100%;">
<td>
<xsl:if test="./paragraph">
<xsl:apply-templates select="./paragraph" />
</xsl:if>
<xsl:if test="./list">
<xsl:apply-templates select="./list" />
</xsl:if>
<xsl:apply-templates select="./source" />
</td>
<td style="text-align:right;">
<a ref="{./@image}"><img src="{./@image-mini}" alt=" " /></a>
</td>
</tr>
</table-->
</div> </div>
<div class="news-separator">_________________</div> <div class="news-separator">_________________</div>

View File

@ -1,140 +1,224 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" /> <xsl:strip-space elements="*" />
<xsl:output <xsl:output
method="xml" method="xml"
media-type="application/xhtml+xml; charset=iso-8859-1" media-type="application/xhtml+xml; charset=iso-8859-1"
version="1.0" version="1.0"
encoding="iso-8859-1" encoding="iso-8859-1"
standalone="no" standalone="no"
omit-xml-declaration="no" omit-xml-declaration="no"
doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
indent="no" /> indent="no" />
<xsl:template match="link"> <xsl:template match="link">
<a href="{./@href}"><xsl:value-of select="." /></a> <a href="{./@href}"><xsl:value-of select="." /></a>
</xsl:template> </xsl:template>
<xsl:template match="image"> <xsl:template match="image">
<xsl:choose> <xsl:choose>
<xsl:when test="./@href"> <xsl:when test="./@href">
<xsl:element name="a"> <xsl:element name="a">
<xsl:attribute name="class">menu-titre2</xsl:attribute> <xsl:attribute name="class">menu-titre2</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="./@href" /></xsl:attribute> <xsl:attribute name="href"><xsl:value-of select="./@href" /></xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="@file" /></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="@file" /></xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="img"> <xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="@file" /></xsl:attribute> <xsl:attribute name="src"><xsl:value-of select="@file" /></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="@file" /></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="@file" /></xsl:attribute>
</xsl:element> </xsl:element>
</xsl:element> </xsl:otherwise>
</xsl:when> </xsl:choose>
<xsl:otherwise> </xsl:template>
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="@file" /></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="@file" /></xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="image-list"> <xsl:template match="image-list">
<div class="news-image"> <div class="news-image">
<xsl:apply-templates select="./image-element" /> <xsl:apply-templates select="./image-element" />
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="image-element"> <xsl:template match="image-element">
<a href="{./@normal}"> <a href="{./@normal}">
<img src="{./@small}" alt="{./@title}" /> <img src="{./@small}" alt="{./@title}" />
</a> </a>
</xsl:template> </xsl:template>
<xsl:template match="list"> <xsl:template match="list">
<xsl:value-of select="./@nom" /><br /> <xsl:value-of select="./@nom" /><br />
<xsl:apply-templates select="./element"/> <xsl:apply-templates select="./element"/>
<br /> <br />
</xsl:template> </xsl:template>
<xsl:template match="element"> <xsl:template match="element">
<xsl:apply-templates /><br /> <xsl:apply-templates /><br />
</xsl:template> </xsl:template>
<xsl:template match="paragraph"> <xsl:template match="paragraph">
<div class="paragraph"><xsl:text /><xsl:apply-templates /><xsl:text /></div><br /> <div class="paragraph"><xsl:text /><xsl:apply-templates /><xsl:text /></div><br />
</xsl:template> </xsl:template>
<xsl:template match="about-short"> <xsl:template match="about-short">
<div class="title3"> <div class="title3">
<xsl:apply-templates select="./element" /> <xsl:apply-templates select="./element" />
</div> </div>
<br /> <br />
</xsl:template> </xsl:template>
<xsl:template match="source"> <xsl:template match="source">
<xsl:value-of select="./@type"/>: <a href="{./@adresse}"><xsl:value-of select="."/></a><br /> <xsl:value-of select="./@type"/>: <a href="{./@href}"><xsl:value-of select="."/></a><br />
</xsl:template> </xsl:template>
<xsl:template match="menu"> <xsl:template match="menu">
<div class="menu1"> <div class="menu1">
<br /> <br />
<div> <div>
<a href="./goodies/logo1920x1200.png"> <a href="./goodies/logo1920x1200.png">
<img class="menu-img" src="./common/logo.png" alt="GLM Logo"/> <img class="menu-img" src="./common/logo.png" alt="GLM Logo"/>
</a> </a>
</div> </div>
<br /> <br />
<div> <div>
<a class="menu" href="{/glm/downloads/section/download/@link}"> <a class="menu" href="{/glm/downloads/section/download/@link}">
Download <xsl:value-of select="/glm/downloads/section/download/@name" /> Download <xsl:value-of select="/glm/downloads/section/download/@name" />
</a> </a>
</div> </div>
</div> </div>
<br /> <br />
<xsl:apply-templates select="./menu-group"/> <xsl:apply-templates select="./menu-group"/>
<br /> <br />
<xsl:apply-templates select="./menu-link"/> <xsl:apply-templates select="./menu-link"/>
<br /> <br />
<!--div> <!--div>
<script type="text/javascript" src="http://feedjit.com/map/?bc=FFFFFF&amp;tc=494949&amp;brd1=FFFFFF&amp;lnk=494949&amp;hc=FF8000&amp;dot=FF8000"></script> <script type="text/javascript" src="http://feedjit.com/map/?bc=FFFFFF&amp;tc=494949&amp;brd1=FFFFFF&amp;lnk=494949&amp;hc=FF8000&amp;dot=FF8000"></script>
<noscript> <noscript>
<a href="http://feedjit.com/">Feedjit Live Blog Stats</a> <a href="http://feedjit.com/">Feedjit Live Blog Stats</a>
</noscript> </noscript>
</div--> </div-->
</xsl:template> </xsl:template>
<xsl:template match="menu-pic"> <xsl:template match="menu-pic">
<div class="menu2"> <div class="menu2">
<a href="{@href}"> <a href="{@href}">
<img class="menu-img" src="{@image}" alt="{@name}"/> <img class="menu-img" src="{@image}" alt="{@name}"/>
</a> </a>
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="menu-link"> <xsl:template match="menu-link">
<xsl:apply-templates select="./menu-pic"/> <xsl:apply-templates select="./menu-pic"/>
</xsl:template> </xsl:template>
<xsl:template match="menu-image"> <xsl:template match="menu-image">
<div class="menu2"> <div class="menu2">
<a href="./common/glm.jpg"> <a href="./common/glm.jpg">
<img class="menu-img" src="./common/logo.jpg" alt="G-Truc"/> <img class="menu-img" src="./common/logo.jpg" alt="G-Truc"/>
</a> </a>
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="menu-group"> <xsl:template match="menu-group">
<xsl:apply-templates select="./menu-entry"/> <xsl:apply-templates select="./menu-entry"/>
<br /> <br />
</xsl:template> </xsl:template>
<xsl:template match="menu-entry"> <xsl:template match="menu-entry">
<div class="menu2"> <div class="menu2">
<a href="{./@href}"> <a href="{./@href}">
<xsl:value-of select="./@name"/> <xsl:value-of select="./@name"/>
</a> </a>
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="code">
<xsl:choose>
<xsl:when test="./@href">
<span xmlns="http://www.w3.org/1999/xhtml" class="code-title">
<a href="{./@href}">
<xsl:value-of select="./@author" />
</a>
</span>
</xsl:when>
<xsl:otherwise>
<span xmlns="http://www.w3.org/1999/xhtml" class="code-title">
<xsl:value-of select="./@title" />
</span>
</xsl:otherwise>
</xsl:choose>
<ul xmlns="http://www.w3.org/1999/xhtml" class="code-list">
<xsl:apply-templates select="./line" />
</ul>
</xsl:template>
<xsl:template match="line">
<li xmlns="http://www.w3.org/1999/xhtml" class="code-line">
<xsl:choose>
<xsl:when test="@align">
<span class="code-line-content" style="padding-left:{@align}">
<xsl:apply-templates />
</span>
</xsl:when>
<xsl:otherwise>
<span class="code-line-content">
<xsl:apply-templates />
</span>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<xsl:template match="progword">
<xsl:choose>
<xsl:when test="./@href">
<span xmlns="http://www.w3.org/1999/xhtml" class="progword">
<a href="{./@href}">
<xsl:apply-templates />
</a>
</span>
</xsl:when>
<xsl:otherwise>
<span xmlns="http://www.w3.org/1999/xhtml" class="progword">
<xsl:apply-templates />
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="keyword">
<span xmlns="http://www.w3.org/1999/xhtml" class="keyword">
<xsl:apply-templates />
</span>
</xsl:template>
<xsl:template match="userword">
<span xmlns="http://www.w3.org/1999/xhtml" class="userword">
<xsl:apply-templates />
</span>
</xsl:template>
<xsl:template match="codeword">
<span xmlns="http://www.w3.org/1999/xhtml" class="codeword">
<xsl:apply-templates />
</span>
</xsl:template>
<xsl:template match="string">
<span xmlns="http://www.w3.org/1999/xhtml" class="string">
<xsl:apply-templates />
</span>
</xsl:template>
<xsl:template match="comment">
<span xmlns="http://www.w3.org/1999/xhtml" class="comment">
<xsl:apply-templates />
</span>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>