Interface to Alias meshes.
#include <AlMesh.h> class AlMesh : public AlObject AlMesh(); virtual ~AlMesh(); virtual statusCode deleteObject(); virtual AlObject* copyWrapper() const; virtual AlObjectType type() const; AlMeshNode* meshNode() const; statusCode create( int numVertices, const float* vertices, int numTriangles, const int* triangles, const float* normals = 0, const float* uvs = 0); int numberOfVertices() const; int numberOfTriangles() const; const float* vertices() const; const int* triangles() const; const float* normals() const; const float* uvs() const; void uvRange( float* ) const; statusCode setUVRange( float * ); int drawFlag() const; API_BOOLEAN isDrawFlag( int ) const; statusCode setDrawFlag( int, bool ); statusCode setDrawFlag( int ); API_BOOLEAN isFlatShaded() const; statusCode setFlatShaded( bool ); float* affectedVertices( const AlTM& tm ); float* affectedNormals( const AlTM& tm ); statusCode removeDuplicateTris(); statusCode compact(); statusCode transform( double [4][4] ) const; statusCode boundingBox( double *min, double *max ) const; AlShader* firstShader() const; AlShader* nextShader( AlShader* ) const; statusCode nextShaderD( AlShader *) const; statusCode assignShader( AlShader* ); statusCode layerShader( AlShader* ); statusCode renderInfo( AlRenderInfo& ) const; statusCode setRenderInfo( const AlRenderInfo& ) const;
AlMesh is the interface to meshes and their data in Alias. This class lets a developer create and manipulate mesh objects. Data access methods to all properties are provided. The following properties are used throughout the mesh class.
Vertices are passed by this class using an array of floating point values. A vertex consists of three values; x,y,z respectively. Refer to the definition of triangles for a description of the relationship between vertices and triangles.
The number of vertices is equivalent to the number of x,y,z triplets stored in the vertices array. The total number of floats in the vertices array is equivalent to three times the number of vertices.
Triangles are passed by this class using an array of integer values. A triangle consists of three integer indices. These indices reference a vertex in the vertices array such that vertices[3*index] returns the x coordinate of the vertex. Similarly, vertices[3*index+1] and vertices[3*index+2] return the y and z coordinate respectively. Indices are to be specified in counter clockwise order relative to the front of their face.
The number of triangles is equivalent to the number of integer triplets stored in the triangles array. The total number of integers in the triangles array is equivalent to three times the number of triangles.
Normals are passed by this class using an array of floating point values. They consist of three values; x,y,z respectively. Normals are per vertex. They are referenced by triangles in the same manner that vertices are referenced.
UVs are passed by this class using an array of float values. They consist of two floating point values; u,v respectively. UVs are per vertex. They are referenced by triangles in the same manner that vertices are referenced.
Constructs an AlMesh wrapper object.
Deletes an AlMesh wrapper object.
This method deletes the AlMesh, and its parent AlMeshNode.
sSuccess - the mesh was deleted.
sInvalidObject - the mesh was invalid.
Makes an exact copy of the AlMesh wrapper.
Returns the class identifier kMeshExtType.
Returns a pointer to the AlMeshNode for this mesh. Returns NULL if there is not an attached mesh node.
Creates a mesh object with the supplied data. The user This is expected to allocate memory and seed data for the various arrays. Refer to the description of this class for detailed information on the arguments passed. Passing a uv array is optional. Passing a normal array is optional. Note that normals are recalculated as the mesh is changed.
sSuccess - The mesh was successfully created.
sInsufficientMemory - Sufficient memeory for the provided mesh could not be allocated.
sFailure - Failed to complete request. This result may occur because of insufficient memory.
Returns the number of vertices currently stored in the mesh. The function will return -1 if the mesh was not created properly.
Returns the number of triangles currently stored in the mesh. The function will return -1 if the mesh was not created properly.
Returns a const pointer to the mesh's vertex data. The function will return 0 if the mesh was not created properly. Refer to the description of this class for more information.
Returns a const pointer to the mesh's triangle data. The function will return 0 if the mesh was not created properly. Refer to the description of this class for more information.
Returns a const pointer to the mesh's normal data. The function will return 0 if the mesh was not created properly. Refer to the description of this class for more information.
Returns a const pointer to the mesh's uv data. The function will return 0 if the mesh was not created properly. Refer to the description of this class for more information.
Stores the uv range of the mesh in 'range'. 'range' is an array with four elements; minu, minv, maxu, maxv respectively.The function will return if the mesh was not created properly leaving 'range' unaltered.
Sets the uv range of the mesh. 'uvrange' is an array with four elements; minu, minv, maxu, maxv respectively.
sSuccess - The range was properly set.
sInvalidObject - Returned if uvrange is 0 or the mesh was not created properly.
sFailure - Unable to process request.
Returns the mesh's draw flags. The function will return 0 if the mesh was not created properly.
Returns TRUE if 'flag' is set in the mesh's draw flag. FALSE otherwise. The function will return FALSE if the mesh was not created properly.
Sets the 'flag' bit to the value of 'on' in the mesh's draw flag.
sSuccess - The flag was properly set.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Directly assigns 'flag' to the mesh's draw flag.
sSuccess - The flag was properly set.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Returns TRUE if the mesh is flat shaded. FALSE otherwise. The function will return FALSE if the mesh was not created properly.
Sets the mesh's flat shading property to the value of 'flat'.
sSuccess - Flat shading was properly set.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Transforms the mesh by the matrix 'tm'.
sSuccess - The mesh was properly transformed.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Removes duplicate triangles from the mesh.
sSuccess - Duplicate triangles were removed successfully.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Returns a pointer to a float array of affected vertices. Refer to vertices in the description of this class for more information on the format of the array. The function will return 0 if the mesh was not created properly.
Returns a pointer to a float array of affected normals. Refer to normals in the description of this class for more information on the format of the array. The function will return 0 if the mesh was not created properly.
This algorithm compacts the mesh by eliminating numerically identical vertices. This algorithm is useful when processing STL files, which duplicate vertex coordinates for adjacent triangles.
sSuccess - The mesh was successfully compacted.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Retrieves the bounding box of the mesh. The 'min' and 'max' arguments are arrays that contain the min or max x,y,z values respectively.
sSuccess - The bounding box was successfully sent to minimum and maximum.
sInvalidObject - The mesh was not created properly. The arguments remain unaltered.
sFailure - Unable to process request. The arguments remain unaltered.
Returns the first shader that this mesh object references. The function will return 0 if there are no shaders or the mesh was not created properly.
Returns the shader after the one specified by 'shader'. The function will return 0 if:
Destructively points the argument 'shader' to the shader that follows.
sSuccess - The 'shader' was properly set to the next shader in the list.
sFailure - Unable to process request. Refer to AlMesh::nextShader for possible reasons for a failure.
Assigns 'shader' to the mesh.
sSuccess - The shader was successfully assigned to the mesh.
sInvalidArgument - 'shader' is invalid.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Layers the 'shader' on the mesh.
sSuccess - the shader was successfully layered on the mesh.
sInvalidArgument - 'shader' is invalid.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Fills in 'renderInfo' with the render info for this mesh.
sSuccess - 'renderInfo' was properly set.
sInvalidArgument - 'renderInfo' is NULL.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.
Sets the render info for this mesh to the contents of 'renderInfo'.
sSuccess - The mesh's render info was properly set.
sInvalidArgument - 'renderInfo' is NULL or a parameter in renderInfo is out of range.
sInvalidObject - The mesh was not created properly.
sFailure - Unable to process request.