IFXIterators

The iterator classes allow you to access or modify the individual mesh attributes. They behave much like conventional pointers in Visual C§:

ptr.Next() is like ptr++;
ptr.Index(i) is like ptr[i];
x = ptr.Get() is like x = ptr;
ptr.PointAt(mysample) is like ptr = mysample

Note: ptr and mysample must have same stride.

To use an iterator, first instantiate it as a local variable, then pass a pointer from the iterator to one of the get() iterator methods, such as GetPositionIter(), from an IFXMesh class. The get() iterator methods initialize the iterator by calling SetStride() and PointAt() with the correct stride and base pointer values.

The IFXVector2Iter, IFXFaceIter, and U32Iter are the same as IFXVector3Iter, which is detailed, except for the datatype accessed.

The IFXVertexIter is a special iterator that allows access to the position, normal, diffuse color, and texture coordinate(s) properties of a vertex through one iterator.

IFXVector3Iter

Interface Method

Description

SetStride

Initializes the stride

PointAt

Points to the location specified by "ptr" argument

Get

Gets value at current location

Index

Gets value at offset from the current location

Next

Gets current value and sets current to next location

Clone

Makes this iterator like pSrcIter


IFXVector3Iter::SetStride(U32 stride)

Note:This method should be called only from IFXMesh to initialize the stride.

Parameters:

stride

Stride number to be initialized

Return Values:

None


IFXVector3Iter::PointAt( IFXVector3* ptr)

This method makes the iterator point to the location specified by "ptr" argument.

Note: Both iterators must have been initialized by the same IFXMesh, cloned, or guaranteed to have the same stride.

Parameters:

ptr

Pointer to IFXVector3

Return Values:

None


IFXVector3Iter::Get()

This method gets the value at current location.

Parameters:

ptr

Pointer to IFXVector3

Return Values:

IFXVector3*


IFXVector3Iter::Index(U32 index)

This method gets the value at offset from the current location.

Parameters:

index

Index number

Return Values:

IFXVector3*


IFXVector3Iter::Next()

This method gets the current value and sets current to next location.

Parameters:

None

Return Values:

IFXVector3*


IFXVector3Iter::Clone(IFXVector3Iter* pSrcIter)

This method makes this iterator like pSrcIter.

Parameters:

pSrcIter

Pointer to IFXVector3Iter

Return Values:

None



IFXVector2Iter

void SetStride( U32 stride)

void PointAt( IFXVector2* ptr)

IFXVector2* Get()

IFXVector2* Index( U32 index)

IFXVector2* Next()

void Clone(IFXVector2Iter* pSrcIter)


IFXFaceIter

void SetStride( U32 stride)

void PointAt( IFXFace* ptr)

IFXFace* Get()

IFXFace* Index( U32 index)

IFXFace* Next()

void Clone(IFXFaceIter* pSrcIter)


IFXFacePoolIter

(For use with pencil sketch algorithm.)

void SetStride( U32 stride)

void PointAt( IFXFace** ptr)

IFXFace** Get()

IFXFace** Next()

void Clone(IFXFacePoolIter* pSrcIter)


U32Iter

void SetStride( U32 stride)

void PointAt( U32* ptr)

U32* Get()

U32* Index( U32 index)

U32* Next()

void Clone(U32Iter* pSrcIter)


IFXVertexIter

Note: IFXVertexIter is no longer used, having been replaced by IFXVector3Iter or IFXVector2Iter. It is here for backward compatibility. This is a special iterator/pointer that abstracts access to the fields of a vertex record.

void PointAt(void* ptr)

void* Get()

void* Index(U32 index)

void* Next()

void Clone(IFXVertexIter* pSrcIter)

IFXVertexAttributes GetAttributes()

U32 GetNumTextureLayers()

Note: These methods are used in combination with GetPostion(), GetNormal(), GetDiffuseColor(), and GetTexCoord() to determine if the results are valid.

IFXVector3* GetPosition()

Checks GetAttributeLayout for hasPosition

IFXVector3* GetNormal()

Checks GetAttributeLayout for hasNormal

U32* GetDiffuseColor()

Checks GetAttributeLayout for hasDiffuseColor

IFXVector2* GetTexCoord(U8 layer = 0)

Checks GetAttributeLayout for hasTexCoords and GetNumTextureLayers for number of texture layers

 

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