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.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_GRAPHICS_GL_VERTEX_HPP_
9#define GALAXY_GRAPHICS_GL_VERTEX_HPP_
10
11#include <array>
12
13#include <glm/vec2.hpp>
14#include <glm/vec3.hpp>
15
17
18namespace galaxy
19{
23 struct Vertex final
24 {
28 glm::vec3 m_pos;
29
33 glm::vec2 m_texels;
34
38 unsigned int m_index;
39 };
40
41 namespace graphics
42 {
52 std::vector<Vertex> gen_quad_vertices(const float width, const float height, float depth) noexcept;
53
59 std::vector<unsigned int> gen_default_indices() noexcept;
60
71 template<meta::is_arithmetic Type>
72 [[nodiscard]]
73 inline float map_x_texel(const Type x, const float width) noexcept
74 {
75 return static_cast<float>(x) / width;
76 }
77
88 template<meta::is_arithmetic Type>
89 [[nodiscard]]
90 inline float map_y_texel(const Type y, const float height) noexcept
91 {
92 return static_cast<float>(y) / height;
93 }
94 } // namespace graphics
95} // namespace galaxy
96
97#endif
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
float map_y_texel(const Type y, const float height) noexcept
Takes in a y positon texture coord and maps it to a texel.
Definition Vertex.hpp:90
float map_x_texel(const Type x, const float width) noexcept
Takes in a x positon texture coord and maps it to a texel.
Definition Vertex.hpp:73
Animated.cpp galaxy.
Definition Animated.cpp:16
Represents a single vertex point.
Definition Vertex.hpp:24
glm::vec2 m_texels
Texture coords (uv).
Definition Vertex.hpp:33
unsigned int m_index
Uniform data index.
Definition Vertex.hpp:38
glm::vec3 m_pos
Position.
Definition Vertex.hpp:28