crystalspace.jbind.interfaces.imesh.thing
Interface iThingFactoryState

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

public interface iThingFactoryState
extends iBase

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

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

Method Summary
 int addEmptyPolygon()
          Add an empty polygon.
 int addInsideBox(csVector3 bmin, csVector3 bmax)
          Add a box that can be seen from the inside.
 int addOutsideBox(csVector3 bmin, csVector3 bmax)
          Add a box that can be seen from the outside.
 int addPolygon(csVector3[] vertices, int num)
          Add a general polygon.
 void addPolygonVertex(csPolygonRange range, csVector3 vt)
          Add a vertex to all polygons in the given range.
 void addPolygonVertex(csPolygonRange range, int vt)
          Add a vertex index to all polygons in the given range.
 int addQuad(csVector3 v1, csVector3 v2, csVector3 v3, csVector3 v4)
          Add a quad.
 int addTriangle(csVector3 v1, csVector3 v2, csVector3 v3)
          Add a triangle.
 void compressVertices()
          Compress the vertex table so that all nearly identical vertices are compressed.
 iPolygonHandle createPolygonHandle(int polygon_idx)
          Create a polygon handle that can be used to refer to some polygon.
 int createVertex(csVector3 vt)
          Create a vertex given his object-space coords and return his index.
 void deleteVertex(int idx)
          Delete a vertex.
 void deleteVertices(int from, int to)
          Delete a range of vertices (inclusive);.
 int findPolygonByName(java.lang.String name)
          Find a polygon index with a name.
 float getCosinusFactor()
          Get cosinus factor.
 csFlags getFlags()
          Set thing flags (see CS_THING_... values above);.
 csVector3[] getNormals()
          Gets the normals.
 int getPolygonCount()
          Query number of polygons in this thing.
 csFlags getPolygonFlags(int polygon_idx)
          Get the flags of the specified polygon.
 iMaterialWrapper getPolygonMaterial(int polygon_idx)
          Get the material for the specified polygon.
 java.lang.String getPolygonName(int polygon_idx)
          Get the name of the specified polygon.
 csPlane3 getPolygonObjectPlane(int polygon_idx)
          Get object space plane of the specified polygon.
 void getPolygonTextureMapping(int polygon_idx, csMatrix3 m, csVector3 v)
          Get the texture space information for the specified polygon.
 csVector3 getPolygonVertex(int polygon_idx, int vertex_idx)
          Get a vertex from a polygon.
 int getPolygonVertexCount(int polygon_idx)
          Get number of vertices for polygon.
 int[] getPolygonVertexIndices(int polygon_idx)
          Get table with vertex indices from polygon.
 boolean getSmoothingFlag()
          Gets the smoothing flag.
 csVector3 getVertex(int idx)
          Get the given vertex coordinates in object space.
 int getVertexCount()
          Query number of vertices in set.
 csVector3[] getVertices()
          Get the vertex coordinates in object space.
 boolean isPolygonTextureMappingEnabled(int polygon_idx)
          Check if texture mapping is enabled for the specified polygon.
 boolean isPolygonTransparent(int polygon_idx)
          Return true if this polygon or the texture it uses is transparent.
 boolean pointOnPolygon(int polygon_idx, csVector3 v)
          Return true if an object space point is on (or very nearly on); the given polygon.
 void removePolygon(int idx)
          Delete a polygon given an index.
 void removePolygons()
          Delete all polygons.
 void resetPolygonFlags(csPolygonRange range, int flags)
          Reset the given flags to all polygons in the range.
 void setCosinusFactor(float cosfact)
          Set cosinus factor.
 void setPolygonFlags(csPolygonRange range, int flags)
          Set the given flags to all polygons in the range.
 void setPolygonFlags(csPolygonRange range, int mask, int flags)
          Set the given flags to all polygons in the range.
 void setPolygonMaterial(csPolygonRange range, iMaterialWrapper material)
          Set the material of all polygons in the given range.
 void setPolygonName(csPolygonRange range, java.lang.String name)
          Set the name of all polygons in the given range.
 void setPolygonTextureMapping(csPolygonRange range, csMatrix3 m, csVector3 v)
          Set texture mapping of all polygons in the given range to use the transform.
 void setPolygonTextureMapping(csPolygonRange range, csVector2 uv1, csVector2 uv2, csVector2 uv3)
          Set texture mapping of all polygons in the given range to use the given uv coordinates for the first three vertices of every polygon.
 void setPolygonTextureMapping(csPolygonRange range, csVector3 p1, csVector2 uv1, csVector3 p2, csVector2 uv2, csVector3 p3, csVector2 uv3)
          Set texture mapping of all polygons in the given range to use the given uv coordinates for the specified three vertices of every polygon.
 void setPolygonTextureMapping(csPolygonRange range, csVector3 v_orig, csVector3 v1, float len1)
          Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon.
 void setPolygonTextureMapping(csPolygonRange range, csVector3 v_orig, csVector3 v1, float len1, csVector3 v2, float len2)
          Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon.
 void setPolygonTextureMapping(csPolygonRange range, float len1)
          Set texture mapping of all polygons in the given range to use the texture mapping as specified by the two first vertices on the polygon.
 void setPolygonTextureMappingEnabled(csPolygonRange range, boolean enabled)
          Disable or enable texture mapping for the range of polygons.
 void setPolygonVertexIndices(csPolygonRange range, int num, int[] indices)
          Set the given polygon index table for all polygons in the given range.
 void setSmoothingFlag(boolean smoothing)
          Sets the smoothing flag.
 void setVertex(int idx, csVector3 vt)
          Set the object space vertices for a given vertex.
 
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

