shdata.uniform("env_world_matrix", LinAl::SquareMatrix<float, 3>::identity());
}
+void EnvironmentMap::set_fixed_position(const Vector3 &p)
+{
+ fixed_position = p;
+ use_fixed_pos = true;
+}
+
void EnvironmentMap::set_depth_clip(float n, float f)
{
for(unsigned i=0; i<6; ++i)
update_delay = update_interval-1;
environment.setup_frame(renderer);
- const Matrix *matrix = renderable.get_matrix();
- if(!matrix)
- return;
+ Vector3 center;
+ if(use_fixed_pos)
+ center = fixed_position;
+ else
+ {
+ const Matrix *matrix = renderable.get_matrix();
+ if(!matrix)
+ return;
+
+ center = matrix->column(3).slice<3>(0);
+ }
Renderer::Push push(renderer);
Renderer::Exclude exclude1(renderer, renderable);
Renderer::Exclude exclude2(renderer, *this);
- Vector3 center = matrix->column(3).slice<3>(0);
-
for(unsigned i=0; i<6; ++i)
{
faces[i].camera.set_position(center);
TextureCube env_tex;
Texture2D depth_buf;
Face faces[6];
+ Vector3 fixed_position;
+ bool use_fixed_pos = false;
TextureCube irradiance;
const Program &irradiance_shprog;
EnvironmentMap(unsigned size, PixelFormat, Renderable &rend, Renderable &env);
EnvironmentMap(unsigned size, PixelFormat, unsigned, Renderable &rend, Renderable &env);
+ void set_fixed_position(const Vector3 &);
+
void set_depth_clip(float, float);
/** Sets the interval in frames between environment map updates. A value of