Sign in to follow this  
axelfr74

Skinned mesh and shadow volume

Recommended Posts

Hi, I'm tying to generate a shadow volume of a skinned animated mesh. I have no problems generating the shadow volume from a LPD3DXMESH and no problems to generate and render a skinned mesh with animations. BUT..how do it put these parts together? I thought of catching the LPD3DXMESH of my skinned mesh after drawing the subsets like shown here:
void D3DSkinnedMesh::SkinnedMeshContainerClass::DrawMeshContainer(LPD3DXMESHCONTAINER pMeshContainerBase, LPD3DXFRAME pFrameBase)
{
	D3DXMESHCONTAINER_DERIVED *pMeshContainer = (D3DXMESHCONTAINER_DERIVED*)pMeshContainerBase;
	D3DXFRAME_DERIVED *pFrame = (D3DXFRAME_DERIVED*)pFrameBase;
	UINT iMaterial;
	UINT NumBlend;
	UINT iAttrib;
	DWORD AttribIdPrev;
	LPD3DXBONECOMBINATION pBoneComb;

	UINT iMatrixIndex;
	UINT iPaletteEntry;
	D3DXMATRIXA16 matTemp;

	shadowMesh = pMeshContainer->MeshData.pMesh;
	D3DXComputeNormals(shadowMesh, NULL);

	m_pd3dDevice->SetTransform(D3DTS_WORLD, &pFrame->CombinedTransformationMatrix);

	

	for (iMaterial = 0; iMaterial < pMeshContainer->NumMaterials; iMaterial++)
	{
		m_pd3dDevice->SetMaterial( &pMeshContainer->pMaterials[iMaterial].MatD3D );
		m_pd3dDevice->SetTexture( 0, pMeshContainer->ppTextures[iMaterial] );
		pMeshContainer->MeshData.pMesh->DrawSubset(iMaterial);
	}

}
After doing this there is something in my shadowMesh..but far away from the mesh I need. What can I do? Where do I have to fetch the needed LPD3DXMESH? Thanks for any help. AXel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this