CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iThingFactoryState Struct Reference

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

#include <thing.h>

Inheritance diagram for iThingFactoryState:

iBase List of all members.

Public Methods

virtual void * GetPrivateObject ()=0
 @ UGLY

virtual void CompressVertices ()=0
 Compress the vertex table so that all nearly identical vertices are compressed.

virtual int GetPolygonCount ()=0
 Query number of polygons in this thing.

virtual void RemovePolygon (int idx)=0
 Delete a polygon given an index.

virtual void RemovePolygons ()=0
 Delete all polygons.

virtual int FindPolygonByName (const char *name)=0
 Find a polygon index with a name.

virtual int AddEmptyPolygon ()=0
 Add an empty polygon.

virtual int AddTriangle (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3)=0
 Add a triangle.

virtual int AddQuad (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3, const csVector3 &v4)=0
 Add a quad.

virtual int AddPolygon (csVector3 *vertices, int num)=0
 Add a general polygon.

virtual int AddPolygon (int num,...)=0
 Add a general polygon using vertex indices.

virtual int AddOutsideBox (const csVector3 &bmin, const csVector3 &bmax)=0
 Add a box that can be seen from the outside.

virtual int AddInsideBox (const csVector3 &bmin, const csVector3 &bmax)=0
 Add a box that can be seen from the inside.

virtual void SetPolygonName (const csPolygonRange &range, const char *name)=0
 Set the name of all polygons in the given range.

virtual const char * GetPolygonName (int polygon_idx)=0
 Get the name of the specified polygon.

virtual csPtr< iPolygonHandleCreatePolygonHandle (int polygon_idx)=0
 Create a polygon handle that can be used to refer to some polygon.

virtual void SetPolygonMaterial (const csPolygonRange &range, iMaterialWrapper *material)=0
 Set the material of all polygons in the given range.

virtual iMaterialWrapperGetPolygonMaterial (int polygon_idx)=0
 Get the material for the specified polygon.

virtual void AddPolygonVertex (const csPolygonRange &range, const csVector3 &vt)=0
 Add a vertex to all polygons in the given range.

virtual void AddPolygonVertex (const csPolygonRange &range, int vt)=0
 Add a vertex index to all polygons in the given range.

virtual void SetPolygonVertexIndices (const csPolygonRange &range, int num, int *indices)=0
 Set the given polygon index table for all polygons in the given range.

virtual int GetPolygonVertexCount (int polygon_idx)=0
 Get number of vertices for polygon.

virtual const csVector3GetPolygonVertex (int polygon_idx, int vertex_idx)=0
 Get a vertex from a polygon.

virtual int * GetPolygonVertexIndices (int polygon_idx)=0
 Get table with vertex indices from polygon.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, const csMatrix3 &m, const csVector3 &v)=0
 Set texture mapping of all polygons in the given range to use the transform.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, const csVector2 &uv1, const csVector2 &uv2, const csVector2 &uv3)=0
 Set texture mapping of all polygons in the given range to use the given uv coordinates for the first three vertices of every polygon.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, const csVector3 &p1, const csVector2 &uv1, const csVector3 &p2, const csVector2 &uv2, const csVector3 &p3, const csVector2 &uv3)=0
 Set texture mapping of all polygons in the given range to use the given uv coordinates for the specified three vertices of every polygon.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, const csVector3 &v_orig, const csVector3 &v1, float len1)=0
 Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, const csVector3 &v_orig, const csVector3 &v1, float len1, const csVector3 &v2, float len2)=0
 Set texture mapping of all polygons in the given range to use the texture mapping as specified by two vertices on the polygon.

virtual void SetPolygonTextureMapping (const csPolygonRange &range, float len1)=0
 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.

virtual void GetPolygonTextureMapping (int polygon_idx, csMatrix3 &m, csVector3 &v)=0
 Get the texture space information for the specified polygon.

virtual void SetPolygonTextureMappingEnabled (const csPolygonRange &range, bool enabled)=0
 Disable or enable texture mapping for the range of polygons.

virtual bool IsPolygonTextureMappingEnabled (int polygon_idx) const=0
 Check if texture mapping is enabled for the specified polygon.

virtual void SetPolygonFlags (const csPolygonRange &range, uint32 flags)=0
 Set the given flags to all polygons in the range.

virtual void SetPolygonFlags (const csPolygonRange &range, uint32 mask, uint32 flags)=0
 Set the given flags to all polygons in the range.

