Sophie

Sophie

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

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.16.4.3 Hints</title>

<meta name="description" content="Crystal Space 1.2.1: 4.16.4.3 Hints">
<meta name="keywords" content="Crystal Space 1.2.1: 4.16.4.3 Hints">
<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="Map-File-Hints"></a>
<a name="0"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="Map-File-Syntax.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="Binary-XML.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="Old-Map-File-Format.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">
<h4 class="subsubsection"> 4.16.4.3 Hints </h4>


<p><em>Written by Jorrit Tyberghein,
<a href="mailto:jorrit.tyberghein@gmail.com">jorrit.tyberghein@gmail.com</a>.  Mathematical typesetting for
TeX performed by Eric Sunshine, <a href="mailto:sunshine@sunshineco.com">sunshine@sunshineco.com</a>.</em>
</p>
<p>This section contains extra discussions and hints regarding the map file and
the objects contained within it (this documentation is a little bit outdated
but still useful for the general idea. However it should be moved to the
thing mesh object description).
</p>
<p>First, a little explanation about <samp>&lsquo;LEN&rsquo;</samp> and <samp>&lsquo;TEXLEN&rsquo;</samp>.  With these
you can specify the size of the texture on the polygon.  For example, let's
say that you have a rectangular polygon which is 4 units wide and 6 units
tall.  A texture with <samp>&lsquo;LEN&rsquo;</samp> set to 2 will be tiled 2 times horizontally
and 3 times vertically.  If this texture is 128x128 (for example) then the
final texture on the polygon will be 256x384.
</p>
<p>Using a <samp>&lsquo;TEXTURE&rsquo;</samp> statement inside a <samp>&lsquo;POLYGON&rsquo;</samp> or with a
<samp>&lsquo;PLANE&rsquo;</samp> statement you can obtain even more control over how the texture
should be scaled across the polygon.  This is most easily explained with an
example.  Say that you have a polygon like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">VERTEX (0,2,3) VERTEX (2,2,3) VERTEX (2,0,3) VERTEX (0,0,3)
POLYGON 'poly' (VERTICES (0,1,2,3))
</pre></td></tr></table>
<p>Let's say that you want to align the texture so that its origin is at (2,2,3).
You can do this as follows:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">POLYGON 'poly' (
  VERTICES (0,1,2,3)
  TEXTURE (
    ORIG (2,2,3)
    FIRST (0,2,3)
    SECOND (2,0,3)
    FIRST_LEN (1)
    SECOND_LEN (1)))
