IFXMesh

Render performance is achieved by partitioning 3-D meshes into smaller face sets (or simply meshes) with same material and texture properties. This is done to minimize video card state changes during rendering. IFXMesh is the interface to a single material mesh (a triangle mesh where all the faces have the same material and thus all vertices have same format). To specify an entire model, meshes are grouped together inside a MeshGroup which also specifies a material for each mesh.

Note:The interface is not specific to a particular data layout. This allows the layout to be changed to improve performance while minimizing changes to the rest of the code base. Rendering code uses the token returned by GetRenderCode() and GetInterface() to obtain, in a safe manner, a pointer to the class implementation. The IFXMesh implementations include methods for directly accessing the mesh data for rendering purposes.

Interface Methods

Description

GetNumFaces

Gets the number of faces in mesh

SetNumFaces

Sets the number of faces in mesh

GetNumVertices

Gets the number of vertices in mesh

SetNumVertices

Sets the number of vertices in mesh

GetMaxNumVertices

Get the maximum (allocated) number of vertices

GetMaxNumFaces

Get the maximum (allocated) number of faces

GetAttributes

Gets mesh attributes

GetFaceIter

Accesses the faces of the mesh

GetVertexIter

Accesses the vertex attributes of the mesh

GetPositionIter

Accesses the position attribute of vertices

GetNormalIter

Accesses the normal attribute of vertices

GetColorIter

Accesses the color attribute of vertices

GetTexCoordIter

Accesses the texture coordinate attribute of vertices

SetMeshFactory

Sets a pointer to the mesh factory that created the mesh

GetMeshFactory

Gets a pointer to the mesh factory that created the mesh

Allocate

Specifies the mesh attributes and allocates memory for the vertex and face data

IncreaseSize

Creates a new mesh of larger dimensions and copies the old mesh data into it

PartialCopy

Adds or removes attributes, vertices, and faces

Copy

Adds or removes attributes, vertices, and faces

~IFXMesh

Class destructor

GetInterface

Obtains the class implementation in a runtime type-safe manner

GetRenderCode

Obtains render code

IsDiffuseBGR

Indicates whether the diffuse color channel is BGR or RGB

IsSpecularBGR

Indicates whether the specular color channel is BGR or RGB

SwizzleDiffuse

Switches the diffuse color channel from BGR to RGB and vice versa

SwizzleSpecular

Switches the specular color channel from BGR to RGB and vice versa


IFXMesh::GetNumFaces()

This method gets the number of faces in the mesh.

Parameters:

None

Return Values:

U32


IFXMesh::SetNumFaces(U32 numFaces)

This method sets the number of faces in the mesh.

Parameters:

numFaces

Number of faces

Return Values:

U32


IFXMesh::GetNumVertices()

This method gets the number of vertices in the mesh.

Parameters:

None

Return Values:

U32


IFXMesh::SetNumVertices(U32 numVertices)

This method sets the number of vertices in the mesh.

Parameters:

None

Return Values:

U32


IFXMesh::GetMaxNumVertices()

This method gets the maximum (allocated) number of vertices.

Parameters:

None

Return Values:

U32


IFXMesh::GetMaxNumFaces()

This method gets the maximum (allocated) number of faces.

Parameters:

None

Return Values:

U32


IFXMesh::GetAttributes()

This method gets the mesh attributes.

Parameters:

None

Return Values:

IFXVertexAttributes


IFXMesh::GetFaceIter(IFXFaceIter* pFaceIter)

This method initializes a face iterator for accessing faces in this mesh. Creates a new IFXFaceIter and passes its pointer into this method to be initialized.

Parameters:

pFaceIter

Pointer to a face iterator

Return Values


IFXMesh::GetVertexIter(IFXVertexIter* pVertexIter)

This method initializes a vertex iterator for accessing the attribute information for vertices in the mesh.
Note: If you need to access only one or two vertex attributes, use a more specific iterator. See GetPositionIter(), GetNormalIter(), GetColorIter(), and GetTexCoordIter(). This may result in a performance gain.

Parameters:

pVertexIter

Pointer to a vertex iterator

Return Values


IFXMesh::GetPositionIter(IFXVector3Iter* pPositionIter)

This method initializes a vector iterator for accessing the position attribute of vertices in the mesh.

Parameters:

pPositionIter

Pointer to a vector iterator

Return Values


IFXMesh::GetNormalIter(IFXVector3Iter* pNormalIter)

This method initializes a vector iterator for accessing the normal attribute of vertices in this mesh.

Parameters:

pNormalIter

Pointer to a vector iterator

Return Values


IFXMesh::GetColorIter(U32Iter* pColorIter)

This method initializes a U32 iterator for accessing the diffuse color attribute of vertices in this mesh.

Parameters:

