Jump to content
  • Advertisement
Sign in to follow this  
Ncyphe

D3DX SetTransform

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

Very quick question guys, and I need a quick answer.

The (D3DXGraohicsDevice)->SetTransform(~~) function that can be used to modify a mesh's position on screen. Can it still be used in conjunction with shader rendering?

Note that this is in C++.

Edit: This may be just hitting me now, but is the World matrix supposed to represent the actual position of an object in the world?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
The (D3DXGraohicsDevice)->SetTransform(~~) function that can be used to modify a mesh's position on screen. Can it still be used in conjunction with shader rendering?
I'm not an expert on DirectX, but I think SetTransform() is fixed-function only. (If that's wrong, I'm sure someone will correct me.)
Quote:
Edit: This may be just hitting me now, but is the World matrix supposed to represent the actual position of an object in the world?
The world matrix represents the world transform for the object. This can include translation (the position), rotation, scaling, shearing, etc. It doesn't represent any one thing, but rather a combined affine transform that can comprise any number of individual transforms.

But yes, in practice it's usually used to specify the position at which an object should be rendered, along with its orientation. Scaling is also a commonly applied transform (other transforms, such as shear, are less commonly used).

Share this post


Link to post
Share on other sites
Thanks for the information.

All these years reading the tutorials and books, it sounded like the World matrix was for doing something like modifying the world axis, or I don't know what I thought.

The books all said, "Convert To World Space," why couldn't they have just said, "aligns the object within it world position, rotation, and scale."

Share this post


Link to post
Share on other sites
Wow, JYK almost always has the answers.... and for once I do :)

First off it's the d3d device, not d3dx... the d3dx library is only an extension on to direct3d.

SetTransform, as are a large number of other d3ddevice methods are for the fixed function only. If you are using shaders, variables will be passed in through the device->SetVertexShaderConstant* family of functions.

Yes the world matrix represents the position of an object, but also it's orientation, and it also maps axii from one space to another... pretty useful eh?

if you think about how you describe your world, most of it is in reference to you, correct? your shoes are on your feet. your coffee is infront of you, your chair behind... each of these things are based of your understanding of front/up/right...

Say your house is on of 123 street, well i need to find out where i am for that to have any relevance to me. My world transformation tells me this. It gives me an absolute position, in world space, as well as references for front/up/right in world space. (As in i'm facing east, so south is to my right and up is well up).

If you describe something in another space altogether I'm lost again, so i need a way to reference that space... luckily the inverse of the world transform will map from world->local space. So if you say the table is in front of you, it's the same as saying you are behind the table...

Share this post


Link to post
Share on other sites
That y'all for all your help guys.

Shaders are not my most knowledgeable subject, but I am learning a lot.

Right now, I'm enrolled in the DeVry Games and Simulations Programming coarse, in my engine design class. I was tasked with programming a dynamic shader class, able to load shaders, and draw shaders, so that was a lot to ask for from me.

I program one set of code, get it working, the professor has issues with it

rewrite

get code working, classmates have issues with it (too many function calls for our scripting class)

rewrite to use custom ".material" and ".shader" files containing data about the shader, and info to pass to the shader.

And this is where I'm at now. Group-mate informed me that her skybox wasn't moving, was passing the wrong World matrix, then I realized that the LoadMaterial function I created can only be used outside of a render loop.

I think I fixed that, but it's been a long 8 weeks. This should have been finished 4 weeks ago, lol.

edit: I do have to say though, a lot of people say I am very smart; however, I tend to learn very slowly, often with the solution just suddenly popping into my head on day . . . while doing something entirely irrelevant.

[Edited by - Ncyphe on August 23, 2010 12:22:11 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!