bloboland
diff src/renderer.cc @ 5:2f4406cc341e
meh
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 19 Dec 2012 02:37:20 +0200 |
parents | 9021a906c5d3 |
children |
line diff
1.1 --- a/src/renderer.cc Tue Dec 18 06:13:09 2012 +0200 1.2 +++ b/src/renderer.cc Wed Dec 19 02:37:20 2012 +0200 1.3 @@ -31,6 +31,7 @@ 1.4 leveltex->create(vol->get_size(0), vol->get_size(1), vol->get_size(2)); 1.5 1.6 blobtex = new Texture1D; 1.7 + blobtex->set_pixel_format(GL_RGBA16F); // floating point textures 1.8 blobtex->create(level->blobs.size()); 1.9 blobtex->set_filtering(GL_NEAREST); 1.10 1.11 @@ -59,11 +60,14 @@ 1.12 1.13 static void draw_cube(const Vector3 &pos, float sz); 1.14 1.15 +void Renderer::prepare() 1.16 +{ 1.17 + leveltex->update((float*)level->terrain->get_data_ptr()); 1.18 + update_blobtex(); 1.19 +} 1.20 + 1.21 void Renderer::render() const 1.22 { 1.23 - leveltex->update((float*)level->terrain->get_data_ptr()); 1.24 - ((Renderer*)this)->update_blobtex(); 1.25 - 1.26 bind_texture(leveltex, 0); 1.27 bind_texture(blobtex, 1); 1.28 1.29 @@ -73,6 +77,8 @@ 1.30 level->terrain->get_size(1), level->terrain->get_size(2)); 1.31 set_uniform_float4(sdrprog, "camprop", fov, aspect, 0, 0); 1.32 1.33 + set_uniform_int(sdrprog, "num_blobs", (int)level->blobs.size()); 1.34 + 1.35 set_uniform_int(sdrprog, "voltex", 0); 1.36 set_uniform_int(sdrprog, "blobtex", 1); 1.37 bind_program(sdrprog);