attribute_mapping collection
#include <attribute_bindings.hpp>
Public Member Functions | |
void | insert (std::string const &name, enum vertex_attribute_usage usage, int index, int dimension) |
void | bind_attributes (class attribute_bindings &bindings, class program const &program, class mesh const &mesh) const |
Definition at line 67 of file attribute_bindings.hpp.
void renderstack::attribute_mappings::insert | ( | std::string const & | name, | |
enum vertex_attribute_usage | usage, | |||
int | index, | |||
int | dimension | |||
) | [inline] |
Definition at line 70 of file attribute_bindings.hpp.
void renderstack::attribute_mappings::bind_attributes | ( | class attribute_bindings & | bindings, | |
class program const & | program, | |||
class mesh const & | mesh | |||
) | const |
Definition at line 34 of file attribute_bindings.cpp.
00039 { 00040 for( 00041 std::vector<std::tr1::shared_ptr<attribute_mapping> >::const_iterator i = m_mappings.begin(); 00042 i != m_mappings.end(); 00043 ++i 00044 ) 00045 { 00046 class vertex_format const &vertex_format = mesh.vertex_buffer()->vertex_format(); 00047 00048 std::tr1::shared_ptr<attribute_mapping> mapping = *i; 00049 00050 if( 00051 (program.has_attribute(mapping->name) == true) && 00052 (vertex_format.has_attribute(mapping->usage, mapping->index) == true) 00053 ) 00054 { 00055 class vertex_attribute const &vertex_attribute = vertex_format.attribute(mapping->usage, mapping->index); 00056 00057 bindings.add( 00058 program.attribute(mapping->name).gl_slot(), /* index */ 00059 vertex_attribute.dimension(), /* size */ 00060 vertex_attribute.gl_type_code(), /* type */ 00061 GL_FALSE, /* normalized */ 00062 vertex_format.stride(), /* stride */ 00063 reinterpret_cast<const ::GLvoid *>( /* pointer */ 00064 vertex_attribute.offset() 00065 ) 00066 ); 00067 } 00068 00069 } 00070 }