com.jme.scene
Class CameraNode

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Node
          extended by com.jme.scene.CameraNode
All Implemented Interfaces:
Savable, java.io.Serializable

public class CameraNode
extends Node

CameraNode defines a node that contains a camera object. This allows a camera to be controlled by any other node, and allows the camera to be attached to any node. A call to updateWorldData will adjust the camera's frame by the world translation and the world rotation. The column 0 of the world rotation matrix is used for the camera left vector, column 1 is used for the camera up vector, column 2 is used for the camera direction vector.

Version:
$Id: CameraNode.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mark Powell
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
CameraNode()
           
CameraNode(java.lang.String name, Camera camera)
          Constructor instantiates a new CameraNode object setting the camera to use for the frame reference.
 
Method Summary
 Camera getCamera()
          getCamera retrieves the camera object that this node controls.
 void read(JMEImporter e)
           
 void setCamera(Camera camera)
          setCamera sets the camera that this node controls.
 void updateFromCamera()
          Forces rotation and translation of this node to be consistant with the attached camera.
 void updateWorldData(float time)
          updateWorldData updates the rotation and translation of this node, and sets the camera's frame buffer to reflect the current view.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldVectors
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBranch, lockMeshes, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBranch, unlockMeshes, updateGeometricState, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

CameraNode

public CameraNode()

CameraNode

public CameraNode(java.lang.String name,
                  Camera camera)
Constructor instantiates a new CameraNode object setting the camera to use for the frame reference.

Parameters:
name - the name of the scene element. This is required for identification and comparision purposes.
camera - the camera this node controls.
Method Detail

updateFromCamera

public void updateFromCamera()
Forces rotation and translation of this node to be consistant with the attached camera. (Assumes the node is in world space.)


setCamera

public void setCamera(Camera camera)
setCamera sets the camera that this node controls.

Parameters:
camera - the camera that this node controls.

getCamera

public Camera getCamera()
getCamera retrieves the camera object that this node controls.

Returns:
the camera this node controls.

updateWorldData

public void updateWorldData(float time)
updateWorldData updates the rotation and translation of this node, and sets the camera's frame buffer to reflect the current view.

Overrides:
updateWorldData in class Node
Parameters:
time - the time between frames.

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Node
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Node
Throws:
java.io.IOException