cangine
Loading...
Searching...
No Matches
vertex.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../types/types.hpp"
4#include "../util/color.hpp"
5
6namespace cangine {
14 struct Vertex {
15 float x{0.0f}, y{0.0f}, z{0.0f};
17 Vector2 uv{0.0f, 0.0f};
18
20 constexpr Vertex() noexcept = default;
21
30 constexpr Vertex(float _x, float _y, float _z, const Color& c, const Vector2& texCoord) noexcept
31 : x(_x), y(_y), z(_z), color(c), uv(texCoord) {}
32
40 constexpr Vertex(float _x, float _y, float _z, const Color& c) noexcept
41 : Vertex(_x, _y, _z, c, Vector2{0.0f, 0.0f}) {}
42
49 constexpr Vertex(float _x, float _y, float _z) noexcept
50 : Vertex(_x, _y, _z, Colors::BLACK) {}
51
58 constexpr Vertex(const Vector3& v, const Color& c, const Vector2& texCoord) noexcept
59 : Vertex(v.x, v.y, v.z, c, texCoord) {}
60
66 constexpr Vertex(const Vector3& v, const Color& c) noexcept
67 : Vertex(v.x, v.y, v.z, c) {}
68
73 constexpr Vertex(const Vector3& v) noexcept
74 : Vertex(v.x, v.y, v.z, Colors::BLACK) {}
75 };
76}
const Color BLACK(0, 0, 0)
Black.
Definition audiomanager.cpp:4
RGBA color stored as normalized floating-point components.
Definition color.hpp:12
Two-component floating-point vector.
Definition vector2.hpp:13
Three-component floating-point vector.
Definition vector3.hpp:13
A single renderable vertex: position, color and texture coordinate.
Definition vertex.hpp:14
Color color
Vertex color.
Definition vertex.hpp:16
constexpr Vertex() noexcept=default
Constructs a vertex at the origin, black, with zero UV.
constexpr Vertex(float _x, float _y, float _z, const Color &c) noexcept
Constructs a colored vertex with a zero texture coordinate.
Definition vertex.hpp:40
Vector2 uv
Texture coordinate.
Definition vertex.hpp:17
float z
Position components.
Definition vertex.hpp:15
float y
Definition vertex.hpp:15
float x
Definition vertex.hpp:15
constexpr Vertex(float _x, float _y, float _z) noexcept
Constructs a black vertex from explicit components.
Definition vertex.hpp:49
constexpr Vertex(const Vector3 &v, const Color &c) noexcept
Constructs a colored vertex from a position vector.
Definition vertex.hpp:66
constexpr Vertex(const Vector3 &v) noexcept
Constructs a black vertex from a position vector.
Definition vertex.hpp:73
constexpr Vertex(const Vector3 &v, const Color &c, const Vector2 &texCoord) noexcept
Constructs a fully specified vertex from a position vector.
Definition vertex.hpp:58