renderstack::uniform_bindings Class Reference

uniform_binding collection

#include <uniform_bindings.hpp>

Public Member Functions

void clear ()
bool add (enum uniform_type type, int gl_slot, int count, void *value)
void apply ()

Detailed Description

Definition at line 110 of file uniform_bindings.hpp.


Member Function Documentation

void renderstack::uniform_bindings::clear (  )  [inline]

Definition at line 113 of file uniform_bindings.hpp.

00114     {
00115         m_bindings.clear();
00116     }

bool renderstack::uniform_bindings::add ( enum uniform_type  type,
int  gl_slot,
int  count,
void *  value 
)

Definition at line 35 of file uniform_bindings.cpp.

00041 {
00042     uniform_binding u(type, gl_slot, count, value);
00043 
00044     m_bindings.push_back(u);
00045 
00046     return true;
00047 }

void renderstack::uniform_bindings::apply (  ) 

Definition at line 49 of file uniform_bindings.cpp.

00050 {
00051     for(
00052         std::vector<uniform_binding>::const_iterator i = m_bindings.begin();
00053         i != m_bindings.end();
00054         ++i
00055     )
00056     {
00057         uniform_binding const& binding = *i;
00058 
00059         switch(binding.type)
00060         {
00061             case uniform_type_matrix_4:
00062             {
00063                 ::rs_gl_uniform_matrix_4fv(
00064                     binding.gl_slot,
00065                     binding.count,
00066                     GL_FALSE, 
00067                     reinterpret_cast<::GLfloat const *>(binding.value)
00068                 );
00069                 break;
00070             }
00071             case uniform_type_float:
00072             {
00073                 ::rs_gl_uniform_1fv(
00074                     binding.gl_slot,
00075                     binding.count,
00076                     reinterpret_cast<::GLfloat const *>(binding.value)
00077                 );
00078                 break;
00079             }
00080             case uniform_type_vec2:
00081             {
00082                 ::rs_gl_uniform_2fv(
00083                     binding.gl_slot,
00084                     binding.count,
00085                     reinterpret_cast<::GLfloat const *>(binding.value)
00086                 );
00087                 break;
00088             }
00089             case uniform_type_vec3:
00090             {
00091                 ::rs_gl_uniform_3fv(
00092                     binding.gl_slot,
00093                     binding.count,
00094                     reinterpret_cast<::GLfloat const *>(binding.value)
00095                 );
00096                 break;
00097             }
00098             case uniform_type_vec4:
00099             {
00100                 ::rs_gl_uniform_4fv(
00101                     binding.gl_slot,
00102                     binding.count,
00103                     reinterpret_cast<::GLfloat const *>(binding.value)
00104                 );
00105                 break;
00106             }
00107             case uniform_type_int:
00108             {
00109                 ::rs_gl_uniform_1iv(
00110                     binding.gl_slot,
00111                     binding.count,
00112                     reinterpret_cast<::GLint const *>(binding.value)
00113                 );
00114                 break;
00115             }
00116             case uniform_type_uint:
00117             {
00118                 ::rs_gl_uniform_1uiv(
00119                     binding.gl_slot,
00120                     binding.count,
00121                     reinterpret_cast<::GLuint const *>(binding.value)
00122                 );
00123                 break;
00124             }
00125             case uniform_type_texture_2d:
00126             {
00127                 texture_binding *t = reinterpret_cast<texture_binding*>(binding.value);
00128                 int             texture_index   = t->index;
00129                 class texture   *texture        = t->texture;
00130 
00131                 ::rs_gl_uniform_1i     (binding.gl_slot, texture_index);
00132                 ::rs_gl_active_texture (GL_TEXTURE0 + texture_index);
00133                 ::rs_gl_bind_texture   (texture->gl_bind_target(), texture->gl_texture_object()); 
00134                 ::rs_gl_tex_parameter_i(texture->gl_bind_target(), GL_TEXTURE_WRAP_S,     texture->gl_wrap());
00135                 ::rs_gl_tex_parameter_i(texture->gl_bind_target(), GL_TEXTURE_WRAP_T,     texture->gl_wrap());
00136                 ::rs_gl_tex_parameter_i(texture->gl_bind_target(), GL_TEXTURE_MAG_FILTER, texture->gl_magnification_filter());
00137                 ::rs_gl_tex_parameter_i(texture->gl_bind_target(), GL_TEXTURE_MIN_FILTER, texture->gl_minification_filter());
00138                 break;
00139             }
00140             case uniform_type_texture_cube:
00141             {
00142                 break;
00143             }
00144 
00145             default:
00146             {
00147                 throw false;
00148             }
00149 
00150         }
00151     }
00152 }


The documentation for this class was generated from the following files:
Generated on Sun Apr 11 12:23:12 2010 for RenderStack by  doxygen 1.6.3