com.jme.scene
Class ImposterNode

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Node
          extended bycom.jme.scene.ImposterNode
All Implemented Interfaces:
java.io.Serializable

public class ImposterNode
extends Node

ImposterNode

Version:
$Id: ImposterNode.java,v 1.13 2005/01/03 20:04:43 renanse Exp $
Author:
Joshua Slack
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
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.
 void drawBounds(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.
 void renderTexture()
          force the underlying texture renderer to render the scene.
 void resetTexture()
          Resets and applies the texture, texture state and alpha 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 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.
 
Methods inherited from class com.jme.scene.Node
applyRenderState, detachAllChildren, detachChild, detachChildAt, detachChildNamed, findCollisions, findPick, getChild, getChild, getChildren, getQuantity, hasChild, hasCollision, putClone, setChild, setForceView, updateCollisionTree
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.

drawBounds

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

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

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 alpha 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.