com.jmex.effects
Class LensFlare

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

public class LensFlare
extends Node

LensFlare Lens flare effect for jME. Notice that currently, it doesn't do occlusion culling. The easiest way to use this class is to use the LensFlareFactory to create your LensFlare and then attach it as a child to a lightnode. Optionally you can make it a child or a sibling of an object you wish to have a 'glint' on. In the case of sibling, use setLocalTranslation(sibling.getLocalTranslation()) or something similar to ensure position. Only FlareQuad objects are acceptable as children.

Version:
$Id: LensFlare.java 4133 2009-03-19 20:40:11Z 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
 
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
LensFlare()
           
LensFlare(java.lang.String name)
          Creates a new LensFlare node without FlareQuad children.
 
Method Summary
 int attachChild(Spatial spat)
          Calls Node's attachChild after ensuring child is a FlareQuad.
 void draw(Renderer r)
          draw calls the onDraw method for each child maintained by this node.
 float getIntensity()
          Query intensity of the flares.
 Vector2f getMidPoint()
          Get the flare's reference midpoint, usually the center of the screen.
 Node getRootNode()
          getter for field rootNode
 void onDraw(Renderer r)
          onDraw checks the node with the camera to see if it should be culled, if not, the node's draw method is called.
 void read(JMEImporter e)
           
 void setIntensity(float value)
          Set intensity of the flare.
 void setMidPoint(Vector2f midPoint)
          Set the flare's reference midpoint, the center of the screen by default.
 void setRootNode(Node value)
          setter for field rootNode
 void setTriangleAccurateOcclusion(boolean use)
           
 boolean useTriangleAccurateOcclusion()
           
 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, updateWorldBound, updateWorldData, 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, 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

LensFlare

public LensFlare()

LensFlare

public LensFlare(java.lang.String name)
Creates a new LensFlare node without FlareQuad children. Use attachChild to attach FlareQuads.

Parameters:
name - The name of the node.
Method Detail

getMidPoint

public Vector2f getMidPoint()
Get the flare's reference midpoint, usually the center of the screen.

Returns:
Vector2f

setMidPoint

public void setMidPoint(Vector2f midPoint)
Set the flare's reference midpoint, the center of the screen by default. It may be useful to change this if the whole screen is not used for a scene (for example, if part of the screen is taken up by a status bar.)

Parameters:
midPoint - Vector2f

getIntensity

public float getIntensity()
Query intensity of the flares.

Returns:
current value of field intensity
See Also:
setIntensity(float)

setIntensity

public void setIntensity(float value)
Set intensity of the flare. Intensity 0 means flares are not visible, 1 means maximum size and opacity.

Parameters:
value - new value between 0 and 1

onDraw

public void onDraw(Renderer r)
onDraw checks the node with the camera to see if it should be culled, if not, the node's draw method is called.

Overrides:
onDraw in class Spatial
Parameters:
r - the renderer used for display.

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)

attachChild

public int attachChild(Spatial spat)
Calls Node's attachChild after ensuring child is a FlareQuad.

Overrides:
attachChild in class Node
Parameters:
spat - Spatial
Returns:
int
See Also:
Node.attachChild(Spatial)

getRootNode

public Node getRootNode()
getter for field rootNode

Returns:
current value of field rootNode

setRootNode

public void setRootNode(Node value)
setter for field rootNode

Parameters:
value - new value

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

useTriangleAccurateOcclusion

public boolean useTriangleAccurateOcclusion()
Returns:
true if additional triangle accurate lens flare occlusion checks should done for this lens flare. (Useful for terrain, etc.)

setTriangleAccurateOcclusion

public void setTriangleAccurateOcclusion(boolean use)