CrystalSpace

Public API Reference

iGeneralFactoryState Struct Reference
[Mesh plugins]

This interface describes the API for the general mesh factory. More...

#include <imesh/genmesh.h>

Inheritance diagram for iGeneralFactoryState:

List of all members.

Public Member Functions

virtual void AddTriangle (const csTriangle &tri)=0
 Add a triangle.
virtual void AddVertex (const csVector3 &v, const csVector2 &uv, const csVector3 &normal, const csColor4 &color)=0
 Add a vertex.
virtual void CalculateNormals (bool compress=true)=0
 Automatically calculate normals based on the current mesh.
virtual void Compress ()=0
 Compress the vertex table.
virtual void DisableAutoNormals ()=0
 Disable auto-generated normals.
virtual void GenerateBox (const csBox3 &box)=0
 Generate procedurally a box.
virtual void GenerateCapsule (float l, float r, uint sides)=0
 Generate procedurally a capsule of given length and radius.
virtual void GenerateCone (float l, float r, uint sides)=0
 Generate procedurally a cone of given length and radius.
virtual void GenerateCylinder (float l, float r, uint sides)=0
 Generate procedurally a cylinder of given length and radius.
virtual void GenerateSphere (const csEllipsoid &ellips, int rim_vertices, bool cyl_mapping=false, bool toponly=false, bool reversed=false)=0
 Generate procedurally a sphere.
virtual
iGenMeshAnimationControlFactory
GetAnimationControlFactory () const =0
 Get the current animation control factory for this factory.
virtual const csColorGetColor () const =0
 Get the color.
virtual csColor4GetColors ()=0
 Get the array of colors.
virtual csVector3GetNormals ()=0
 Get the array of normals.
virtual csVector2GetTexels ()=0
 Get the array of texels.
virtual int GetTriangleCount () const =0
 Get the number of triangles for this mesh.
virtual csTriangleGetTriangles ()=0
 Get the array of triangles.
virtual int GetVertexCount () const =0
 Get the number of vertices for this mesh.
virtual csVector3GetVertices ()=0
 Get the array of vertices.
virtual void Invalidate ()=0
 After making a significant change to the vertices or triangles you probably want to let this object recalculate the bounding boxes and such.
virtual bool IsAutoNormals () const =0
 Returns whether normals were autogenerated or manual.
virtual bool IsBack2Front () const =0
 Get the value of the back2front flag.
virtual void SetAnimationControlFactory (iGenMeshAnimationControlFactory *anim_ctrl)=0
 Set the animation control factory to use for this factory.
virtual void SetBack2Front (bool b2f)=0
 Enable back to front rendering for the triangles of this genmesh.
virtual void SetColor (const csColor &col)=0
 Set the color to use. Will be added to the lighting values.
virtual void SetTriangleCount (int n)=0
 Set the number of triangles to use for this mesh.
virtual void SetVertexCount (int n)=0
 Set the number of vertices to use for this mesh.
SubMesh handling



virtual iGeneralMeshSubMeshAddSubMesh (iRenderBuffer *indices, iMaterialWrapper *material, const char *name, uint mixmode=(uint)~0)=0
 Add a submesh to this object.
virtual void ClearSubMeshes ()=0
 Remove all submeshes added to this object.
virtual void DeleteSubMesh (iGeneralMeshSubMesh *mesh)=0
 Delete a submesh.
virtual iGeneralMeshSubMeshFindSubMesh (const char *name) const =0
 Find the index of a submesh.
virtual iGeneralMeshSubMeshGetSubMesh (size_t index) const =0
 Get a specific submesh.
virtual size_t GetSubMeshCount () const =0
 Get the number of submeshes.
Progressive LODs



virtual int GetNumProgLODLevels () const =0
 Get the maximum between all submeshes' progressive LOD levels.
virtual void GetProgLODDistances (float &out_min, float &out_max) const =0
 Get distances where progressive LOD will be in effect.
virtual void SetProgLODDistances (float min, float max)=0
 Set distances where progressive LOD will be in effect.

Detailed Description

This interface describes the API for the general mesh factory.

iGeneralFactoryState inherits from iGeneralMeshState. All methods from iGeneralMeshState as set on the factory will serve as defaults for mesh objects that are created from this factory AFTER the default value is set. So changing such a value on the factory will have no effect on meshes already created. The material wrapper is an exception to this rule. Setting that on the factory will have an effect immediatelly on all mesh objects created from that factory except for those mesh objects that have their own material set.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Main users of this interface:

Definition at line 313 of file genmesh.h.


Member Function Documentation

