Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
Shapes.hpp
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5 */
6
7#ifndef ENGINE_SHAPES
8#define ENGINE_SHAPES
9
10#include "Mesh.hpp"
11
12namespace Engine::Graphics {
13
19 class Plane : public Mesh {
20 public:
21 Plane() : Mesh() {
22 AddQuad({-0.5, -0.5, 0, 0, 1}, {0.5, -0.5, 0, 1, 1}, {0.5, 0.5, 0, 1, 0},
23 {-0.5, 0.5, 0, 0, 0});
24 }
25 };
26
32 class Cube : public Mesh {
33 public:
34 Cube() : Mesh() {
35 AddQuad({-0.5, -0.5, -0.5, 0, 1}, {0.5, -0.5, -0.5, 1, 1},
36 {0.5, 0.5, -0.5, 1, 0}, {-0.5, 0.5, -0.5, 0, 0});
37
38 AddQuad({-0.5, -0.5, 0.5, 0, 1}, {-0.5, 0.5, 0.5, 1, 1},
39 {0.5, 0.5, 0.5, 1, 0}, {0.5, -0.5, 0.5, 0, 0});
40
41 AddQuad({-0.5, -0.5, -0.5, 0, 1}, {-0.5, 0.5, -0.5, 0, 0},
42 {-0.5, 0.5, 0.5, 1, 0}, {-0.5, -0.5, 0.5, 1, 1});
43
44 AddQuad({0.5, 0.5, -0.5, 0, 1}, {0.5, -0.5, -0.5, 0, 0},
45 {0.5, -0.5, 0.5, 1, 0}, {0.5, 0.5, 0.5, 1, 1});
46
47 AddQuad({-0.5, -0.5, -0.5, 0, 1}, {-0.5, -0.5, 0.5, 1, 1},
48 {0.5, -0.5, 0.5, 1, 0}, {0.5, -0.5, -0.5, 0, 0});
49
50 AddQuad({-0.5, 0.5, -0.5, 0, 1}, {0.5, 0.5, -0.5, 1, 1},
51 {0.5, 0.5, 0.5, 1, 0}, {-0.5, 0.5, 0.5, 0, 0});
52 }
53 };
54}
55
56#endif
A simple cube mesh.
Definition Shapes.hpp:32
A simple plane mesh.
Definition Shapes.hpp:19