void CAnimatedMesh::Render()
{
if(!m_bLoaded)
return;
void *pSource,*pDest;
if(m_bUpdated)
{
m_pRootFrame->UpdateHierarchy();
for(DWORD i=0; i<m_pContainer->pSkinInfo->GetNumBones(); i++)
{
m_pContainer->pBoneMatrices = (*m_pContainer->pSkinInfo->GetBoneOffsetMatrix(i));
if(m_pContainer->ppFrameMatrices)
m_pContainer->pBoneMatrices *= (*m_pContainer->ppFrameMatrices);
}
m_pContainer->pMesh->LockVertexBuffer(D3DLOCK_READONLY,(void**)&pSource);
m_pContainer->pSecondaryMesh->LockVertexBuffer(0,(void**)&pDest);
m_pContainer->pSkinInfo->UpdateSkinnedMesh(m_pContainer->pBoneMatrices,NULL,pSource,pDest);
m_pContainer->pMesh->UnlockVertexBuffer();
m_pContainer->pSecondaryMesh->UnlockVertexBuffer();
m_bUpdated = false;
}
m_pD3DDevice->SetVertexShader(NULL);
m_pD3DDevice->SetVertexDeclaration(NULL);
for(DWORD i=0; i<m_pContainer->dwNumMaterials; i++)
{
if(m_pContainer->pMaterials.MatD3D.Diffuse.a !=1.0f)
{
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);
m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE);
m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_DESTCOLOR);
}
else
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE);
m_pD3DDevice->SetMaterial(&m_pContainer->pMaterials.MatD3D);
m_pD3DDevice->SetTexture(0,m_pContainer->ppTextures);
m_pContainer->pSecondaryMesh->DrawSubset(i);
}
}
Mesh rendering problem
hi, im trying to render a skinned mesh and for some reson it doenst show up.
this is the Render function of the mesh , thanks for all helpers :P
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement