public class ShadowHelper
extends java.lang.Object
GLSLShadowInjector| Constructor and Description |
|---|
ShadowHelper(FrameBuffer buffer,
Projector lightSource,
int maxSize)
Creates a new shadow helper.
|
ShadowHelper(FrameBuffer buffer,
Projector lightSource,
int maxSize,
float bias)
Creates a new shadow helper.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCaster(Object3D obj)
Adds a caster.
|
void |
addReceiver(Object3D obj)
Adds a receiver.
|
int |
getCasterCount()
Gets the number of casters in the helper.
|
float |
getEdgeSize()
Returns the relative edge size used, if edge smoothing is enabled.
|
int |
getFilterSize()
Returns the size of the filter kernel used, if PCF is enabled.
|
Projector |
getLightSource()
Returns the light source.
|
int |
getReceiverCount()
Gets the number of receivers in the helper.
|
Texture |
getShadowMap()
Returns the shadow map's texture.
|
static int |
getShadowMode()
Returns the shadow mode.
|
boolean |
isAutoAdjustFov()
Returns if the fov will be adjusted automatically or not.
|
void |
removeCaster(Object3D caster)
Removes a caster.
|
static void |
resetTextureCounter()
Resets the texture counter.
|
void |
setAdditionalColorMode(boolean disabled)
Sets how an objects additional color will be treated.
|
void |
setAmbientLight(RGBColor col)
Sets the ambient lighting used during the shadow pass.
|
void |
setAutoAdjustFov(boolean autoAdjustFov)
If enabled, the fov will be adjusted to the near plane of the projector
to avoid the "zoom-in" effect that this will otherwise have.
|
void |
setBorder(int width)
Sets a border around the actual shadow map to prevent the shadows from
bleeding into parts of the scene that are not covered by the projector's
view.
|
void |
setCullingMode(boolean inverted)
Sets the culling mode.
|
void |
setEdgeSize(float edgeSize)
Sets the relative edge size used, if edge smoothing is enabled.
|
void |
setFilterSize(int filterSize)
Sets the size of the filter kernel used, if PCF is enabled.
|
void |
setLightMode(boolean disabled)
Sets the lighting mode.
|
void |
setLightSource(Projector projector)
Sets the light source to another one.
|
static void |
setShadowMode(int shadowMode)
Sets the shadow mode.This method is static and it's actually a short cut
to the method with the same name in GLSLShadowInjector.
|
void |
updateShadowMap(FrameBuffer buffer,
World world)
Updates the shadow map.
|
public ShadowHelper(FrameBuffer buffer, Projector lightSource, int maxSize)
buffer - the framebuffer into which will be renderedlightSource - the light source that casts the shadowsmaxSize - the maximum size of the shadow map. The actual resolution
might be lower if the hardware doesn't support this size. Has
to be a power of 2.public ShadowHelper(FrameBuffer buffer, Projector lightSource, int maxSize, float bias)
buffer - the framebuffer into which will be renderedlightSource - the light source that casts the shadowsmaxSize - the maximum size of the shadow map. The actual resolution
might be lower if the hardware doesn't support this size. Has
to be a power of 2.bias - the offset of the depth to prevent shadow acne. Default is
0.008f.public void addCaster(Object3D obj)
obj - the new casterpublic void addReceiver(Object3D obj)
obj - the receiverpublic static void resetTextureCounter()
public Projector getLightSource()
public void setLightSource(Projector projector)
lightSource - the new sourcepublic void setBorder(int width)
width - public void setCullingMode(boolean inverted)
inverted - should it be inverted?public void setLightMode(boolean disabled)
disabled - should the light be disabled during shadow pass? Default is
true.public void setAdditionalColorMode(boolean disabled)
disabled - should the additional color be disabled during shadow pass?
Default is true.public void setAmbientLight(RGBColor col)
col - the color of the light source. Default is 60,60,60public int getReceiverCount()
public int getCasterCount()
public void removeCaster(Object3D caster)
caster - the caster to removepublic Texture getShadowMap()
public void updateShadowMap(FrameBuffer buffer, World world)
buffer - the current FrameBufferworld - the world instance that contains the objects that should cast
shadowspublic boolean isAutoAdjustFov()
public void setAutoAdjustFov(boolean autoAdjustFov)
autoAdjustFov - should it be adjusted?public static int getShadowMode()
GLSLShadowInjector.getShadowMode(),
GLSLShadowInjector.NORMAL_SHADOWS,
GLSLShadowInjector.NORMAL_SHADOWS_WITH_EDGE_SMOOTHING,
GLSLShadowInjector.PCF_FILTERED_SHADOWS,
GLSLShadowInjector.PCF_FILTERED_SHADOWS_WITH_EDGE_SMOOTHINGpublic static void setShadowMode(int shadowMode)
shadowMode - the shadow mode as defined by the constants in
GLSLShadowInjectorGLSLShadowInjector.setShadowMode(int),
GLSLShadowInjector.NORMAL_SHADOWS,
GLSLShadowInjector.NORMAL_SHADOWS_WITH_EDGE_SMOOTHING,
GLSLShadowInjector.PCF_FILTERED_SHADOWS,
GLSLShadowInjector.PCF_FILTERED_SHADOWS_WITH_EDGE_SMOOTHINGpublic float getEdgeSize()
public void setEdgeSize(float edgeSize)
edgeSize - the sizepublic int getFilterSize()
public void setFilterSize(int filterSize)
filterSize - the size