|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultSceneNode
cz.cuni.jagrlib.CSGCommonNode
public abstract class CSGCommonNode
Common code for CSG nodes. Contains support for scene hierarchy and attribute machinery.
Field Summary | |
---|---|
protected Map<String,Object> |
attr
Attribute dictionary (hashing table of [key,value] pairs). |
protected int |
order
Order in the parent node. |
protected SceneNode |
parent
Handle of node's parent (or null for root-node). |
protected boolean |
root
Root-property. |
Fields inherited from class cz.cuni.jagrlib.DefaultSceneNode |
---|
serial |
Fields inherited from interface cz.cuni.jagrlib.SceneNode |
---|
ATTR_COLOR, ATTR_LIGHT_MODEL, ATTR_MATERIAL, ATTR_TEXTURE |
Constructor Summary | |
---|---|
protected |
CSGCommonNode()
Default initializing constructor. |
Method Summary | |
---|---|
int |
assertAttributes(MicroFacet mf,
Object tmp,
int attributes)
Asserts validity of the given intersection-attributes. |
Object |
getAttribute(String key)
Returns the given attribute (defined in this SceneNode or inherited from
some parent node). |
List<Object> |
getAttributes(String key)
Returns the whole inherence-sequence for the given attribute. |
int |
getOrder()
Returns order of this SceneNode in its parent. |
SceneNode |
getParent()
Returns the parent of this node. |
double |
getTime()
Returns the actual time value for the scene (used in animations). |
double[] |
getTimeInterval(double[] pre)
Retrieve the valid bounds for time variable. |
boolean |
isObjectRoot()
Returns true if this node is root of object (component) hierarchy. |
boolean |
selfAttribute(String key)
Is the given attribute defined in the node itself or is it inherited? |
Object |
setAttribute(String key,
Object value)
Defines the given attribute (key-value pair) in the node. |
void |
setObjectRoot(boolean root)
Sets this node as root for the object (component). |
void |
setOrder(int ord)
Sets order of this SceneNode in its parent. |
void |
setParent(SceneNode par)
Sets handle to the parent node. |
void |
setTime(double time)
Sets the actual time value for the scene (used in animations). |
Methods inherited from class cz.cuni.jagrlib.DefaultSceneNode |
---|
getChild, getChildMatrix, getChildMatrixInv, getSerial, children, insertChild, intersection, removeChild, setSerial |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<String,Object> attr
protected SceneNode parent
null
for root-node).
protected int order
protected boolean root
Constructor Detail |
---|
protected CSGCommonNode()
Method Detail |
---|
public Object getAttribute(String key)
SceneNode
or inherited from
some parent node).
Returned object can be an original data object and must not be altered
outside this SceneNode
instance.
getAttribute
in interface SceneNode
getAttribute
in class DefaultSceneNode
key
- Key-string.
null
. Must not be altered!getAttributes(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
selfAttribute(java.lang.String)
public boolean selfAttribute(String key)
selfAttribute
in interface SceneNode
selfAttribute
in class DefaultSceneNode
key
- Key-string.
true
if the node defines the given attribute.getAttribute(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
getAttributes(java.lang.String)
public Object setAttribute(String key, Object value)
setAttribute
in interface SceneNode
setAttribute
in class DefaultSceneNode
key
- Key-string.value
- Attribute value (arbitrary type).
null
.getAttribute(java.lang.String)
,
selfAttribute(java.lang.String)
,
getAttributes(java.lang.String)
public List<Object> getAttributes(String key)
getAttributes
in interface SceneNode
getAttributes
in class DefaultSceneNode
key
- Key-string.
result[0]
.. definition in the node itself,
result[1]
.. definition in parent node,
result[2]
.. definition in "grand-parent" node, etc.getAttribute(java.lang.String)
,
setAttribute(java.lang.String, java.lang.Object)
,
selfAttribute(java.lang.String)
public SceneNode getParent()
getParent
in interface SceneNode
getParent
in class DefaultSceneNode
null
for scene-root.setParent(cz.cuni.jagrlib.SceneNode)
,
getOrder()
,
DefaultSceneNode.children()
,
DefaultSceneNode.getChild(int)
public void setParent(SceneNode par)
setParent
in interface SceneNode
setParent
in class DefaultSceneNode
par
- Parent node (or null
).getParent()
public int getOrder()
SceneNode
in its parent.
getOrder
in interface SceneNode
getOrder
in class DefaultSceneNode
-1
for scene-root).setOrder(int)
,
getParent()
public void setOrder(int ord)
SceneNode
in its parent.
setOrder
in interface SceneNode
setOrder
in class DefaultSceneNode
ord
- The new order.getOrder()
public boolean isObjectRoot()
true
if this node is root of object (component) hierarchy.
isObjectRoot
in interface SceneNode
isObjectRoot
in class DefaultSceneNode
setObjectRoot(boolean)
public void setObjectRoot(boolean root)
setObjectRoot
in interface SceneNode
setObjectRoot
in class DefaultSceneNode
root
- Should this node be treated as root?isObjectRoot()
public int assertAttributes(MicroFacet mf, Object tmp, int attributes)
VALID_TO_WORLD
,
VALID_TO_OBJECT
,
VALID_TEXTURES
,
VALID_BRDF
,
VALID_MATERIAL
,
VALID_COLOR
.
assertAttributes
in interface IntersectionAttributes
assertAttributes
in class DefaultSceneNode
mf
- The checked intersection.tmp
- Non-mandatory object holding state-information for deferred computations.attributes
- Attribute mask (required attributes - see
MicroFacet.VALID_*
).
public double[] getTimeInterval(double[] pre)
getTimeInterval
in interface TimeDependent
pre
- Pre-allocated double[2]
array to hold the result (can be
null
).
result[0]
.. minimum time value, result[1]
.. maximum
time value.getTime()
,
setTime(double)
public double getTime()
getTime
in interface TimeDependent
setTime(double)
public void setTime(double time)
setTime
in interface TimeDependent
time
- New scene time (in seconds).getTime()
,
getTimeInterval(double[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |