• Advertisement

Archived

This topic is now archived and is closed to further replies.

multiple meshes (more noob ?s)

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

I finally get how to load a mesh, so I tried loading 2. I got that to work, but theyre intersecting each other. How do I place individual objects in a scene and move them about independently? (for example, have a stationary ground, and a ship (or 20) that flies over it) thanks again, jason

Share this post


Link to post
Share on other sites
Advertisement
Use a different world matrix for each one. Set it with SetTransform before displaying appropriate meshes.

Share this post


Link to post
Share on other sites
Jason,

I would suggest you read up on using world transformation matrices before going any further if you''re having trouble. Basically, you set the projection transformation once during initialization, set the view transformation once per frame (if it moves), and than for each mesh, set the world transformation, draw a mesh, set next world transformation, draw a mesh, set world... and so on.

To give you your answer in pseudo-code:

For each mesh to draw:
Set mesh''s world transformation matrix
For each material subset in mesh
Set material
Set texture
Draw subset
Next subset
Next mesh

So, basically, a mesh is transformed and rendered using the world transformation currently set. To set any transformation, use the IDirect3DDevice8::SetTransform using D3DTS_WORLD, D3DTS_VIEW, and D3DTS_PROJECTION.



Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX

Share this post


Link to post
Share on other sites

  • Advertisement