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;
}
ul
{
padding:0px;
margin:0px;
}
table.principale
{
background-color:#ff8000;
@ -200,3 +206,99 @@ div.issue-title
{
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>
</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">
<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()
{
//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:apply-templates select="./list" />
</xsl:if>
<xsl:if test="./code">
<xsl:apply-templates select="./code" />
</xsl:if>
<xsl:apply-templates select="./source" />
<!--table style="width:100%;">
<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-->
<!--xsl:apply-templates select="/" /-->
</div>
<div class="news-separator">_________________</div>

View File

@ -73,7 +73,7 @@
</xsl:template>
<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 match="menu">
@ -137,4 +137,88 @@
</div>
</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>