Sign in to follow this  
boboS

Silly .X question

Recommended Posts

Maybe its obvios but i didnt managed to understand how to manipulate the frame tranformation matrix for the mesh/subset... So, I've noticed that the .X (DirectX mesh file) has the vertices in model space and a transformation matrix.I'm using Panda Exporter to export the mesh. For example if I export 100 objects at different locations. If I draw those objects with a shader effect they go in the correct location. How can I acces the transformation matrix of the subset/mesh in code ?

Share this post


Link to post
Share on other sites
Are your meshes animated or non-animated?

If they're non-animated (static meshes), there's no variable (that I know of) that you can access during execution to get the tranformation.

If they're animated, you can find the frame that has the mesh container. The transformation for that frame is what you're looking for.

However you access it, don't forget that each frame's transformation matrix is a local frame, relative to its parent's frame, etc., back to the root.

Share this post


Link to post
Share on other sites
Static meshed.

I've noticed the transformation matrices from the animated meshes (from a skinning example) but how the static meshes are positioned with that frame matrix if there isnt any matrix in the code ?

Share this post


Link to post
Share on other sites
It apparently transforms the mesh during the load by D3DXLoadMeshFromX. You could test that by locking the mesh vertex buffer, examining some vertex positions and comparing them to the vertex positions in the x-file. If the vertex positions match the mesh as it would be transformed, then you know it transforms them when it loads.

I've never done that, but it seems the only likely way.

EDIT: you do realize that you can accomplish the same thing by setting the world transform for each mesh before you render?

Share this post


Link to post
Share on other sites
Yes.
Assuming Im using 3DS max as an editor (postion editor) what will be the best approach to place the objects in space in my code? For example to see if an object is verry far so it doesnt need to be rendered. I must generate an AABB for every object?
Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this