Dave,

In there absence I'll have a go...

1. Yes, Java 3D does try to do this sort of optimization. You have probably
seen the RenderMolecule, RenderAtom classes reported in exceptions etc.
Operations to be sent to the native renderer are described using a
RenderMolecule (which has an associated Material, Texture etc.). The
RenderMolecules maintain references to the RenderMolecules to their left and
right. The RenderMolecule will check the properties of neighboring
RenderMolecules and only apply necessary state changes.

2. Yes. It checks for both reference equality (fast) and then checks for
"equals" type equality.

3. This might be useful to minimize memory usage. It is a little risky
however as you will be "sharing" these Material object references across all
objects. If you modify the Material you will potentially apply that
modification to all your objects. This might be exactly what you want, but
for flexibility you might want to build in some "clone on write" semantics
into your caching utility.

Sincerely,

Daniel Selman

[EMAIL PROTECTED]

Tornado Labs Ltd.
http://www.tornadolabs.com



-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of David
Sent: Saturday, March 17, 2001 5:36 PM
To: [EMAIL PROTECTED]
Subject: Optimization for shared appearances


This is a question for the Sun engineers.

1. If you have two shapes which have different appearences, but the same
material, do you sort and then only send the material once if possible?
2.  Do you sort materials, etc based on their values or the actual
instantiation of the Java object?  So if I have two materials which are
equivelent, but 2 different instantiations of materials do I still get the
optimization?
3. I was thinking of writing a caching system where after I build something
like a Material I would say Material m = checkMaterial(mm), whereupon it
would look in a cache of already instantiated materials and if it finds a
match it would return the original and discard the new one.  Do you see any
issues with this approach? I am planning on doing this for
renderingAttributes, transparencyAttributes, coloringAttributes,
polygonAttributes and materials.  I already cache textures.

Dave Yazel

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to