DX8 - extracting mesh from skinned mesh

Started by
2 comments, last by Crow-knee 20 years ago
Hi all, I am trying to apply volume shadows to my program, and for normal meshes, all works well (apart from when the camera goes into the volume - but that''s another story). My skinned mesh stuff is just a butchered version of the Dx8 sample, and I am having trouble extracting the mesh which I need to feed to my shadowing object. At what point do I need to grab the pMesh from the mesh container? Will I have to do away with processing D3DNONINDEXED and just do the SOFTWARE one and use UpdateSkinnedMesh? Thanks for any help. Steele.
Advertisement
So far I have come up with this :

c_SkinnedMesh::Get_Mesh(SFrame *pframeCur) {	SMeshContainer *pmcMesh = pframeCur->pmcMesh;	D3DXMATRIX  mtxWorld;	while (pmcMesh != NULL) {		METHOD tmp = m_method;		m_method = SOFTWARE;		GenerateMesh(pmcMesh, *m_Caps);		m_method = tmp;				DWORD cBones = pmcMesh->m_pSkinMesh->GetNumBones();		D3DXMATRIXA16 *pBoneMatrices  = new D3DXMATRIXA16[cBones];		// set up bone transforms		for (DWORD iBone = 0; iBone < cBones; ++iBone)		{			D3DXMatrixMultiply(				&pBoneMatrices[iBone],                 // output				&pmcMesh->m_pBoneOffsetMat[iBone], 				pmcMesh->m_pBoneMatrix[iBone]);		}				//D3DXMatrixIdentity(&mtxIdentity);		Generate_World_Matrix(&mtxWorld);		// generate skinned mesh		HRESULT hr = pmcMesh->m_pSkinMesh->UpdateSkinnedMesh(pBoneMatrices, NULL, pmcMesh->pMesh);		if (FAILED(hr)) {			DebugPrint(false, ("Failed to update skinned mesh on update\n"));		} else {			if (!gmGM->m_svLight_Shadows->Add_Shadow(string("SKINNED TMP"), pmcMesh->pMesh, &mtxWorld)) {				gmGM->m_svLight_Shadows->Update_Shadow(string("SKINNED TMP"), pmcMesh->pMesh, &mtxWorld);			}		}		pmcMesh = pmcMesh->pmcNext;	}	SFrame *pframeChild = pframeCur->pframeFirstChild;    while (pframeChild != NULL) {			Get_Mesh(pframeChild);        pframeChild = pframeChild->pframeSibling;    }}c_SkinnedMesh::Update(float fDelta) {	SDrawElement *pdeCur;    SFrame *pframeCur;	SFrame *frmRoot;	SMeshContainer *pmcMesh;	D3DXMATRIX  mtxIdentity;	    pdeCur = m_pdeHead;    while (pdeCur != NULL)    {        pdeCur->fCurTime += fDelta;        if (pdeCur->fCurTime > 1.0e15f)            pdeCur->fCurTime = 0;        pframeCur = pdeCur->pframeAnimHead;        while (pframeCur != NULL)        {            pframeCur->SetTime(pdeCur->fCurTime);			pframeCur = pframeCur->pframeAnimNext;        }				Get_Mesh(pdeCur->pframeRoot);        pdeCur = pdeCur->pdeNext;    }} 


The mesh doesn''t seem to be correct, however, containing just a mish-mash of polys.
Am I going the right way about this?
Thanks,
Steele.
Anyone have any idea on how to extract a mesh representing the current skinned mesh position?
Steele.
You''ll probably want to go with software skinning. If your mesh was set up right and you had access to vertex shaders, you could do indexed skinning and stay on the GPU, but at first, go with software to get it working.

Extracting the mesh with software skinning is just that--skin it, like always, and use that. If you need the vertices to get put into memory, that''s really the way to go.

I like pie.
[sub]My spoon is too big.[/sub]

This topic is closed to new replies.

Advertisement