|
| ShadowMap (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
virtual | ~ShadowMap () |
|
void | draw () const |
|
void | reset () |
|
void | update (double deltaT) |
|
void | setShader (Shader *val) |
|
glm::mat4 | getDepthMVP () const |
|
glm::mat4 | getDepthBiasMVP () const |
|
GLuint | getDepthTexture () const |
|
| Light (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1)) |
| Construct new light. More...
|
|
virtual | ~Light () |
|
glm::vec3 | getPower () const |
|
glm::vec3 | getDiffuse () const |
|
glm::vec3 | getAmbient () const |
|
glm::vec3 | getSpecular () const |
|
glm::vec3 | getPosition () const |
|
void | setPower (const glm::vec3 &val) |
|
void | setDiffuse (const glm::vec3 &val) |
|
void | setAmbient (const glm::vec3 &val) |
|
void | setSpecular (const glm::vec3 &val) |
|
| SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
| SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
virtual | ~SceneObject () |
|
Model * | getModel () const |
|
Shader * | getShader () const |
|
glm::mat4 | getModelMatrix () const |
|
glm::mat4 | getGlobalModelMatrix () const |
|
std::string | getName () const |
|
std::shared_ptr< SceneObject > | getParent () const |
|
void | setAnimationTime (double time) |
|
bool | setAnimation (const Animation &anim) |
|
bool | delChild (size_t idx) |
|
bool | getChild (size_t idx, std::shared_ptr< SceneObject > &child) const |
|
bool | addChild (std::shared_ptr< SceneObject > &child) |
|
bool | remEffect (const std::string &name) |
|
SceneObject * | getEffect (const std::string &name) const |
|
bool | addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect) |
|
bool | doNotRender () |
|
bool | getIsVolSun () |
|
virtual bool | animate (double time) |
|
Implementation of the shadow map effect.
- Author
- Adam
The scene is being rendered from the light source into a FrameBuffer, which has a texture attached to it. The texture will contain at each position the distance from the light source. When rendering the scene using the camera, the same distance is computed and compared with the one in the texture. If it is less, then the fragment is in shadow. To improve the quality of the shadows, PCF is being used. This is achived by using sampler2Dshadow in the fragment shader. The comparison must be enabled in texture parameters. To requesting a value from the sampler2Dshadow, the x and y texture coordinates and the light distance in the z are given. The sampler will compare also neighboring texels and gives back a value between 0 and 1, the ratio of the texels, which were less then the requested z.
- See also
- http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/