uniform mapping collection
#include <uniform_bindings.hpp>
Public Member Functions | |
void | insert (std::string const &name_in_shader, enum logical_uniform u) |
void | insert (std::string shader_name, std::string parameter_name, enum uniform_type type, int count) |
std::string const & | name (enum logical_uniform u) const |
enum logical_uniform | logical_uniform (std::string const &name_in_shader) const |
void | bind_uniforms (class uniform_bindings &bindings, class program &program, class uniform_source &source) |
void | bind_uniforms (class uniform_bindings &bindings, class program &program, class uniform_parameter_source &source) |
Definition at line 154 of file uniform_bindings.hpp.
void renderstack::uniform_mappings::insert | ( | std::string const & | name_in_shader, | |
enum logical_uniform | u | |||
) | [inline] |
Definition at line 157 of file uniform_bindings.hpp.
void renderstack::uniform_mappings::insert | ( | std::string | shader_name, | |
std::string | parameter_name, | |||
enum uniform_type | type, | |||
int | count | |||
) | [inline] |
Definition at line 162 of file uniform_bindings.hpp.
std::string const & renderstack::uniform_mappings::name | ( | enum logical_uniform | u | ) | const |
Definition at line 156 of file uniform_bindings.cpp.
enum logical_uniform renderstack::uniform_mappings::logical_uniform | ( | std::string const & | name_in_shader | ) | const |
Definition at line 171 of file uniform_bindings.cpp.
00172 { 00173 std::map<std::string, enum logical_uniform>::const_iterator i = m_string_to_uniform.find(name); 00174 if(i != m_string_to_uniform.end()) 00175 { 00176 return (*i).second; 00177 } 00178 else 00179 { 00180 return logical_uniform_generic_uniform; 00181 } 00182 }
void renderstack::uniform_mappings::bind_uniforms | ( | class uniform_bindings & | bindings, | |
class program & | program, | |||
class uniform_source & | source | |||
) |
Definition at line 184 of file uniform_bindings.cpp.
00189 { 00190 for( 00191 std::map< 00192 std::string, 00193 enum logical_uniform 00194 >::const_iterator i = m_string_to_uniform.begin(); 00195 i != m_string_to_uniform.end(); 00196 ++i 00197 ) 00198 { 00199 std::string const &name = (*i).first; 00200 enum logical_uniform lu = (*i).second; 00201 00202 if(program.has_uniform(name) == true) 00203 { 00204 int gl_slot = program.uniform(name).gl_slot(); 00205 if(gl_slot < 0) 00206 { 00207 continue; 00208 } 00209 if(source.connect(bindings, lu, gl_slot) == true) 00210 { 00211 #if 0 00212 ::rs_log("bound %s slot %d\n", name.c_str(), gl_slot); 00213 #endif 00214 } 00215 } 00216 00217 } 00218 }
void renderstack::uniform_mappings::bind_uniforms | ( | class uniform_bindings & | bindings, | |
class program & | program, | |||
class uniform_parameter_source & | source | |||
) |
Definition at line 221 of file uniform_bindings.cpp.
00226 { 00227 for( 00228 std::vector<std::tr1::shared_ptr<uniform_mapping> >::const_iterator i = m_parameter_mappings.begin(); 00229 i != m_parameter_mappings.end(); 00230 ++i 00231 ) 00232 { 00233 std::tr1::shared_ptr<uniform_mapping> mapping = *i; 00234 void *value_source = source.parameter(mapping->parameter_name); 00235 00236 if( 00237 (program.has_uniform(mapping->shader_name) == true) && 00238 (value_source != NULL) 00239 ) 00240 { 00241 int gl_slot = program.uniform(mapping->shader_name).gl_slot(); 00242 if(gl_slot < 0) 00243 { 00244 continue; 00245 } 00246 bindings.add( 00247 mapping->type, 00248 gl_slot, 00249 mapping->count, 00250 value_source 00251 ); 00252 #if 0 00253 ::rs_log("source bound %s slot %d count %d\n", mapping->shader_name.c_str(), gl_slot, mapping->count); 00254 #endif 00255 } 00256 00257 } 00258 }