All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VertexBinding.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Rendering.h"
6 #include "VertexBindingElement.h"
7 #include "VertexAttribs.h"
8 
9 namespace Eegeo
10 {
11  namespace Rendering
12  {
13  namespace VertexLayouts
14  {
19  {
20  public:
21  VertexBinding(const VertexLayout& vertexLayout, const VertexAttribs& vertexAttribs);
22 
23  void BindVertices() const;
24  void UnbindVertices() const;
25 
26  void AddElement(VertexBindingElement element);
27 
28  inline bool operator< (const VertexBinding& other) const
29  {
30  if(m_elements.size() == other.m_elements.size())
31  {
32  for(int i = 0; i < m_elements.size(); ++i)
33  {
34  if(m_elements[i] == other.m_elements[i])
35  {
36  continue;
37  }
38  else
39  {
40  return m_elements[i] < other.m_elements[i];
41  }
42  }
43 
44  return false;
45  }
46  else
47  {
48  return m_elements.size() < other.m_elements.size();
49  }
50  }
51 
52  inline bool operator== (const VertexBinding& other) const
53  {
54  if(m_elements.size() == other.m_elements.size())
55  {
56  for(int i = 0; i < m_elements.size(); ++i)
57  {
58  if(m_elements[i] != other.m_elements[i])
59  {
60  return false;
61  }
62  }
63 
64  return true;
65  }
66  else
67  {
68  return false;
69  }
70  }
71 
72  private:
73  typedef std::vector<VertexBindingElement> TBindingElements;
74  TBindingElements m_elements;
75  };
76  }
77  }
78 }