de.jreality.shader
Class EffectiveAppearance

java.lang.Object
  extended by de.jreality.shader.EffectiveAppearance

public class EffectiveAppearance
extends java.lang.Object

The attributes of Appearances arer designed to be inherited via the scene graph tree structure. This class manages this inheritance mechanism.

To evaluate the actual state of the Appearance system at a point in a scene graph specified by a SceneGraphPath, one must essentially create a chain of EffectiveAppearance's, one for each Appearance instance occurring on this path. Requests for the value of a given key (getAttribute(String, Object) and related methods) cause a search "up" the tree towards the root, for an appearance which containing this key.

If such an appearance is found, then the value is returned. If it is not found, the the special value Appearance.INHERITED is returned.

TODO: The details of this inheritance mechanism are quite complicated and need to be further documented here. In particular, the '.' character plays a special role in the key strings, allowing for example the key "foo" to match a request for the string "bar.foo".


Method Summary
static EffectiveAppearance create()
           
 EffectiveAppearance create(Appearance app)
           
static EffectiveAppearance create(SceneGraphPath p)
           
 Appearance getApp()
           
 java.util.List getAppearanceHierarchy()
           
 boolean getAttribute(java.lang.String key, boolean value)
           
 char getAttribute(java.lang.String key, char value)
           
 double getAttribute(java.lang.String key, double value)
           
 float getAttribute(java.lang.String key, float value)
           
 int getAttribute(java.lang.String key, int value)
           
 long getAttribute(java.lang.String key, long value)
           
 java.lang.Object getAttribute(java.lang.String key, java.lang.Object defaultValue)
           
 java.lang.Object getAttribute(java.lang.String key, java.lang.Object defaultValue, java.lang.Class class1)
           
static boolean matches(EffectiveAppearance eap, SceneGraphPath p)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getApp

public Appearance getApp()

create

public static EffectiveAppearance create()

create

public static EffectiveAppearance create(SceneGraphPath p)

create

public EffectiveAppearance create(Appearance app)

getAttribute

public java.lang.Object getAttribute(java.lang.String key,
                                     java.lang.Object defaultValue)

getAttribute

public java.lang.Object getAttribute(java.lang.String key,
                                     java.lang.Object defaultValue,
                                     java.lang.Class class1)

getAttribute

public double getAttribute(java.lang.String key,
                           double value)

getAttribute

public float getAttribute(java.lang.String key,
                          float value)

getAttribute

public int getAttribute(java.lang.String key,
                        int value)

getAttribute

public long getAttribute(java.lang.String key,
                         long value)

getAttribute

public boolean getAttribute(java.lang.String key,
                            boolean value)

getAttribute

public char getAttribute(java.lang.String key,
                         char value)

matches

public static boolean matches(EffectiveAppearance eap,
                              SceneGraphPath p)

getAppearanceHierarchy

public java.util.List getAppearanceHierarchy()