|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.environment.GraphicsDemoEnvironment
public class GraphicsDemoEnvironment
Graphical demo helper class, contains a key navigator, 3D environment with checkerboard ground, play button and some useful function hooks for subclasses. REMARKS & CHANGES BY DENNIS - i want to be able to add new graphical elements (VGLNodes) to the scene that are NOT added to the root VGLNode. Rather, they are stored in a list of many objects that need to be rendered. WHY? because I sometimes want to be able to do some attrib pushing/popping around each render call - i want to have a list of debugvisualisation objects too -- so we can activate and deactivate rendering for all debug visualsiations, online, with one boolean setting - for both the 'normal' and 'debug' render objects, we need to take into account that when they are added online, i.e. after the applicatino has already been running for some time, we sti;ll need to initialise them (glInit). - instead of the stupid hard coded openglstate, i add a preGlInit and a preGlRender. (also stupid, but probably more flexible & useful.) - animationRootJoint becomes vjWorldAnimationRoot (maar moet bewaard als doorlus variabele? - renderroot becomes vglSceneRenderRoot (maar moet bewaard als doorlus variabele? - initgraphics wordt initrender en initgraphicscene (maar is bewaard als deprecated) - clock becomes renderClock (there will be more! - after init, you need to call StartAll separately (which starts clocks and such) - setupUI becomes initUI
| Nested Class Summary | |
|---|---|
(package private) class |
GraphicsDemoEnvironment.DebugCheckListener
|
(package private) class |
GraphicsDemoEnvironment.MyRenderclockCallback
This object is responsible for doing extra things on the render tick, such as navigation. |
(package private) class |
GraphicsDemoEnvironment.PlayListener
|
(package private) class |
GraphicsDemoEnvironment.ResetListener
|
| Field Summary | |
|---|---|
protected Background |
background
This simple colored background is always available, and will always be rendered just *after* the glPreRender and BEFORE the elements in the visualisations list |
(package private) GLTextureWow |
color_buf_tex
Used to copy the rendered area into |
boolean |
debugJOGL
If true, the JOGL renderer will be set to use the DEBUG GL |
private ArrayList<VGLNode> |
debugVisualisations
Debugvisulaisations are stored in a separate array - this allows us to add some setting 'allowDebugRender' in the future. |
private ArrayList<VGLNode> |
debugVisualisationsUninitialized
Unitialized debug visulaisations -- see also visualisationsUnititialized. |
(package private) GLTextureWow |
depth_buf_tex
Used to copy the depth of the rendered area into |
(package private) float |
dx
|
(package private) float |
dy
|
(package private) float |
dz
|
boolean |
enableFSAA
enableFSAA |
double |
fovyFar
NEar and Far planes |
double |
fovyNear
NEar and Far planes |
String |
frameTitle
Title of the frame. |
int |
FSAA_samples
FSAA |
boolean |
fullscreen
fullscreen mode |
protected javax.media.opengl.GLCanvas |
glCanvas
The 3D enabled Canvas, inside the JFrame |
protected NavigationControl |
glNavControl
The glNavControl operates on the vjNavigationNode and its children, and allows for keyboard based navigation through the scene |
protected VJointMoveControl |
glObjectControl
The glObjectControl operates on an as of yet unspecified vjoint, and allows for keyboard based manipulation of one object |
protected ArrayList<VGLNode> |
hiddenVisualisations
Visualisations that have been (GL)initialized already, but are currently hidden (so moved from visualisations to this list) |
protected JFrame |
jframe
The JFrame for the application |
boolean |
laptop
Set to true if you are running on a laptop and the program crashes, or the mesh looks exploded. |
protected SimpleLight |
light0
several simple openGL lights that are always available |
protected SimpleLight |
light1
|
protected SimpleLight |
light2
|
protected SimpleLight |
light3
|
protected SimpleLight |
light4
|
protected float[] |
lightPos0
This is the position of light0.. |
protected float[] |
lightPos1
|
protected float[] |
lightPos2
|
protected float[] |
lightPos3
|
protected float[] |
lightPos4
|
private static org.slf4j.Logger |
logger
|
int |
numStencilBits
Number of stencil bits |
boolean |
render
|
SystemClock |
renderClock
The Clock that triggers rendering. |
boolean |
renderDebugVisualisations
If true, debug visualisations will be rendered |
protected JOGLRenderer |
renderer
The module that renders the 3D scene. |
protected List<Runnable> |
renderRunners
|
protected Object |
shutdownSync
this sync is used because we do not want to dispose the frame in the middle of an openGL render action |
protected JToolBar |
toolBar
|
boolean |
useVsync
denotes whether vsync should be used or not. |
protected VGLNode |
vglSceneRenderRoot
This node is available as the top-level VGLNode for the scene -- the VGLNode for vjSceneRenderRoot. |
protected ArrayList<VGLNode> |
visualisations
The shapes, meshes, materials, etc that are to be rendered are contained in this list of VGLNodes. |
protected ArrayList<VGLNode> |
visualisationsUninitialized
When a new visulaisation object is added through addVisualisation, we need to be sure that glInit is called on it before calling glRender on it. |
protected VJoint |
vjNavigationNode
The vjWorldRenderRoot is added to vjNavigationNode; the navigation controls operate on the vjNavigationNode. |
protected VJoint |
vjSceneRenderRoot
At the top of the VJoint hierarchy, we find the vjSceneRenderRoot. |
protected VJoint |
vjWorldAnimationRoot
The vjWorldAnimationRoot defines the world, in which the VJoints of all objects that must be animated reside. |
protected VJoint |
vjWorldRenderRoot
The vjWorldRenderRoot is the render node of the World. |
(package private) float[] |
wowTransformMatrix
|
boolean |
wowvx
Set to true to use the WOWVX screen capabilities |
(package private) byte[] |
wowvx_header_data
The header is a magic sequence of pixels (1 stands for blue, 0 stands for black) that fills the first half of the first line. |
(package private) GLTextureWow |
wowvx_header_tex
Contains the header that should be drawn at the top left of the screen to make the wowvx switch to 3D mode. |
| Constructor Summary | |
|---|---|
GraphicsDemoEnvironment()
Constructor. |
|
| Method Summary | |
|---|---|
void |
addDebugVisualisation(VGLNode viz)
Add a VGLNode to the list of debugvisualisations. |
protected void |
addRenderRunner(Runnable r)
Add a runner to the render thread. |
void |
addVisualisation(VGLNode viz)
Add a VGLNode to the list of visualisations. |
protected void |
close()
close button pressed, extend or override in subclass |
(package private) void |
convertBufferToWowVX(GLRenderContext glc)
Convert the region in the bottom left to 2d + depth format. |
protected void |
disposeFrame()
close button pressed, extend or override in subclass |
protected void |
exit()
|
JFrame |
getFrame()
|
ImageIcon |
getGeneralImageIcon(String imageName,
String altText)
|
ImageIcon |
getImageIcon(String imageName,
String altText)
|
VJoint |
getWorldAnimationRoot()
get vjWorldAnimationRoot. |
VJoint |
getWorldRenderRoot()
get vjWorldAnimationRoot. |
void |
glInit(GLRenderContext glc)
Run the init for some default stuff (glpreInit, can be overridden), followed by the init for everything that is in the list of uninitialized objects |
void |
glPreInit(GLRenderContext glc)
Do some basic initialization prior to initializing the scene: smoothing, cull_face, etc |
void |
glPreRender(GLRenderContext glc)
Do some basic rendering calls prior to initializing the scene: It clears the necessary OpenGL buffers (color, depth, ..) and calls glInit on any uninitialized (debug)visualisations |
void |
glRender(GLRenderContext glc)
do the main rendering step. |
boolean |
hasVisualisation(VGLNode viz)
Checks if a visualization is already in the scene (returns true on hidden VGLNodes too) |
void |
init()
The init method has been moved out of the constructor, because we sometimes want to override it with additional initialisation BEFORE calling the superclass init() method |
protected void |
initGraphics()
For backwards compatibility -- calls initRender & initGraphicScene |
protected void |
initGraphicScene()
initialize the actual graphic scene (floor, lights, objects, etc). |
protected void |
initQuickSettings()
Override this method to change the quick-settings for your application (see top of source file) |
protected void |
initRender()
initialize the renderer |
protected void |
initToolbar()
Initializes the toolbar. |
protected void |
initUI()
Make frame, make canvas, make toolbars & buttons... |
protected void |
initVisualGround()
you can override this one to get rid of the visual ground... called from initGraphicScene() |
protected void |
initVJointStructure()
Setup the main scene structure with the navigation node, the node to be animated, the central nodes to render, etc. |
boolean |
isVisualisationVisible(VGLNode viz)
|
void |
keyPressed(KeyEvent e)
KeyListener callback: exit if the escape key was pressed |
void |
keyReleased(KeyEvent e)
|
void |
keyTyped(KeyEvent e)
|
protected void |
navigate(double currentTime)
Do the navigation for this time step |
protected void |
play()
Play button pressed, override in subclass |
protected void |
prepareClose()
prepare to close on a renderrunner |
protected void |
prepareDispose()
prepare to close on a renderrunner |
void |
prepareReset()
prepare to reset on a renderrunner |
void |
processAnimationResultForRender(GLRenderContext glc)
This method makes sure that all relevant information from the vjWorldAnimationRoot is processed. |
void |
removeDebugVisualisation(VGLNode viz)
|
void |
removeVisualisation(VGLNode viz)
|
protected void |
renderTime(double currentTime)
|
protected void |
reset()
Reset button pressed, override in subclass |
void |
setFullScreen(boolean full)
This method may be changed to use the stuff described here: http://java.sun.com/docs/books/tutorial/extra/fullscreen/exclusivemode.html because this gives us more control over the display... |
void |
setupMediaButton(ImageIcon icon,
ActionListener listener,
String toolTipText,
String altText,
JButton button)
|
void |
setupMediaButton(String imageName,
ActionListener listener,
String toolTipText,
String altText,
JButton button)
|
protected void |
setupUI()
Deprecated. |
protected void |
setupVJointStructure()
Deprecated. |
void |
setVisualisationVisible(VGLNode viz,
boolean enabled)
Show/hide a VGLNode |
void |
startAll()
start the frame, canvas, clocks and render loops. |
void |
startClocks()
start render clock... |
void |
toggleDebugViz()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Object shutdownSync
private static org.slf4j.Logger logger
public boolean laptop
public String frameTitle
public boolean useVsync
public boolean debugJOGL
public volatile boolean renderDebugVisualisations
public volatile boolean render
public int numStencilBits
public int FSAA_samples
public double fovyNear
public double fovyFar
public boolean enableFSAA
public boolean fullscreen
public boolean wowvx
protected JFrame jframe
protected JToolBar toolBar
protected javax.media.opengl.GLCanvas glCanvas
protected JOGLRenderer renderer
public SystemClock renderClock
protected List<Runnable> renderRunners
protected VJoint vjWorldAnimationRoot
protected VJoint vjWorldRenderRoot
protected VJoint vjNavigationNode
protected VJoint vjSceneRenderRoot
protected NavigationControl glNavControl
protected VJointMoveControl glObjectControl
protected VGLNode vglSceneRenderRoot
protected ArrayList<VGLNode> visualisations
protected ArrayList<VGLNode> hiddenVisualisations
protected ArrayList<VGLNode> visualisationsUninitialized
private ArrayList<VGLNode> debugVisualisations
private ArrayList<VGLNode> debugVisualisationsUninitialized
protected Background background
protected SimpleLight light0
protected SimpleLight light1
protected SimpleLight light2
protected SimpleLight light3
protected SimpleLight light4
protected float[] lightPos0
protected float[] lightPos1
protected float[] lightPos2
protected float[] lightPos3
protected float[] lightPos4
GLTextureWow color_buf_tex
GLTextureWow depth_buf_tex
GLTextureWow wowvx_header_tex
byte[] wowvx_header_data
float[] wowTransformMatrix
float dx
float dy
float dz
| Constructor Detail |
|---|
public GraphicsDemoEnvironment()
| Method Detail |
|---|
public VJoint getWorldAnimationRoot()
protected void addRenderRunner(Runnable r)
public VJoint getWorldRenderRoot()
public void init()
protected void initQuickSettings()
@Deprecated protected void setupVJointStructure()
protected void initVJointStructure()
@Deprecated protected void setupUI()
protected void initUI()
protected void initToolbar()
public void setFullScreen(boolean full)
public void toggleDebugViz()
protected void initGraphics()
protected void initRender()
protected void initGraphicScene()
protected void initVisualGround()
public void startAll()
public void startClocks()
protected void play()
public void prepareReset()
protected void prepareClose()
protected void prepareDispose()
protected void reset()
protected void close()
protected void disposeFrame()
throws InterruptedException,
InvocationTargetException
InvocationTargetException
InterruptedExceptionprotected void exit()
public void addVisualisation(VGLNode viz)
public boolean hasVisualisation(VGLNode viz)
public boolean isVisualisationVisible(VGLNode viz)
public void setVisualisationVisible(VGLNode viz,
boolean enabled)
public void removeVisualisation(VGLNode viz)
public void addDebugVisualisation(VGLNode viz)
public void removeDebugVisualisation(VGLNode viz)
public void glPreInit(GLRenderContext glc)
public void glInit(GLRenderContext glc)
glInit in interface GLRenderObjectpublic void glPreRender(GLRenderContext glc)
public void processAnimationResultForRender(GLRenderContext glc)
public void glRender(GLRenderContext glc)
glRender in interface GLRenderObjectprotected void renderTime(double currentTime)
protected void navigate(double currentTime)
void convertBufferToWowVX(GLRenderContext glc)
public void keyPressed(KeyEvent e)
keyPressed in interface KeyListenerpublic void keyTyped(KeyEvent e)
keyTyped in interface KeyListenerpublic void keyReleased(KeyEvent e)
keyReleased in interface KeyListenerpublic JFrame getFrame()
public ImageIcon getImageIcon(String imageName,
String altText)
public ImageIcon getGeneralImageIcon(String imageName,
String altText)
public void setupMediaButton(ImageIcon icon,
ActionListener listener,
String toolTipText,
String altText,
JButton button)
public void setupMediaButton(String imageName,
ActionListener listener,
String toolTipText,
String altText,
JButton button)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||