Package WildMagic.LibGraphics.Effects
Class PlanarShadowEffect
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.Effects.Effect
-
- WildMagic.LibGraphics.Effects.PlanarShadowEffect
-
- All Implemented Interfaces:
java.io.Serializable
,NameIdInterface
,StreamInterface
public class PlanarShadowEffect extends Effect implements NameIdInterface, StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ColorRGBA[]
m_akShadowColor
The Shadow Colorsprotected TriMesh[]
m_aspkPlane
The Light Planesprotected Light[]
m_aspkProjector
The Light Projectorsprotected int
m_iQuantity
The number of Light Planesprotected AlphaState
m_spkAState
Temporary render state for drawing.protected MaterialEffect
m_spkMEffect
Temporary render state for drawing.protected MaterialState
m_spkMState
Temporary render state for drawing.protected StencilState
m_spkSState
Temporary render state for drawing.protected ZBufferState
m_spkZState
Temporary render state for drawing.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description PlanarShadowEffect()
Streaming constructor:PlanarShadowEffect(int iQuantity)
Creates a new PlanarShadowEffect for the number of planes specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Delete data members:void
Draw(Renderer pkRenderer, Spatial pkGlobalObject, int iMin, int iMax, VisibleObject[] akVisible)
Draw the planar shadowsvoid
GetAllObjectsByName(java.lang.String rkName, java.util.Vector<GraphicsObject> rkObjects)
Writes all GraphicsObjects with the name that matches the input parameter, rkName into the Vector parameter rkObjects.int
GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.GraphicsObject
GetObjectByID(int uiID)
Returns the GraphicsObject with the ID that matches the input parameter, uiID.GraphicsObject
GetObjectByName(java.lang.String rkName)
Returns the GraphicsObject with the name that matches the input parameter, rkName.TriMesh
GetPlane(int i)
Returns the ith shadow planeprotected boolean
GetProjectionMatrix(int i, BoundingVolume pkGlobalObjectWorldBound, Matrix4f rkProjection)
Computes the ith Light Projection MatrixLight
GetProjector(int i)
Returns the ith Light projector for the shadows.int
GetQuantity()
Return the number of shadow planesColorRGBA
GetShadowColor(int i)
Returns the ith shadow color.void
Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.void
Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.boolean
Register(Stream rkStream)
Registers this object with the input Stream parameter.void
Save(Stream rkStream)
Write this object and all it's children to the Stream.StringTree
SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.void
SetPlane(int i, TriMesh spkPlane)
Sets the ith shadow planevoid
SetProjector(int i, Light spkProjector)
Sets the ith Light projector for the shadows.void
SetShadowColor(int i, ColorRGBA rkShadowColor)
Sets the ith shadow color.-
Methods inherited from class WildMagic.LibGraphics.Effects.Effect
LoadResources, ReleaseResources
-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_iQuantity
protected int m_iQuantity
The number of Light Planes
-
m_aspkPlane
protected TriMesh[] m_aspkPlane
The Light Planes
-
m_aspkProjector
protected Light[] m_aspkProjector
The Light Projectors
-
m_akShadowColor
protected ColorRGBA[] m_akShadowColor
The Shadow Colors
-
m_spkAState
protected AlphaState m_spkAState
Temporary render state for drawing.
-
m_spkMState
protected MaterialState m_spkMState
Temporary render state for drawing.
-
m_spkSState
protected StencilState m_spkSState
Temporary render state for drawing.
-
m_spkZState
protected ZBufferState m_spkZState
Temporary render state for drawing.
-
m_spkMEffect
protected MaterialEffect m_spkMEffect
Temporary render state for drawing.
-
-
Method Detail
-
dispose
public void dispose()
Delete data members:- Overrides:
dispose
in classGraphicsObject
-
Draw
public void Draw(Renderer pkRenderer, Spatial pkGlobalObject, int iMin, int iMax, VisibleObject[] akVisible)
Draw the planar shadows
-
GetAllObjectsByName
public void GetAllObjectsByName(java.lang.String rkName, java.util.Vector<GraphicsObject> rkObjects)
Writes all GraphicsObjects with the name that matches the input parameter, rkName into the Vector parameter rkObjects.- Specified by:
GetAllObjectsByName
in interfaceNameIdInterface
- Overrides:
GetAllObjectsByName
in classGraphicsObject
- Parameters:
rkName
- the name of the objects to return.rkObjects
- a Vector of all objects with the matching name.
-
GetDiskUsed
public int GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.- Specified by:
GetDiskUsed
in interfaceStreamInterface
- Overrides:
GetDiskUsed
in classEffect
- Parameters:
rkVersion
- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetObjectByID
public GraphicsObject GetObjectByID(int uiID)
Returns the GraphicsObject with the ID that matches the input parameter, uiID.- Specified by:
GetObjectByID
in interfaceNameIdInterface
- Overrides:
GetObjectByID
in classGraphicsObject
- Parameters:
uiID
- the ID of the object to return.- Returns:
- the GraphicsObject that matches the input name.
-
GetObjectByName
public GraphicsObject GetObjectByName(java.lang.String rkName)
Returns the GraphicsObject with the name that matches the input parameter, rkName.- Specified by:
GetObjectByName
in interfaceNameIdInterface
- Overrides:
GetObjectByName
in classGraphicsObject
- Parameters:
rkName
- the name of the object to return.- Returns:
- the GraphicsObject that matches the input name.
-
GetPlane
public TriMesh GetPlane(int i)
Returns the ith shadow plane- Parameters:
i
- the ith shadow plane- Returns:
- the ith shadow plane
-
GetProjector
public Light GetProjector(int i)
Returns the ith Light projector for the shadows.- Parameters:
i
- the ith shadow plane- Returns:
- the ith Light Projector
-
GetQuantity
public int GetQuantity()
Return the number of shadow planes- Returns:
- the number of shadow planes
-
GetShadowColor
public ColorRGBA GetShadowColor(int i)
Returns the ith shadow color.- Parameters:
i
- the ith shadow- Returns:
- the shadow color
-
Link
public void Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.- Specified by:
Link
in interfaceStreamInterface
- Overrides:
Link
in classEffect
- Parameters:
rkStream
- the Stream where the child objects are stored.pkLink
- the Link class from which the child object IDs are read.
-
Load
public void Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.- Specified by:
Load
in interfaceStreamInterface
- Overrides:
Load
in classEffect
- Parameters:
rkStream
- the Stream from which this object is being read.pkLink
- the Link class for storing the IDs of this object's children objects.
-
Register
public boolean Register(Stream rkStream)
Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.- Specified by:
Register
in interfaceStreamInterface
- Overrides:
Register
in classEffect
- Parameters:
rkStream
- the Stream where the child objects are stored.- Returns:
- true if this object is registered, false if the object has already been registered.
-
Save
public void Save(Stream rkStream)
Write this object and all it's children to the Stream.- Specified by:
Save
in interfaceStreamInterface
- Overrides:
Save
in classEffect
- Parameters:
rkStream
- the Stream where the child objects are stored.
-
SaveStrings
public StringTree SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.- Specified by:
SaveStrings
in interfaceStreamInterface
- Overrides:
SaveStrings
in classEffect
- Parameters:
acTitle
- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
SetPlane
public void SetPlane(int i, TriMesh spkPlane)
Sets the ith shadow plane- Parameters:
i
- the ith shadow plane to setspkPlane
- the shadow plane
-
SetProjector
public void SetProjector(int i, Light spkProjector)
Sets the ith Light projector for the shadows.- Parameters:
i
- the ith shadow planespkProjector
- the ith Light
-
SetShadowColor
public void SetShadowColor(int i, ColorRGBA rkShadowColor)
Sets the ith shadow color.- Parameters:
i
- the ith shadowrkShadowColor
- the shadow color
-
GetProjectionMatrix
protected boolean GetProjectionMatrix(int i, BoundingVolume pkGlobalObjectWorldBound, Matrix4f rkProjection)
Computes the ith Light Projection Matrix- Parameters:
i
- the ith planepkGlobalObjectWorldBound
- tests to see if a shadow should be castrkProjection
- the project matrix for the light source- Returns:
- true if success false on failure.
-
-