Sophie

Sophie

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

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: 4.10.9 Thing Mesh Object</title>

<meta name="description" content="Crystal Space 1.2.1: 4.10.9 Thing Mesh Object">
<meta name="keywords" content="Crystal Space 1.2.1: 4.10.9 Thing Mesh Object">
<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="MeshObject-Thing"></a>
<a name="0"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="MeshObject-Genmesh.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="MeshObject-TerrFunc.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="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="MeshObject.html#0" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Working-with-Engine-Content.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"> 4.10.9 Thing Mesh Object </h3>

<p><em>Written by Jorrit Tyberghein,
(<a href="mailto:jorrit.tyberghein@gmail.com">jorrit.tyberghein@gmail.com</a>).</em>
</p>
<p>This mesh object represents a 'thing' which is a very often used
geometry object in Crystal Space. Things are often used to mark the bounding
geometry of a sector so that it represents a closed space. Things are not
very dynamic in nature (although you can have things that move) so they
are most often used for static geometry. Things are considered deprecated
and you should use 'genmesh' instead. See section <a href="MeshObject-Genmesh.html#0">Genmesh Mesh Object</a>.
</p>
<p>Things support general polygons (as opposed to only supporting triangles).
</p>
<p>There is also a howto on creating things (see section <a href="HOWTO-Create-Thing.html#0">Creating a Thing Mesh</a>).
</p>
<a name="1"></a>
<h4 class="subsubheading"> Basic Structure </h4>

<p>The following <small>SCF</small> class names are used (for <code>csLoadPlugin</code>):
</p>
<ul>
<li>
Type plugin: <samp>&lsquo;crystalspace.mesh.object.thing&rsquo;</samp>
</li><li>
Loader plugin: <samp>&lsquo;crystalspace.mesh.loader.thing&rsquo;</samp>
</li><li>
Factory loader plugin: <samp>&lsquo;crystalspace.mesh.loader.factory.thing&rsquo;</samp>
</li></ul>

<p>Objects in this plugin implement the following <small>SCF</small> interfaces (get
with <code>scfQueryInterface</code>):
</p>
<ul>
<li>
<em>MeshObjectFactory</em>
<ul>
<li>
Implements <samp>&lsquo;iMeshObjectFactory&rsquo;</samp>
</li><li>
Implements <samp>&lsquo;iThingFactoryState&rsquo;</samp>
</li></ul>
</li><li>
<em>MeshObject</em>
<ul>
<li>
Implements <samp>&lsquo;iMeshObject&rsquo;</samp>
</li><li>
Implements <samp>&lsquo;iThingState&rsquo;</samp>
</li><li>
Implements <samp>&lsquo;iVisibilityCuller&rsquo;</samp>
</li><li>
Implements <samp>&lsquo;iLightingInfo&rsquo;</samp>
</li></ul>
</li><li>
<em>MeshObjectType</em>
<ul>
<li>
Implements <samp>&lsquo;iMeshObjectType&rsquo;</samp>
</li><li>
Implements <samp>&lsquo;iThingEnvironment&rsquo;</samp>
</li></ul>
</li></ul>

<a name="2"></a>
<h4 class="subsubheading"> State Interfaces </h4>

<p><samp>&lsquo;iThingFactoryState&rsquo;</samp> is the <small>SCF</small> interface that you can use to
set/get settings for a thing. The definition of this interface
can be found in <tt>&lsquo;CS/include/imesh/thing.h&rsquo;</tt> and that is also the
include file you need to include in your applications to use this plugin.
Using this interface you can access the vertices, polygons, materials,
and various other configuration parameters for a thing.
</p>
<p><samp>&lsquo;iThingState&rsquo;</samp> is for thing instances.
</p>
<a name="3"></a>
<h4 class="subsubheading"> Factory and Object Loader </h4>

