Package de.coreengine.system.gameObjects
Class ShadowBox
- java.lang.Object
-
- de.coreengine.system.GameObject
-
- de.coreengine.system.gameObjects.ShadowBox
-
public class ShadowBox extends GameObject
-
-
Field Summary
-
Fields inherited from class de.coreengine.system.GameObject
parent
-
-
Constructor Summary
Constructors Constructor Description ShadowBox()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.vecmath.Vector3f
getCenter()
Calculates the center of the "view cuboid" in light space first, and then converts this to world space using the inverse light's view matrix.protected float
getHeight()
protected float
getLength()
javax.vecmath.Vector3f
getLightDirection()
Read/Writeable vector of the light/shadow direction (most likely inverted lightposition)protected float
getWidth()
void
onInit()
This method gets called once in the GameObject life cycle.void
onRender()
In this method the GameObject gets rendered onto the screen (if it has an graphical representation).void
onUpdate()
Updates the bounds of the shadow box based on the light direction and the camera's view frustum, to make sure that the box covers the smallest area possible while still ensuring that everything inside the camera's view (within a certain range) will cast shadows.void
setViewCamera(Camera viewCamera)
Set camera to align shadow map to view frustuum-
Methods inherited from class de.coreengine.system.GameObject
addActionToPhysicWorld, addChild, addRigidBodyToWorld, getScene, onAdd, onLoad, onPauseUpdate, onRemove, onSave, onSyncronize, removeChild, setShouldRender, setShouldSyncronize, setShouldUpdate
-
-
-
-
Method Detail
-
setViewCamera
public void setViewCamera(Camera viewCamera)
Set camera to align shadow map to view frustuum- Parameters:
viewCamera
- Camera to align to
-
getLightDirection
public javax.vecmath.Vector3f getLightDirection()
Read/Writeable vector of the light/shadow direction (most likely inverted lightposition)- Returns:
- Read/Writeable vector of the light/shadow direction
-
onInit
public void onInit()
Description copied from class:GameObject
This method gets called once in the GameObject life cycle. Even if the GameObject gets removed and readded, this method dont gets called again. Its like an additional constructor, except that its not gets called when the GameObject gets created, but when its first has to action.- Overrides:
onInit
in classGameObject
-
onUpdate
public void onUpdate()
Updates the bounds of the shadow box based on the light direction and the camera's view frustum, to make sure that the box covers the smallest area possible while still ensuring that everything inside the camera's view (within a certain range) will cast shadows.- Overrides:
onUpdate
in classGameObject
-
getCenter
protected javax.vecmath.Vector3f getCenter()
Calculates the center of the "view cuboid" in light space first, and then converts this to world space using the inverse light's view matrix.- Returns:
- The center of the "view cuboid" in world space.
-
getWidth
protected float getWidth()
- Returns:
- The width of the "view cuboid" (orthographic projection area).
-
getHeight
protected float getHeight()
- Returns:
- The height of the "view cuboid" (orthographic projection area).
-
getLength
protected float getLength()
- Returns:
- The length of the "view cuboid" (orthographic projection area).
-
onRender
public void onRender()
Description copied from class:GameObject
In this method the GameObject gets rendered onto the screen (if it has an graphical representation). Its primary used for MasterRenderer calls.- Overrides:
onRender
in classGameObject
-
-