virtual iGeneralMeshSubMesh* iGeneralFactoryState::AddSubMesh ( iRenderBuffer indices,
iMaterialWrapper material,
const char *  name,
uint  mixmode = (uint)~0 
) [pure virtual]

Add a submesh to this object.

A submesh is a subset of the mesh triangles rendered with a certain material. When a mesh has one or more submeshes, only submeshes are drawn and not original geometry. That means submeshes should cover all original triangles to avoid holes in the mesh.

Remarks:
SubMeshes added to an instance of a genmesh will override the submeshes from the factory (i.e. the submeshes of the factory will be completely ignored as soon as the instance has submeshes).
Parameters:
indices Render buffer holding the geometry for the submesh in usual render buffer formatting, ie for triangles three vertices for every triangle.
material Material to assign to the submesh.
name (Optional) Name to identify the submesh.
mixmode (Optional) Mixmode to override the mesh's mixmode.
Returns:
The added submesh, if successful.
Remarks:
This will change the indices of other submeshes.
virtual void iGeneralFactoryState::AddTriangle ( const csTriangle tri  )  [pure virtual]

Add a triangle.

This is one way to fill the triangle table. The other way is to use SetTriangleCount() and then fill the table manually.

virtual void iGeneralFactoryState::AddVertex ( const csVector3 v,
const csVector2 uv,
const csVector3 normal,
const csColor4 color 
) [pure virtual]

Add a vertex.

This is one way to fill the vertex and other tables. The other way is to use SetVertexCount() and then fill the tables manually.

virtual void iGeneralFactoryState::CalculateNormals ( bool  compress = true  )  [pure virtual]

Automatically calculate normals based on the current mesh.

Parameters:
compress if true (default) then calculate the normals based on compressed vertices.
virtual void iGeneralFactoryState::ClearSubMeshes (  )  [pure virtual]

Remove all submeshes added to this object.

virtual void iGeneralFactoryState::Compress (  )  [pure virtual]

Compress the vertex table.

This should be called after setting up the geometry.

virtual void iGeneralFactoryState::DeleteSubMesh ( iGeneralMeshSubMesh mesh  )  [pure virtual]

Delete a submesh.

virtual void iGeneralFactoryState::DisableAutoNormals (  )  [pure virtual]

Disable auto-generated normals.

This does not have an effect on the current normals, but only changes the return value of IsAutoNormals(). However, this affects saving of genmesh factories, as all vertex normals will be written out explicitly.

virtual iGeneralMeshSubMesh* iGeneralFactoryState::FindSubMesh ( const char *  name  )  const [pure virtual]

Find the index of a submesh.

The index can be used with DeleteSubMesh() and the GetSubMesh...() methods. Returns 0 if the submesh was not found.

virtual void iGeneralFactoryState::GenerateBox ( const csBox3 box  )  [pure virtual]

Generate procedurally a box.

This will set the number of vertices to eight and generate vertices, texels, normals, and triangles. The vertex colors are set to black.

virtual void iGeneralFactoryState::GenerateCapsule ( float  l,
float  r,
uint  sides 
) [pure virtual]

Generate procedurally a capsule of given length and radius.

Parameters:
l Capsule length.
r Capsule radius.
sides Number of sides.
virtual void iGeneralFactoryState::GenerateCone ( float  l,
float  r,
uint  sides 
) [pure virtual]

Generate procedurally a cone of given length and radius.

Parameters:
l Cone length.
r Cone radius.
sides Number of sides.
virtual void iGeneralFactoryState::GenerateCylinder ( float  l,
float  r,
uint  sides 
) [pure virtual]

Generate procedurally a cylinder of given length and radius.

Parameters:
l Cylinder length.
r Cylinder radius.
sides Number of sides.
virtual void iGeneralFactoryState::GenerateSphere ( const csEllipsoid ellips,
int  rim_vertices,
bool  cyl_mapping = false,
bool  toponly = false,
bool  reversed = false 
) [pure virtual]

Generate procedurally a sphere.

This will set the apropriate number of vertices and generate vertices, texels, normals, and triangles. The vertex colors are set to black.

Parameters:
ellips Properties of the ellipsoid to generate.
rim_vertices Number of vertices on a rim.
cyl_mapping if true then use cylindrical texture mapping.
toponly if true then only generate the top half of the sphere.
reversed if true then generate the sphere so it is visible from the inside.
virtual iGenMeshAnimationControlFactory* iGeneralFactoryState::GetAnimationControlFactory (  )  const [pure virtual]

Get the current animation control factory for this factory.