<p>At load time a thing can be constructed from several <em>thing parts</em>.
At run time these parts will all be combined into one big thing but
at load time it is sometimes easy to be able to split the thing in parts
so that you can have a more logical grouping of thing data. The important
feature of parts is that the vertex table starts from zero again. This means
that you can define vertices in a part and then use them in polygons in that
part as if the vertex table starts at 0 again. This is useful because then
you can more easily add new parts and even move around parts without having
to change all vertex indices. Note that it is no problem to have duplicate
vertices between different parts as they will be combined in a post-processing
pass anyway. The table below describes everything which you can use in a
single <em>part</em> which is also what you can use in the top level thing
definition.
</p>
<ul>
<li>
Vertex and polygon definition commands. Note that in a given part the vertex
table always starts at index 0. Every vertex you add will use a new index.
<dl compact="compact">
<dt> <code>vertex &lt;v x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>Define a single vertex given three coordinates. The coordinates are given
in local object space for this thing.
</p></dd>
<dt> <code>polygon &lt;p name=&quot;&quot;&gt; <small class="dots">...</small></code></dt>
<dd><p>This defines a single polygon using the vertices described above. The
definition of a polygon is given below.
</p></dd>
</dl>

</li><li>
Material related commands.
<dl compact="compact">
<dt> <code>&lt;material&gt;materialName&lt;/material&gt;</code></dt>
<dd><p>The default material to use for all following polygons. A polygon can
still override this.
</p></dd>
<dt> <code>&lt;matsetselect&gt;materialSetName&lt;/matsetselect&gt;</code></dt>
<dd><p>Use a set of textures that was defined previously.
</p></dd>
<dt> <code>&lt;texlen&gt;scaleValue&lt;/texlen&gt;</code></dt>
<dd><p>This is a very general and easy command to control texture mapping on
a polygon. It basically defines the scale of a texture. If you want more
control over polygon texture mapping you should look at the texture mapping
parameters in a polygon. But if you want Quick-And-Dirty texture mapping
then this command can help you. <samp>&lsquo;texlen&rsquo;</samp> expects a single parameter
which is a scale. A scale of 1 means that the given texture will be scaled
once in both directions for 1 unit in world space. A scale of 2 means that
the given texture will be scaled once in 2 units of world space.
</p></dd>
</dl>

</li><li>
Various other commands.
<dl compact="compact">
<dt> <code>&lt;fastmesh&gt;yes/no&lt;/fastmesh&gt;</code></dt>
<dd><p>This command only works for the top-level thing. It indicates that this
mesh will be rendered using a faster technique. At this moment this is
default if the number of polygons exceeds some threshold.
</p></dd>
<dt> <code>&lt;factory&gt;factoryName&lt;/factory&gt;</code></dt>
<dd><p>This thing will be made from the given thing factory.
</p></dd>
<dt> <code>&lt;clone&gt;thingName&lt;/clone&gt;</code></dt>
<dd><p>This is similar to <samp>&lsquo;factory&rsquo;</samp> but the thing will be made from the
given thing instead. i.e. it is a clone.
</p></dd>
<dt> <code>&lt;cosfact&gt;factorValue&lt;/cosfact&gt;</code></dt>
<dd><p>The cosinus factor to use for lighting. The default is 0 which means
that the strength of the light falling on this polygon will depend
completely on the angle of the light and a polygon. This is the most
realistic setting but in some cases it doesn't look right. To completely
disable dependence on angle you can use 1. In between values are also
possible.
</p></dd>
</dl>
</li></ul>

