Jump to content
  • Advertisement


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


how do I load and control different meshes?

This topic is 6057 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''m using DirectX8 in VB and i can load one textured mesh fine and set controls with the cursor key. I set the world transformation to move it about but I was wondering how do I load several meshes and set a different world transformation to each? The D3DXMatrixTransform takes only a D3D Device as a parameter so I can''t specify which object I want to transform. Or do I have to reload the mesh everytime I Want to move a different mesh?

Share this post

Link to post
Share on other sites
You need to make several transformation matrices and apply them before rendering respective meshes. There might be a more efficient way to do this.

Share this post

Link to post
Share on other sites
here''s the order my program does things:

-create device
-load mesh
-set matrices
-draw mesh

Here''s how I draw the mesh:

Dim counter As Long
''meshes are divided in subsets, one for each material
''loop through each subset
For counter = 0 To numMaterials - 1

''set the material and texture for this subset
objD3DDevice.SetMaterial Materials(counter)
objD3DDevice.SetTexture 0, Textures(counter)

''draw the mesh subset
objMesh.DrawSubset counter

Next counter

so I''d have to save different materials and textures array for every mesh and draw the mesh I want to transform after specifying the transform?

Share this post

Link to post
Share on other sites
OK just tried doing it this way let me know if there''s a better way:

Public Type MESHTYPE
meshName As String
mesh As D3DXMesh
moveX As Single
moveY As Single
moveZ As Single
numMaterials As Long
materials() As D3DMATERIAL8
textures() As Direct3DTexture8
End Type

and the DrawMesh function takes a MESHTYPE as a parameter after applying the world transformation matrix to draw the mesh which I want to transform.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
to move seperate meshes, just set the world matrix as needed. you can set it an unlimited amount of times.

for example:

move first mesh

move next mesh

there''s only one world matrix...you just move it, draw what you want moved, then set it back.

Share this post

Link to post
Share on other sites

  • 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!