addEmptyPolygon

public int addEmptyPolygon()
Add an empty polygon. Returns: the index of the created polygon. Implemented in csThingStatic.

Returns:

addInsideBox

public int addInsideBox(csVector3 bmin,
                        csVector3 bmax)
Add a box that can be seen from the inside. This will add six polygons. By default the texture mapping is set so that the texture is aligned on the u-axis with the 'v1'-'v2' vector and the scale is set so that the texture tiles once for every unit (i.e. if you have the vertices v1 and v2 are 5 units separated from each other then the texture will repeat exactly five times between v1 and v2);. Returns: the index of the first created polygon. Implemented in csThingStatic.

Parameters:
bmin -
bmax -
Returns:

addOutsideBox

public int addOutsideBox(csVector3 bmin,
                         csVector3 bmax)
Add a box that can be seen from the outside. This will add six polygons. By default the texture mapping is set so that the texture is aligned on the u-axis with the 'v1'-'v2' vector and the scale is set so that the texture tiles once for every unit (i.e. if you have the vertices v1 and v2 are 5 units separated from each other then the texture will repeat exactly five times between v1 and v2);. Returns: the index of the first created polygon. Implemented in csThingStatic.

Parameters:
bmin -
bmax -
Returns:

addPolygon

public int addPolygon(csVector3[] vertices,
                      int num)
Add a general polygon. By default the texture mapping is set so that the texture is aligned on the u-axis with the 'v1'-'v2' vector and the scale is set so that the texture tiles once for every unit (i.e. if you have the vertices v1 and v2 are 5 units separated from each other then the texture will repeat exactly five times between v1 and v2);. Returns: the index of the created polygon. Implemented in csThingStatic.

Parameters:
vertices -
num -
Returns:

addPolygonVertex

public void addPolygonVertex(csPolygonRange range,
                             int vt)
Add a vertex index to all polygons in the given range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
vt -

addPolygonVertex

public void addPolygonVertex(csPolygonRange range,
                             csVector3 vt)
Add a vertex to all polygons in the given range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
vt -

addQuad

public int addQuad(csVector3 v1,
                   csVector3 v2,
                   csVector3 v3,
                   csVector3 v4)
Add a quad. Note that quads are the most optimal kind of polygon for a thing so you should try to use these as much as possible. By default the texture mapping is set so that the texture is aligned on the u-axis with the 'v1'-'v2' vector and the scale is set so that the texture tiles once for every unit (i.e. if you have the vertices v1 and v2 are 5 units separated from each other then the texture will repeat exactly five times between v1 and v2);. Returns: the index of the created polygon. Implemented in csThingStatic.

Parameters:
v1 -
v2 -
v3 -
v4 -
Returns:

addTriangle

public int addTriangle(csVector3 v1,
                       csVector3 v2,
                       csVector3 v3)
Add a triangle. By default the texture mapping is set so that the texture is aligned on the u-axis with the 'v1'-'v2' vector and the scale is set so that the texture tiles once for every unit (i.e. if you have the vertices v1 and v2 are 5 units separated from each other then the texture will repeat exactly five times between v1 and v2);. Returns: the index of the created polygon. Implemented in csThingStatic.

