|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultSceneNode
public abstract class DefaultSceneNode
Default implementation of scene node. Doesn't implement hierarchy-related methods.
Field Summary | |
---|---|
protected int |
serial
Serial number used in intersection testing. |
Fields inherited from interface cz.cuni.jagrlib.SceneNode |
---|
ATTR_BSSRDF, ATTR_COLOR, ATTR_TEXTURE |
Constructor Summary | |
---|---|
DefaultSceneNode()
|
Method Summary | |
---|---|
int |
assertAttributes(MicroFacet mf,
java.lang.Object tmp,
int attributes)
Asserts validity of the given intersection-attributes. |
java.lang.Object |
getAttribute(java.lang.String key)
Returns the given attribute (defined in this SceneNode or inherited from
some parent node). |
java.util.List<java.lang.Object> |
getAttributes(java.lang.String key)
Returns the whole inherence-sequence for the given attribute. |
SceneNode |
getChild(int i)
Returns the given child node. |
TrMatrix |
getChildMatrix(int i)
Returns transformation matrix for the given child node. |
TrMatrix |
getChildMatrixInv(int i)
Returns inverse transformation matrix for the given child node. |
int |
getOrder()
Returns order of this SceneNode in its parent. |
SceneNode |
getParent()
Returns the parent of this node. |
int |
getSerial()
Sets serial number of the current test. |
int |
children()
Returns number of child nodes. |
int |
insertChild(SceneNode child,
TrMatrix m,
TrMatrix mInv)
Inserts a new child node. |
java.util.List<MicroFacet> |
intersection(double[] P0,
double[] P1)
Computes all intersections of the given ray with the sub-scene. |
boolean |
isObjectRoot()
Returns true if this node is root of object (component) hierarchy. |
int |
removeChild(int i)
Removes the given child node. |
boolean |
selfAttribute(java.lang.String key)
Is the given attribute defined in the node itself or is it inherited? |
java.lang.Object |
setAttribute(java.lang.String key,
java.lang.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 |
setSerial(int serial)
Returns serial number assigned to the node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int serial
Constructor Detail |
---|
public DefaultSceneNode()
Method Detail |
---|
public java.lang.Object getAttribute(java.lang.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
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(java.lang.String key)
selfAttribute
in interface SceneNode
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 java.lang.Object setAttribute(java.lang.String key, java.lang.Object value)
setAttribute
in interface SceneNode
key
- Key-string.value
- Attribute value (arbitrary type).
null
.getAttribute(java.lang.String)
,
selfAttribute(java.lang.String)
,
getAttributes(java.lang.String)
public java.util.List<java.lang.Object> getAttributes(java.lang.String key)
getAttributes
in interface SceneNode
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 int children()
children
in interface SceneNode
0
for this node).getChild(int)
,
getChildMatrix(int)
,
getChildMatrixInv(int)
public SceneNode getChild(int i)
getChild
in interface SceneNode
i
- Order of the requested node (from 0
to children()-1
).
null
.children()
,
getChildMatrix(int)
,
getChildMatrixInv(int)
public TrMatrix getChildMatrix(int i)
getChildMatrix
in interface SceneNode
i
- Order of the child node.
null
stands for identity.children()
,
getChild(int)
,
getChildMatrixInv(int)
public TrMatrix getChildMatrixInv(int i)
getChildMatrixInv
in interface SceneNode
i
- Order of the child node.
null
stands for identity.children()
,
getChild(int)
,
getChildMatrix(int)
public int insertChild(SceneNode child, TrMatrix m, TrMatrix mInv)
insertChild
in interface SceneNode
child
- The new child node.m
- Transformation matrix for the new child node (transformation from child's
coordinate system to this node's one). Can be null
, even
for non-trivial mInv
.mInv
- Inverse transformation matrix for the new child node (transformation from
this node's coordinate system to child's one). Can be null
, even
for non-trivial m
.
-1
in case of failure).removeChild(int)
,
children()
public int removeChild(int i)
removeChild
in interface SceneNode
i
- Order of the child node to be removed.
insertChild(cz.cuni.jagrlib.SceneNode, cz.cuni.jagrlib.TrMatrix, cz.cuni.jagrlib.TrMatrix)
,
children()
public SceneNode getParent()
getParent
in interface SceneNode
null
for scene-root.setParent(cz.cuni.jagrlib.SceneNode)
,
getOrder()
,
children()
,
getChild(int)
public void setParent(SceneNode par)
setParent
in interface SceneNode
par
- Parent node (or null
).getParent()
public int getOrder()
SceneNode
in its parent.
getOrder
in interface SceneNode
-1
for scene-root).setOrder(int)
,
getParent()
public void setOrder(int ord)
SceneNode
in its parent.
setOrder
in interface SceneNode
ord
- The new order.getOrder()
public boolean isObjectRoot()
true
if this node is root of object (component) hierarchy.
isObjectRoot
in interface SceneNode
setObjectRoot(boolean)
public void setObjectRoot(boolean root)
setObjectRoot
in interface SceneNode
root
- Should this node be treated as root?isObjectRoot()
public int getSerial()
getSerial
in interface SceneNode
public void setSerial(int serial)
setSerial
in interface SceneNode
public java.util.List<MicroFacet> intersection(double[] P0, double[] P1)
intersection
in interface SceneNode
P0
- Ray origin (double[3]
or double[4]
).P1
- Direction vector of the ray (double[3]
or double[4]
).
public int assertAttributes(MicroFacet mf, java.lang.Object tmp, int attributes)
assertAttributes
in interface IntersectionAttributes
mf
- The checked intersection.tmp
- Non-mandatory object holding state-information for deferred computations.attributes
- Attribute mask (required attributes - see
MicroFacet.VALID_*
).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |