X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fenvironmentmap.cpp;h=2291a2023471ca4c960b1dd922bbff6896b0aa98;hb=1b23728908f5ec9beb08b2b70737c3903745fddc;hp=ced4a1044d2bd4cbe33f388d2299c7fc4025e83e;hpb=6353307898cd397e2bcde13e2448a8a678a60004;p=libs%2Fgl.git diff --git a/source/effects/environmentmap.cpp b/source/effects/environmentmap.cpp index ced4a104..2291a202 100644 --- a/source/effects/environmentmap.cpp +++ b/source/effects/environmentmap.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "environmentmap.h" #include "mesh.h" #include "renderer.h" @@ -10,18 +11,6 @@ using namespace std; namespace Msp { namespace GL { -EnvironmentMap::EnvironmentMap(unsigned s, Renderable &r, Renderable &e): - Effect(r), - environment(e), - irradiance_shprog(Resources::get_global().get("_envmap_irradiance.glsl.shader")), - specular_shprog(Resources::get_global().get("_envmap_specular.glsl.shader")), - fullscreen_mesh(Resources::get_global().get("_fullscreen_quad.mesh")), - sampler(Resources::get_global().get("_linear_clamp.samp")), - mip_sampler(Resources::get_global().get("_mip_clamp.samp")) -{ - init(s, RGB8, 1); -} - EnvironmentMap::EnvironmentMap(unsigned s, PixelFormat f, Renderable &r, Renderable &e): Effect(r), environment(e), @@ -60,7 +49,7 @@ void EnvironmentMap::init(unsigned s, PixelFormat f, unsigned l) depth_buf.storage(DEPTH_COMPONENT32F, size, size, 1); for(unsigned i=0; i<6; ++i) { - TextureCubeFace face = TextureCube::enumerate_faces(i); + TextureCubeFace face = static_cast(i); faces[i].fbo.set_format((COLOR_ATTACHMENT,f, DEPTH_ATTACHMENT,DEPTH_COMPONENT32F)); faces[i].fbo.attach(COLOR_ATTACHMENT, env_tex, face, 0); faces[i].fbo.attach(DEPTH_ATTACHMENT, depth_buf); @@ -87,7 +76,7 @@ void EnvironmentMap::init(unsigned s, PixelFormat f, unsigned l) LinAl::Matrix face_matrices[6]; for(unsigned i=0; i<6; ++i) { - GL::TextureCubeFace face = GL::TextureCube::enumerate_faces(i); + GL::TextureCubeFace face = static_cast(i); GL::Vector3 columns[3]; columns[0] = GL::TextureCube::get_s_direction(face); columns[1] = GL::TextureCube::get_t_direction(face); @@ -151,7 +140,6 @@ void EnvironmentMap::setup_frame(Renderer &renderer) { faces[i].camera.set_position(center); renderer.set_framebuffer(&faces[i].fbo); - renderer.clear(); renderer.set_camera(faces[i].camera); renderer.render(environment); } @@ -198,7 +186,7 @@ void EnvironmentMap::set_debug_name(const string &name) #ifdef DEBUG env_tex.set_debug_name(name+"/environment.texcb"); depth_buf.set_debug_name(name+"/environment_depth.rbuf"); - static const char *face_names[] = { "X+", "X-", "Y+", "Y-", "Z+", "Z-" }; + static const char *const face_names[] = { "X+", "X-", "Y+", "Y-", "Z+", "Z-" }; for(unsigned i=0; i<6; ++i) { faces[i].fbo.set_debug_name(format("%s [FBO:%s]", name, face_names[i]));