]> git.tdb.fi Git - r2c2.git/blob - source/3d/sky.cpp
Don't crash if a train has no router
[r2c2.git] / source / 3d / sky.cpp
1 #include <msp/gl/renderer.h>
2 #include "catalogue.h"
3 #include "sky.h"
4
5 using namespace Msp;
6
7 namespace R2C2 {
8
9 Sky3D::Sky3D(Catalogue3D &cat):
10         GL::ObjectInstance(cat.get<GL::Object>("sky.object"))
11 { }
12
13 void Sky3D::setup_render(GL::Renderer &renderer, const GL::Tag &) const
14 {
15         GL::Vector4 sky_dir = renderer.matrix_stack().top()*GL::Vector4(0, 0 ,1, 0);
16         shdata.uniform("eye_sky_dir", sky_dir.x, sky_dir.y, sky_dir.z);
17         renderer.add_shader_data(shdata);
18 }
19
20 } // namespace R2C2