com.jme.renderer.lwjgl
Class LWJGLCamera

java.lang.Object
  extended by com.jme.renderer.AbstractCamera
      extended by com.jme.renderer.lwjgl.LWJGLCamera
All Implemented Interfaces:
Camera, Savable, java.io.Serializable

public class LWJGLCamera
extends AbstractCamera

LWJGLCamera defines a concrete implementation of a AbstractCamera using the LWJGL library for view port setting. Most functionality is provided by the AbstractCamera class with this class handling the OpenGL specific calls to set the frustum and viewport.

Author:
Mark Powell, Joshua Slack
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jme.renderer.Camera
Camera.FrustumIntersect
 
Field Summary
 
Fields inherited from class com.jme.renderer.AbstractCamera
_modelView, _projection, _transMatrix, BOTTOM_PLANE, coeffBottom, coeffLeft, coeffRight, coeffTop, direction, FAR_PLANE, FRUSTUM_PLANES, frustumBottom, frustumFar, frustumLeft, frustumNear, frustumRight, frustumTop, height, left, LEFT_PLANE, location, MAX_WORLD_PLANES, NEAR_PLANE, newDirection, planeQuantity, RIGHT_PLANE, TOP_PLANE, up, viewPortBottom, viewPortLeft, viewPortRight, viewPortTop, width, worldPlane
 
Constructor Summary
LWJGLCamera()
           
LWJGLCamera(int width, int height)
          Constructor instantiates a new LWJGLCamera object.
LWJGLCamera(int width, int height, boolean dataOnly)
          Constructor instantiates a new LWJGLCamera object.
 
Method Summary
 void apply()
          Apply the settings of the camera to the current graphics state.
protected  void doFrameChange()
          Uses GLU's lookat function to set the OpenGL frame.
protected  void doFrustumChange()
          Sets the OpenGL frustum.
protected  void doViewPortChange()
          Sets OpenGL's viewport.
 int getHeight()
           
 int getWidth()
           
 void onFrameChange()
          onFrameChange updates the view frame of the camera.
 void onFrustumChange()
          onFrustumChange updates the frustum to reflect any changes made to the planes.
 void onViewPortChange()
          onViewPortChange is an update callback that is activated if the view port changes.
 void resize(int width, int height)
          Resizes this camera's view with the given width and height.
(package private)  void resize(int width, int height, boolean forceDirty)
          Resizes this camera's view with the given width and height.
 
Methods inherited from class com.jme.renderer.AbstractCamera
contains, getClassTag, getDirection, getFrustumBottom, getFrustumFar, getFrustumLeft, getFrustumNear, getFrustumRight, getFrustumTop, getLeft, getLocation, getModelViewMatrix, getPlaneState, getProjectionMatrix, getScreenCoordinates, getScreenCoordinates, getUp, getViewPortBottom, getViewPortLeft, getViewPortRight, getViewPortTop, getWorldCoordinates, getWorldCoordinates, isDataOnly, isParallelProjection, lookAt, normalize, read, setAxes, setAxes, setDataOnly, setDirection, setFrame, setFrame, setFrustum, setFrustumBottom, setFrustumFar, setFrustumLeft, setFrustumNear, setFrustumPerspective, setFrustumRight, setFrustumTop, setLeft, setLocation, setParallelProjection, setPlaneState, setUp, setViewPort, setViewPortBottom, setViewPortLeft, setViewPortRight, setViewPortTop, update, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLCamera

public LWJGLCamera()

LWJGLCamera

public LWJGLCamera(int width,
                   int height)
Constructor instantiates a new LWJGLCamera object. The width and height are provided, which corresponds to either the width and height of the rendering window, or the resolution of the fullscreen display.

Parameters:
width - the width/resolution of the display.
height - the height/resolution of the display.

LWJGLCamera

public LWJGLCamera(int width,
                   int height,
                   boolean dataOnly)
Constructor instantiates a new LWJGLCamera object. The width and height are provided, which corresponds to either the width and height of the rendering window, or the resolution of the fullscreen display.

Parameters:
width - the width/resolution of the display.
height - the height/resolution of the display.
Method Detail

getHeight

public int getHeight()
Specified by:
getHeight in class AbstractCamera
Returns:
the width/resolution of the display.

getWidth

public int getWidth()
Specified by:
getWidth in class AbstractCamera
Returns:
the height/resolution of the display.

resize

public void resize(int width,
                   int height)
Resizes this camera's view with the given width and height. This is similar to constructing a new camera, but reusing the same Object. This method is called by an associated renderer to notify the camera of changes in the display dimensions.

Parameters:
width - the view width
height - the view height

resize

void resize(int width,
            int height,
            boolean forceDirty)
Resizes this camera's view with the given width and height. This is similar to constructing a new camera, but reusing the same Object. This method is called by an associated renderer to notify the camera of changes in the display dimensions. A renderer can use the forceDirty parameter for a newly associated camera to ensure that the settings for a previously used camera will be part of the next rendering phase.

Parameters:
width - the view width
height - the view height
forceDirty - true if camera settings should be treated as changed

apply

public void apply()
Description copied from interface: Camera
Apply the settings of the camera to the current graphics state.

If state should be applied even if not dirty, make sure to call Camera.update() before.


onFrustumChange

public void onFrustumChange()
Description copied from class: AbstractCamera
onFrustumChange updates the frustum to reflect any changes made to the planes. The new frustum values are kept in a temporary location for use when calculating the new frame. It should be noted that the abstract implementation of this class only updates the data, and does not make any rendering calls. As such, any impelmenting subclass should insure to override this method call it with super and then call the rendering specific code.

Specified by:
onFrustumChange in interface Camera
Overrides:
onFrustumChange in class AbstractCamera

onViewPortChange

public void onViewPortChange()
Description copied from interface: Camera
onViewPortChange is an update callback that is activated if the view port changes.


onFrameChange

public void onFrameChange()
Description copied from class: AbstractCamera
onFrameChange updates the view frame of the camera. It should be noted that the abstract implementation of this class only updates the data, and does not make any rendering calls. As such, any implementing subclass should insure to override this method call it with super and then call the rendering specific code.

Specified by:
onFrameChange in interface Camera
Overrides:
onFrameChange in class AbstractCamera

doFrustumChange

protected void doFrustumChange()
Sets the OpenGL frustum.

See Also:
Camera.onFrustumChange()

doViewPortChange

protected void doViewPortChange()
Sets OpenGL's viewport.

See Also:
Camera.onViewPortChange()

doFrameChange

protected void doFrameChange()
Uses GLU's lookat function to set the OpenGL frame.

See Also:
Camera.onFrameChange()