diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2011-01-23 22:31:36 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2011-01-26 21:22:46 -0800 |
commit | b2a30c5914b51b47ff7b5e75dd4c61060b7666d7 (patch) | |
tree | e1af5b185b869def9df220faa5af4a4172a81ffa | |
parent | bfb61a78713327dc8ae70caf52538270f89afc77 (diff) |
Mark top sphere as an occluder; only draw occluders into shadowtex.
-rwxr-xr-x | src/scene.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/scene.cpp b/src/scene.cpp index 333fbee..be5586f 100755 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -79,6 +79,13 @@ static const GLUvec4 sphere_locations[] = { GLUvec4(0.0, 4.0, 0.0, 0.0), }; +static const bool sphere_occluder[] = { + false, + false, + false, + true, +}; + static float specular_exponent[ELEMENTS_OF(sphere_locations)] = { 198.0, 64.0, @@ -115,7 +122,7 @@ static GLuint cubemap; static patch_set_info *object = NULL; void -Render(const GLUvec4 &look_at) +Render(const GLUvec4 &look_at, bool occluders_only) { const patch_set_info *info = object; @@ -145,8 +152,10 @@ Render(const GLUvec4 &look_at) info->attribs[attr].stride, BUFFER_OFFSET(info->attribs[attr].base)); - for (unsigned i = 0; i < ELEMENTS_OF(sphere_locations); i++) { + if (occluders_only && !sphere_occluder[i]) + continue; + const GLUmat4 m(gluTranslate(sphere_locations[i]) * model); const GLUmat4 mv(view * m); const GLUmat4 mvp(projection_matrix * mv); @@ -188,14 +197,14 @@ void RenderPhong() { glUseProgram(phong_prog); - Render(eye); + Render(eye, false); } void RenderShadow() { glUseProgram(shadow_prog); - Render(light); + Render(light, true); } |