Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 4082

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Crystal Space 1.2.1: 5.9.1 A Simple 3D Sprite</title>

<meta name="description" content="Crystal Space 1.2.1: 5.9.1 A Simple 3D Sprite">
<meta name="keywords" content="Crystal Space 1.2.1: 5.9.1 A Simple 3D Sprite">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="g_t3D-Sprites-Example-1"></a>
<a name="0"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="3D-Sprites.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="3D-Sprites-Example-2.html#0" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="Working-with-Engine-Content.html#0" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="3D-Sprites.html#0" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Internals.html#0" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<hr size="1">
<h3 class="subsection"> 5.9.1 A Simple 3D Sprite </h3>

<p>Let us consider a simple 3D sprite&mdash;a 24 sided prism meant to look like a
cylinder.  Each side is made from two triangles, and the ends are made
from 24 polygons (you could make the ends from 23 polygons, but that's not
how artists do things :-).
</p>
<p><img src="content/sprites/cylinder.jpg" alt="content/sprites/cylinder">
</p>
<p>This sprite has 96 triangles.  If we treat each triangle as a separate
object, it has 288 vertices.  Every frame each of those 288 vertices has
to be transformed from local coordinates to screen space coordinates.
</p>
<p>Each vertex is also consuming some memory.  If each vertex only has
three 32 bit float coordinates, then the sprite uses 3456 bytes of memory,
but in practice each vertex also has texture alignment, color, and
surface normal data, and if the sprite has precalculated animation, that
data is multiplied by the number of frames.
</p>
<p>However, the 3D sprite structure is compressed so that triangles can share
vertices.  Instead of 288 vertices, the cylinder sprite has 48 vertices
shared by the 96 triangles.  Each triangle is simply three indices to
to the vertex list.
</p>
<ul>
<li>
Vertices
<ul class="toc">
<li>-
3D Coordinates (X, Y, Z)
</li><li>-
Texture Coordinates (U, V)
</li><li>-
Color (R, G, B)
</li><li>-
Surface Normal (X, Y, Z)
</li></ul>
</li><li>
Triangles
<ul class="toc">
<li>-
First Vertex Index
</li><li>-
Second Vertex Index
</li><li>-
Third Vertex Index
</li></ul>
</li></ul>

<hr size="1">
<p>
 <font size="-1">
  This document was generated using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

</p>
</body>
</html>