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
15#include "galaxy/meta/Memory.hpp"
16
17namespace galaxy
18{
19 namespace graphics
20 {
24 struct Vertex final
25 {
29 glm::vec2 m_pos;
30
34 glm::vec2 m_texels;
35 };
36
45 std::array<Vertex, 4> gen_quad_vertices(const float width, const float height);
46
52 std::array<unsigned int, 6> gen_default_indices();
53
64 template<meta::is_arithmetic Type>
65 [[nodiscard]]
66 inline float map_x_texel(const Type x, const float width)
67 {
68 return static_cast<float>(x) / width;
69 }
70
81 template<meta::is_arithmetic Type>
82 [[nodiscard]]
83 inline float map_y_texel(const Type y, const float height)
84 {
85 return static_cast<float>(y) / height;
86 }
87 } // namespace graphics
88} // namespace galaxy
89
90#endif
std::array< Vertex, 4 > gen_quad_vertices(const float width, const float height)
Generate some default verticies.
Definition Vertex.cpp:14
float map_y_texel(const Type y, const float height)
Takes in a y positon texture coord and maps it to a texel.
Definition Vertex.hpp:83
float map_x_texel(const Type x, const float width)
Takes in a x positon texture coord and maps it to a texel.
Definition Vertex.hpp:66
std::array< unsigned int, 6 > gen_default_indices()
Generate some default indicies.
Definition Vertex.cpp:37
Animated.cpp galaxy.
Definition Animated.cpp:16
Represents a single vertex point.
Definition Vertex.hpp:25
glm::vec2 m_pos
Position..
Definition Vertex.hpp:29
glm::vec2 m_texels
Texture coords.
Definition Vertex.hpp:34