As far as I can tell you can not share Geometry derived classes like Line and Circle. Whenever you set them as the target of a SharedNode they get ignored. So how do you share these classes?
Thanks in advance.
You could try SharedNode and attach the line to that node
Tried SharedNode. I added the Circle to a Node then set that Node as the target for the SharedNode. SharedNode then makes a copy of the target Node but only copies across other child Nodes and Meshes. It leaves behind everything else.
SharedNode.processTarget(Node parent, Spatial target) recursively wraps the nodes and meshes, yet forgets the rest. Just wondering if this looks like an oversight or was by design.
to the first post, what you mean,as far as I know it should reference them not copy them ?
Take a look it copies any Nodes it finds recursively. The real problem is it ignores everything that isnt a TriMesh or Node. Doesn't look like what I need exists so I'll start writing a mechanism to share LinesCircles.
private void processTarget(Node parent, Spatial target) {
if(target instanceof Node) {
Node ntarget = (Node)target;
Node node = new Node();
UserDataManager.getInstance().bind(node, target);
copyNode(ntarget, node);
parent.attachChild(node);
if (ntarget.getChildren() != null)
for(int i = 0; i < ntarget.getChildren().size(); i++) {
processTarget(node, ntarget.getChild(i));
}
} else if(target instanceof TriMesh) {
if(target instanceof SharedMesh) {
SharedMesh copy = new SharedMesh((SharedMesh)target);
parent.attachChild(copy);
} else {
SharedMesh copy = new SharedMesh((TriMesh)target);
parent.attachChild(copy);
}
}
}
Ah I see what you mean, same problem as before :/, it does not help Sharing them then.
Have you thought about creating a own Line class that derives from Trimesh? Probably shoudn't be that hard to implement.