X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fambientocclusion.cpp;h=9e376a456f760ce84933b6f5f204f4cd21246cd2;hb=5172d32d67595ea0b70184fadcfcb8e023cccbc8;hp=2775e854cfe1d73b4b5c7f3786e8d440f91a8a66;hpb=5687bb2b8cd7715b5a5c5bb1d75f42992a23a56c;p=libs%2Fgl.git diff --git a/source/ambientocclusion.cpp b/source/ambientocclusion.cpp index 2775e854..9e376a45 100644 --- a/source/ambientocclusion.cpp +++ b/source/ambientocclusion.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of libmspgl -Copyright © 2010 Mikko Rasa, Mikkosoft Productions +Copyright © 2010-2011 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -82,7 +82,9 @@ namespace GL { AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float depth_ratio): occlude_shader(vertex_shader, occlude_fs), + occlude_shdata(occlude_shader), combine_shader(vertex_shader, combine_fs), + combine_shdata(combine_shader), quad(VERTEX2) { occlusion.storage(GL::RGB, w, h); @@ -110,14 +112,14 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float depth_ratio): occlude_texturing.attach(1, rotate_lookup); - occlude_shdata.uniform(occlude_shader.get_uniform_location("depth"), 0); - occlude_shdata.uniform(occlude_shader.get_uniform_location("rotate"), 1); - occlude_shdata.uniform(occlude_shader.get_uniform_location("screen_size"), w, h); + occlude_shdata.uniform("depth", 0); + occlude_shdata.uniform("rotate", 1); + occlude_shdata.uniform("screen_size", w, h); - combine_shdata.uniform(combine_shader.get_uniform_location("color"), 1); - combine_shdata.uniform(combine_shader.get_uniform_location("depth"), 0); - combine_shdata.uniform(combine_shader.get_uniform_location("occlusion"), 2); - combine_shdata.uniform(combine_shader.get_uniform_location("screen_size"), w, h); + combine_shdata.uniform("color", 1); + combine_shdata.uniform("depth", 0); + combine_shdata.uniform("occlusion", 2); + combine_shdata.uniform("screen_size", w, h); set_depth_ratio(depth_ratio); set_darkness(1.5); @@ -135,13 +137,13 @@ void AmbientOcclusion::set_depth_ratio(float depth_ratio) { depth_ratio = 1/depth_ratio; - occlude_shdata.uniform(occlude_shader.get_uniform_location("depth_ratio"), depth_ratio, 1+depth_ratio); - combine_shdata.uniform(combine_shader.get_uniform_location("depth_ratio"), depth_ratio, 1+depth_ratio); + occlude_shdata.uniform("depth_ratio", depth_ratio, 1+depth_ratio); + combine_shdata.uniform("depth_ratio", depth_ratio, 1+depth_ratio); } void AmbientOcclusion::set_darkness(float darkness) { - occlude_shdata.uniform(occlude_shader.get_uniform_location("darkness"), darkness); + occlude_shdata.uniform("darkness", darkness); } void AmbientOcclusion::render(const Texture2D &color, const Texture2D &depth)