Multiple views of one object

View: New views
3 Messages — Rating Filter:   Alert me  

Multiple views of one object

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

Is it possible to multiply the view of an object in different locations of the canvas without creating a new instance of the object?  To be more specific: to have the same object appearing more times without creating a new instance.

Thanks in advance!
[Message sent by forum member 'adriana22' (adriana.buriuc@...)]

http://forums.java.net/jive/thread.jspa?messageID=371283

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Multiple views of one object

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To reuse the same object, use the SharedGroup class. Add your node to the SharedGroup and where you want to display an instance, you add a Link node which has a reference to your SharedGroup. You can also have your Link node inside a TransformGroup to do any transformations you need to your object instance.

For example, the code below adds to instances of the same SharedGroup.
BranchGroup objToShare = new BranchGroup();
SharedGroup sharedGroup = new SharedGroup();
sharedGroup.addChild(objToShare);

rootBG.addChild(new Link(sharedGroup));
rootBG.addChild(new Link(sharedGroup));

Be aware that using a SharedGroup adds a bit more complexity when it comes to Picking and getting the localToVworld transform, you will have to read up on that, but basically because some objects are being referenced more than once in the scene, java3d will only be able to identify which node you are referring to if it knows the complete scenegraphpath to the node, which it can obtain if you have using picking to select the object.
[Message sent by forum member 'chrismcband' (chrismcband@...)]

http://forums.java.net/jive/thread.jspa?messageID=371320

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Multiple views of one object

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you very much!
[Message sent by forum member 'adriana22' (adriana.buriuc@...)]

http://forums.java.net/jive/thread.jspa?messageID=371422

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...