How to reuse geometry in the scene graph

hello, I want to show the same triMesh in different places of the scene… I try creating three nodes, with different local translations, and attach the triMesh to each one. Then I add the nodes to the root node. Program runs but it only shows the triMesh one time. what would be wrong?



TriMesh t = … new TriMesh…

Node node1 = new Node("1");

node1.setLocalTranslation(vector1);

node1.attachChild(t);

rootNode.add(node1);



Node node2 = new Node("2");

node2.setLocalTranslation(vector2);

node2.attachChild(t);

rootNode.add(node2);

etc…

If you are using CVS there is a CloneCreator mechanism in place. This will do what you want. If you are not using CVS but the 0.7 jar, you’ll have to wait for 0.8.

But shouldn’t that method still render the same trimesh in different places, just not as fast as CloneCreator?

No, by adding the TriMesh to two parents, you are affecting the localTrans/rotation and everything of the same object. So, when the scenegraph is updated it’s set to the first parent, then reset to the second, then rendered. So you only see the results of the second.

I don´t use CVS, I am behind a corporative proxy :’(

it is not possible to make available for http download CVS snapshots? I had seen some sites where they put a build every day (lastnight build, I think they call it)

Well CollabNet (java.net) does not provide such tools, and setting up something locally would be difficult. However, someone could probably easily send you a jar if you are unable to obtain CVS access. Just let me know.

hey that would be great! I have a gmail accout: cesarpachon@gmail.com where you can send a copy of the jar… thanks by the help! :slight_smile: