|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.grogra.imp3d.Visitor3D
de.grogra.imp3d.DisplayVisitor
de.grogra.imp3d.ray2.SceneVisitor
public class SceneVisitor
A SceneVisitor
is used to traverse a graph, collect
the geometry and lights of this graph and represent them as a
Scene
.
SceneVisitor(de.grogra.pf.ui.Workbench, de.grogra.graph.Graph, float, de.grogra.ray2.Options, de.grogra.imp3d.ViewConfig3D, boolean[], de.grogra.imp3d.ray2.VolumeListener, de.grogra.ray.physics.Spectrum)
Field Summary | |
---|---|
static int |
MIN_OBJ
|
Fields inherited from class de.grogra.imp3d.DisplayVisitor |
---|
lastEntered, lastEnteredIsNode |
Fields inherited from class de.grogra.imp3d.Visitor3D |
---|
layer, state, transformation |
Fields inherited from interface de.grogra.ray2.ProgressMonitor |
---|
DONE_PROGRESS, INDETERMINATE_PROGRESS |
Fields inherited from interface de.grogra.graph.Visitor |
---|
STOP |
Constructor Summary | |
---|---|
SceneVisitor(Workbench wb,
Graph graph,
float epsilon,
Options opts,
ViewConfig3D view,
boolean[] visibleLayers,
VolumeListener mapping,
Spectrum spectrumFactory)
Constructs a new SceneVisitor which traverses the given
graph to obtain the complete geometry and light
information and represent it as a Scene . |
Method Summary | |
---|---|
void |
appendStatistics(java.lang.StringBuffer stats)
Appends some statistics information about the scene to stats . |
boolean |
computeIntersections(Line ray,
int which,
IntersectionList list,
Intersection excludeStart,
Intersection excludeEnd)
Computes intersections between the boundary surface of the objects of the scene and the specified line . |
Spectrum |
createSpectrum()
This factory method creates a new spectrum which shall be used for light computations within the context of this scene. |
void |
dispose()
|
Scene |
dup()
Returns a clone of this Scene . |
BoundingBox |
getBoundingBox()
Returns a bounding box which contains all finite geometric objects of the scene. |
java.lang.Object |
getGraph()
Returns an object identifying the underlying scene graph. |
Interior |
getInterior(Volume v)
Returns the interior which is associated with volume v . |
Matrix4d |
getInverseLightTransformation(int light)
Returns the affine light transformation from global world coordinates to local light coordinates for the light having index light in
Scene.getLights() . |
Matrix4d |
getInverseSensorTransformation(int sensor)
Returns the affine sensor transformation from global world coordinates to local sensor coordinates for the sensor having index sensor in
Scene.getSensors() . |
int |
getLight(Volume v)
Returns the index in Scene.getLights() of the light which is
associated with volume v , or -1
if no such light exists. |
Light[] |
getLights()
Returns an array of all lights in the scene. |
Matrix4d |
getLightTransformation(int light)
Returns the affine light transformation from local light coordinates to global world coordinates for the light having index light in
Scene.getLights() . |
OctreeUnion |
getOctree()
|
int |
getSensor(Volume v)
Returns the index in Scene.getSensors() of the sensor which is
associated with volume v , or -1
if no such sensor exists. |
Sensor[] |
getSensors()
Returns an array of all sensors in the scene. |
Matrix4d |
getSensorTransformation(int sensor)
Returns the affine sensor transformation from local sensor coordinates to global world coordinates for the sensor having index sensor in
Scene.getSensors() . |
Shader |
getShader(Volume v)
Returns the shader which is associated with volume v . |
int |
getStamp()
Returns a modification stamp for the underlying scene graph. |
java.lang.String |
getUniqueName()
Returns a unique name for the current scene, so that the test whether two scenes are identical can be performed. |
protected boolean |
isInVisibleLayer(java.lang.Object o,
boolean asNode)
|
protected Shader |
resolveShader(Shader shader)
|
void |
setProgress(java.lang.String text,
float progress)
This method is invoked by the renderer to monitor its progress. |
void |
showMessage(java.lang.String message)
This method is invoked by the renderer to show a message, e.g., the statistics after rendering has completed. |
void |
transform(Volume v,
Tuple3d global,
Tuple3d localOut)
Transforms a point in global world coordinates to local object coordinates of the volume v . |
protected void |
visitEnterImpl(java.lang.Object object,
boolean asNode,
Path path)
This method has to be implemented by subclasses. |
protected void |
visitImpl(java.lang.Object object,
boolean asNode,
Shader s,
Path path)
|
java.lang.Object |
visitInstanceEnter()
Informs this visitor about the beginning of an instantiation. |
boolean |
visitInstanceLeave(java.lang.Object o)
Informs this visitor that an instantiation has been processed completely. |
protected void |
visitLeaveImpl(java.lang.Object object,
boolean asNode,
Path path)
This method has to be implemented by subclasses. |
Methods inherited from class de.grogra.imp3d.DisplayVisitor |
---|
getCurrentShader, init |
Methods inherited from class de.grogra.imp3d.Visitor3D |
---|
getCurrentTransformation, getGraphState, init, visitEnter, visitEnter, visitLeave |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int MIN_OBJ
Constructor Detail |
---|
public SceneVisitor(Workbench wb, Graph graph, float epsilon, Options opts, ViewConfig3D view, boolean[] visibleLayers, VolumeListener mapping, Spectrum spectrumFactory)
SceneVisitor
which traverses the given
graph
to obtain the complete geometry and light
information and represent it as a Scene
. Note that the traversal
is already part of the constructor, so no additional method invocation
is required to obtain the geometry.
wb
- the workbench to usegraph
- xepsilon
- only objects whose magnitude is larger than this value
are consideredopts
- options for the construction of geometryview
- if the scene is used to render a 3D view, this has to be
specified in this parameter.
Otherwise view
is null
, this is interpreted
such that a radiation model is to be computedvisibleLayers
- layers which are visible for the scene visitor, or
null
if view
shall be used to determine the
visibilitymapping
- if not null
, mappings from graph objects to
volumes are reported to this parameterspectrumFactory
- instance of spectrum to be used as factory
(i.e., new spectra are allocated using spectrumFactory.newInstance()
)Method Detail |
---|
public void appendStatistics(java.lang.StringBuffer stats)
Scene
stats
.
appendStatistics
in interface Scene
stats
- buffer for statistics informationpublic boolean computeIntersections(Line ray, int which, IntersectionList list, Intersection excludeStart, Intersection excludeEnd)
Scene
line
. For the precise
behaviour and the meaning of the parameters, see
Volume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
.
computeIntersections
in interface Scene
ray
- a linewhich
- one of Intersection.ALL
,
Intersection.CLOSEST
, Intersection.ANY
, this
determines which intersections have to be added to list
list
- the intersections are added to this listexcludeStart
- intersection at start point which shall be excluded, or null
excludeEnd
- intersection at end point which shall be excluded, or null
true
iff the beginning of the line lies
within the volume (i.e., if the line starts within the volume or
enters the volume at the starting point); however note that the returned
value is valid only if which == Intersection.ALL
Volume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
public Spectrum createSpectrum()
Scene
createSpectrum
in interface Scene
public void dispose()
dispose
in interface Disposable
public Scene dup()
Scene
Scene
.
All constant variables which are related to the structure
of the scene are copied shallowly, state variables
are newly created without copying.
dup
in interface Scene
public BoundingBox getBoundingBox()
Scene
getBoundingBox
in interface Scene
public java.lang.Object getGraph()
Scene
getGraph
in interface Scene
public Interior getInterior(Volume v)
Scene
v
.
getInterior
in interface Scene
v
- a volume
public Matrix4d getInverseLightTransformation(int light)
Scene
light
in
Scene.getLights()
.
getInverseLightTransformation
in interface Scene
light
- index of light in Scene.getLights()
light
Scene.getLights()
public Matrix4d getInverseSensorTransformation(int sensor)
Scene
sensor
in
Scene.getSensors()
.
getInverseSensorTransformation
in interface Scene
sensor
- index of sensor in Scene.getSensors()
sensor
Scene.getSensors()
public int getLight(Volume v)
Scene
Scene.getLights()
of the light which is
associated with volume v
, or -1
if no such light exists.
getLight
in interface Scene
v
- a volume
Scene.getLights()
public Light[] getLights()
Scene
Scene.getLightTransformation(int)
.
getLights
in interface Scene
public Matrix4d getLightTransformation(int light)
Scene
light
in
Scene.getLights()
.
getLightTransformation
in interface Scene
light
- index of light in Scene.getLights()
light
Scene.getLights()
public OctreeUnion getOctree()
getOctree
in interface Scene
public int getSensor(Volume v)
Scene
Scene.getSensors()
of the sensor which is
associated with volume v
, or -1
if no such sensor exists.
getSensor
in interface Scene
v
- a volume
Scene.getSensors()
public Sensor[] getSensors()
Scene
Scene.getSensorTransformation(int)
.
getSensors
in interface Scene
public Matrix4d getSensorTransformation(int sensor)
Scene
sensor
in
Scene.getSensors()
.
getSensorTransformation
in interface Scene
sensor
- index of sensor in Scene.getSensors()
sensor
Scene.getSensors()
public Shader getShader(Volume v)
Scene
v
.
getShader
in interface Scene
v
- a volume
public int getStamp()
Scene
getStamp
in interface Scene
public java.lang.String getUniqueName()
Scene
getUniqueName
in interface Scene
protected boolean isInVisibleLayer(java.lang.Object o, boolean asNode)
isInVisibleLayer
in class DisplayVisitor
protected Shader resolveShader(Shader shader)
resolveShader
in class DisplayVisitor
public void setProgress(java.lang.String text, float progress)
ProgressMonitor
setProgress
in interface ProgressMonitor
text
- short text to displayprogress
- state of progress from 0 to 1, or one of the
constants ProgressMonitor.INDETERMINATE_PROGRESS
, ProgressMonitor.DONE_PROGRESS
public void showMessage(java.lang.String message)
ProgressMonitor
showMessage
in interface ProgressMonitor
message
- message to displaypublic void transform(Volume v, Tuple3d global, Tuple3d localOut)
Scene
v
.
transform
in interface Scene
v
- volume which defines the local object coordinatesglobal
- input point in global world coordinateslocalOut
- output point in local object coordinatesprotected void visitEnterImpl(java.lang.Object object, boolean asNode, Path path)
Visitor3D
object
is entered.
visitEnterImpl
in class DisplayVisitor
object
- the object being enteredasNode
- is object
a node or an edge?path
- the path to object
if object
is a node, the path to the node where object
points to
if object
is an edgeprotected void visitImpl(java.lang.Object object, boolean asNode, Shader s, Path path)
visitImpl
in class DisplayVisitor
public java.lang.Object visitInstanceEnter()
Visitor
visitEnter
/visitLeave
of a node. Later on,
Visitor.visitInstanceLeave(Object)
will be invoked with
the returned value of this invocation as argument. If this method returns
Visitor.STOP
, the visitInstanceLeave
-method
will be invoked immediately after this method, i.e., the visitor
does not dive into the instantiation. Otherwise, the instantiation
is performed, starting with an edge.
visitInstanceEnter
in interface Visitor
visitInstanceEnter
in class Visitor3D
visitInstanceLeave
, may be Visitor.STOP
public boolean visitInstanceLeave(java.lang.Object o)
Visitor
o
is the return value
of the corresponding invocation of Visitor.visitInstanceEnter()
.
If this invocation returns false
, no further
instantiations or edges of the current level of hierarchy will
be passed to this
visitor, i.e., the visitLeave
method for the enclosing
node will be invoked immediately.
visitInstanceLeave
in interface Visitor
visitInstanceLeave
in class Visitor3D
o
- returned value of visitInstanceEnter
true
iff processing of current level shall be continuedprotected void visitLeaveImpl(java.lang.Object object, boolean asNode, Path path)
Visitor3D
object
is left.
visitLeaveImpl
in class DisplayVisitor
object
- the object being leftasNode
- is object
a node or an edge?path
- the path to object
if object
is a node, the path to the node where object
points to
if object
is an edge
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |