Symphony Of Empires
primitive.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 // primitive.hpp
20 //
21 // Abstract:
22 // Does some important stuff.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <glm/glm.hpp>
28 #include <glm/vec2.hpp>
29 #include <glm/vec3.hpp>
30 
31 #include "eng3d/mesh.hpp"
32 #include "eng3d/rectangle.hpp"
33 
34 namespace Eng3D {
35  struct Line : Eng3D::MeshStatic<2, 0, glm::vec2, glm::vec2> {
36  Line(glm::vec2 start, glm::vec2 end);
37  ~Line() = default;
38  };
39 
40  struct Quad : Eng3D::MeshStatic<6, 0, glm::vec3, glm::vec2> {
41  Quad(glm::vec3 c1, glm::vec3 c2, glm::vec3 c3, glm::vec3 c4);
42  ~Quad() = default;
43  };
44 
45  struct Quad2D : Eng3D::MeshStatic<6, 0, glm::vec2, glm::vec2> {
46  Quad2D();
47  ~Quad2D() = default;
48  };
49 
50  struct Square : Eng3D::MeshStatic<6, 0, glm::vec2, glm::vec2> {
51  Square(float start_x, float start_y, float end_x, float end_y);
52  Square(const Eng3D::Rectangle& pos, const Eng3D::Rectangle& texcoord);
53  ~Square() = default;
54  };
55 
56  struct TriangleList : Eng3D::Mesh<glm::vec3, glm::vec2> {
57  TriangleList(std::vector<glm::vec3>& positions, std::vector<glm::vec2>& tex_coords);
58  ~TriangleList() = default;
59  };
60 
61  class Sphere : public Eng3D::Mesh<glm::vec3, glm::vec2> {
62  Eng3D::MeshData<glm::vec3, glm::vec2> calc_pos(glm::vec3 center_pos, float longitude, float latitude);
63  int resolution;
64  public:
65  Sphere(float x, float y, float z, float radius, int resolution, bool cw_winding = true);
66  ~Sphere() = default;
67  float radius;
68  };
69 }
~Sphere()=default
Sphere(float x, float y, float z, float radius, int resolution, bool cw_winding=true)
Definition: primitive.cpp:101
Line(glm::vec2 start, glm::vec2 end)
Definition: primitive.cpp:36
~Line()=default
Packed model - packs both vertices and texcoords into the same buffer.
Definition: mesh.hpp:144
A static mesh with fixed number of elements.
Definition: mesh.hpp:192
~Quad2D()=default
Quad(glm::vec3 c1, glm::vec3 c2, glm::vec3 c3, glm::vec3 c4)
Definition: primitive.cpp:44
~Quad()=default
Square(float start_x, float start_y, float end_x, float end_y)
Definition: primitive.cpp:68
~Square()=default
TriangleList(std::vector< glm::vec3 > &positions, std::vector< glm::vec2 > &tex_coords)
Definition: primitive.cpp:92
~TriangleList()=default