Click to See Complete Forum and Search --> : Duplicate a D3DXMESH?
danielkw
Sep 17th, 2002, 01:49 AM
How do I duplicate a D3DXMESH?
First, I load an X file into Mesh1:
Set Mesh1 = D3DX.LoadMeshFromX ...
Then I want Mesh2 to be an exact copy Mesh1. I don't use the
Set Mesh2 = Mesh1
since Mesh2 will only point to Mesh1 and not become and individual copy.
Any suggestions?
Zaei
Sep 17th, 2002, 06:03 AM
Im thinking that you will have to write a function yourself. It just isnt functionality that is required much...
Z.
danday1974
Sep 17th, 2002, 06:39 AM
cant you draw the mesh, transform it then draw it again or am I getting the wrong idea here?
Zaei
Sep 17th, 2002, 10:38 AM
That is what most people would do.
Z.
danielkw
Sep 17th, 2002, 11:17 AM
No, that's what I am doing right now. Drawing, transforming, drawing new etc...
The problem is that, with this method, I have to apply the transformation every time I draw the mesh since it may have been altered in the previous loop. So if I had one instance of the mesh per object that I want to draw, then I would only have to apply transformations when needed, not on every frame.
Is this understandable? I'm not too good at explaining things in english *lol* =)
Zaei
Sep 17th, 2002, 11:48 AM
Performance says that changing your matrices will be FAR faster then changing your mesh.
Consider. Setting a world matrix involves copying 16 Single values into an internal Matrix. Setting a mesh involves change a Vertex buffer, Copying 4*Len(Vertex)*numVerts, and an index buffer, which is indexSize*numIndices.
Besides, that is what matrices are for, so you dont have to duplicate geometry.
Z.
danielkw
Sep 17th, 2002, 11:55 AM
Okedoki! Thanx for your answer! Sounds clever to me! I will try that as soon as I get time...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.