ID3DX10SkinInfo::DoSoftwareSkinning method

Do software skinning on an array of vertices.

Syntax

HRESULT DoSoftwareSkinning(
  [in]      UINT                    StartVertex,
  [in]      UINT                    VertexCount,
  [in]      void                    *pSrcVertices,
  [in]      UINT                    SrcStride,
  [in, out] void                    *pDestVertices,
  [in]      UINT                    DestStride,
  [in]      D3DXMATRIX              *pBoneMatrices,
  [in]      D3DXMATRIX              *pInverseTransposeBoneMatrices,
  [in]      D3DX10_SKINNING_CHANNEL *pChannelDescs,
  [in]      UINT                    NumChannels
);

Parameters

StartVertex [in]

Type: UINT

A 0-based index into pSrcVertices.

VertexCount [in]

Type: UINT

Number of vertices to transform.

pSrcVertices [in]

Type: void*

Pointer to an array of vertices to transform.

SrcStride [in]

Type: UINT

The size, in bytes, of a vertex in pSrcVertices.

pDestVertices [in, out]

Type: void*

Pointer to an array of vertices, which will be filled with the transformed vertices.

DestStride [in]

Type: UINT

The size, in bytes, of a vertex in pDestVertices.

pBoneMatrices [in]

Type: D3DXMATRIX*

An array of matrices that will be used to transform the points mapped to each bone, such that the vertices mapped to bone[i] will be transformed by pBoneMatrices[i]. This array will be used to transform the matrices only if the IsNormal value in pChannelDescs is set to FALSE, otherwise pInverseTransposeBoneMatrices will be used.

pInverseTransposeBoneMatrices [in]

Type: D3DXMATRIX*

If this value is NULL, it will be set equal to pBoneMatrices. This array of matrices will be used to transform the vertices only if the IsNormal value in pChannelDescs is set to TRUE, otherwise pBoneMatrices will be used.

pChannelDescs [in]

Type: D3DX10_SKINNING_CHANNEL*

Pointer to a D3DX10_SKINNING_CHANNEL structure, which determines the member of the vertex decl the software skinning will be done on.

NumChannels [in]

Type: UINT

The number of D3DX10_SKINNING_CHANNEL structures in pChannelDescs.

Return value

Type: HRESULT

If the method succeeds, the return value is S_OK. If the method fails, the return value can be: E_INVALIDARG.

Remarks

Here is an example of how to use software skinning:

//vertex definition
struct MyVertex
{
    D3DXVECTOR3 Position;
    D3DXVECTOR2 Weight;
    D3DXVECTOR2 TexCoord;
};

//create vertex data
const UINT numVertices = 16;
MyVertex vertices[numVertices] = {...};
MyVertex destVertices[numVertices];

//create bone matrices
D3DXMATRIX boneMatrices[2];
D3DXMatrixIdentity(&boneMatrices[0]);
D3DXMatrixRotationX(&boneMatrices[1], 3.14159f / 180.0f);

//create bone indices and weights
UINT boneIndices[numVertices] = {...};
float boneWeights[2][numVertices] = {...};

//create skin info, populate it with bones and vertices, and then map them to each other
ID3DX10SkinInfo *pSkinInfo = NULL;
D3DX10CreateSkinInfo(&pSkinInfo);
pSkinInfo->AddBones(2);
pSkinInfo->AddVertices(numVertices);
pSkinInfo->AddBoneInfluences(0, numVertices, boneIndices, boneWeights[0]);
pSkinInfo->AddBoneInfluences(1, numVertices, boneIndices, boneWeights[1]);

//create channel desc
D3DX10_SKINNING_CHANNEL channelDesc;
channelDesc.SrcOffset = 0;
channelDesc.DestOffset = 0;
channelDesc.IsNormal = FALSE;

//do the skinning
pSkinInfo->DoSoftwareSkinning(0, numVertices,
                              vertices, sizeof(MyVertex), 
                              destVertices, sizeof(MyVertex), 
                              boneMatrices, NULL, 
                              &channelDesc, 1);

Requirements

Requirement Value
Header
D3DX10.h
Library
D3DX10.lib

See also

ID3DX10SkinInfo

D3DX Interfaces