Jump to content
  • Advertisement
Sign in to follow this  
EvilProject

Mesh rendering problem

This topic is 4006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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);
	}
}

Share this post


Link to post
Share on other sites
Advertisement
Please use either [ code][/ code] or [ source][/ source] tags, omitting the spaces.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!