crystalspace.jbind.interfaces.imesh.thing
Interface iThingState

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csThingState

public interface iThingState
extends iBase

This is the state interface to access the internals of a thing mesh object.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/devapi/structiThingState.php

Method Summary
 void clearReplacedMaterials()
          Clear all replaced materials (i.e. reset to default materials from factory).
 iPolygonHandle createPolygonHandle(int polygon_idx)
          Create a polygon handle that can be used to refer to some polygon.
 iThingFactoryState getFactory()
          Get the factory.
 int getMixMode()
          Get mix mode.
 int getMovingOption()
          Get the moving option.
 iMaterialWrapper getPolygonMaterial(int polygon_idx)
          Get the material for the specified polygon.
 csPlane3 getPolygonWorldPlane(int polygon_idx)
          Get world space plane of the specified polygon.
 csVector3 getVertexW(int idx)
          Get the given vertex coordinates in world space.
 csVector3[] getVerticesW()
          Get the vertex coordinates in world space.
 void prepare()
          Prepare the thing to be ready for use.
 void replaceMaterial(iMaterialWrapper oldmat, iMaterialWrapper newmat)
          Scan all polygons and replace the given material with a new material.
 void setMixMode(int mode)
          Set mix mode.
 void setMovingOption(int opt)
          Control how this thing will be moved.
 void setPolygonMaterial(csPolygonRange range, iMaterialWrapper material)
          Set the material of all polygons in the given range.
 void unprepare()
          Reset the prepare flag so that this Thing can be re-prepared.
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

clearReplacedMaterials

public void clearReplacedMaterials()
Clear all replaced materials (i.e. reset to default materials from factory).


createPolygonHandle

public iPolygonHandle createPolygonHandle(int polygon_idx)
Create a polygon handle that can be used to refer to some polygon. This can be useful in situations where an SCF handle is required to be able to reference a polygon. The thing will not keep a reference to this handle so you are fully responsible for it after calling this function. Parameters: polygon_idx is a polygon index. CS_POLYINDEX_LAST is NOT supported here!

Parameters:
polygon_idx -
Returns:

getFactory

public iThingFactoryState getFactory()
Get the factory.

Returns:

getMixMode

public int getMixMode()
Get mix mode.

Returns:

getMovingOption

public int getMovingOption()
Get the moving option.

Returns:

getPolygonMaterial

public iMaterialWrapper getPolygonMaterial(int polygon_idx)
Get the material for the specified polygon. Parameters: polygon_idx is a polygon index. CS_POLYINDEX_LAST is NOT supported here!

Parameters:
polygon_idx -
Returns:

getPolygonWorldPlane

public csPlane3 getPolygonWorldPlane(int polygon_idx)
Get world space plane of the specified polygon. Parameters: polygon_idx is a polygon index. CS_POLYINDEX_LAST is NOT supported here!

Parameters:
polygon_idx -
Returns:

getVertexW

public csVector3 getVertexW(int idx)
Get the given vertex coordinates in world space.

Parameters:
idx -
Returns:

getVerticesW

public csVector3[] getVerticesW()
Get the vertex coordinates in world space.

Returns:

prepare

public void prepare()
Prepare the thing to be ready for use. Normally this doesn't have to be called as the engine will call this function automatically as soon as the object is rendered. However, to avoid the (sometimes long) setup time for an object while walking around an application can choose to call this function manually in order to increase load time but decrease the time need to setup things later.


replaceMaterial

public void replaceMaterial(iMaterialWrapper oldmat,
                            iMaterialWrapper newmat)
Scan all polygons and replace the given material with a new material. Note that the new material MUST have the same size as the old material! If 'newmat' == 0 then the default from the factory will be used again. Note that 'oldmat' will always be compared from the factory and not from the current material the polygon has!

Parameters:
oldmat -
newmat -

setMixMode

public void setMixMode(int mode)
Set mix mode.

Parameters:
mode -

setMovingOption

public void setMovingOption(int opt)
Control how this thing will be moved. There are currently two options. CS_THING_MOVE_NEVER: this option is set for a thing that cannot move at all. In this case the movable will be ignored and only hard transforms can be used to move a thing with this flag. This setting is both efficient for memory (object space coordinates are equal to world space coordinates so only one array is kept) and render speed (only the camera transform is needed). This option is very useful for static geometry like walls. This option is default. CS_THING_MOVE_OCCASIONAL: this option is set for a thing that is movable but doesn't move all the time usually. Setting this option means that the world space vertices will be cached (taking up more memory that way) but the coordinates will be recalculated only at rendertime (and cached at that time). This option has the same speed efficiency as MOVE_NEVER when the object doesn't move but more memory is used as all the vertices are duplicated. Use this option for geometry that is not too big (in number of vertices) and only moves occasionally like doors of elevators. Note: it is no longer needed to manually set this option. By default things will use CS_THING_MOVE_NEVER and they will automatically switch to the slightly less efficient CS_THING_MOVE_OCCASIONAL if needed.

Parameters:
opt -

setPolygonMaterial

public void setPolygonMaterial(csPolygonRange range,
                               iMaterialWrapper material)
Set the material of all polygons in the given range. Set the material of all polygons in the given range. This material must have the same size as the material given in the factory! If 0 then the factory material will be used. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Note that it is not allowed to use CS_POLYRANGE_LAST here!

Parameters:
range -
material -

unprepare

public void unprepare()
Reset the prepare flag so that this Thing can be re-prepared. Among other things this will allow cached lightmaps to be recalculated.