IFXShaderData

IFXShaderData is the interface for a shader data object, which is essentially a container class for pointers to specific instances of objects that a shader will render. Shaders are a prescribed way of rendering objects. They are a rendering tool, which must act upon a specific set of objects in order to do their job. The shader data container is used to point to those specific instances. The IFXShaderData interface is used to change which instances the corresponding shader will use when it is next asked to render with IFXShader::Render().

There are two main types of data that a shader data container will have: meshes or particle groups. These two types are mutually exclusive, so a shader data container will have either one or the other, but not both. There are other supporting types as well: transforms and edge sets. Transforms will always be present, as both meshes and particle groups require an object-to-world matrix transformation. Edge sets, however, are only relevant to meshes, and are optional. Edge sets will not be present when shader data is associated with particle groups.

When to Use

Every shader has a pointer to an IFXShaderData interface, and it will query this interface as it prepares the render layer to render the shader data. Additionally, any object that must initialize or change the associations between shaders and their assigned data must ask the shader for its IFXShadaData interface and then use that interface to point the shader to the right data.

The IFXShaderData interface inherits the IFXUnknown interface and is supported by CIFXShaderData.

Interface Methods

Description

GetNumberOfElements

Retrieves the number of elements in the shader data.

SetNumberOfElements

Sets the number of elements in the shader data.

GetTransforms

Retrieves the list of element-to-world matrices for the elements.

SetTransforms

Associates the shader data with a list of element-to-world matrices.

GetMeshes

Retrieves the array of pointers to IFXMesh interfaces currently associated with the shader.

SetMeshes

Associates the shader data with an array of pointers to IFXMesh interfaces.

GetEdgeSets

Retrieves the array of pointers to IFXEdgeSet interfaces currently associated with the shader.

SetEdgeSets

Associates the shader data with an array of pointers to IFXEdgeSet interfaces.

GetParticleGroups

Retrieves the array of pointers to IFXParticleGroup interfaces currently associated with the shader.

SetParticleGroups

Associates the shader data with an array of pointers to IFXParticleGroup interfaces.

GetShaderStates

Retrieves the shader state of the model

SetShaderStates

Associates the shader state with the model

GetMaterialID

Gets the material ID for the shader

SetMaterialID

Sets the material ID for the shader


IFXShaderData::GetNumberOfElements(U32* puOutNumberOfElements)

This method retrieves the number of elements in the shader data. Elements can be either meshes or particle groups, but not both. The number of edge sets is equal to the number of meshes. If the shader data uses particle groups, it does not use either meshes or edge sets.

Parameters:

puOutNumberOfElements

The number of elements assigned to the shader data. This value represents the number of elements in the array of interface pointers retrieved by GetEdgeSets(), GetMeshes(), GetTransforms or GetParticleGroups().

Return Values


IFXShaderData::SetNumberOfElements(U32 uInNumberOfElements)

This method establishes the number of elements associated with the shader data container. It is essentially the size of the arrays of interface pointers for meshes, edge sets, transforms and particle groups. Keep in mind that a shader data container cannot simultaneously be associated with meshes and particle groups. If it is associated with meshes, then it will have a list of transforms, and may or may not also have edge sets. It will not have particle groups if it has meshes. Conversely, if the shader data has particle groups, it will have transforms, but will have neither meshes nor edge sets.

Parameters:

uInNumberOfElements

The number of elements in the shader data arrays of interface pointers for meshes, edge sets, or particle groups.

Return Values

Comments:

This method is intended to be called in conjunction with the other methods which assign the shader data container a list of elements. In other words, if the shader data is assigned a new element list (meshes, edge sets, particle groups, etc.) then it needs to be informed of the new element count as well, via SetNumberOfElements().


IFXShaderData::GetTransforms(IFXSGMatrix*** pppmOutTransforms)

Retrieves an array of interface pointers to the element-to-world matrix transformations. There is one matrix transform for each element. In other words, if a shader data container has a list of meshes, then there will be one matrix transform for each mesh. If it has a list of particle groups, there will be one transform for each particle group.

Parameters:

