?/TD> |
Microsoft DirectX 9.0 |
Creates a simplification mesh.
Syntax
HRESULT D3DXCreateSPMesh(
LPD3DXMESH pMesh, CONST DWORD *pAdjacency, CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights, CONST FLOAT *pVertexWeights, LPD3DXSPMESH *ppSMesh );
Parameters
- pMesh
- [in] Pointer to an ID3DXMesh interface, representing the mesh to simplify.
- pAdjacency
- [in] Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the created simplification mesh.
- pVertexAttributeWeights
- [in] Pointer to a D3DXATTRIBUTEWEIGHTS structure, containing the weight for each vertex component. If this parameter is set to NULL, a default structure is used. See Remarks.
- pVertexWeights
- [in] Pointer to an array of vertex weights. If this parameter is set to NULL, all vertex weights are set to 1.0. Note that the higher the vertex weight for a given vertex, the less likely it is to be simplified away.
- ppSMesh
- [out] Address of a pointer to an ID3DXSPMesh interface, representing the created simplification mesh.
Return Value
If the function succeeds, the return value is D3D_OK.
If the function fails, the return value can be one of the following values.
D3DXERR_CANNOTATTRSORT Attribute sort (D3DXMESHOPT_ATTRSORT) is not supported as an optimization technique. D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value. E_OUTOFMEMORY Microsoft?Direct3D?could not allocate sufficient memory to complete the call.
Remarks
A simplification mesh is used to simplify a mesh to a lower number of triangles and faces.
If pVertexAttributeWeights is set to NULL, the following values are assigned to the default D3DXATTRIBUTEWEIGHTS structure.
D3DXATTRIBUTEWEIGHTS AttributeWeights; AttributeWeights.Position = 1.0; AttributeWeights.Boundary = 1.0; AttributeWeights.Normal = 1.0; AttributeWeights.Diffuse = 0.0; AttributeWeights.Specular = 0.0; AttributeWeights.Tex[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};This default structure is what most applications should use because it considers only geometric and normal adjustment. Only in special cases will the other member fields need to be modified.
Function Information
Header d3dx9mesh.h Import library d3dx9.lib Minimum operating systems Windows 98