</pre></td></tr></table>
<p>With <samp>&lsquo;ORIG&rsquo;</samp>, <samp>&lsquo;FIRST&rsquo;</samp>, and <samp>&lsquo;SECOND&rsquo;</samp> you specify how the u/v
coordinate system is located.  The origin of u/v is at <samp>&lsquo;ORIG&rsquo;</samp>; the u-axis
is at <samp>&lsquo;FIRST-ORIG&rsquo;</samp>; and the v-axis is at <samp>&lsquo;SECOND-ORIG&rsquo;</samp>.
<samp>&lsquo;FIRST_LEN&rsquo;</samp> and <samp>&lsquo;SECOND_LEN&rsquo;</samp> are similar to <samp>&lsquo;LEN&rsquo;</samp> and
<samp>&lsquo;TEXLEN&rsquo;</samp> except that you can control the u and v scaling separately here.
Note that <samp>&lsquo;ORIG&rsquo;</samp>, <samp>&lsquo;FIRST&rsquo;</samp>, and <samp>&lsquo;SECOND&rsquo;</samp> need not coincide with
vertices of the polygon.  They should just be on the same plane as the
polygon.  That way you can also create slanted textures.
</p>
<p><samp>&lsquo;TEXLEN&rsquo;</samp> in a <samp>&lsquo;THING&rsquo;</samp> or <samp>&lsquo;SECTOR&rsquo;</samp> is the default <samp>&lsquo;LEN&rsquo;</samp> for
all polygons following the <samp>&lsquo;TEXLEN&rsquo;</samp> declaration.  <samp>&lsquo;TEXNR&rsquo;</samp> in a
<samp>&lsquo;THING&rsquo;</samp> or <samp>&lsquo;SECTOR&rsquo;</samp> is the default <samp>&lsquo;TEXNR&rsquo;</samp> for all following
polygons.  <em>Note, however, that <samp>&lsquo;TEXNR&rsquo;</samp> is considered obsolete and
its use is deprecated.</em>
</p>
<p>Use of planes is recommended.  A <samp>&lsquo;PLANE&rsquo;</samp> provides a way to assign a name
to a texture orientation.  All polygons sharing the same <samp>&lsquo;PLANE&rsquo;</samp> will
have textures that fit perfectly at the borders.  Crystal Space will also be
able to do some optimizations on polygons that share the same plane (like
backface culling an entire set of polygons in one operation).  Note that even
if a <samp>&lsquo;PLANE&rsquo;</samp> is only used by one polygon it does not hurt.  If you do not
specify the <samp>&lsquo;PLANE&rsquo;</samp>, Crystal Space will create one anyway.
</p>
<p>Currently Crystal Space assumes that there is a sector called <samp>&lsquo;room&rsquo;</samp>.  It
will use that as a starting place, and will always start at location (0,0,0)
unless you use an <samp>&lsquo;ORIGIN&rsquo;</samp> directive to instruct it otherwise.
</p>
<p>Note that Sectors must be convex (unless you add a <small>BSP</small> tree).  Things
need not be convex.
</p>
<p>Vertices in a <samp>&lsquo;THING&rsquo;</samp> are specified in local object space.  You can
translate this object space to world space with the <samp>&lsquo;MOVE&rsquo;</samp> directive.
</p>
<p>When a <samp>&lsquo;THING&rsquo;</samp> or <samp>&lsquo;SPRITE&rsquo;</samp> is defined in the <samp>&lsquo;WORLD&rsquo;</samp> statement
and not in a <samp>&lsquo;SECTOR&rsquo;</samp> or <samp>&lsquo;ROOM&rsquo;</samp> then it defines a template.  This
template can then be used inside a <samp>&lsquo;SECTOR&rsquo;</samp> or <samp>&lsquo;ROOM&rsquo;</samp> by providing
another <samp>&lsquo;THING&rsquo;</samp> or <samp>&lsquo;SPRITE&rsquo;</samp> statement and using the <samp>&lsquo;TEMPLATE&rsquo;</samp>
statement there.  It is also possible to define the <samp>&lsquo;THING&rsquo;</samp> or
<samp>&lsquo;SPRITE&rsquo;</samp> inside a <samp>&lsquo;SECTOR&rsquo;</samp> or <samp>&lsquo;ROOM&rsquo;</samp> directly, but using
templates is preferable.
</p>
<p>With <samp>&lsquo;WARP&rsquo;</samp> you provide a matrix which will mirror or warp space.  For
example, when you want to make a mirroring floor the warping matrix should
invert the Y-axis and leave the others intact.  So the <samp>&lsquo;WARP&rsquo;</samp> matrix
would be:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">/ 1  0 0 \
| 0 -1 0 |
\ 0  0 1 /
</pre></td></tr></table>
<p>The vector should be a vector on the plane of the mirror.  It is used to
determine exactly where mirroring should start.  For example, if the floor is
at height -1, then (0,-1,0) is a good spot.
</p>
<p><samp>&lsquo;MATRIX (.5)&rsquo;</samp> is a shorthand for:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">/ .5  0  0 \
|  0 .5  0 |
\  0  0 .5 /
</pre></td></tr></table>
<p>Portals are unidirectional.  If you need a <samp>&lsquo;PORTAL&rsquo;</samp> that works in two
directions (so that you can go back) then you'll also have to specify a
<samp>&lsquo;PORTAL&rsquo;</samp> in the other sector pointing back.
</p>
<p>Note that even though a <samp>&lsquo;PORTAL&rsquo;</samp> does not require a texture (unless it
has alpha transparency) you still need to specify one, since Crystal Space
currently assumes that every polygon has a texture.
</p>
<p>The <samp>&lsquo;ROOM&rsquo;</samp> and <samp>&lsquo;SIXFACE&rsquo;</samp> interfaces are good for human editors but
it not suited for computer generated output.  Ignore <samp>&lsquo;ROOM&rsquo;</samp> and
<samp>&lsquo;SIXFACE&rsquo;</samp> if you want to write an editor or converter and concentrate on
<samp>&lsquo;SECTOR&rsquo;</samp> and <samp>&lsquo;THING&rsquo;</samp> instead.
</p>

<hr size="1">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="Map-File-Syntax.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="Binary-XML.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="Old-Map-File-Format.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>