|
||||||||
| 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)
Scenestats.
appendStatistics in interface Scenestats - buffer for statistics information
public boolean computeIntersections(Line ray,
int which,
IntersectionList list,
Intersection excludeStart,
Intersection excludeEnd)
Sceneline. 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 Sceneray - a linewhich - one of Intersection.ALL,
Intersection.CLOSEST, Intersection.ANY, this
determines which intersections have to be added to listlist - the intersections are added to this listexcludeStart - intersection at start point which shall be excluded, or nullexcludeEnd - 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.ALLVolume.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 Scenepublic void dispose()
dispose in interface Disposablepublic Scene dup()
SceneScene.
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 Scenepublic BoundingBox getBoundingBox()
Scene
getBoundingBox in interface Scenepublic java.lang.Object getGraph()
Scene
getGraph in interface Scenepublic Interior getInterior(Volume v)
Scenev.
getInterior in interface Scenev - a volume
public Matrix4d getInverseLightTransformation(int light)
Scenelight in
Scene.getLights().
getInverseLightTransformation in interface Scenelight - index of light in Scene.getLights()
lightScene.getLights()public Matrix4d getInverseSensorTransformation(int sensor)
Scenesensor in
Scene.getSensors().
getInverseSensorTransformation in interface Scenesensor - index of sensor in Scene.getSensors()
sensorScene.getSensors()public int getLight(Volume v)
SceneScene.getLights() of the light which is
associated with volume v, or -1
if no such light exists.
getLight in interface Scenev - a volume
Scene.getLights()public Light[] getLights()
SceneScene.getLightTransformation(int).
getLights in interface Scenepublic Matrix4d getLightTransformation(int light)
Scenelight in
Scene.getLights().
getLightTransformation in interface Scenelight - index of light in Scene.getLights()
lightScene.getLights()public OctreeUnion getOctree()
getOctree in interface Scenepublic int getSensor(Volume v)
SceneScene.getSensors() of the sensor which is
associated with volume v, or -1
if no such sensor exists.
getSensor in interface Scenev - a volume
Scene.getSensors()public Sensor[] getSensors()
SceneScene.getSensorTransformation(int).
getSensors in interface Scenepublic Matrix4d getSensorTransformation(int sensor)
Scenesensor in
Scene.getSensors().
getSensorTransformation in interface Scenesensor - index of sensor in Scene.getSensors()
sensorScene.getSensors()public Shader getShader(Volume v)
Scenev.
getShader in interface Scenev - a volume
public int getStamp()
Scene
getStamp in interface Scenepublic java.lang.String getUniqueName()
Scene
getUniqueName in interface Scene
protected boolean isInVisibleLayer(java.lang.Object o,
boolean asNode)
isInVisibleLayer in class DisplayVisitorprotected Shader resolveShader(Shader shader)
resolveShader in class DisplayVisitor
public void setProgress(java.lang.String text,
float progress)
ProgressMonitor
setProgress in interface ProgressMonitortext - short text to displayprogress - state of progress from 0 to 1, or one of the
constants ProgressMonitor.INDETERMINATE_PROGRESS, ProgressMonitor.DONE_PROGRESSpublic void showMessage(java.lang.String message)
ProgressMonitor
showMessage in interface ProgressMonitormessage - message to display
public void transform(Volume v,
Tuple3d global,
Tuple3d localOut)
Scenev.
transform in interface Scenev - volume which defines the local object coordinatesglobal - input point in global world coordinateslocalOut - output point in local object coordinates
protected void visitEnterImpl(java.lang.Object object,
boolean asNode,
Path path)
Visitor3Dobject is entered.
visitEnterImpl in class DisplayVisitorobject - 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 edge
protected void visitImpl(java.lang.Object object,
boolean asNode,
Shader s,
Path path)
visitImpl in class DisplayVisitorpublic java.lang.Object visitInstanceEnter()
VisitorvisitEnter/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 VisitorvisitInstanceEnter in class Visitor3DvisitInstanceLeave, may be Visitor.STOPpublic boolean visitInstanceLeave(java.lang.Object o)
Visitoro 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 VisitorvisitInstanceLeave in class Visitor3Do - returned value of visitInstanceEnter
true iff processing of current level shall be continued
protected void visitLeaveImpl(java.lang.Object object,
boolean asNode,
Path path)
Visitor3Dobject is left.
visitLeaveImpl in class DisplayVisitorobject - 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 | |||||||