Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

need help with D3D mouse picking...

If the model is not set to the Identity , what space do i pick in ?

this is its translation and rendering

// Build castle's world matrix.
D3DXMatrixRotationY(&Ry, D3DX_PI);
D3DXMatrixTranslation(&T, 8.0f, 35.0f, -80.0f);
mCastleWorld = Ry*T;

void PropsDemo::drawObject(Object3D& obj, const D3DXMATRIX& toWorld)
// Transform AABB into the world space.

AABB box;, 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.
HR(mFX->SetTexture(mhTex, mWhiteTex));


drawObject(mCastle, mCastleWorld);
They hacked my password. Slap me!
Sign In or Register to comment.