renderstack::vertex_format Class Reference

collection of vertex attributes

#include <vertex_format.hpp>

Public Member Functions

 vertex_format ()
 ~vertex_format ()
void append (vertex_attribute &attribute)
bool has_attribute (vertex_attribute_usage usage, int index=0) const
vertex_attribute const & attribute (vertex_attribute_usage usage, int index=0) const
int stride () const

Detailed Description

Definition at line 96 of file vertex_format.hpp.


Constructor & Destructor Documentation

renderstack::vertex_format::vertex_format (  ) 

Definition at line 92 of file vertex_format.cpp.

00093 :    m_stride(0)
00094 {
00095 }

renderstack::vertex_format::~vertex_format (  ) 

Definition at line 97 of file vertex_format.cpp.

00098 {
00099 }


Member Function Documentation

void renderstack::vertex_format::append ( vertex_attribute attribute  ) 

Definition at line 101 of file vertex_format.cpp.

00102 {
00103     int size = gl_size_of_type(attribute.gl_type_code()) * attribute.dimension();
00104 
00105     attribute.set_offset(m_stride);
00106     m_attributes.push_back(attribute);
00107 
00108     m_stride += size;
00109 }

bool renderstack::vertex_format::has_attribute ( vertex_attribute_usage  usage,
int  index = 0 
) const

Definition at line 111 of file vertex_format.cpp.

00115 {
00116     for(
00117         std::vector<vertex_attribute>::const_iterator i = m_attributes.begin();
00118         i != m_attributes.end();
00119         ++i
00120     )
00121     {
00122         vertex_attribute const &attribute = *i;
00123 
00124         if(
00125             (attribute.usage() == usage) &&
00126             (attribute.index() == index)
00127         )
00128         {
00129             return true;
00130         }
00131     }
00132 
00133     return false;
00134 }

vertex_attribute const & renderstack::vertex_format::attribute ( vertex_attribute_usage  usage,
int  index = 0 
) const

Definition at line 136 of file vertex_format.cpp.

00140 {
00141     for(
00142         std::vector<vertex_attribute>::const_iterator i = m_attributes.begin();
00143         i != m_attributes.end();
00144         ++i
00145     )
00146     {
00147         vertex_attribute const &attribute = *i;
00148 
00149         if(
00150             (attribute.usage() == usage) &&
00151             (attribute.index() == index)
00152         )
00153         {
00154             return attribute;
00155         }
00156     }
00157 
00158     throw vertex_attribute_not_found_exception(usage, index);
00159 }

int renderstack::vertex_format::stride (  )  const

Definition at line 161 of file vertex_format.cpp.

00162 {
00163     return m_stride;
00164 }


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