Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

Should I still set my world matrix, even if i'm not using it?

This topic is 4883 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, I was wondering if I should bother setting my world matrix, even though I'm not actually using it to move any of my 3d objects. eg D3DXMATRIXA16 matWorld; D3DXMatrixTranslation(&matWorld, 0.0f, 0.0f, 0.0f); d3dDevice->SetTransform(D3DTS_WORLD, &matWorld); Thanks

Share this post


Link to post
Share on other sites
Advertisement
If you've already set it once, and it's not changed from the last frame then there's no reason to set it. The default world matrix is the identity matrix, so if you need something else, you'll need to set it at least once.
Also, you're better using D3DXMatrixIdentity(), since that's what it's for.

Share this post


Link to post
Share on other sites
I meant can I just not even setting it once, to not even call it at all, could that cause any problems?

... I didnt know about the identity matrix, i'll be having quick look at that now.

Share this post


Link to post
Share on other sites
I just tried not setting the world matrix at all, and the outcome is normal (both with the FFP and directly with HLSL).

Share this post


Link to post
Share on other sites
According to the docs, the default transform matrices are all the identity matrix. The identity matrix is exactly the same as a translation of 0 (what you had). So not setting the world matrix means you'll just have the identity matrix, which means no translation.

So, there's no problem with leaving the line of code out (which is what circlesoft said).

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!