Symphony Of Empires
curve.hpp
Go to the documentation of this file.
1 // Eng3D - General purpouse game engine
2 // Copyright (C) 2021, Eng3D contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // curve.hpp
20 //
21 // Abstract:
22 // Does some important stuff.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <vector>
28 #include <memory>
29 #include <glm/vec2.hpp>
30 #include <glm/mat4x4.hpp>
31 #include "eng3d/primitive.hpp"
32 
33 namespace Eng3D {
34  namespace OpenGL {
35  class Program;
36  }
37 
38  struct Curve {
39  Curve() = default;
40  Curve(std::vector<glm::vec3> points, std::vector<glm::vec3> normals, float width);
41  ~Curve() = default;
42  // Curve(glm::vec2 p1, glm::vec2 p2, float width);
43  void add_line(std::vector<glm::vec3> points, std::vector<glm::vec3> normals, float width);
44  void upload();
45 #if defined E3D_BACKEND_OPENGL || defined E3D_BACKEND_GLES
46  void draw();
47 #else
48 # error not implemented
49 #endif
50  private:
51  void create_line(const std::vector<glm::vec3>& points, const std::vector<glm::vec3>& normals, float width);
52  void add_quad(glm::vec3 c1, glm::vec3 c2, glm::vec3 c3, glm::vec3 c4);
53  std::vector<glm::vec3> positions;
54  std::vector<glm::vec2> tex_coords;
55  std::unique_ptr<TriangleList> quads;
56  };
57 }
void draw(const Eng3D::OpenGL::VAO &vao, MeshMode mode, const void *indices, size_t n_indices, const void *buffer, size_t n_buffer, int instances)
Definition: mesh.cpp:136
void add_line(std::vector< glm::vec3 > points, std::vector< glm::vec3 > normals, float width)
Definition: curve.cpp:40
void upload()
Definition: curve.cpp:45
~Curve()=default
Curve()=default