virtual const csColor& iGeneralFactoryState::GetColor (  )  const [pure virtual]

Get the color.

virtual csColor4* iGeneralFactoryState::GetColors (  )  [pure virtual]

Get the array of colors.

It is legal to modify the colors in this array (but don't forget to call Invalidate()). The number of colors in this array will be equal to the number of vertices set. Note that modifying the colors will not do a lot if manual colors is not enabled (SetManualColors).

virtual csVector3* iGeneralFactoryState::GetNormals (  )  [pure virtual]

Get the array of normals.

It is legal to modify the normals in this array (but don't forget to call Invalidate()). The number of normals in this array will be equal to the number of vertices set. Note that modifying the normals is only useful when manual colors are not enabled and lighting is enabled because the normals are used for lighting.

virtual int iGeneralFactoryState::GetNumProgLODLevels (  )  const [pure virtual]

Get the maximum between all submeshes' progressive LOD levels.

virtual void iGeneralFactoryState::GetProgLODDistances ( float &  out_min,
float &  out_max 
) const [pure virtual]

Get distances where progressive LOD will be in effect.

See SetProgLODDistances for parameter details.

virtual iGeneralMeshSubMesh* iGeneralFactoryState::GetSubMesh ( size_t  index  )  const [pure virtual]

Get a specific submesh.

virtual size_t iGeneralFactoryState::GetSubMeshCount (  )  const [pure virtual]

Get the number of submeshes.

virtual csVector2* iGeneralFactoryState::GetTexels (  )  [pure virtual]

Get the array of texels.

It is legal to modify the texels in this array (but don't forget to call Invalidate()). The number of texels in this array will be equal to the number of vertices set.

virtual int iGeneralFactoryState::GetTriangleCount (  )  const [pure virtual]

Get the number of triangles for this mesh.

virtual csTriangle* iGeneralFactoryState::GetTriangles (  )  [pure virtual]

Get the array of triangles.

It is legal to modify the triangles in this array (but don't forget to call Invalidate()). The number of triangles in this array will be equal to the number of triangles set.

virtual int iGeneralFactoryState::GetVertexCount (  )  const [pure virtual]

Get the number of vertices for this mesh.

virtual csVector3* iGeneralFactoryState::GetVertices (  )  [pure virtual]

Get the array of vertices.

It is legal to modify the vertices in this array (but don't forget to call Invalidate()). The number of vertices in this array will be equal to the number of vertices set.

virtual void iGeneralFactoryState::Invalidate (  )  [pure virtual]

After making a significant change to the vertices or triangles you probably want to let this object recalculate the bounding boxes and such.

This function will invalidate the internal data structures so that they are recomputed.

virtual bool iGeneralFactoryState::IsAutoNormals (  )  const [pure virtual]

Returns whether normals were autogenerated or manual.

virtual bool iGeneralFactoryState::IsBack2Front (  )  const [pure virtual]

Get the value of the back2front flag.

virtual void iGeneralFactoryState::SetAnimationControlFactory ( iGenMeshAnimationControlFactory anim_ctrl  )  [pure virtual]

Set the animation control factory to use for this factory.

See iGenMeshAnimationControlFactory for more information.

virtual void iGeneralFactoryState::SetBack2Front ( bool  b2f  )  [pure virtual]

Enable back to front rendering for the triangles of this genmesh.

This is useful if this factory represents a transparent genmesh or the material that is being used is itself transparent.

virtual void iGeneralFactoryState::SetColor ( const csColor col  )  [pure virtual]

Set the color to use. Will be added to the lighting values.

virtual void iGeneralFactoryState::SetProgLODDistances ( float  min,
float  max 
) [pure virtual]

Set distances where progressive LOD will be in effect.

Parameters:
min Minimum distance - starting from this distance, the model will begin to become less detailed.
max Maximum distance - at this distance, the model will be at its minimum LOD.
virtual void iGeneralFactoryState::SetTriangleCount ( int  n  )  [pure virtual]

Set the number of triangles to use for this mesh.

The easiest way to set the triangle data is to just use AddTriangle(). However, you can also call SetTriangleCount() and then call GetTriangles() to set the data that way. Note that you have to call Invalidate() after modifying the triangle data this way.

virtual void iGeneralFactoryState::SetVertexCount ( int  n  )  [pure virtual]

Set the number of vertices to use for this mesh.

The easiest way to set the mesh data is to just use AddVertex(). However, you can also call SetVertexCount() and then call GetVertices(), GetTexels(), ... to set the data that way. Note that you have to call Invalidate() after modifying the vertex data this way.


The documentation for this struct was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1