virtual void ResetPolygonFlags (const csPolygonRange &range, uint32 flags)=0
 Reset the given flags to all polygons in the range.

virtual csFlagsGetPolygonFlags (int polygon_idx)=0
 Get the flags of the specified polygon.

virtual const csPlane3GetPolygonObjectPlane (int polygon_idx)=0
 Get object space plane of the specified polygon.

virtual bool IsPolygonTransparent (int polygon_idx)=0
 Return true if this polygon or the texture it uses is transparent.

virtual bool PointOnPolygon (int polygon_idx, const csVector3 &v)=0
 Return true if an object space point is on (or very nearly on) the given polygon.

virtual int GetVertexCount () const=0
 Query number of vertices in set.

virtual const csVector3GetVertex (int idx) const=0
 Get the given vertex coordinates in object space.

virtual const csVector3GetVertices () const=0
 Get the vertex coordinates in object space.

virtual int CreateVertex (const csVector3 &vt)=0
 Create a vertex given his object-space coords and return his index.

virtual void SetVertex (int idx, const csVector3 &vt)=0
 Set the object space vertices for a given vertex.

virtual void DeleteVertex (int idx)=0
 Delete a vertex.

virtual void DeleteVertices (int from, int to)=0
 Delete a range of vertices (inclusive).

virtual csFlagsGetFlags ()=0
 Set thing flags (see CS_THING_... values above).

virtual void SetSmoothingFlag (bool smoothing)=0
 Sets the smoothing flag.

virtual bool GetSmoothingFlag ()=0
 Gets the smoothing flag.

virtual csVector3GetNormals ()=0
 Gets the normals.

virtual float GetCosinusFactor () const=0
 Get cosinus factor.

virtual void SetCosinusFactor (float cosfact)=0
 Set cosinus factor.


Detailed Description

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

Definition at line 175 of file thing.h.


Member Function Documentation

virtual int iThingFactoryState::AddEmptyPolygon   [pure virtual]
 

Add an empty polygon.

Returns:
the index of the created polygon.

virtual int iThingFactoryState::AddInsideBox const csVector3   bmin,
const csVector3   bmax
[pure virtual]
 

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.

virtual int iThingFactoryState::AddOutsideBox const csVector3   bmin,
const csVector3   bmax
[pure virtual]
 

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.

virtual int iThingFactoryState::AddPolygon int    num,
...   
[pure virtual]
 

Add a general polygon using vertex indices.

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.

virtual int iThingFactoryState::AddPolygon csVector3   vertices,
int    num
[pure virtual]
 

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.

virtual void iThingFactoryState::AddPolygonVertex const csPolygonRange   range,
int    vt
[pure virtual]
 

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.

virtual void iThingFactoryState::AddPolygonVertex const csPolygonRange   range,
const csVector3   vt
[pure virtual]
 

Add a vertex to all polygons in the given range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual int iThingFactoryState::AddQuad const csVector3   v1,
const csVector3   v2,
const csVector3   v3,
const csVector3   v4
[pure virtual]
 

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.

virtual int iThingFactoryState::AddTriangle const csVector3   v1,
const csVector3   v2,
const csVector3   v3
[pure virtual]
 

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.

virtual void iThingFactoryState::CompressVertices   [pure virtual]
 

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.

virtual csPtr<iPolygonHandle> iThingFactoryState::CreatePolygonHandle int    polygon_idx [pure virtual]
 

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.

virtual int iThingFactoryState::CreateVertex const csVector3   vt [pure virtual]
 

Create a vertex given his object-space coords and return his index.

virtual void iThingFactoryState::DeleteVertex int    idx [pure virtual]
 

Delete a vertex.

Warning this will invalidate all polygons that use vertices after this vertex because their vertex indices will no longer be ok.

virtual void iThingFactoryState::DeleteVertices int    from,
int    to
[pure virtual]
 

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

virtual int iThingFactoryState::FindPolygonByName const char *    name [pure virtual]
 

Find a polygon index with a name.

virtual float iThingFactoryState::GetCosinusFactor   [pure virtual]
 

Get cosinus factor.

virtual csFlags& iThingFactoryState::GetFlags   [pure virtual]
 

Set thing flags (see CS_THING_... values above).

virtual csVector3* iThingFactoryState::GetNormals   [pure virtual]
 

Gets the normals.

virtual int iThingFactoryState::GetPolygonCount   [pure virtual]
 

Query number of polygons in this thing.

virtual csFlags& iThingFactoryState::GetPolygonFlags int    polygon_idx [pure virtual]
 

