Jump to content
  • Advertisement
Sign in to follow this  
Haytil

DirectX 9 - D3DXMATRIXTransformation2D Questions

This topic is 2754 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

Hello,

I am trying to update my 2D graphics engine from DirectX 9.0 to one of the more recent DirectX 9 updates. Unfortunately, due to several changes, I can no longer rely on the simplicity of the ID3DXSprite::Draw() function, but must also now rely on matrix transformations. (The documentation states that the new version is the DirectX 9 Update October 2005, for reference).

In doing so, I'm trying to stick to the D3DXMATRIXTransformation2D() function. However, I have a few questions, which the documentation has left me confused regarding:

-What is the purpose of the third parameter, "pScalingRotation?" The documentation says this is "the scaling rotation factor," but I don't understand what that means.

The scaling factor is determined by the fourth parameter, "pScaling," which is a pointer to a D3DXVECTOR2, containing two floats which determine the scaling factor for the X and Y axes (so you can scale vertically more than horizontally, for instance).

The rotation factor is determined by the sixth parameter, "Rotation," which is simply a float representing the amount of rotation desired in radians.

So if those parameters take care of how much I want to scale and rotate an image, what is the purpose of "pScalingRotation?"



-What does the identity Mrc matrix represent? These are the default values, if the "pRotationCenter" parameter is NULL (it's a D3DXVECTOR2 pointers).

I want to rotate around the center of my image (rather than a corner or any other point), so I'll pass a vector containing 0.5*desired_image_width and 0.5*desired_image_height. But out of curiosity, what would the identity Mrc matrix represent in this case, if I didn't pass my desired vector?



-What is D3DXMATRIXAffineTransformation2D(), and what is the difference between this and D3DXMATRIXTransformation2D()? The documentation says it builds a 2D affine transformation matrix in the xy plane, rather than a 2D transformation matrix in the xy plane - so all I know is one is "affine," and the other is not, which is obvious, given the function's title.

What I don't understand is what that actually means.

Based on the parameters, it looks like it's the same, except it only allows one-dimensional scaling (no scaling center, and the scaling is represented by a float) - so using this function, I would only be able to scale the horizontal axis by the same amount as the vertical axis, and vice versa.

Is this a correct interpretation? Is D3DXMATRIXAffineTransformation2D() simply a simpler version of D3DXMATRIXTransformation2D(), to be used when I don't need more fancy scaling?


Thanks.

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!