Results 1 to 7 of 7

Thread: Duplicate a D3DXMESH?

  1. #1

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134

    Angry Duplicate a D3DXMESH?

    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?

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Im thinking that you will have to write a function yourself. It just isnt functionality that is required much...

    Z.

  3. #3
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    cant you draw the mesh, transform it then draw it again or am I getting the wrong idea here?

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    That is what most people would do.

    Z.

  5. #5

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    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* =)

  6. #6
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    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.

  7. #7

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    Okedoki! Thanx for your answer! Sounds clever to me! I will try that as soon as I get time...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width