Get the flags of the specified polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual iMaterialWrapper* iThingFactoryState::GetPolygonMaterial int    polygon_idx [pure virtual]
 

Get the material for the specified polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual const char* iThingFactoryState::GetPolygonName int    polygon_idx [pure virtual]
 

Get the name of the specified polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual const csPlane3& iThingFactoryState::GetPolygonObjectPlane int    polygon_idx [pure virtual]
 

Get object space plane of the specified polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual void iThingFactoryState::GetPolygonTextureMapping int    polygon_idx,
csMatrix3   m,
csVector3   v
[pure virtual]
 

Get the texture space information for the specified polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual const csVector3& iThingFactoryState::GetPolygonVertex int    polygon_idx,
int    vertex_idx
[pure virtual]
 

Get a vertex from a polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual int iThingFactoryState::GetPolygonVertexCount int    polygon_idx [pure virtual]
 

Get number of vertices for polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual int* iThingFactoryState::GetPolygonVertexIndices int    polygon_idx [pure virtual]
 

Get table with vertex indices from polygon.

Parameters:
polygon_idx  is a polygon index or CS_POLYINDEX_LAST for last created polygon.

virtual void* iThingFactoryState::GetPrivateObject   [pure virtual]
 

@ UGLY

@

virtual bool iThingFactoryState::GetSmoothingFlag   [pure virtual]
 

Gets the smoothing flag.

virtual const csVector3& iThingFactoryState::GetVertex int    idx const [pure virtual]
 

Get the given vertex coordinates in object space.

virtual int iThingFactoryState::GetVertexCount   [pure virtual]
 

Query number of vertices in set.

virtual const csVector3* iThingFactoryState::GetVertices   [pure virtual]
 

Get the vertex coordinates in object space.

virtual bool iThingFactoryState::IsPolygonTextureMappingEnabled int    polygon_idx const [pure virtual]
 

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.

virtual bool iThingFactoryState::IsPolygonTransparent int    polygon_idx [pure virtual]
 

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.

virtual bool iThingFactoryState::PointOnPolygon int    polygon_idx,
const csVector3   v
[pure virtual]
 

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.

virtual void iThingFactoryState::RemovePolygon int    idx [pure virtual]
 

Delete a polygon given an index.

virtual void iThingFactoryState::RemovePolygons   [pure virtual]
 

Delete all polygons.

virtual void iThingFactoryState::ResetPolygonFlags const csPolygonRange   range,
uint32    flags
[pure virtual]
 

Reset the given flags to all polygons in the range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetCosinusFactor float    cosfact [pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonFlags const csPolygonRange   range,
uint32    mask,
uint32    flags
[pure virtual]
 

Set the given flags to all polygons in the range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetPolygonFlags const csPolygonRange   range,
uint32    flags
[pure virtual]
 

Set the given flags to all polygons in the range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetPolygonMaterial const csPolygonRange   range,
iMaterialWrapper   material
[pure virtual]
 

Set the material of all polygons in the given range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetPolygonName const csPolygonRange   range,
const char *    name
[pure virtual]
 

Set the name of all polygons in the given range.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
float    len1
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
const csVector3   v_orig,
const csVector3   v1,
float    len1,
const csVector3   v2,
float    len2
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
const csVector3   v_orig,
const csVector3   v1,
float    len1
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
const csVector3   p1,
const csVector2   uv1,
const csVector3   p2,
const csVector2   uv2,
const csVector3   p3,
const csVector2   uv3
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
const csVector2   uv1,
const csVector2   uv2,
const csVector2   uv3
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMapping const csPolygonRange   range,
const csMatrix3   m,
const csVector3   v
[pure virtual]
 

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.

virtual void iThingFactoryState::SetPolygonTextureMappingEnabled const csPolygonRange   range,
bool    enabled
[pure virtual]
 

Disable or enable texture mapping for the range of polygons.

Parameters:
range  is one of the CS_POLYRANGE defines to specify a polygon range.

virtual void iThingFactoryState::SetPolygonVertexIndices const csPolygonRange   range,
int    num,
int *    indices
[pure virtual]
 

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.

virtual void iThingFactoryState::SetSmoothingFlag bool    smoothing [pure virtual]
 

Sets the smoothing flag.

virtual void iThingFactoryState::SetVertex int    idx,
const csVector3   vt
[pure virtual]
 

Set the object space vertices for a given vertex.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18