|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.Exhibit vmm.core3D.Exhibit3D
public abstract class Exhibit3D
An exhibit that can be rendered in 3D can be defined as a subclass of this class. It is not an absolute requirement that a 3D exhibit be a subclass of this class, since an Exhibit is always in charge of rendering itself. However, this class does provide some convenient default behavior for 3D exhibits. Remember that it is possible for a single exhibit to have both 2D and 3D views.
Field Summary | |
---|---|
protected Vector3D |
defaultViewpoint
The value of this variable is returned by the getDefaultViewpoint() method. |
protected Vector3D |
defaultViewUp
The value of this variable is returned by the getDefaultViewUp() method. |
protected Transform3D |
previousTransform3D
When the computeDrawDataHook(View, Transform) method is called with a 3D View and Transform, the
Transform3D that is being used is recorded here so that it can be compared with the Transform3D that is
used the next time the method is called. |
Fields inherited from class vmm.core.Exhibit |
---|
decorations, exhibitNeedsRedraw, isMorphing, morphingView, parameters, previousTransform |
Constructor Summary | |
---|---|
Exhibit3D()
|
Method Summary | |
---|---|
protected void |
computeDrawData3D(View3D view,
boolean exhibitNeedsRedraw,
Transform3D previousTransform3D,
Transform3D newTransform3D)
Recopmputes cached data, if necessary, for a 3D rendering of this exhibit. |
protected void |
computeDrawDataHook(View view,
Transform transform)
Called by Exhibit.render(Graphics2D, View, Transform, ArrayList) to give the exhibit a chance
to compute its cached data, if necessary. |
protected void |
doDraw3D(java.awt.Graphics2D g,
View3D view,
Transform3D transform)
Draws this Exhibit in a 3D view. |
protected void |
doDrawHook(java.awt.Graphics2D g,
View view,
Transform transform)
Called by Exhibit.doDraw(Graphics2D, View, Transform) when the exhibit needs to
redraw itself. |
Transform |
getDefaultTransform(View view)
Returns the default transform for use in the specified View. |
View |
getDefaultView()
Returns the default View of this Exhibit. |
Vector3D |
getDefaultViewpoint()
Returns the default viewpoint for viewing this Exhibit in 3D. |
Vector3D |
getDefaultViewUp()
Returns the default view up for viewing this Exhibit in 3D. |
void |
setDefaultViewpoint(Vector3D defaultViewpoint)
Set the default viewpoint for viewing this exhibit in 3D. |
void |
setDefaultViewUp(Vector3D defaultViewUp)
Set the default view up vector for viewing this exhibit in 3D. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Transform3D previousTransform3D
computeDrawDataHook(View, Transform)
method is called with a 3D View and Transform, the
Transform3D that is being used is recorded here so that it can be compared with the Transform3D that is
used the next time the method is called. This is only for use in rare circumstances when am Exhibit has
cached data that depends on the transform.
protected Vector3D defaultViewpoint
getDefaultViewpoint()
method. When the Exhibit
is installed in a View3D, this vector is used as the initial viewpoint for viewing the exhibit.
protected Vector3D defaultViewUp
getDefaultViewUp()
method. When the Exhibit
is installed in a View3D, this vector is used as the initial view up vector. A null value indicates
that the default should be used.
Constructor Detail |
---|
public Exhibit3D()
Method Detail |
---|
public Transform getDefaultTransform(View view)
View3D
class, then a Transform3D
object is returned; this object is constructed from the
exhibit's default viewpoint and default window. If the view is not a View3D, then a 2D Transform
is
returned that is constructed using the exhibit's default window only.
getDefaultTransform
in class Exhibit
view
- The View is provided as a parameter since there might be several
types of View appropriate for a given exhibit, and they might require
different Transforms. In particular, for example, a 3D View will require a 3D Transform.
getDefaultWindow
.setDefaultViewpoint(Vector3D)
,
Exhibit.setDefaultWindow(double, double, double, double)
public View getDefaultView()
View3D
.
getDefaultView
in class Exhibit
public Vector3D getDefaultViewpoint()
setDefaultViewpoint(Vector3D)
public void setDefaultViewpoint(Vector3D defaultViewpoint)
getDefaultTransform(View)
.
Subclasses of Exhibit3D can call this method -- probably in a construtor -- to set a resonable viewpoint
for the particular exhibit. If the default viewpoint is set to null, then the default
of the Transform3D
class is used; this default is the point (20,0,0).
defaultViewpoint
- the default viewpoint for this Exhibit3D, or null to indicate that the
default viewpoint in Transform3D is to be used.public Vector3D getDefaultViewUp()
setDefaultViewUp(Vector3D)
public void setDefaultViewUp(Vector3D defaultViewUp)
defaultViewUp
- the default view up vector for this Exhibit3D, or null to indicate that the
default view up should be accepted.protected void computeDrawDataHook(View view, Transform transform)
Exhibit.render(Graphics2D, View, Transform, ArrayList)
to give the exhibit a chance
to compute its cached data, if necessary. This method is not meant to be called directly. It exists
only to make it possible to write a unified render
method that will work for both the
basic Exhibit class and for its subclasses. The method in this Exhibit3D class simply calls either
Exhibit.computeDrawData(View, boolean, Transform, Transform)
or
computeDrawData3D(View3D, boolean, Transform3D, Transform3D)
, depending on
whether the View is a 2D or 3D View.
Subclasses should almost always override computeDrawData
and/or
computeDrawData3D
instead of overriding this method.
computeDrawDataHook
in class Exhibit
protected void doDrawHook(java.awt.Graphics2D g, View view, Transform transform)
Exhibit.doDraw(Graphics2D, View, Transform)
when the exhibit needs to
redraw itself. This method is not meant to be called directly. It exists
only to make it possible to write a unified doDraw
method that will work for both the
basic Exhibit class and for its subclasses. The method in this Exhibit3D class simply calls either
Exhibit.doDraw(Graphics2D, View, Transform)
or
doDraw3D(Graphics2D, View3D, Transform3D)
, depending on
whether the View is a 2D or 3D View.
Subclasses should almost always override doDraw
and/or
doDraw3D
instead of overriding this method.
doDrawHook
in class Exhibit
protected void computeDrawData3D(View3D view, boolean exhibitNeedsRedraw, Transform3D previousTransform3D, Transform3D newTransform3D)
Exhibit.computeDrawData(View, boolean, Transform, Transform)
to say what should be drawn in a 2D view.
view
- the 3D View where the Exhibit is about to be drawn.exhibitNeedsRedraw
- if true, then something about the Exhibit has changed that probably requires
recomputation of cached data. For example, this is set to true when one of the Parameters of the Exhibit
has changed since the previous redraw.previousTransform3D
- the Transform3D that was used the last time this exhibit was drawn. This can be null, if
this is the first time that the Exhibit is being drawn (in 3D).newTransform3D
- the transform that will be used to draw the Exhibit during the current drawing operation.
This parameter and the previousTransform3D parameter are provided so that the Exhbit can detect those rare
cases where cached data exists that depends on the transform. Most Exhibits will just ignore the
transform parameters.protected void doDraw3D(java.awt.Graphics2D g, View3D view, Transform3D transform)
computeDrawData3D(View3D, boolean, Transform3D, Transform3D)
has already been called, so that any cached data should be correct.
Note that this method is called only if the Exhibit is being drawn in a View3D. Exhibits that have
both two and three dimensional renderings should also override Exhibit.doDraw(Graphics2D, View, Transform)
.
When drawing a 3D exhibit, you are strongly advised to use the drawing routines supplied by the
View3D
and View3DLit
classes. These routines will automatically produce the correct results
in stereo views -- the same is not true about direct drawing to the graphics context.
g
- the graphics context where the exhibit is being drawn.view
- The View3D in which the exhibit is being drawn. In general, it is advisable to use the view for
all drawing operations.transform
- The transform that is being used to draw the exhibit.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |