Node cloning

Hi guys,

I have to use multiple instance of the same Node, so I've thinked about to clone. There's somenthing similar? or is better to continue loading the same 3ds from file for all the instances? Other ways are welcome…thanks  :wink:

Hola,…for that you can use the CloneImportExport-Class:



Node bullet = loadit3DSMODEL

CloneImportExport bulletClone = new CloneImportExport();

bulletClone.saveClone(bullet);



// now you can get clone like this:

BulletNode bN = (BulletNode) bulletClone.loadClone();

also take a look at geometry instancing

Thank you very much! I was looking for the most performant way, I'll try!.. :wink:



My question is…for the engine work with cloned models is lighter then work with the same model loaded many times?

The weight to render will be the same? Or there's some performance improvement?

Using CloneImportExport does technically the same as loading it again. It is just faster. I'm not so sure about the geomertry-instancing. (Is this using sharedmeshes?)

Well,…I would say you have to differ if you use static models you can also use SharedMeshes which will save RAM but will (as far as I know) not speed up the game as still the same amount of data have to be rendered. Have a look here:



http://www.jmonkeyengine.com/wiki/doku.php/sharedmesh