Parameters:
v1 -
v2 -
v3 -
Returns:

compressVertices

public void compressVertices()
Compress the vertex table so that all nearly identical vertices are compressed. The polygons in the set are automatically adapted. This function can be called at any time in the creation of the object and it can be called multiple time but it normally only makes sense to call this function after you have finished adding all polygons and all vertices. Implemented in csThingStatic.


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. The polygon handle created here will not have a mesh object or thing state set since it is created from the factory. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

createVertex

public int createVertex(csVector3 vt)
Create a vertex given his object-space coords and return his index. Implemented in csThingStatic.

Parameters:
vt -
Returns:

deleteVertex

public void deleteVertex(int idx)
Delete a vertex. Warning this will invalidate all polygons that use vertices after this vertex because their vertex indices will no longer be ok. Implemented in csThingStatic.

Parameters:
idx -

deleteVertices

public void deleteVertices(int from,
                           int to)
Delete a range of vertices (inclusive);. Warning this will invalidate all polygons that use vertices after these vertices because their vertex indices will no longer be ok. This function does bounds-checking so an easy way to delete all vertices is DeleteVertices(0,1000000000);. Implemented in csThingStatic.

Parameters:
from -
to -

findPolygonByName

public int findPolygonByName(java.lang.String name)
Find a polygon index with a name. Implemented in csThingStatic.

Parameters:
name -
Returns:

getCosinusFactor

public float getCosinusFactor()
Get cosinus factor. Implemented in csThingStatic.

Returns:

getFlags

public csFlags getFlags()
Set thing flags (see CS_THING_... values above);. Implemented in csThingStatic.

Returns:

getNormals

public csVector3[] getNormals()
Gets the normals. Implemented in csThingStatic.

Returns:

getPolygonCount

public int getPolygonCount()
Query number of polygons in this thing. Implemented in csThingStatic.

Returns:

getPolygonFlags

public csFlags getPolygonFlags(int polygon_idx)
Get the flags of the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getPolygonMaterial

public iMaterialWrapper getPolygonMaterial(int polygon_idx)
Get the material for the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getPolygonName

public java.lang.String getPolygonName(int polygon_idx)
Get the name of the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getPolygonObjectPlane

public csPlane3 getPolygonObjectPlane(int polygon_idx)
Get object space plane of the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getPolygonTextureMapping

public void getPolygonTextureMapping(int polygon_idx,
                                     csMatrix3 m,
                                     csVector3 v)
Get the texture space information for the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
m -
v -

getPolygonVertex

public csVector3 getPolygonVertex(int polygon_idx,
                                  int vertex_idx)
Get a vertex from a polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
vertex_idx -
Returns:

getPolygonVertexCount

public int getPolygonVertexCount(int polygon_idx)
Get number of vertices for polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getPolygonVertexIndices

public int[] getPolygonVertexIndices(int polygon_idx)
Get table with vertex indices from polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

getSmoothingFlag

public boolean getSmoothingFlag()
Gets the smoothing flag. Implemented in csThingStatic.

Returns:

getVertex

public csVector3 getVertex(int idx)
Get the given vertex coordinates in object space. Implemented in csThingStatic.

Parameters:
idx -
Returns:

getVertexCount

public int getVertexCount()
Query number of vertices in set. Implemented in csThingStatic.

Returns:

getVertices

public csVector3[] getVertices()
Get the vertex coordinates in object space. Implemented in csThingStatic.

Returns:

isPolygonTextureMappingEnabled

public boolean isPolygonTextureMappingEnabled(int polygon_idx)
Check if texture mapping is enabled for the specified polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

isPolygonTransparent

public boolean isPolygonTransparent(int polygon_idx)
Return true if this polygon or the texture it uses is transparent. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
Returns:

pointOnPolygon

public boolean pointOnPolygon(int polygon_idx,
                              csVector3 v)
Return true if an object space point is on (or very nearly on); the given polygon. Parameters: polygon_idx is a polygon index or CS_POLYINDEX_LAST for last created polygon. Implemented in csThingStatic.

Parameters:
polygon_idx -
v -
Returns:

removePolygon

public void removePolygon(int idx)
Delete a polygon given an index. Implemented in csThingStatic.

Parameters:
idx -

removePolygons

public void removePolygons()
Delete all polygons. Implemented in csThingStatic.


resetPolygonFlags

