Euphoria
bufferbuilder2d.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 
5 
6 #include "base/vec2.h"
7 
8 
9 namespace eu::core
10 {
11  struct BufferPoint2
12  {
13  const vec2f pos;
14  const vec2f uv;
15 
16  BufferPoint2(float x, float y, float u, float v);
17  BufferPoint2(const vec2f& p, const vec2f& u);
18  };
19 
21  {
22  std::vector<float> data;
23  std::vector<unsigned int> tris;
24 
26 
27  void
28  add_vertex(const BufferPoint2& p);
29 
30  // ccw
31  void
32  add_triangle(unsigned int a, unsigned int b, unsigned int c);
33 
34  // bottom->top, left->right
35  // c --- d
36  // | |
37  // a --- b
38  void
39  add_quad(const BufferPoint2& a, const BufferPoint2& b, const BufferPoint2& c, const BufferPoint2& d);
40 
41  void
42  dump(const std::string& filename) const;
43  };
44 }
void add_vertex(const BufferPoint2 &p)
void add_quad(const BufferPoint2 &a, const BufferPoint2 &b, const BufferPoint2 &c, const BufferPoint2 &d)
std::vector< unsigned int > tris
void add_triangle(unsigned int a, unsigned int b, unsigned int c)
std::vector< float > data
void dump(const std::string &filename) const
BufferPoint2(float x, float y, float u, float v)
Definition: vec2.h:33