galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Vertex.cpp
Go to the documentation of this file.
1
7
8#include <algorithm>
9
10#include "Vertex.hpp"
11
12namespace galaxy
13{
14 namespace graphics
15 {
16 std::vector<Vertex> gen_quad_vertices(const float width, const float height, float depth) noexcept
17 {
18 depth = std::clamp(depth, -1.0f, 1.0f);
19
20 // clang-format off
21 const std::vector<Vertex> vertices =
22 {
23 Vertex {
24 .m_pos = glm::vec3 {0.0f, 0.0f, depth},
25 .m_texels = glm::vec2 {0.0f, 0.0f},
26 .m_index = 0
27 },
28 Vertex {
29 .m_pos = glm::vec3 {width, 0.0f, depth},
30 .m_texels = glm::vec2 {1.0f, 0.0f},
31 .m_index = 0
32 },
33 Vertex {
34 .m_pos = glm::vec3 {width, height, depth},
35 .m_texels = glm::vec2 {1.0f, 1.0f},
36 .m_index = 0
37 },
38 Vertex {
39 .m_pos = glm::vec3 {0.0f, height, depth},
40 .m_texels = glm::vec2 {0.0f, 1.0f},
41 .m_index = 0
42 }
43 };
44 // clang-format on
45
46 return vertices;
47 }
48
49 std::vector<unsigned int> gen_default_indices() noexcept
50 {
51 return {0u, 1u, 3u, 1u, 2u, 3u};
52 }
53 } // namespace graphics
54} // namespace galaxy
thread_local const float vertices[]
Video.cpp galaxy.
Definition Video.cpp:19
std::vector< Vertex > gen_quad_vertices(const float width, const float height, float depth) noexcept
Generate some default verticies.
Definition Vertex.cpp:16
std::vector< unsigned int > gen_default_indices() noexcept
Generate some default indices.
Definition Vertex.cpp:49
Animated.cpp galaxy.
Definition Animated.cpp:16
Represents a single vertex point.
Definition Vertex.hpp:24