de.jreality.shader
Class EffectiveAppearance
java.lang.Object
de.jreality.shader.EffectiveAppearance
public class EffectiveAppearance
- extends Object
The attributes of Appearance
s 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)
|
List |
getAppearanceHierarchy()
|
boolean |
getAttribute(String key,
boolean value)
|
char |
getAttribute(String key,
char value)
|
double |
getAttribute(String key,
double value)
|
float |
getAttribute(String key,
float value)
|
int |
getAttribute(String key,
int value)
|
long |
getAttribute(String key,
long value)
|
Object |
getAttribute(String key,
Object defaultValue)
|
Object |
getAttribute(String key,
Object defaultValue,
Class class1)
|
static boolean |
matches(EffectiveAppearance eap,
SceneGraphPath p)
|
String |
toString()
|
toString
public String toString()
- Overrides:
toString
in class Object
create
public static EffectiveAppearance create()
create
public static EffectiveAppearance create(SceneGraphPath p)
create
public EffectiveAppearance create(Appearance app)
getAttribute
public Object getAttribute(String key,
Object defaultValue)
getAttribute
public Object getAttribute(String key,
Object defaultValue,
Class class1)
getAttribute
public double getAttribute(String key,
double value)
getAttribute
public float getAttribute(String key,
float value)
getAttribute
public int getAttribute(String key,
int value)
getAttribute
public long getAttribute(String key,
long value)
getAttribute
public boolean getAttribute(String key,
boolean value)
getAttribute
public char getAttribute(String key,
char value)
matches
public static boolean matches(EffectiveAppearance eap,
SceneGraphPath p)
getAppearanceHierarchy
public List getAppearanceHierarchy()