pppmOutTransforms

The address of an array of pointers to interfaces of matrices.

Return Values

Comments:

This method is intended to be used after having already called GetNumberOfElements() in order to be able to create an array of the appropriate size which can be handed to GetTransforms().


IFXShaderData::SetTransforms(IFXSGMatrix** ppmInTransforms)

Assigns an array of IFXSGMatrix interface pointers to the shader data container. This array must have as many elements as there are in the shader data's array of either meshes or particle groups.

Parameters:

ppmInTransforms

Description of param1

Return Values

Comments:

Be sure to call SetNumberOfElements() after having assigned a new list of elements to the shader data container.


IFXShaderData::GetMeshes(IFXMesh*** pppOutMeshes)

Retrieves an array of IFXMesh interface pointers. These are the mesh interfaces that the shader will use when rendering the meshes.

Parameters:

pppOutMeshes

The address of an array of pointers to mesh interfaces

Return Values

Comments:

This method is intended to be used after having already called GetNumberOfElements() in order to be able to create an array of the appropriate size which can be handed to GetMeshes().


IFXShaderData::SetMeshes(IFXMesh** ppInMeshes)

Assigns an array of IFXMesh interface pointers to the shader data container. This array must have as many elements as there are in the shader data's array of transforms (and edge sets if they are used).

Parameters:

ppInMeshes

An array of pointers to IFXMesh interfaces

Return Values

Comments:

Be sure to call SetNumberOfElements() after having assigned a new list of elements to the shader data container.


IFXShaderData::GetEdgeSets(IFXEdgeSet*** pppOutEdgeSets)

Retrieves an array of IFXEdgeSet interface pointers. There must be as many edge sets as there are meshes assigned to the shader data container.

Parameters:

pppOutEdgeSets

The address of an array of pointers to edge set interfaces

Return Values

Comments:

This method is intended to be used after having already called GetNumberOfElements() in order to be able to create an array of the appropriate size which can be handed to GetEdgeSets().


IFXShaderData::SetEdgeSets(IFXEdgeSet** ppInEdgeSets)

Assigns an array of IFXEdgeSet interface pointers to the shader data container. This array must have as many elements as there are in the shader data's array of meshes.

Parameters:

ppInEdgeSets

An array of pointers to IFXEdgeSet interfaces

Return Values

Comments:

Be sure to call SetNumberOfElements() after having assigned a new list of elements to the shader data container.


IFXShaderData::GetParticleGroups(IFXParticleGroup*** pppOutParticleGroup)

Retrieves an array of IFXParticleGroup interface pointers. These are the interfaces that the shader will use when rendering the particle groups.

Parameters:

pppOutParticleGroup

The address of an array of pointers to particle group interfaces

Return Values

Comments:

This method is intended to be used after having already called GetNumberOfElements() in order to be able to create an array of the appropriate size which can be handed to GetParticleGroups().


IFXShaderData::SetParticleGroups(IFXParticleGroup** ppInParticleGroup)

Assigns an array of IFXParticleGroup interface pointers to the shader data container. This array must have as many elements as there are in the shader data's array of transforms.

Parameters:

ppInParticleGroup

An array of pointers to IFXParticleGroup interfaces

Return Values

Comments:

Be sure to call SetNumberOfElements() after having assigned a new list of elements to the shader data container.


IFXShaderData::GetShaderStates(SIFXModelShaderState*** pppOutShaderState)

This method retrieves the shader state of a model.

Parameters:

pppOutShaderState

Pointer to SIFXModelShaderState

Return Values


IFXShaderData::SetShaderStates(SIFXModelShaderState** ppOutShaderState)

This method assigns the shader state of a model.

Parameters:

ppOutShaderState

Pointer to SIFXModelShaderState

Return Values


IFXShaderData::GetMaterialID(U32 *puMatID)

This method retrieves the material ID number to the shader.

Parameters:

puMatID

Pointer to material ID

Return Values


IFXShaderData::SetMaterialID(U32 uMatID)

This method assigns the material ID number to the shader.

Parameters:

uMatID

Material ID number

Return Values

 

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