public void resetPolygonFlags(csPolygonRange range,
                              int flags)
Reset the given flags to all polygons in the range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
flags -

setCosinusFactor

public void setCosinusFactor(float cosfact)
Set cosinus factor. This cosinus factor controls how lighting affects the polygons relative to the angle. If no value is set here then the default is used. Implemented in csThingStatic.

Parameters:
cosfact -

setPolygonFlags

public void setPolygonFlags(csPolygonRange range,
                            int mask,
                            int flags)
Set the given flags to all polygons in the range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
mask -
flags -

setPolygonFlags

public void setPolygonFlags(csPolygonRange range,
                            int flags)
Set the given flags to all polygons in the range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
flags -

setPolygonMaterial

public void setPolygonMaterial(csPolygonRange range,
                               iMaterialWrapper material)
Set the material of all polygons in the given range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
material -

setPolygonName

public void setPolygonName(csPolygonRange range,
                           java.lang.String name)
Set the name of all polygons in the given range. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
name -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     float len1)
Set texture mapping of all polygons in the given range to use the texture mapping as specified by the two first vertices on the polygon. The first vertex is seen as the origin and the second as the u-axis of the texture space coordinate system. The v-axis is calculated on the plane of the polygons and orthogonal to the given u-axis. The length of the u-axis and the v-axis is given as the 'len1' parameter. For example, if 'len1' is equal to 2 this means that texture will be tiled exactly two times between the two first vertices. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
len1 -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     csVector3 v_orig,
                                     csVector3 v1,
                                     float len1,
                                     csVector3 v2,
                                     float len2)
Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon. The first vertex is seen as the origin, the second as the u-axis of the texture space coordinate system, and the third as the v-axis. The length of the u-axis and the v-axis is given with the 'len1' and 'len2' parameters. For example, if 'len1' is equal to 2 this means that texture will be tiled exactly two times between vertex 'v_orig' and 'v1'. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
v_orig -
v1 -
len1 -
v2 -
len2 -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     csVector3 v_orig,
                                     csVector3 v1,
                                     float len1)
Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon. The first vertex is seen as the origin and the second as the u-axis of the texture space coordinate system. The v-axis is calculated on the plane of the polygons and orthogonal to the given u-axis. The length of the u-axis and the v-axis is given as the 'len1' parameter. For example, if 'len1' is equal to 2 this means that texture will be tiled exactly two times between vertex 'v_orig' and 'v1'. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
v_orig -
v1 -
len1 -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     csVector3 p1,
                                     csVector2 uv1,
                                     csVector3 p2,
                                     csVector2 uv2,
                                     csVector3 p3,
                                     csVector2 uv3)
Set texture mapping of all polygons in the given range to use the given uv coordinates for the specified three vertices of every polygon. Note that this function is only useful for polygon ranges that are on the same plane. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
p1 -
uv1 -
p2 -
uv2 -
p3 -
uv3 -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     csVector2 uv1,
                                     csVector2 uv2,
                                     csVector2 uv3)
Set texture mapping of all polygons in the given range to use the given uv coordinates for the first three vertices of every polygon. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
uv1 -
uv2 -
uv3 -

setPolygonTextureMapping

public void setPolygonTextureMapping(csPolygonRange range,
                                     csMatrix3 m,
                                     csVector3 v)
Set texture mapping of all polygons in the given range to use the transform. This function is usually not used by application code as it is complicated to specify texture mapping like this. It is recommended to use one of the other texture mapping routines. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
m -
v -

setPolygonTextureMappingEnabled

public void setPolygonTextureMappingEnabled(csPolygonRange range,
                                            boolean enabled)
Disable or enable texture mapping for the range of polygons. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
enabled -

setPolygonVertexIndices

public void setPolygonVertexIndices(csPolygonRange range,
                                    int num,
                                    int[] indices)
Set the given polygon index table for all polygons in the given range. It is more optimal to call this routine as opposed to calling AddPolygonVertex(); all the time. Parameters: range is one of the CS_POLYRANGE defines to specify a polygon range. Implemented in csThingStatic.

Parameters:
range -
num -
indices -

setSmoothingFlag

public void setSmoothingFlag(boolean smoothing)
Sets the smoothing flag. Implemented in csThingStatic.

Parameters:
smoothing -

setVertex

public void setVertex(int idx,
                      csVector3 vt)
Set the object space vertices for a given vertex. Implemented in csThingStatic.

Parameters:
idx -
vt -