void CD3DRenderer::render(const Object& obj, Matrix4 modelMatrix, const CCamera &camera, float time)
{
CMeshAnimator meshAnimator(obj);
meshAnimator.update(&modelMatrix, time);
m_Cam = camera;
//UpdateFrame(&modelMatrix);
RenderFrame((D3DXFRAME_DERIVED*)obj.mesh.m_Root);
RenderFrame2((D3DXFRAME_DERIVED*)obj.mesh.m_Root);
}
class CMeshAnimator
{
public:
CMeshAnimator(const Object& obj) { m_obj = obj; }
virtual void update(D3DXMATRIX* mat, float deltaTime) {
if (m_obj.m_pAnimCtrl)
{
m_obj.m_pAnimCtrl->AdvanceTime(deltaTime,0);
}
UpdateFrame(mat); }
protected:
void UpdateFrame(D3DXMATRIX* mat);
void UpdateAllChildren(D3DXFRAME_DERIVED* pFrame, D3DXMATRIX* pMat);
Object m_obj;
};
if( pMeshContainer->pSkinInfo != NULL )
{
//if( g_SkinningMethod == D3DNONINDEXED )
//{
AttribIdPrev = UNUSED32;
pBoneComb = reinterpret_cast<LPD3DXBONECOMBINATION>( pMeshContainer->pBoneCombinationBuf->GetBufferPointer
() );
// Draw using default vtx processing of the device (typically HW)
for( iAttrib = 0; iAttrib < pMeshContainer->NumAttributeGroups; iAttrib++ )
{
NumBlend = 0;
for( DWORD i = 0; i < pMeshContainer->NumInfl; ++i )
{
if( pBoneComb[iAttrib].BoneId[i] != UINT_MAX )
{
NumBlend = i;
}
}
if( d3dCaps.MaxVertexBlendMatrices >= NumBlend + 1 )
{
// first calculate the world matrices for the current set of blend weights and get the accurate count of the number of blends
for( DWORD i = 0; i < pMeshContainer->NumInfl; ++i )
{
iMatrixIndex = pBoneComb[iAttrib].BoneId[i];
if( iMatrixIndex != UINT_MAX )
{
D3DXMatrixMultiply( &matTemp, &pMeshContainer->pBoneOffsetMatrices[iMatrixIndex],
pMeshContainer->ppBoneMatrixPtrs[iMatrixIndex] );
g_pDevice->SetTransform( D3DTS_WORLDMATRIX( i ), &matTemp );
}
}
g_pDevice->SetRenderState( D3DRS_VERTEXBLEND, NumBlend );
// lookup the material used for this subset of faces
if( ( AttribIdPrev != pBoneComb[iAttrib].AttribId ) || ( AttribIdPrev == UNUSED32 ) )
{
g_pDevice->SetMaterial( &pMeshContainer->pMaterials[pBoneComb[iAttrib].AttribId].MatD3D);
g_pDevice->SetTexture( 0, pMeshContainer->textures[pBoneComb[iAttrib].AttribId] );
AttribIdPrev = pBoneComb[iAttrib].AttribId;
}
// draw the subset now that the correct material and matrices are loaded
pMeshContainer->MeshData.pMesh->DrawSubset( iAttrib );
}
}

The scaling and translation has no effect. I have set it at the beginning of the program.
which looks something like this
D3DXMatrixTransformation(&obj.transform, NULL, NULL, NULL, NULL, &D3DXVECTOR3(10,0,50));
Anyone shedding some lights on this would be greatly appreciated!
Thanks
Jack
Edited by lucky6969b, 04 January 2013 - 01:45 AM.






