Package WildMagic.LibGraphics.Effects
Class LightingEffect
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.Effects.Effect
-
- WildMagic.LibGraphics.Effects.ShaderEffect
-
- WildMagic.LibGraphics.Effects.LightingEffect
-
- All Implemented Interfaces:
java.io.Serializable
,NameIdInterface
,StreamInterface
public class LightingEffect extends ShaderEffect implements StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
GetAttenuation
private static java.lang.String
GetDirectionalLightFactors
private static java.lang.String
GetPointLightFactors
private static java.lang.String
GetSpotLightFactors
protected Light
m_kLight0Save
protected java.util.Vector<Light>
m_kLights
The list of Lights in this Effect:protected ColorRGB
m_kSaveEmissive
The Emissive Material color for Emissive Lighting Effects.private static long
serialVersionUID
-
Fields inherited from class WildMagic.LibGraphics.Effects.ShaderEffect
m_iPassQuantity, m_kAlphaState, m_kCompiledPrograms, m_kPShader, m_kVShader
-
-
Constructor Summary
Constructors Constructor Description LightingEffect()
Creates a LightingEffect
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
AttachLight(Light pkLight)
Attaches a new Light to this Effectvoid
Configure()
After attaching and/or detaching lights, call Configure() to activate the correct shader program for the current set of lights.private java.lang.String
createLightShaderText(char key)
void
DetachAllLights()
Removes all Lights from this Effectvoid
DetachLight(Light pkLight)
Removes the Light from this Effectvoid
dispose()
Delete memoryint
GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.Light
GetLight(int i)
Returns the ith Light in this Effectint
GetLightQuantity()
Returns the number of lights in this Effectvoid
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
RestoreGlobalState(int iPass, Renderer pkRenderer, boolean bPrimaryEffect)
Enable and disable lights for multipass drawing.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
SetGlobalState(int iPass, Renderer pkRenderer, boolean bPrimaryEffect)
Enable and disable lights for multipass drawing.-
Methods inherited from class WildMagic.LibGraphics.Effects.ShaderEffect
GetAllObjectsByName, GetBlending, GetCProgram, GetObjectByID, GetObjectByName, GetPassQuantity, GetPProgram, GetSamplerInformation, GetTexture, GetTexture, GetTextureQuantity, GetVProgram, LoadPrograms, LoadResources, OnLoadPrograms, OnReleasePrograms, ReleasePrograms, ReleaseResources, SetCProgram, SetDefaultAlphaState, SetPassQuantity, SetPShader, SetVShader
-
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_kSaveEmissive
protected ColorRGB m_kSaveEmissive
The Emissive Material color for Emissive Lighting Effects.
-
m_kLight0Save
protected Light m_kLight0Save
-
m_kLights
protected java.util.Vector<Light> m_kLights
The list of Lights in this Effect:
-
GetDirectionalLightFactors
private static java.lang.String GetDirectionalLightFactors
-
GetPointLightFactors
private static java.lang.String GetPointLightFactors
-
GetSpotLightFactors
private static java.lang.String GetSpotLightFactors
-
GetAttenuation
private static java.lang.String GetAttenuation
-
-
Method Detail
-
AttachLight
public void AttachLight(Light pkLight)
Attaches a new Light to this Effect- Parameters:
pkLight
- a new Light to add to this Effect
-
Configure
public void Configure()
After attaching and/or detaching lights, call Configure() to activate the correct shader program for the current set of lights.
-
DetachAllLights
public void DetachAllLights()
Removes all Lights from this Effect
-
DetachLight
public void DetachLight(Light pkLight)
Removes the Light from this Effect- Parameters:
pkLight
- the Light to remove from this Effect
-
dispose
public void dispose()
Delete memory- Overrides:
dispose
in classShaderEffect
-
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 classShaderEffect
- Parameters:
rkVersion
- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetLight
public Light GetLight(int i)
Returns the ith Light in this Effect- Returns:
- the ith Light in this Effect
-
GetLightQuantity
public int GetLightQuantity()
Returns the number of lights in this Effect- Returns:
- the number of lights
-
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 classShaderEffect
- 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 classShaderEffect
- 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 classShaderEffect
- 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.
-
RestoreGlobalState
public void RestoreGlobalState(int iPass, Renderer pkRenderer, boolean bPrimaryEffect)
Enable and disable lights for multipass drawing. The first pass is responsible for handling the emissive lighting.- Overrides:
RestoreGlobalState
in classShaderEffect
- Parameters:
iPass
- the current rendering passpkRenderer
- the Renderer objectbPrimaryEffect
- when true this Effect is the primary Effect
-
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 classShaderEffect
- 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 classShaderEffect
- Parameters:
acTitle
- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
SetGlobalState
public void SetGlobalState(int iPass, Renderer pkRenderer, boolean bPrimaryEffect)
Enable and disable lights for multipass drawing. The first pass is responsible for handling the emissive lighting.- Overrides:
SetGlobalState
in classShaderEffect
- Parameters:
iPass
- the current rendering passpkRenderer
- the Renderer objectbPrimaryEffect
- when true this Effect is the primary Effect
-
createLightShaderText
private java.lang.String createLightShaderText(char key)
-
-