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
16
17namespace galaxy
18{
22 struct Vertex final
23 {
27 glm::vec2 m_pos;
28
32 glm::vec2 m_texels;
33 };
34
35 namespace graphics
36 {
45 std::array<Vertex, 4> gen_quad_vertices(const float width, const float height) noexcept;
46
52 std::array<unsigned int, 6> gen_default_indices() noexcept;
53
64 template<meta::is_arithmetic Type>
65 [[nodiscard]]
66 inline float map_x_texel(const Type x, const float width) noexcept
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) noexcept
84 {
85 return static_cast<float>(y) / height;
86 }
87 } // namespace graphics
88} // namespace galaxy
89
90#endif
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:83
std::array< Vertex, 4 > gen_quad_vertices(const float width, const float height) noexcept
Generate some default verticies.
Definition Vertex.cpp:14
std::array< unsigned int, 6 > gen_default_indices() noexcept
Generate some default indicies.
Definition Vertex.cpp:41
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:66
Animated.cpp galaxy.
Definition Animated.cpp:16
Represents a single vertex point.
Definition Vertex.hpp:23
glm::vec2 m_pos
Position.
Definition Vertex.hpp:27
glm::vec2 m_texels
Texture coords (uv).
Definition Vertex.hpp:32