How to copy VECTORs or D3D mater,text or MESHes

Hello,

I am having a problem with creating a MESH object. I can load it from an X-file, but I would like to to be able to COPY whole object from one SPRITE to ANOTHER so I dont have to access .X file all the time...

I can copy mest with CloneMeshFVF, but I fail in copying it's textures and materials...

I think every class(SPRITE) should have its MESH type, MATERIALS, TEXTURES saved and not share same things,shoulnt it

For instance, when object is being hit in game I destroy it, and therefore I am deleting also its mesh and mats, textures...

I would appreciate any ideas



Answer this question

How to copy VECTORs or D3D mater,text or MESHes

  • lakshmiy

    Thank you.

    :)


  • Matt Braafhart

    Unless you are modifiying anything in the mesh after it is loaded, its not efficient to have multiple copies of it loaded into memory. So load it once and then have an array of sprites that you want to render. Store the x,y value of each sprite and a reference to the mesh you want rendered. Then just call draw on that mesh.

    Dispose of everything at the end of your level or game rather that during the game unless you have a *lot* of things being loaded/unloading as the game runs.



  • How to copy VECTORs or D3D mater,text or MESHes