Jmonkey Node and Memory consomption

Hello, I was wondering. Does the Node keep track of all the Vertices data of every model or does it keep a reference of the model?

//Exemple, 
Node rootNode = new Node("RootNode");

//as (8 vertices) (Let's say it was a loaded cube)
Spatial object1= assetmanager.loadAsset("something...");
//does it make 8 new vertices? or does it do a direct reference the first object? 
Spatial object2= object1.clone(); 

rootNode.attachChild(object1); 
rootNode.attachChild(object2);

Ok, so does it make more memory in the System memory? (By system i mean the ddr3-ddr4 memory and not the graphics gddr5 memory)
Or does it allocate only a reference pointer and a boolean or something to say “Hey I m a clone!” and does some copy pasting all over the place with the referenced model?

cause if it s the first point then it would explain why my game waste so much memory. And wouldn’t it be easy to make the second implementation? Or is it already there and I’m just bad and didn’t know about it?

Node only reference Geometry objects. Geometry objects hold a reference to a Mesh object. The mesh objects holds vertex data, that can also be shared IIRC.

How this is turned into video memory and vertex bufferes etc. is something i have not looked at.

I wasn’t asking about the video memory anyway, but are you sure, since cloning could clone all the memory data

I am not a dev. But yes i am sure. There is even a flag for duplicating material data. But default mesh and material data is not duplicated. This is easily verified by checking the mesh instances or the source.

I even do poor man instancing by using the same mesh data 100s of times in my scenes.

Mesh data is only duplicated for animated models (and only the buffers that need to be duplicated).

…else everything in a clone is shared unless you call deepClone().

2 Likes

Alright thank you i wanted to be sure.