CSLBaseShape Class Reference

#include <BaseShape.h>

Inheritance diagram for CSLBaseShape:

CSLTemplate CSIBCNode CSLShape CSLShape_35 List of all members.

Public Types

enum   EShapeType {
  SI_ORDERED,
  SI_INDEXED
}
typedef CSLArrayProxy< CSIBCVector2D,
SI_Float, 2 > 
CSLVector2DArray
typedef CSLArrayProxy< CSIBCVector3D,
SI_Float, 3 > 
CSLVector3DArray
typedef CSLArrayProxy< CSIBCColorf,
SI_Float, 4 > 
CSLColorArray
typedef CSLArrayProxy< SLIndexedVector2D,
SI_Float, 3 > 
CSLIndexedVector2DArray
typedef CSLArrayProxy< SLIndexedVector3D,
SI_Float, 4 > 
CSLIndexedVector3DArray
typedef CSLArrayProxy< SLIndexedColor,
SI_Float, 5 > 
CSLIndexedColorArray

Public Member Functions

virtual  ~CSLBaseShape ()
CSLVector3DArray CreateNormals ()
CSLIndexedVector3DArray CreateIndexedNormals ()
SI_Int  GetNormalCount ()
CSLVector3DArray GetNormalList ()
CSIBCVector3D GetNormalListPtr ()
CSLIndexedVector3DArray GetIndexedNormalList ()
SLIndexedVector3D GetIndexedNormalListPtr ()
SI_Error  DestroyNormals ()
CSLColorArray CreateColors ()
CSLIndexedColorArray CreateIndexedColors ()
SI_Int  GetColorCount ()
CSLColorArray GetColorList ()
CSIBCColorf GetColorListPtr ()
CSLIndexedColorArray GetIndexedColorList ()
SLIndexedColor GetIndexedColorListPtr ()
SI_Error  DestroyColors ()
SI_Int  GetVertexCount ()
CSLVector3DArray GetVertexList ()
CSIBCVector3D GetVertexListPtr ()
CSLIndexedVector3DArray GetIndexedVertexList ()
SLIndexedVector3D GetIndexedVertexListPtr ()
EShapeType  ShapeType ()
virtual SI_Error  Fix ()
virtual SI_Error  Synchronize ()

Protected Member Functions

  CSLBaseShape (CSLScene *in_pScene, CSLModel *in_pModel, CdotXSITemplate *in_pTemplate, EShapeType in_Type)

Detailed Description

Describes the shape of a mesh

The CSLBaseShape class contains information about the position coordinates, normal coordinates and color values of a mesh.

There are two possible types of shape: ordered & indexed. The set of functions that can be used depends on the type of shape that is described by each class instance.

For example, the function CreateNormals will work on an ordered shape, but won't on an indexed shape. On the other hand, the function CreateIndexedNormals will work on an indexed shape, but won't on an ordered shape. However, the functions DestroyNormals and GetNormalCount will work with both types (ordered & indexed).

Example - Using CSLBaseShape

        CSLModel *l_pMeshModel = RootModel->AddMesh();

        //
        // Set some default values
        //

        l_pMeshModel->SetName("MyMesh");
        l_pMeshModel->Visibility()->SetVisibility(SI_TRUE);
        l_pMeshModel->Transform()->SetScale(CSIBCVector3D(1.0, 1.0, 1.0) );
        l_pMeshModel->GlobalMaterial()->SetPropagationType(CSLGlobalMaterial::SI_INHERITED);

        //
        // Set default material
        //

        l_pMeshModel->GlobalMaterial()->SetMaterial(l_pMeshModel->Scene()->GetMaterialLibrary()->GetMaterialList()[0] );

        //
        // Get the CSLMesh pointer from the model
        //
            
        CSLMesh *l_pMesh = (CSLMesh *) l_pMeshModel->Primitive();

        //
        // Get a pointer to the Mesh's shape
        //

        CSLBaseShape *l_pShape = l_pMesh->Shape();

        //
        // Add 8 vertices
        //

        CSLBaseShape::CSLVector3DArray *l_Vertices = l_pShape->GetVertexList();
        l_Vertices->Resize(8);

        //
        // Add 8 normals
        //

        CSLBaseShape::CSLVector3DArray *l_Normals = l_pShape->CreateNormals();
        l_Normals.Resize(8);

        //
        // Now set the positions / normal
        //

        for (int i=0;i<8;i++)
        {
            (*l_Vertices)[vindex].Set(0.0f, 0.0f, 0.0f);
                
            (*l_Normals)[vindex].Set (0.0f, 1.0f, 0.0f);
        }


Member Typedef Documentation

typedef CSLArrayProxy<CSIBCVector2D, SI_Float, 2> CSLVector2DArray

Proxy class that allows modifying a list of CSIBCVector2D objects like an array.

typedef CSLArrayProxy<CSIBCVector3D, SI_Float, 3> CSLVector3DArray

Proxy class that allows modifying a list of CSIBCVector3D objects like an array.

typedef CSLArrayProxy<CSIBCColorf, SI_Float, 4> CSLColorArray

Proxy class that allows modifying a list of CSIBCColorf objects like an array.

typedef CSLArrayProxy<SLIndexedVector2D, SI_Float, 3> CSLIndexedVector2DArray

