Index Topic Contents | |||
Previous Topic: IDirect3DRMMaterial Next Topic: IDirect3DRMMeshBuilder |
IDirect3DRMMesh
Applications use the methods of the IDirect3DRMMesh interface to interact with groups of meshes. This section is a reference to the methods of this interface. For a conceptual overview, see IDirect3DRMMesh, IDirect3DRMMeshBuilder, and IDirect3DRMMeshBuilder2 Interfaces.
The methods of the IDirect3DRMMesh interface can be organized into the following groups:
Color GetGroupColor SetGroupColor SetGroupColorRGB Creation and AddGroup information GetBox GetGroup GetGroupCount Materials GetGroupMaterial SetGroupMaterial Miscellaneous Scale Translate Rendering quality GetGroupQuality SetGroupQuality Texture mapping GetGroupMapping SetGroupMapping Textures GetGroupTexture SetGroupTexture Vertex positions GetVertices SetVertices The IDirect3DRMMesh interface, like all Component Object Model (COM) interfaces, inherits the IUnknown interface methods. The IUnknown interface supports the following three methods:
AddRef QueryInterface Release In addition, the IDirect3DRMMesh interface inherits the following methods from the IDirect3DRMObject interface:
AddDestroyCallback Clone DeleteDestroyCallback GetAppData GetClassName GetName SetAppData SetName The Direct3DRMMesh object is obtained by using the IDirect3DRM::CreateMesh method.
IDirect3DRMMesh
IDirect3DRMMesh::AddGroupGroups a collection of faces and retrieves an identifier for the group. The first group added to a mesh always has index 0. The index of each successive group increases by 1.
HRESULT AddGroup(
unsigned vCount,
unsigned fCount,
unsigned vPerFace,
unsigned *fData,
D3DRMGROUPINDEX *returnId
);Parameters
- vCount and fCount
- Number of vertices and faces in the group.
- vPerFace
- Number of vertices per face in the group, if all faces have the same vertex count. If the group contains faces with varying vertex counts, this parameter should be zero.
- fData
- Address of face data. If the vPerFace parameter specifies a value, this data is simply a list of indices into the group's vertex array. If vPerFace is zero, the vertex indices should be preceded by an integer specifying the number of vertices in that face. For example, if vPerFace is zero and the group is made up of triangular and quadrilateral faces, the data might be in the following form: 3 index index index 4 index index index index 3 index index index ...
- returnId
- Address of the variable that identifies the group when the method returns.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
A newly added group has the following default properties:
- White
- No texture
- No specular reflection
- Position, normal, and color of each vertex in the vertex array equal to zero
To set the positions of the vertices, use the IDirect3DRMMesh::SetVertices method.
IDirect3DRMMesh
IDirect3DRMMesh::GetBox
Retrieves the bounding box containing a Direct3DRMMesh object. The bounding box gives the minimum and maximum model coordinates in each dimension.
HRESULT GetBox(
D3DRMBOX * lpD3DRMBox
);Parameters
- lpD3DRMBox
- Address of a D3DRMBOX structure filled with the bounding box coordinates.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupRetrieves the data associated with a specified group.
HRESULT GetGroup(
D3DRMGROUPINDEX id,
unsigned *vCount,
unsigned *fCount,
unsigned *vPerFace,
DWORD *fDataSize,
unsigned *fData
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- vCount and fCount
- Addresses of variables that will contain the number of vertices and the number of faces for the group when the method returns. These parameters can be NULL.
- vPerFace
- Address of a variable that will contain the number of vertices per face for the group when the method returns. This parameter can be NULL.
- fDataSize
- Address of a variable that specifies the number of unsigned elements in the buffer that the fData parameter points to. This parameter cannot be NULL.
- fData
- Address of a buffer that will contain the face data for the group when the method returns. The format of this data is the same as was specified in the call to the IDirect3DRMMesh::AddGroup method. If this parameter is NULL, the method returns the required size of the buffer in the fDataSize parameter.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupColorRetrieves the color for a group.
D3DCOLOR GetGroupColor(
D3DRMGROUPINDEX id
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
Return Values
Returns a D3DCOLOR variable specifying the color if successful, or zero otherwise.
See Also
IDirect3DRMMesh::SetGroupColor, IDirect3DRMMesh::SetGroupColorRGB
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupCountRetrieves the number of groups for a given Direct3DRMMesh object.
unsigned GetGroupCount( );
Return Values
Returns the number of groups if successful, or zero otherwise.
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupMappingRetrieves a description of how textures are mapped to a group in a Direct3DRMMesh object.
D3DRMMAPPING GetGroupMapping(
D3DRMGROUPINDEX id
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
Return Values
Returns one of the D3DRMMAPPING values that describe how textures are mapped to a group, if successful. Returns zero otherwise.
See Also
IDirect3DRMMesh::SetGroupMapping
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupMaterialRetrieves a pointer to the material associated with a group in a Direct3DRMMesh object.
HRESULT GetGroupMaterial(
D3DRMGROUPINDEX id,
LPDIRECT3DRMMATERIAL *returnPtr
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- returnPtr
- Address of a pointer to a variable that will contain the IDirect3DRMMaterial interface for the group when the method returns.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::SetGroupMaterial
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupQualityRetrieves the rendering quality for a specified group in a Direct3DRMMesh object.
D3DRMRENDERQUALITY GetGroupQuality(
D3DRMGROUPINDEX id
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
Return Values
Returns values from the enumerated types represented by D3DRMRENDERQUALITY if successful, or zero otherwise. These values include the shading, lighting, and fill modes for the object.
See Also
IDirect3DRMMesh::SetGroupQuality
IDirect3DRMMesh
IDirect3DRMMesh::GetGroupTextureRetrieves an address of the texture associated with a group in a Direct3DRMMesh object.
HRESULT GetGroupTexture(
D3DRMGROUPINDEX id,
LPDIRECT3DRMTEXTURE *returnPtr
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- returnPtr
- Address of a pointer to a variable that will contain the IDirect3DRMTexture interface for the group when the method returns.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::SetGroupTexture
IDirect3DRMMesh
IDirect3DRMMesh::GetVerticesRetrieves vertex information for a specified group in a Direct3DRMMesh object.
HRESULT GetVertices(
D3DRMGROUPINDEX id,
DWORD index,
DWORD count,
D3DRMVERTEX *returnPtr
);Parameters
- id
- Identifier of the group. This identifier must have been produced by using the IDirect3DRMMesh::AddGroup method.
- index
- Index into the array of D3DRMVERTEX structures at which to begin returning vertex positions.
- count
- Number of D3DRMVERTEX structures (vertices) to retrieve following the index given in the index parameter. This parameter cannot be NULL. To retrieve the number of vertices in a group, use the IDirect3DRMMesh::GetGroup method.
- returnPtr
- Array of D3DRMVERTEX structures that will contain the vertex information (vertex positions, colors, texture coordinates, and so on) when the method returns.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::GetGroup, IDirect3DRMMesh::SetVertices
IDirect3DRMMesh
IDirect3DRMMesh::Scale
Scales a Direct3DRMMesh object by the given scaling factors, parallel to the x-, y-, and z-axes in model coordinates.
HRESULT Scale(
D3DVALUE sx,
D3DVALUE sy,
D3DVALUE sz
);Parameters
- sx, sy, and sz
- Scaling factors that are applied along the x-, y-, and z-axes.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupColorSets the color of a group in a Direct3DRMMesh object.
HRESULT SetGroupColor(
D3DRMGROUPINDEX id,
D3DCOLOR value
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- value
- Color of the group.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
This method is also used to add a group color key to a Direct3DRMMeshInterpolator object.
See Also
IDirect3DRMMesh::GetGroupColor, IDirect3DRMMesh::SetGroupColorRGB
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupColorRGBSets the color of a group in a Direct3DRMMesh object, using individual RGB values.
HRESULT SetGroupColorRGB(
D3DRMGROUPINDEX id,
D3DVALUE red,
D3DVALUE green,
D3DVALUE blue
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- red, green, and blue
- Red, green, and blue components of the group color.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
This method is also used to add a group RGB key to a Direct3DRMMeshInterpolator object.
See Also
IDirect3DRMMesh::GetGroupColor, IDirect3DRMMesh::SetGroupColor
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupMappingSets the mapping for a group in a Direct3DRMMesh object. The mapping controls how textures are mapped to a surface.
HRESULT SetGroupMapping(
D3DRMGROUPINDEX id,
D3DRMMAPPING value
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- value
- Value of the D3DRMMAPPING type that describes the mapping for the group.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::GetGroupMapping
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupMaterialSets the material associated with a group in a Direct3DRMMesh object.
HRESULT SetGroupMaterial(
D3DRMGROUPINDEX id,
LPDIRECT3DRMMATERIAL value
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- value
- Address of the IDirect3DRMMaterial interface for the Direct3DRMMesh object.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::GetGroupMaterial
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupQualitySets the rendering quality for a specified group in a Direct3DRMMesh object.
HRESULT SetGroupQuality(
D3DRMGROUPINDEX id,
D3DRMRENDERQUALITY value
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- value
- Values from the enumerated types represented by the D3DRMRENDERQUALITY type. These values include the shading, lighting, and fill modes for the object.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::GetGroupQuality
IDirect3DRMMesh
IDirect3DRMMesh::SetGroupTextureSets the texture associated with a group in a Direct3DRMMesh object.
HRESULT SetGroupTexture(
D3DRMGROUPINDEX id,
LPDIRECT3DRMTEXTURE value
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- value
- Address of the IDirect3DRMTexture interface for the Direct3DRMMesh object.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
See Also
IDirect3DRMMesh::GetGroupTexture
IDirect3DRMMesh
IDirect3DRMMesh::SetVerticesSets the vertex positions for a specified group in a Direct3DRMMesh object.
HRESULT SetVertices(
D3DRMGROUPINDEX id,
unsigned index,
unsigned count,
D3DRMVERTEX *values
);Parameters
- id
- Identifier of the group. This identifier must be produced by using the IDirect3DRMMesh::AddGroup method.
- index
- Index of the first vertex in the mesh group to be modified.
- count
- Number of consecutive vertices to set. The values array must contain at least the number of count elements.
- values
- Array of D3DRMVERTEX structures specifying the vertex positions to be set.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
Vertices are local to the group. If an application needs to share vertices between two different groups (for example, if neighboring faces in a mesh are different colors), the vertices must be duplicated in both groups.
This method is also used to add a vertex position key to a Direct3DRMMeshInterpolator object.
See Also
IDirect3DRMMesh
IDirect3DRMMesh::Translate
Adds the specified offsets to the vertex positions of a Direct3DRMMesh object.
HRESULT Translate(
D3DVALUE tx,
D3DVALUE ty,
D3DVALUE tz
);Parameters
- tx, ty, and tz
- Offsets that are added to the x-, y-, and z-coordinates, respectively, of each vertex position.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.