Euphoria
attributebinder.cc
Go to the documentation of this file.
2 
3 #include <numeric>
4 
5 #include "render/buffer.h"
6 
7 namespace eu::render
8 {
9  void
11  (
12  const std::vector<ShaderAttribute>& attributes,
13  PointLayout* layout
14  )
15  {
16  const int total_size = std::accumulate
17  (
18  attributes.begin(),
19  attributes.end(),
20  0,
21  [](int value, const ShaderAttribute& att) -> int
22  {
23  return value + att.get_byte_size();
24  }
25  );
26 
27  int offset = 0;
28  for(const auto& attribute: attributes)
29  {
30  layout->bind_data(attribute, total_size, offset);
31  offset += attribute.get_byte_size();
32  }
33  }
34 }
void bind_attributes(const std::vector< ShaderAttribute > &attributes, PointLayout *layout)
Stores what the data in the vertex_buffer is and how it is laid out/used Represents a OpenGL Vertex A...
Definition: buffer.h:34
void bind_data(const ShaderAttribute &attribute, int stride, int offset)
Definition: buffer.cc:110
Represents a shader attribute like vertex, normal or uv coord.