org.xith3d.effects.shadows
Class ShadowMappingFactory

java.lang.Object
  extended by org.xith3d.effects.shadows.ShadowFactory
      extended by org.xith3d.effects.shadows.ShadowMappingFactory
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable
Direct Known Subclasses:
FixedFuncShadowMappingFactory, GLSLShadowMappingFactory

public abstract class ShadowMappingFactory
extends ShadowFactory

This ShadowFactory is a base for any factory realizing shadow-mapping.


Nested Class Summary
static class ShadowMappingFactory.HackedRenderBinProvider
           
 
Nested classes/interfaces inherited from class org.xith3d.effects.shadows.ShadowFactory
ShadowFactory.ShadowFactoryIdentifier
 
Field Summary
static ShadowFactory.ShadowFactoryIdentifier SHADOW_FACTORY_ID
           
 
Constructor Summary
ShadowMappingFactory()
           
 
Method Summary
protected  float calculateScreenScale()
           
protected  void calculateTextureMatrix(float fovy, float aspect, float near, float far, Transform3D lightTransform, Transform3D viewTransform, Transform3D textureTransform)
           
 TextureRenderTarget getDepthRenderTarget()
           
 RenderPass getGenerationPass()
           
 org.openmali.types.twodee.Sized2iRO getLightViewport()
          
 ShadowMappingFactory.HackedRenderBinProvider getRenderBinProvider()
           
 ShadowAtom getShadowAtom(Node node)
          This is called by the FrustumCuller, if a Node with occluder has been detected within the frustum.
 ShadowFactory.ShadowFactoryIdentifier getShadowFactoryId()
          
 Texture2D getShadowMap()
           
 TextureAttributes getShadowMapAttributes()
           
 boolean needsPerLightCulling()
          
 void onOccluderStateChanged(Node node, boolean isOccluder)
          This must be called from the scenegraph when a node's occluder state is changed.
 void setEnabled(boolean enabled)
          
 void setShadowQuality(int quality)
          
 RenderPass setupRenderPass(View view, Light light, float viewportAspect, RenderBin shadowBin, long frameId, boolean justForCulling)
          
 void verifyLight(Light light)
          Checks, if the Light is accepted as "shadow caster".
 
Methods inherited from class org.xith3d.effects.shadows.ShadowFactory
getShadowQuality, getShadowSoftness, getShadowTextureUnit, isEnabled, onShadowReceiverStateChanged, setShadowSoftness, setShadowTextureUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHADOW_FACTORY_ID

public static final ShadowFactory.ShadowFactoryIdentifier SHADOW_FACTORY_ID
Constructor Detail

ShadowMappingFactory

public ShadowMappingFactory()
Method Detail

getShadowFactoryId

public ShadowFactory.ShadowFactoryIdentifier getShadowFactoryId()

Specified by:
getShadowFactoryId in class ShadowFactory
Returns:
the (partially) unique id, that maps the shadow-factory to the render-code.

getDepthRenderTarget

public TextureRenderTarget getDepthRenderTarget()

getRenderBinProvider

public ShadowMappingFactory.HackedRenderBinProvider getRenderBinProvider()

getGenerationPass

public RenderPass getGenerationPass()

calculateScreenScale

protected float calculateScreenScale()

calculateTextureMatrix

protected void calculateTextureMatrix(float fovy,
                                      float aspect,
                                      float near,
                                      float far,
                                      Transform3D lightTransform,
                                      Transform3D viewTransform,
                                      Transform3D textureTransform)
Parameters:
fovy -
aspect -
near -
far -
lightTransform -
viewTransform -
textureTransform -

setupRenderPass

public RenderPass setupRenderPass(View view,
                                  Light light,
                                  float viewportAspect,
                                  RenderBin shadowBin,
                                  long frameId,
                                  boolean justForCulling)

Specified by:
setupRenderPass in class ShadowFactory

getShadowMap

public Texture2D getShadowMap()

getShadowMapAttributes

public TextureAttributes getShadowMapAttributes()

getShadowAtom

public ShadowAtom getShadowAtom(Node node)
This is called by the FrustumCuller, if a Node with occluder has been detected within the frustum.

Specified by:
getShadowAtom in class ShadowFactory

verifyLight

public void verifyLight(Light light)
Checks, if the Light is accepted as "shadow caster". throws an ecception, if it is not accepted.

Specified by:
verifyLight in class ShadowFactory

needsPerLightCulling

public boolean needsPerLightCulling()

Specified by:
needsPerLightCulling in class ShadowFactory
Returns:
whether this ShadowFactory needs per-light-frustum-culling.

setShadowQuality

public void setShadowQuality(int quality)

Overrides:
setShadowQuality in class ShadowFactory

getLightViewport

public org.openmali.types.twodee.Sized2iRO getLightViewport()

Specified by:
getLightViewport in class ShadowFactory

onOccluderStateChanged

public void onOccluderStateChanged(Node node,
                                   boolean isOccluder)
This must be called from the scenegraph when a node's occluder state is changed.

Specified by:
onOccluderStateChanged in class ShadowFactory

setEnabled

public void setEnabled(boolean enabled)

Specified by:
setEnabled in interface org.jagatoo.datatypes.Enableable
Overrides:
setEnabled in class ShadowFactory