public class View extends Object
View
holds a Scene
, a LightSet
, an ICanvas
to render into. It is the responsability to layout a set of concrete
AbstractViewportManager
s such as the rendering the
scene or an AWTImageViewport
for displaying an image in the same
window. On can control the Camera
with a and get notifyed by a IViewPointChangedListener
that the view point has changed. The control is relative to the center of the
Scene
and is defined using polar coordinates.
The View
supports post rendering through the addition of
Renderer2d
s whose implementation can define Java2d calls to render on
top on OpenGL2.
Last, the View
offers the ability to get an AxeBox
for
embedding the Scene
and getting values along axes.Modifier and Type | Field and Description |
---|---|
protected Scene |
annotations |
protected IAxe |
axe |
protected boolean |
axeBoxDisplayed |
protected Color |
bgColor |
protected ViewBoundMode |
boundmode |
protected Camera |
cam |
protected CameraMode |
cameraMode |
protected ICanvas |
canvas |
protected Coord3d |
center |
protected Chart |
chart
A view may optionnaly know its parent chart.
|
protected static View |
current |
static Coord3d |
DEFAULT_VIEW |
protected boolean |
dimensionDirty |
protected boolean |
DISPLAY_AXE_WHOLE_BOUNDS
display a magenta parallelepiped (debug).
|
protected float |
factorViewPointDistance
Applies a factor to the default camera distance which is set to the
radius of the scene bounds.
|
protected com.jogamp.opengl.glu.GLU |
glu |
protected BoundingBox3d |
initBounds |
protected static org.apache.log4j.Logger |
LOGGER |
protected boolean |
MAINTAIN_ALL_OBJECTS_IN_VIEW
force to have all object maintained in screen, meaning axebox won't
always keep the same size.
|
protected static float |
PI_div2 |
protected Quality |
quality |
protected Coord3d |
scaling |
protected Scene |
scene |
protected boolean |
slave
A slave view won't clear its color and depth buffer before rendering
|
protected SpaceTransformer |
spaceTransformer |
protected boolean |
squared |
static float |
STRETCH_RATIO |
protected BoundingBox3d |
viewbounds |
protected boolean |
viewDirty
can be set to true by the Renderer3d so that the View knows it is
rendering due to a canvas size change
|
protected List<IViewLifecycleEventListener> |
viewLifecycleListeners |
protected ViewPositionMode |
viewmode |
protected List<IViewIsVerticalEventListener> |
viewOnTopListeners |
protected Coord3d |
viewpoint |
protected List<IViewPointChangedListener> |
viewPointChangedListeners |
protected boolean |
wasOnTopAtLastRendering |
Constructor and Description |
---|
View(IChartComponentFactory factory,
Scene scene,
ICanvas canvas,
Quality quality)
Create a view attached to a Scene, with its own Camera and Axe.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addViewLifecycleChangedListener(IViewLifecycleEventListener listener) |
boolean |
addViewOnTopEventListener(IViewIsVerticalEventListener listener) |
boolean |
addViewPointChangedListener(IViewPointChangedListener listener) |
void |
clear(com.jogamp.opengl.GL gl)
Clear the color and depth buffer.
|
void |
clearColorAndDepth(com.jogamp.opengl.GL gl) |
protected Coord3d |
computeCameraEye(Coord3d target) |
protected Coord3d |
computeCameraEye(Coord3d target,
ViewPositionMode viewmode,
Coord3d viewpoint) |
protected Coord3d |
computeCameraEyeFree(Coord3d viewpoint,
Coord3d target) |
protected Coord3d |
computeCameraEyeProfile(Coord3d viewpoint,
Coord3d target) |
protected Coord3d |
computeCameraEyeTop(Coord3d viewpoint,
Coord3d target) |
protected void |
computeCameraRenderingSphereRadius(Camera cam,
com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport,
BoundingBox3d bounds) |
protected Coord3d |
computeCameraTarget() |
protected Coord3d |
computeCameraTarget(Coord3d center,
Coord3d scaling) |
protected Coord3d |
computeCameraUp() |
protected Coord3d |
computeCameraUpAndTriggerEvents() |
protected Coord3d |
computeCameraUpAndTriggerEvents(Coord3d viewpoint) |
BoundingBox3d |
computeScaledViewBounds() |
Coord3d |
computeSceneScaling() |
Coord3d |
computeSceneScaling(Scene scene,
boolean squared,
ViewBoundMode boundmode,
BoundingBox3d viewbounds,
SpaceTransformer spaceTransformer) |
protected void |
correctCameraPositionForIncludingTextLabels(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport) |
static View |
current() |
void |
dispose() |
protected void |
fireViewLifecycleHasInit(ViewLifecycleEvent e) |
protected void |
fireViewLifecycleWillRender(ViewLifecycleEvent e) |
protected void |
fireViewOnTopEvent(boolean isOnTop) |
protected void |
fireViewPointChangedEvent(ViewPointChangedEvent e) |
Graph |
getAnnotations() |
IAxe |
getAxe() |
Color |
getBackgroundColor() |
BoundingBox3d |
getBounds()
Get the
AxeBox 's BoundingBox3d |
ViewBoundMode |
getBoundsMode() |
Camera |
getCamera() |
CameraMode |
getCameraMode()
Get the projection of this view, either CameraMode.ORTHOGONAL or
CameraMode.PERSPECTIVE.
|
ICanvas |
getCanvas() |
protected com.jogamp.opengl.GLAutoDrawable |
getCanvasAsGLAutoDrawable() |
Coord3d |
getCenter()
Return the central point of the view scene, that is the last bounding box
center set by
lookToBox(BoundingBox3d box) |
Chart |
getChart() |
com.jogamp.opengl.GLContext |
getCurrentContext() |
com.jogamp.opengl.GL |
getCurrentGL() |
BoundingBox3d |
getInitBounds() |
Coord3d |
getLastViewScaling()
Return the last used view scaling that was set according to the
setSquared(boolean v) status. |
Scale |
getScale() |
Scene |
getScene() |
protected BoundingBox3d |
getSceneGraphBounds() |
protected BoundingBox3d |
getSceneGraphBounds(Scene scene) |
Rectangle |
getSceneViewportRectangle() |
SpaceTransformer |
getSpaceTransformer() |
boolean |
getSquared() |
ViewPositionMode |
getViewMode()
Return the
ViewPositionMode applied to this view. |
Coord3d |
getViewPoint()
Get the viewpoint.
|
protected void |
glModelView(com.jogamp.opengl.GL gl) |
void |
init(com.jogamp.opengl.GL gl)
The initialization function:
specifies general GL settings that impact the rendering quality and
performance (computation speed).
|
protected void |
initBounds(Scene scene,
BoundingBox3d viewbounds,
BoundingBox3d initBounds) |
void |
initLights(com.jogamp.opengl.GL gl) |
void |
initLights(com.jogamp.opengl.GL gl,
Scene scene) |
void |
initQuality(com.jogamp.opengl.GL gl) |
void |
initResources(com.jogamp.opengl.GL gl) |
boolean |
isAxeBoxDisplayed() |
boolean |
isSlave() |
void |
lookToBox(BoundingBox3d box)
|
void |
project() |
Coord3d |
projectMouse(int x,
int y) |
boolean |
removeViewLifecycleChangedListener(IViewLifecycleEventListener listener) |
boolean |
removeViewOnTopEventListener(IViewIsVerticalEventListener listener) |
boolean |
removeViewPointChangedListener(IViewPointChangedListener listener) |
void |
render(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu) |
void |
renderAnnotations(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera camera) |
protected void |
renderAxeBox(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu) |
protected void |
renderAxeBox(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
IAxe axe,
Scene scene,
Camera camera,
Coord3d scaling,
boolean axeBoxDisplayed) |
void |
renderBackground(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu2,
float f,
float g)
To be implemented (see AWTView)
|
void |
renderBackground(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu2,
ViewportConfiguration backgroundViewPort)
To be implemented (see AWTView)
|
void |
renderOverlay(com.jogamp.opengl.GL gl) |
void |
renderOverlay(com.jogamp.opengl.GL gl,
ViewportConfiguration viewportConfiguration) |
void |
renderScene(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu) |
void |
renderScene(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
float left,
float right) |
void |
renderScene(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport) |
void |
renderSceneGraph(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu) |
void |
renderSceneGraph(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
boolean light) |
void |
renderSceneGraph(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
boolean light,
Camera camera,
Scene scene,
Coord3d scaling) |
void |
rotate(Coord2d move)
GENERAL DISPLAY CONTROLS
|
void |
rotate(Coord2d move,
boolean updateView) |
void |
setAxe(IAxe ax) |
void |
setAxeBoxDisplayed(boolean axeBoxDisplayed) |
void |
setBackgroundColor(Color color) |
void |
setBoundManual(BoundingBox3d bounds)
Set a manual bounding box and switch the bounding mode to
{ViewBoundMode.MANUAL}, meaning that any call to
updateBounds()
will update view bounds to the current bounds. |
void |
setBoundMode(ViewBoundMode mode)
Select between an automatic bounding (that allows fitting the entire
scene graph), or a custom bounding.
|
void |
setCameraMode(CameraMode mode)
Set the projection of this view, either Camera.ORTHOGONAL or
Camera.PERSPECTIVE.
|
void |
setChart(Chart chart) |
void |
setInitBounds(BoundingBox3d initBounds) |
void |
setMaximized(boolean status) |
void |
setScale(Scale scale)
Z scale.
|
void |
setScale(Scale scale,
boolean notify)
Z scale.
|
void |
setScaleX(Scale scale) |
void |
setScaleX(Scale scale,
boolean notify) |
void |
setScaleY(Scale scale) |
void |
setScaleY(Scale scale,
boolean notify) |
void |
setScaleZ(Scale scale) |
void |
setScaleZ(Scale scale,
boolean notify) |
void |
setSlave(boolean slave) |
void |
setSpaceTransformer(SpaceTransformer transformer) |
void |
setSquared(boolean status) |
void |
setSquarifier(ISquarifier squarifier) |
void |
setViewPoint(Coord3d polar)
Set the viewpoint and query a view update.
|
void |
setViewPoint(Coord3d polar,
boolean updateView)
Set the viewpoint using polar coordinates relative to the target (i.e.
|
void |
setViewPositionMode(ViewPositionMode mode)
Set the
ViewPositionMode applied to this view. |
void |
shift(float factor) |
void |
shift(float factor,
boolean updateView) |
void |
shoot()
Current view selection into the mother Scene, and call to target canvas
rendering.
|
protected Coord3d |
squarify() |
protected Coord3d |
squarify(Scene scene,
ViewBoundMode boundmode,
BoundingBox3d viewbounds,
SpaceTransformer spaceTransformer)
Return a 3d scaling factor that allows scaling the scene into a square
box, according to the current ViewBoundMode.
|
protected Coord3d |
squarifyComputeBoundsRanges(BoundingBox3d bounds) |
void |
updateBounds()
Set the bounds of the view according to the current
ViewBoundMode
, and orders a Camera.shoot() . |
void |
updateBoundsForceUpdate(boolean refresh)
Update the bounds according to the scene graph whatever is the current
ViewBoundMode , and orders a Camera.shoot() |
void |
updateCamera(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport,
BoundingBox3d boundsScaled) |
void |
updateCamera(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport,
BoundingBox3d bounds,
float sceneRadiusScaled) |
void |
updateCamera(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
ViewportConfiguration viewport,
BoundingBox3d bounds,
float sceneRadiusScaled,
ViewPositionMode viewmode,
Coord3d viewpoint,
Camera cam,
CameraMode cameraMode,
float factorViewPointDistance,
Coord3d center,
Coord3d scaling) |
void |
updateQuality(com.jogamp.opengl.GL gl) |
void |
zoom(float factor) |
void |
zoom(float factor,
boolean updateView) |
void |
zoomX(float factor) |
void |
zoomX(float factor,
boolean updateView) |
void |
zoomY(float factor) |
void |
zoomY(float factor,
boolean updateView) |
void |
zoomZ(float factor) |
void |
zoomZ(float factor,
boolean updateView) |
protected static org.apache.log4j.Logger LOGGER
protected Chart chart
protected com.jogamp.opengl.glu.GLU glu
public static float STRETCH_RATIO
protected boolean MAINTAIN_ALL_OBJECTS_IN_VIEW
protected boolean DISPLAY_AXE_WHOLE_BOUNDS
protected boolean axeBoxDisplayed
protected boolean squared
protected Camera cam
protected IAxe axe
protected Quality quality
protected Scene scene
protected ICanvas canvas
protected Scene annotations
protected Coord3d viewpoint
protected Coord3d center
protected Coord3d scaling
protected BoundingBox3d viewbounds
protected CameraMode cameraMode
protected ViewPositionMode viewmode
protected ViewBoundMode boundmode
protected Color bgColor
protected List<IViewPointChangedListener> viewPointChangedListeners
protected List<IViewIsVerticalEventListener> viewOnTopListeners
protected List<IViewLifecycleEventListener> viewLifecycleListeners
protected boolean wasOnTopAtLastRendering
protected static final float PI_div2
public static final Coord3d DEFAULT_VIEW
protected boolean dimensionDirty
protected boolean viewDirty
protected static View current
protected BoundingBox3d initBounds
protected float factorViewPointDistance
protected boolean slave
protected SpaceTransformer spaceTransformer
public View(IChartComponentFactory factory, Scene scene, ICanvas canvas, Quality quality)
View.DEFAULT_VIEW
.
The Quality
allows setting the rendering capabilities that are
set one time by the init() method.public Chart getChart()
public void setChart(Chart chart)
public boolean isSlave()
public void setSlave(boolean slave)
public void dispose()
public void shoot()
public void project()
public Coord3d projectMouse(int x, int y)
public void rotate(Coord2d move)
public void rotate(Coord2d move, boolean updateView)
public void shift(float factor)
public void shift(float factor, boolean updateView)
public void zoom(float factor)
public void zoom(float factor, boolean updateView)
public void zoomX(float factor)
public void zoomX(float factor, boolean updateView)
public void zoomY(float factor)
public void zoomY(float factor, boolean updateView)
public void zoomZ(float factor)
public void zoomZ(float factor, boolean updateView)
public void setScale(Scale scale)
setScaleX, setScaleY, setScaleZ
public void setScale(Scale scale, boolean notify)
setScaleX, setScaleY, setScaleZ
public void setScaleX(Scale scale)
public void setScaleX(Scale scale, boolean notify)
public void setScaleY(Scale scale)
public void setScaleY(Scale scale, boolean notify)
public void setScaleZ(Scale scale)
public void setScaleZ(Scale scale, boolean notify)
public Scale getScale()
public void lookToBox(BoundingBox3d box)
public Coord3d getCenter()
lookToBox(BoundingBox3d box)
public BoundingBox3d getBounds()
AxeBox
's BoundingBox3d
public ViewBoundMode getBoundsMode()
public void setViewPositionMode(ViewPositionMode mode)
ViewPositionMode
applied to this view.public ViewPositionMode getViewMode()
ViewPositionMode
applied to this view.public void setViewPoint(Coord3d polar, boolean updateView)
updateCamera()
.public void setViewPoint(Coord3d polar)
setViewPoint(Coord3d polar, boolean updateView)}
public Coord3d getViewPoint()
updateCamera()
, which depends on the view scaling.setViewPoint(Coord3d polar, boolean updateView)}
public Coord3d getLastViewScaling()
setSquared(boolean v)
status.public void setAxe(IAxe ax)
public IAxe getAxe()
public boolean getSquared()
public void setSquared(boolean status)
public boolean isAxeBoxDisplayed()
public void setAxeBoxDisplayed(boolean axeBoxDisplayed)
public void setBackgroundColor(Color color)
public Color getBackgroundColor()
public Camera getCamera()
public void setCameraMode(CameraMode mode)
public CameraMode getCameraMode()
public void setMaximized(boolean status)
public Scene getScene()
public Rectangle getSceneViewportRectangle()
public ICanvas getCanvas()
public Graph getAnnotations()
public boolean addViewOnTopEventListener(IViewIsVerticalEventListener listener)
public boolean removeViewOnTopEventListener(IViewIsVerticalEventListener listener)
protected void fireViewOnTopEvent(boolean isOnTop)
public boolean addViewPointChangedListener(IViewPointChangedListener listener)
public boolean removeViewPointChangedListener(IViewPointChangedListener listener)
protected void fireViewPointChangedEvent(ViewPointChangedEvent e)
public boolean addViewLifecycleChangedListener(IViewLifecycleEventListener listener)
public boolean removeViewLifecycleChangedListener(IViewLifecycleEventListener listener)
protected void fireViewLifecycleHasInit(ViewLifecycleEvent e)
protected void fireViewLifecycleWillRender(ViewLifecycleEvent e)
public void setBoundMode(ViewBoundMode mode)
public void updateBounds()
ViewBoundMode
, and orders a Camera.shoot()
.protected BoundingBox3d getSceneGraphBounds()
protected BoundingBox3d getSceneGraphBounds(Scene scene)
public void updateBoundsForceUpdate(boolean refresh)
ViewBoundMode
, and orders a Camera.shoot()
public void setBoundManual(BoundingBox3d bounds)
updateBounds()
will update view bounds to the current bounds.public com.jogamp.opengl.GL getCurrentGL()
public com.jogamp.opengl.GLContext getCurrentContext()
protected com.jogamp.opengl.GLAutoDrawable getCanvasAsGLAutoDrawable()
public void init(com.jogamp.opengl.GL gl)
Quality
given in the
constructor parameters.protected void initBounds(Scene scene, BoundingBox3d viewbounds, BoundingBox3d initBounds)
public BoundingBox3d getInitBounds()
public void setInitBounds(BoundingBox3d initBounds)
public void initQuality(com.jogamp.opengl.GL gl)
public void initLights(com.jogamp.opengl.GL gl)
public void initLights(com.jogamp.opengl.GL gl, Scene scene)
public void initResources(com.jogamp.opengl.GL gl)
public void clear(com.jogamp.opengl.GL gl)
public void clearColorAndDepth(com.jogamp.opengl.GL gl)
public void render(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu)
public void renderBackground(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu2, float f, float g)
public void renderBackground(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu2, ViewportConfiguration backgroundViewPort)
public void renderScene(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu)
public void renderScene(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, float left, float right)
public void renderScene(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport)
public void updateQuality(com.jogamp.opengl.GL gl)
protected Coord3d squarify()
protected Coord3d squarify(Scene scene, ViewBoundMode boundmode, BoundingBox3d viewbounds, SpaceTransformer spaceTransformer)
protected Coord3d squarifyComputeBoundsRanges(BoundingBox3d bounds)
public BoundingBox3d computeScaledViewBounds()
public Coord3d computeSceneScaling()
public Coord3d computeSceneScaling(Scene scene, boolean squared, ViewBoundMode boundmode, BoundingBox3d viewbounds, SpaceTransformer spaceTransformer)
public void updateCamera(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport, BoundingBox3d boundsScaled)
public void updateCamera(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport, BoundingBox3d bounds, float sceneRadiusScaled)
public void updateCamera(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport, BoundingBox3d bounds, float sceneRadiusScaled, ViewPositionMode viewmode, Coord3d viewpoint, Camera cam, CameraMode cameraMode, float factorViewPointDistance, Coord3d center, Coord3d scaling)
protected Coord3d computeCameraTarget()
protected Coord3d computeCameraEye(Coord3d target, ViewPositionMode viewmode, Coord3d viewpoint)
protected Coord3d computeCameraEyeProfile(Coord3d viewpoint, Coord3d target)
protected Coord3d computeCameraUpAndTriggerEvents()
protected Coord3d computeCameraUpAndTriggerEvents(Coord3d viewpoint)
protected Coord3d computeCameraUp()
protected void computeCameraRenderingSphereRadius(Camera cam, com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport, BoundingBox3d bounds)
protected void correctCameraPositionForIncludingTextLabels(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, ViewportConfiguration viewport)
protected void renderAxeBox(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu)
protected void renderAxeBox(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, IAxe axe, Scene scene, Camera camera, Coord3d scaling, boolean axeBoxDisplayed)
protected void glModelView(com.jogamp.opengl.GL gl)
public void renderSceneGraph(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu)
public void renderSceneGraph(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, boolean light)
public void renderSceneGraph(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, boolean light, Camera camera, Scene scene, Coord3d scaling)
public void renderOverlay(com.jogamp.opengl.GL gl)
public void renderOverlay(com.jogamp.opengl.GL gl, ViewportConfiguration viewportConfiguration)
public void renderAnnotations(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera)
public static View current()
public SpaceTransformer getSpaceTransformer()
public void setSpaceTransformer(SpaceTransformer transformer)
public void setSquarifier(ISquarifier squarifier)
Copyright © 2018. All rights reserved.