Proxy class that allows modifying a list of SLIndexedVector2D objects like an array.

typedef CSLArrayProxy<SLIndexedVector3D, SI_Float, 4> CSLIndexedVector3DArray

Proxy class that allows modifying a list of SLIndexedVector3D objects like an array.

typedef CSLArrayProxy<SLIndexedColor, SI_Float, 5> CSLIndexedColorArray

Proxy class that allows modifying a list of SLIndexedColor objects like an array.


Member Enumeration Documentation

enum EShapeType

The EShapeType enum contains possible types for a shape

Enumerator:
SI_ORDERED  The shape is of ordered type
SI_INDEXED  The shape is of indexed type


Constructor & Destructor Documentation

virtual ~CSLBaseShape (  )  [virtual]

Destructor

CSLBaseShape ( CSLScene in_pScene,
CSLModel in_pModel,
CdotXSITemplate in_pTemplate,
EShapeType  in_Type  
) [protected]

Constructor

Parameters:
in_pScene  Pointer to the scene containing the BaseShape
in_pModel  Pointer to the model containing the BaseShape
in_pTemplate  Pointer to the CdotXSITemplate containing the BaseShape
in_Type  The shape type to be used in the BaseShape


Member Function Documentation

CSLVector3DArray* CreateNormals (  ) 

Create a normal coordinates array.

Returns:
CSLVector3DArray* Pointer to the newly created array.

CSLIndexedVector3DArray* CreateIndexedNormals (  ) 

Create an indexed normal coordinates array.

Returns:
CSLIndexedVector3DArray* Pointer to the newly created indexed array.

SI_Int GetNormalCount (  ) 

Return the number of normal coordinates.

Returns:
SI_Int Number of normals.

CSLVector3DArray* GetNormalList (  ) 

Return the normal coordinate array proxy.

Returns:
CSLVector3DArray* Pointer to an array proxy of normals.

CSIBCVector3D* GetNormalListPtr (  ) 

Returns an array of CSBCVector3D containing the normal coordinates.

Returns:
CSIBCVector3D* Array of CSIBCVector3D.

CSLIndexedVector3DArray* GetIndexedNormalList (  ) 

Return the indexed normal coordinate array proxy.

Returns:
CSLIndexedVector3DArray* Pointer to an array proxy of indexed normals.

SLIndexedVector3D* GetIndexedNormalListPtr (  ) 

Returns an array of SLIndexedVector3D containing the indexed normal coordinates.

Returns:
SLIndexedVector3D* Array of SLIndexedVector3D.

SI_Error DestroyNormals (  ) 

Destroy the normal coordinates array.

Returns:
SI_Error Error code.

CSLColorArray* CreateColors (  ) 

Create a color values array.

Returns:
CSLColorArray* Pointer to the newly created array.

CSLIndexedColorArray* CreateIndexedColors (  ) 

Create an indexed color values array.

Returns:
CSLIndexedColorArray* Pointer to the newly created indexed array.

SI_Int GetColorCount (  ) 

Return the number of color values.

Returns:
SI_Int Number of colors.

CSLColorArray* GetColorList (  ) 

Return the color values array proxy.

Returns:
CSLColorArray* Pointer to an array proxy of colors.

CSIBCColorf* GetColorListPtr (  ) 

Returns an array of CSIBCColorf containing the color values.

Returns:
CSIBCColorf* Array of CSIBCColorf.

CSLIndexedColorArray* GetIndexedColorList (  ) 

Return the indexed color values array proxy.

Returns:
CSLIndexedVector3DArray* Pointer to an array proxy of indexed colors.

SLIndexedColor* GetIndexedColorListPtr (  ) 

Returns an array of SLIndexedColor containing the indexed color values.

Returns:
SLIndexedColor* Array of SLIndexedColor.

SI_Error DestroyColors (  ) 

Destroy the color values array.

Returns:
SI_Error Error code.

SI_Int GetVertexCount (  ) 

Return the number of vertex coordinates.

Returns:
SI_Int Number of vertices.

CSLVector3DArray* GetVertexList (  ) 

Return the vertex coordinate array proxy.

Returns:
CSLVector3DArray* Pointer to an array proxy of vertices.

CSIBCVector3D* GetVertexListPtr (  ) 

Returns an array of CSBCVector3D containing the vertex coordinates.

Returns:
CSIBCVector3D* Array of CSIBCVector3D.

CSLIndexedVector3DArray* GetIndexedVertexList (  ) 

Return the indexed vertex coordinate array proxy.

Returns:
CSLIndexedVector3DArray* Pointer to an array proxy of indexed vertices.

SLIndexedVector3D* GetIndexedVertexListPtr (  ) 

Returns an array of SLIndexedVector3D containing the indexed vertex coordinates.

Returns:
SLIndexedVector3D* Array of SLIndexedVector3D.

EShapeType ShapeType (  ) 

Indicate which type of shape this object describes.

Returns:
EShapeType Type of shape

virtual SI_Error Fix (  )  [virtual]

Clean invalid data from the template.

Returns:
SI_Error Error code

Reimplemented from CSLTemplate.

virtual SI_Error Synchronize (  )  [virtual]

Synchronize will ensure that the animated parameter is up to date.

Returns:
SI_Error Error code

Reimplemented from CSLTemplate.

Reimplemented in CSLShape, and CSLShape_35.


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