[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] [ Search: ]

4.10.9 Thing Mesh Object

Written by Jorrit Tyberghein, (jorrit.tyberghein@gmail.com).

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 Genmesh Mesh Object.

Things support general polygons (as opposed to only supporting triangles).

There is also a howto on creating things (see section Creating a Thing Mesh).

Basic Structure

The following SCF class names are used (for csLoadPlugin):

Objects in this plugin implement the following SCF interfaces (get with scfQueryInterface):

State Interfaces

‘iThingFactoryState’ is the SCF interface that you can use to set/get settings for a thing. The definition of this interface can be found in ‘CS/include/imesh/thing.h’ 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.

‘iThingState’ is for thing instances.

Factory and Object Loader

At load time a thing can be constructed from several thing parts. 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 part which is also what you can use in the top level thing definition.

A given polygon (inside the ‘polygon’ keyword) is defined as follows:


The material to use for this polygon. If not given then the default material will be used.

<texmap> ...

This keyword can be used to define additional texture mapping parameters.


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).

shading(shadingParm) FIXME: still existing ?

This describes the kind of shading to use for this polygon. Possible values are: ‘none’, ‘flat’, ‘gouraud’, or ‘lightmap’. Default is ‘lightmap’.

vertices <v v1="" ... />

The vertices of the polygon. This is a list of vertex indices local to the part this polygon is in. In combination with the ‘vblock’ or ‘vroom’ commands this command can also contain something with the name: ‘w’, ‘e’, ‘n’, ‘s’, ‘u’, or ‘d’ (for west, east, north, south, up, or down). This will then create vertices according to the last ‘vblock’ or ‘vroom’. Note that there should be no other vertex generating command between the ‘vblock’ or ‘vroom’ and this polygon command! You can also give the first index of the ‘vblock’ or ‘vroom’ generated vertices with a notation like this: ‘vertices (w,8)’.

<uv u1="" v1="" ... />

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).

<uva u1="" v1="" a1="" ... />

Similar to ‘uv’ but uses another technique to describe the coordinates using angle.

<color red="" green="" blue="" ... />

When using ‘uv’ you can use this command to give colors (r,g,b) for every vertex.


Enable/disable collision detection for this polygon. By default a normal polygon will have collision detection enabled.


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).


Using this you can set the alpha transparency factor of this polygon. This is a value between 0 and 100.

<mixmode><mode /></mixmode>

With this you can control more blending options for the polygon. see section Parsing Mixmode.

len(scale) FIXME: obsolete ?

This is similar to the ‘texlen’ command in the part and also to the ‘len’ command in the texture definition but it is repeated here as a short-hand for ‘texture (len (...))’.

plane(planeName) FIXME: no shortcut anymore ?

This is a shorthand for ‘texture (plane (...))’.

A texture mapping specification (the ‘texture’ keyword in a polygon) has the following parameters:

<orig x="" y="" z="" />

The origin for texture mapping (3D coord).

<first x="" y="" z="" />

The u-axis coordinate for texture mapping (3D coord).

<second x="" y="" z="" />

The v-axis coordinate for texture mapping (3D coord).


Scale along the u-axis.


Scale along the v-axis.

<uvec x="" y="" z="" />

Similar to ‘first’ with ‘firstlen’ set to length of vector (‘first’-‘orig’).

<vvec x="" y="" z="" />

Similar to ‘second’ with ‘secondlen’ set to length of vector (‘second’-‘orig’).

<matrix> ...

Most general way to describe texture mapping using the transformation matrix.

<v x="" y="" z="" />

Most general way to describe texture mapping using the transformation vector.

len(scale) FIXME: obsolete ?

Use this as an easier way to describe texture scale (i.e. instead of all the above).

<uv idx1="" u1="" v1="" idx2="" u2="" v2="" idx3="" u3="" v3="" />

Directly specify u,v mapping coordinates for three given vertices.

uv_shift(ushift,vshift) FIXME: where is this now ?

Given the mapping described above, further shift with the given u,v shift value.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.