com.jme.scene
Class ImposterNode

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

public class ImposterNode
extends Node

ImposterNode

Version:
$Id: ImposterNode.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Joshua Slack
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
protected  boolean byCamera
           
protected  boolean byTime
           
protected  float cameraDistance
           
protected  float cameraThreshold
           
protected  float elapsed
           
protected  boolean haveDrawn
           
(package private) static int inode_val
           
protected  float lastAngle
           
protected  float oldAngle
           
protected  Node quadScene
           
protected  float redrawRate
           
protected  Quad standIn
           
protected  Texture2D texture
           
protected  TextureRenderer tRenderer
           
protected  Vector3f worldUpVector
           
 
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
ImposterNode()
           
ImposterNode(java.lang.String name, float size, int twidth, int theight)
           
 
Method Summary
 int attachChild(Spatial child)
          attachChild attaches a child to this node.
 void draw(Renderer r)
          draw calls the onDraw method for each child maintained by this node.
 float getCameraDistance()
          Get the distance we want the render camera to stay away from the render scene.
 float getCameraThreshold()
          Get the camera threshold (see setCameraThreshold())
 float getRedrawRate()
          Get how often (in seconds) we want the texture updated.
 Quad getStandIn()
          Get the Quad used as a standin for the scene being faked.
 TextureRenderer getTextureRenderer()
          Get the Underlying texture renderer used by this imposter.
 Vector3f getWorldUpVector()
           
 void read(JMEImporter e)
           
 void renderTexture()
          force the underlying texture renderer to render the scene.
 void resetTexture()
          Resets and applies the texture, texture state and blend state on the standin Quad.
 void setCameraDistance(float cameraDistance)
          Set the distance we want the render camera to stay away from the render scene.
 void setCameraThreshold(float threshold)
          Set how much the viewers camera position has to change (in terms of angle to the imposter) before an update is called.
 void setRedrawRate(float rate)
          Set the redraw rate (see getRedrawRate())
 void setTextureRenderer(TextureRenderer tRenderer)
          Set the Underlying texture renderer used by this imposter.
 void setWorldUpVector(Vector3f worldUpVector)
           
 void updateCamera(Vector3f eyeLocation)
          Force the texture camera to update its position and direction based on the given eyeLocation
 void updateScene(float timePassed)
          Updates the scene the texture represents.
 void updateWorldBound()
          updateWorldBound merges the bounds of all the children maintained by this node.
 void updateWorldData(float time)
          updateWorldData updates the world transforms from the parent down to the leaf.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, 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
 

Field Detail

tRenderer

protected TextureRenderer tRenderer

texture

protected Texture2D texture

quadScene

protected Node quadScene

inode_val

static int inode_val

standIn

protected Quad standIn

redrawRate

protected float redrawRate

elapsed

protected float elapsed

cameraDistance

protected float cameraDistance

cameraThreshold

protected float cameraThreshold

oldAngle

protected float oldAngle

lastAngle

protected float lastAngle

haveDrawn

protected boolean haveDrawn

byCamera

protected boolean byCamera

byTime

protected boolean byTime

worldUpVector

protected Vector3f worldUpVector
Constructor Detail

ImposterNode

public ImposterNode()

ImposterNode

public ImposterNode(java.lang.String name,
                    float size,
                    int twidth,
                    int theight)
Method Detail

draw

public void draw(Renderer r)
draw calls the onDraw method for each child maintained by this node.

Overrides:
draw in class Node
Parameters:
r - the renderer to draw to.
See Also:
Spatial.draw(com.jme.renderer.Renderer)

updateCamera

public void updateCamera(Vector3f eyeLocation)
Force the texture camera to update its position and direction based on the given eyeLocation

Parameters:
eyeLocation - The location the viewer is looking from in the real world.

attachChild

public int attachChild(Spatial child)
attachChild attaches a child to this node. This node becomes the child's parent. The current number of children maintained is returned.

Overrides:
attachChild in class Node
Parameters:
child - the child to attach to this node.
Returns:
the number of children maintained by this node.

setTextureRenderer

public void setTextureRenderer(TextureRenderer tRenderer)
Set the Underlying texture renderer used by this imposter. Automatically calls resetTexture()

Parameters:
tRenderer - TextureRenderer

getTextureRenderer

public TextureRenderer getTextureRenderer()
Get the Underlying texture renderer used by this imposter.

Returns:
TextureRenderer

getCameraDistance

public float getCameraDistance()
Get the distance we want the render camera to stay away from the render scene.

Returns:
float

setCameraDistance

public void setCameraDistance(float cameraDistance)
Set the distance we want the render camera to stay away from the render scene.

Parameters:
cameraDistance - float

getRedrawRate

public float getRedrawRate()
Get how often (in seconds) we want the texture updated. example: .02 = every 20 ms or 50 times a sec. 0.0 = do not update based on time.

Returns:
float

setRedrawRate

public void setRedrawRate(float rate)
Set the redraw rate (see getRedrawRate())

Parameters:
rate - float

getStandIn

public Quad getStandIn()
Get the Quad used as a standin for the scene being faked.

Returns:
Quad

setCameraThreshold

public void setCameraThreshold(float threshold)
Set how much the viewers camera position has to change (in terms of angle to the imposter) before an update is called.

Parameters:
threshold - angle in radians

getCameraThreshold

public float getCameraThreshold()
Get the camera threshold (see setCameraThreshold())


resetTexture

public void resetTexture()
Resets and applies the texture, texture state and blend state on the standin Quad.


updateScene

public void updateScene(float timePassed)
Updates the scene the texture represents.

Parameters:
timePassed - float

renderTexture

public void renderTexture()
force the underlying texture renderer to render the scene. Could be useful for imposters that do not use time or camera angle to update the scene. (In which case, updateCamera and updateScene would likely be called prior to calling this.)


updateWorldBound

public void updateWorldBound()
updateWorldBound merges the bounds of all the children maintained by this node. This will allow for faster culling operations.

Overrides:
updateWorldBound in class Node
See Also:
Spatial.updateWorldBound()

updateWorldData

public void updateWorldData(float time)
updateWorldData updates the world transforms from the parent down to the leaf.

Overrides:
updateWorldData in class Node
Parameters:
time - the frame time.

getWorldUpVector

public Vector3f getWorldUpVector()
Returns:
Returns the worldUpVector.

setWorldUpVector

public void setWorldUpVector(Vector3f worldUpVector)
Parameters:
worldUpVector - The worldUpVector to set.

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