<p>A given polygon (inside the <samp>&lsquo;polygon&rsquo;</samp> keyword) is defined as
follows:
</p>
<dl compact="compact">
<dt> <code>&lt;material&gt;materialName&lt;/material&gt;</code></dt>
<dd><p>The material to use for this polygon. If not given then the default material
will be used.
</p></dd>
<dt> <code>&lt;texmap&gt; <small class="dots">...</small></code></dt>
<dd><p>This keyword can be used to define additional texture mapping parameters.
</p></dd>
<dt> <code>&lt;lighting&gt;yes/no&lt;/lighting&gt;</code></dt>
<dd><p>Should this polygon use lighting or not. By default this is enabled. If
disabled the texture on this polygon will be rendered using original colors
(i.e. full-bright texture).
</p></dd>
<dt> <code>shading(shadingParm) FIXME: still existing ?</code></dt>
<dd><p>This describes the kind of shading to use for this polygon. Possible values
are: <samp>&lsquo;none&rsquo;</samp>, <samp>&lsquo;flat&rsquo;</samp>, <samp>&lsquo;gouraud&rsquo;</samp>, or <samp>&lsquo;lightmap&rsquo;</samp>. Default
is <samp>&lsquo;lightmap&rsquo;</samp>.
</p></dd>
<dt> <code>vertices &lt;v v1=&quot;&quot; <small class="dots">...</small> /&gt;</code></dt>
<dd><p>The vertices of the polygon. This is a list of vertex indices local to the
part this polygon is in. In combination with the <samp>&lsquo;vblock&rsquo;</samp> or <samp>&lsquo;vroom&rsquo;</samp>
commands this command can also contain something with the name: <samp>&lsquo;w&rsquo;</samp>,
<samp>&lsquo;e&rsquo;</samp>, <samp>&lsquo;n&rsquo;</samp>, <samp>&lsquo;s&rsquo;</samp>, <samp>&lsquo;u&rsquo;</samp>, or <samp>&lsquo;d&rsquo;</samp> (for west, east, north,
south, up, or down). This will then create vertices according to the last
<samp>&lsquo;vblock&rsquo;</samp> or <samp>&lsquo;vroom&rsquo;</samp>. Note that there should be no other vertex
generating command between the <samp>&lsquo;vblock&rsquo;</samp> or <samp>&lsquo;vroom&rsquo;</samp> and this
polygon command! You can also give the first index of the <samp>&lsquo;vblock&rsquo;</samp>
or <samp>&lsquo;vroom&rsquo;</samp> generated vertices with a notation like this:
<samp>&lsquo;vertices (w,8)&rsquo;</samp>.
</p></dd>
<dt> <code>&lt;uv u1=&quot;&quot; v1=&quot;&quot; <small class="dots">...</small> /&gt;</code></dt>
<dd><p>If you use this keyword the polygon will be gouraud shaded and not
lightmapped. This keyword allows you to describe the uv coordinates
for the polygon with gouraud shading. Currently a gouraud shaded polygon
is limited to three vertices. This limitation will be removed in the
future. But for now it means that uv will be followed by six parameters (three
u,v coordinate sets).
</p></dd>
<dt> <code>&lt;uva u1=&quot;&quot; v1=&quot;&quot; a1=&quot;&quot; <small class="dots">...</small> /&gt;</code></dt>
<dd><p>Similar to <samp>&lsquo;uv&rsquo;</samp> but uses another technique to describe the coordinates
using angle.
</p></dd>
<dt> <code>&lt;color red=&quot;&quot; green=&quot;&quot; blue=&quot;&quot; <small class="dots">...</small> /&gt;</code></dt>
<dd><p>When using <samp>&lsquo;uv&rsquo;</samp> you can use this command to give colors (r,g,b) for
every vertex.
</p></dd>
<dt> <code>colldet(boolean)</code></dt>
<dd><p>Enable/disable collision detection for this polygon. By default a normal
polygon will have collision detection enabled.
</p></dd>
<dt> <code>viscull(boolean)</code></dt>
<dd><p>Enable/disable visibility culling for this polygon. By default a normal
polygon will have visibility culling enabled. If the polygon has alpha
then it will be disabled. However if the polygon uses a transparent texture
then CS cannot easily detect that so in that case you have to disable it
manually. This flag tells the visibility culler that this polygon should NOT
be used to cull other objects (i.e. to block visibility).
</p></dd>
<dt> <code>&lt;alpha&gt;alphaValue&lt;/alpha&gt;</code></dt>
<dd><p>Using this you can set the alpha transparency factor of this polygon.
This is a value between 0 and 100.
</p></dd>
<dt> <code>&lt;mixmode&gt;&lt;mode /&gt;&lt;/mixmode&gt;</code></dt>
<dd><p>With this you can control more blending options for the polygon.
see section <a href="XMLServices-Mixmode.html#0">Parsing Mixmode</a>.
</p></dd>
<dt> <code>len(scale) FIXME: obsolete ?</code></dt>
<dd><p>This is similar to the <samp>&lsquo;texlen&rsquo;</samp> command in the part and also to the
<samp>&lsquo;len&rsquo;</samp> command in the texture definition but it is repeated here
as a short-hand for <samp>&lsquo;texture (len (...))&rsquo;</samp>.
</p></dd>
<dt> <code>plane(planeName) FIXME: no shortcut anymore ?</code></dt>
<dd><p>This is a shorthand for <samp>&lsquo;texture (plane (...))&rsquo;</samp>.
</p></dd>
</dl>

