Ronnachai Chinowutthichai wrote:
>
> hmm, I refer to "object" as runtime version of the "class" instance.
> Anyway more to the point, I would specialize Vehicule from
> either Group or TransformGroup.
I would have to disagree about extending it from TransformGroup purely
on the optomisation front.
The Group node is just a very lightweight collection for 3D objects.
When it comes to scenegraph rendering, it does not even enter the
equation. Compiling the class would eliminate the internal structure
altogether.
Using a transform group means that, at the minimum one extra matrix
calculation is required - on a non-optomised scenegraph. Now, most would
argue that, when putting the vehicle in the scene, its probably going to
have a transform group above it anyway. Well, it will, but it is a
matter of height. For example, I might want to leave the car at the
center (no transform) and locate objects relative to it and then move
the whole lot in one hit. The resulting structure would roughly be:
tx
+----------+------ .... +
tx tx (vehicle)
+-+-+ +--+--+
object obj obj obj
So the vehicle transform becomes superfluous.
Another suggestion from another email was to make the object a
BranchGroup. This is a bad practice too. BranchGroups form the root of a
scene graph. Every branchgroup that is inserted limits the amount of
optomisation that can be done on the scene graph (potentially slowing
down rendering speeds). If you think about how you would use one of
these objects, you are likely to put it into a scene anywhere, you may
not necessarily want to remove the object. By making it derive from
BranchGroup, you are limiting the possiblities the renderer has to build
a good scene. Besides, if you wanted to move the object around with a
transform, you would need to create another TransformGroup and
BranchGroup above the object anyway.
--
Justin Couch Author, Java Hacker
Snr Software Engineer [EMAIL PROTECTED]
ADI Ltd, Systems Group http://www.vlc.com.au/~justin/
Java3D FAQ: http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
-------------------------------------------------------------------
"Look through the lens, and the light breaks down into many lights.
Turn it or move it, and a new set of arrangements appears... is it
a single light or many lights, lights that one must know how to
distinguish, recognise and appreciate? Is it one light with many
frames or one frame for many lights?" -Subcomandante Marcos
-------------------------------------------------------------------
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/