C# Class Axiom.Graphics.ShadowCaster

This class defines the interface that must be implemented by shadow casters.
Inheritance: DisposableObject
Show file Open project: mono-soc-2011/axiom

Public Methods

Method Description
ExtrudeVertices ( HardwareVertexBuffer vertexBuffer, int originalVertexCount, Vector4 lightPosition, float extrudeDistance ) : void

Utility method for extruding vertices based on a light.

Unfortunately, because D3D cannot handle homogenous (4D) position coordinates in the fixed-function pipeline (GL can, but we have to be cross-API), when we extrude in software we cannot extrude to infinity the way we do in the vertex program (by setting w to 0.0f). Therefore we extrude by a fixed distance, which may cause some problems with larger scenes. Luckily better hardware (ie vertex programs) can fix this.

GetDarkCapBounds ( Light light, float dirLightExtrusionDist ) : AxisAlignedBox

Gets the world space bounding box of the dark cap, as extruded using the light provided.

GetEdgeList ( ) : EdgeData

Gets details of the edges which might be used to determine a silhouette.

Defaults to LOD index 0.

GetEdgeList ( int lodIndex ) : EdgeData

Gets details of the edges which might be used to determine a silhouette.

GetLastShadowVolumeRenderableEnumerator ( ) : IEnumerator

Return the last calculated shadow renderables.

GetLightCapBounds ( ) : AxisAlignedBox

Gets the world space bounding box of the light cap.

GetPointExtrusionDistance ( Light light ) : float

Get the distance to extrude for a point/spot light.

GetShadowVolumeRenderableEnumerator ( ShadowTechnique technique, Light light, HardwareIndexBuffer indexBuffer, bool extrudeVertices, float extrusionDistance, int flags ) : IEnumerator

Gets an iterator over the renderables required to render the shadow volume.

Shadowable geometry should ideally be designed such that there is only one ShadowRenderable required to render the the shadow; however this is not a necessary limitation and it can be exceeded if required.

GetShadowVolumeRenderableEnumerator ( ShadowTechnique technique, Light light, HardwareIndexBuffer indexBuffer, float extrusionDistance, bool extrudeVertices ) : IEnumerator
GetWorldBoundingBox ( ) : AxisAlignedBox
GetWorldBoundingBox ( bool derive ) : AxisAlignedBox

Get the world bounding box of the caster.

Protected Methods

Method Description
ExtrudeBounds ( AxisAlignedBox box, Vector4 lightPosition, float extrudeDistance ) : void

Utility method for extruding a bounding box.

GenerateShadowVolume ( EdgeData edgeData, HardwareIndexBuffer indexBuffer, Light light, ShadowRenderableList shadowRenderables, int flags ) : void

Generates the indexes required to render a shadow volume into the index buffer which is passed in, and updates shadow renderables to use it.

GetExtrusionDistance ( Vector3 objectPos, Light light ) : float

Helper method for calculating extrusion distance.

UpdateEdgeListLightFacing ( EdgeData edgeData, Vector4 lightPosition ) : void

Tells the caster to perform the tasks necessary to update the edge data's light listing. Can be overridden if the subclass needs to do additional things.

Method Details

ExtrudeBounds() protected method

Utility method for extruding a bounding box.
protected ExtrudeBounds ( AxisAlignedBox box, Vector4 lightPosition, float extrudeDistance ) : void
box Axiom.Math.AxisAlignedBox Original bounding box, will be updated in-place.
lightPosition Vector4 4D light position in object space, when w=0.0f this /// represents a directional light
extrudeDistance float The distance to extrude.
return void

ExtrudeVertices() public static method

Utility method for extruding vertices based on a light.
Unfortunately, because D3D cannot handle homogenous (4D) position coordinates in the fixed-function pipeline (GL can, but we have to be cross-API), when we extrude in software we cannot extrude to infinity the way we do in the vertex program (by setting w to 0.0f). Therefore we extrude by a fixed distance, which may cause some problems with larger scenes. Luckily better hardware (ie vertex programs) can fix this.
public static ExtrudeVertices ( HardwareVertexBuffer vertexBuffer, int originalVertexCount, Vector4 lightPosition, float extrudeDistance ) : void
vertexBuffer HardwareVertexBuffer The vertex buffer containing ONLY xyz position /// values, which must be originalVertexCount * 2 * 3 floats long.
originalVertexCount int The count of the original number of /// vertices, ie the number in the mesh, not counting the doubling /// which has already been done (by ) /// to provide the extruded area of the buffer.
lightPosition Vector4 4D light position in object space, when w=0.0f this /// represents a directional light
extrudeDistance float The distance to extrude.
return void