<p>A texture mapping specification (the <samp>&lsquo;texture&rsquo;</samp> keyword in a polygon)
has the following parameters:
</p>
<dl compact="compact">
<dt> <code>&lt;orig x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>The origin for texture mapping (3D coord).
</p></dd>
<dt> <code>&lt;first x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>The u-axis coordinate for texture mapping (3D coord).
</p></dd>
<dt> <code>&lt;second x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>The v-axis coordinate for texture mapping (3D coord).
</p></dd>
<dt> <code>&lt;firstlen&gt;scale&lt;/firstlen&gt;</code></dt>
<dd><p>Scale along the u-axis.
</p></dd>
<dt> <code>&lt;secondlen&gt;scale&lt;/secondlen&gt;</code></dt>
<dd><p>Scale along the v-axis.
</p></dd>
<dt> <code>&lt;uvec x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>Similar to <samp>&lsquo;first&rsquo;</samp> with <samp>&lsquo;firstlen&rsquo;</samp> set to length
of vector (<samp>&lsquo;first&rsquo;</samp>-<samp>&lsquo;orig&rsquo;</samp>).
</p></dd>
<dt> <code>&lt;vvec x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>Similar to <samp>&lsquo;second&rsquo;</samp> with <samp>&lsquo;secondlen&rsquo;</samp> set to length
of vector (<samp>&lsquo;second&rsquo;</samp>-<samp>&lsquo;orig&rsquo;</samp>).
</p></dd>
<dt> <code>&lt;matrix&gt; <small class="dots">...</small></code></dt>
<dd><p>Most general way to describe texture mapping using the transformation matrix.
</p></dd>
<dt> <code>&lt;v x=&quot;&quot; y=&quot;&quot; z=&quot;&quot; /&gt;</code></dt>
<dd><p>Most general way to describe texture mapping using the transformation vector.
</p></dd>
<dt> <code>len(scale) FIXME: obsolete ?</code></dt>
<dd><p>Use this as an easier way to describe texture scale (i.e. instead
of all the above).
</p></dd>
<dt> <code>&lt;uv idx1=&quot;&quot; u1=&quot;&quot; v1=&quot;&quot; idx2=&quot;&quot; u2=&quot;&quot; v2=&quot;&quot; idx3=&quot;&quot; u3=&quot;&quot; v3=&quot;&quot; /&gt;</code></dt>
<dd><p>Directly specify u,v mapping coordinates for three given vertices.
</p></dd>
<dt> <code>uv_shift(ushift,vshift) FIXME: where is this now ?</code></dt>
<dd><p>Given the mapping described above, further shift with the given
u,v shift value.
</p></dd>
</dl>


<hr size="1">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="MeshObject-Genmesh.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="MeshObject-TerrFunc.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="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="MeshObject.html#0" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Working-with-Engine-Content.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>
<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>