pColorIter

Pointer to a color iterator

Return Values


IFXMesh::GetTexCoordIter(IFXVector2Iter* pTextureIter, U32 layer = 0)

This method initializes a vector iterator for accessing the texture coordinate attribute of vertices in this mesh. Specifies the texture layer using the "layer" argument.

Parameters:

pTextureIter

Pointer to a vector iterator

layer

Layer number

Return Values


IFXMesh::SetMeshFactory(IFXMeshFactory* pMeshFactory)

This method stores the pointer to the mesh factory that created this instance.

Parameters:

pMeshFactory

Pointer to the IFXMeshFactory

Return Values:

None

 


IFXMesh::GetMeshFactory()

This method obtains a pointer to the mesh factory that created the mesh.The mesh factory can be used to create a new (empty) mesh with the same class implementation (vertex data layout) and same attributes.

Note: A high-performance copy can be achieved using the Copy() method on two meshes with the same class implementation and attributes.

Parameters:

None

Return Values:

Pointer to IFXMeshFactory


IFXMesh::IncreaseSize(U32 uNumFaces, U32 uNumVerts)

This method creates a new mesh of larger dimensions (uNumFaces, uNumVerts), copies the old mesh data into it, and then deletes the previously existing mesh. A successful call to Allocate() must occur before calling this method.

Parameters:

uNumFaces

Number of faces

uNumVerts

Number of vertices

Return Values


IFXMesh::Allocate(IFXVertexAttributes attributeFlags, U32 maxNumVertices, U32 maxNumFaces)

This method specifies the mesh attributes and allocates memory for the vertex and face data. The mesh data is not initialized to known values. Use the iterators to set the mesh data. Call Allocate() only once per mesh. Allocate() should be called before any other methods, except Copy() and SetMeshFactory().

Parameters:

attributeFlags

Returns the IFXVertexAttributes

maxNumVertices

Maximum number of vertices

maxNumFaces

Maximum number of faces

Return Values


IFXMesh::PartialCopy(IFXMesh *pSourceMesh, U32 uStartVert, U32 uEndVert, U32 uStartFace, U32 uEndFace)

This method can be called on the destination the mesh before or after Allocate() is called. If PartialCopy() is called before Allocate(), the destination mesh will have the exact same attributes as the source mesh. If PartialCopy() is called after Allocate(), the copy will expand the destination mesh enough for the copy to complete. uEndVert and uEndFace are included in the copy.

Parameters:

pSourceMesh

Pointer to the IFXMesh

uStartVert

Starting number of vertices

uEndVert

Ending number of vertices

uStartFace

Starting number of faces

uEndFace

Ending number of faces

Return Values


IFXMesh::Copy(IFXMesh *pSourceMesh)

This method allows the adding or removing of attributes, vertices, and faces. Allocate() must be called on pSourceMesh before it can be used as a source mesh for copying. Copy() can be called on the destination (this) mesh before or after Allocate() is called. If Copy() is called before Allocate(), the destination mesh will have the exact same number of vertices, faces, and attributes as the source mesh. If Allocate() is called first, the copy will fill in common information as much as possible.

Parameters:

pSourceMesh

Pointer to the IFXMesh

Return Values


IFXMesh::~IFXMesh()

Class destructor.

Parameters:

None

Return Values:

None


IFXMesh::GetInterface(U32 interfaceIdentifier, void** interfaceIdentifier)

This method obtains the class implementation in a runtime type-safe manner. For example:

IFXMeshInterleaved* pMeshInterleaved;
res = GetInterface(IID_IFXMeshInterleaved, (void**)(&pMeshInterleaved));
if (result == IFX_OK)

This method also allows for runtime discovery of extended interfaces.

Parameters:

interfaceIdentifier

ID number of interface

interfaceIdentifier

Pointer to the interface identifier

Return Values


IFXMesh::GetRenderCode()

Interface for rendering system. Each class implementation of IFXMesh has a unique render code associated with it. This render code is used in conjuction with GetInterface() to obtain methods that directly access the mesh data for rendering.

Parameters:

None

Return Values:

IFXRenderCode


IFXMesh::IsDiffuseBGR()

This method indicates whether or not the diffuse color channel is BGR.

Parameters:

None

Return Values:

BOOL


IFXMesh::IsSpecularBGR()

This method indicates whether or not the specular color channel is BGR.

Parameters:

None

Return Values:

BOOL


IFXMesh::SwizzleDiffuse()

This method switches the diffuse color channel from BGR to RGB and vice versa.

Parameters:

None

Return Values


IFXMesh::SwizzleSpecular()

This method switches the specular color channel from BGR to RGB and vice versa.

Parameters:

None

Return Values

§See asterisked (*) statement at Legal Information © 2001 Intel Corporation.