If the model is not set to the Identity , what space do i pick in ?
this is its translation and rendering
[code]
// Build castle's world matrix.
D3DXMatrixRotationY(&Ry, D3DX_PI);
D3DXMatrixTranslation(&T, 8.0f, 35.0f, -80.0f);
mCastleWorld = Ry*T;
[/code]
[code]
void PropsDemo::drawObject(Object3D& obj, const D3DXMATRIX& toWorld)
{
// Transform AABB into the world space.
AABB box;
obj.box.xform(toWorld, box);
// Only draw if AABB is visible.
if( gCamera->isVisible( box ) )
{
HR(mFX->SetMatrix(mhWVP, &(toWorld*gCamera->viewProj())));
D3DXMatrixInverse(&worldInvTrans, 0, &toWorld); //objectspace
D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans);
HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans));
HR(mFX->SetMatrix(mhWorld, &toWorld));
for(UINT j = 0; j < obj.mtrls.size(); ++j)
{
HR(mFX->SetValue(mhMtrl, &obj.mtrls[j], sizeof(Mtrl)));
// If there is a texture, then use.
if(obj.textures[j] != 0)
{
HR(mFX->SetTexture(mhTex, obj.textures[j]));
}
// But if not, then set a pure white texture. When the texture color
// is multiplied by the color from lighting, it is like multiplying by
// 1 and won't change the color from lighting.
else
{
HR(mFX->SetTexture(mhTex, mWhiteTex));
}
HR(mFX->CommitChanges());
HR(obj.mesh->DrawSubset(j));
}
}
}
[/code]
[code]
drawObject(mCastle, mCastleWorld);
[/code]
They hacked my password. Slap me!