GenerateShadowVolume() protected method

Generates the indexes required to render a shadow volume into the index buffer which is passed in, and updates shadow renderables to use it.
protected GenerateShadowVolume ( EdgeData edgeData, HardwareIndexBuffer indexBuffer, Light light, ShadowRenderableList shadowRenderables, int flags ) : void
edgeData EdgeData The edge information to use.
indexBuffer HardwareIndexBuffer The buffer into which to write data into; current /// contents are assumed to be discardable.
light Axiom.Core.Light The light, mainly for type info as silhouette calculations /// should already have been done in
shadowRenderables ShadowRenderableList A list of shadow renderables which has /// already been constructed but will need populating with details of /// the index ranges to be used.
flags int Additional controller flags, see .
return void

GetDarkCapBounds() public abstract method

Gets the world space bounding box of the dark cap, as extruded using the light provided.
public abstract GetDarkCapBounds ( Light light, float dirLightExtrusionDist ) : AxisAlignedBox
light Axiom.Core.Light
dirLightExtrusionDist float
return Axiom.Math.AxisAlignedBox

GetEdgeList() public method

Gets details of the edges which might be used to determine a silhouette.
Defaults to LOD index 0.
public GetEdgeList ( ) : EdgeData
return EdgeData

GetEdgeList() public abstract method

Gets details of the edges which might be used to determine a silhouette.
public abstract GetEdgeList ( int lodIndex ) : EdgeData
lodIndex int
return EdgeData

GetExtrusionDistance() protected method

Helper method for calculating extrusion distance.
protected GetExtrusionDistance ( Vector3 objectPos, Light light ) : float
objectPos Vector3
light Axiom.Core.Light
return float

GetLastShadowVolumeRenderableEnumerator() public abstract method

Return the last calculated shadow renderables.
public abstract GetLastShadowVolumeRenderableEnumerator ( ) : IEnumerator
return IEnumerator

GetLightCapBounds() public abstract method

Gets the world space bounding box of the light cap.
public abstract GetLightCapBounds ( ) : AxisAlignedBox
return Axiom.Math.AxisAlignedBox

GetPointExtrusionDistance() public abstract method

Get the distance to extrude for a point/spot light.
public abstract GetPointExtrusionDistance ( Light light ) : float
light Axiom.Core.Light
return float

GetShadowVolumeRenderableEnumerator() public abstract method

Gets an iterator over the renderables required to render the shadow volume.
Shadowable geometry should ideally be designed such that there is only one ShadowRenderable required to render the the shadow; however this is not a necessary limitation and it can be exceeded if required.
public abstract GetShadowVolumeRenderableEnumerator ( ShadowTechnique technique, Light light, HardwareIndexBuffer indexBuffer, bool extrudeVertices, float extrusionDistance, int flags ) : IEnumerator
technique ShadowTechnique The technique being used to generate the shadow.
light Axiom.Core.Light The light to generate the shadow from.
indexBuffer HardwareIndexBuffer The index buffer to build the renderables into, /// the current contents are assumed to be disposable.
extrudeVertices bool If true, this means this class should extrude /// the vertices of the back of the volume in software. If false, it /// will not be done (a vertex program is assumed).
extrusionDistance float
flags int Technique-specific flags, see
return IEnumerator

GetShadowVolumeRenderableEnumerator() public method

public GetShadowVolumeRenderableEnumerator ( ShadowTechnique technique, Light light, HardwareIndexBuffer indexBuffer, float extrusionDistance, bool extrudeVertices ) : IEnumerator
technique ShadowTechnique
light Axiom.Core.Light
indexBuffer HardwareIndexBuffer
extrusionDistance float
extrudeVertices bool
return IEnumerator

GetWorldBoundingBox() public method

public GetWorldBoundingBox ( ) : AxisAlignedBox
return Axiom.Math.AxisAlignedBox

GetWorldBoundingBox() public abstract method

Get the world bounding box of the caster.
public abstract GetWorldBoundingBox ( bool derive ) : AxisAlignedBox
derive bool
return Axiom.Math.AxisAlignedBox

UpdateEdgeListLightFacing() protected method

Tells the caster to perform the tasks necessary to update the edge data's light listing. Can be overridden if the subclass needs to do additional things.
protected UpdateEdgeListLightFacing ( EdgeData edgeData, Vector4 lightPosition ) : void
edgeData EdgeData The edge information to update.
lightPosition Vector4 4D vector representing the light, a directional light has w=0.0.
return void