aboutsummaryrefslogtreecommitdiff
path: root/src/brussel.engine/GraphicsTags.hpp
blob: f9628b2e4e62203c3ca0ba52179af9445a2d201c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once

#include <MacrosCodegen.hpp>

#include <glad/glad.h>
#include <limits>
#include <string>
#include <string_view>

namespace Tags {
/// Vertex element semantics, used to identify the meaning of vertex buffer contents
enum VertexElementSemantic {
	// clang-format off
	BRUSSEL_ENUM(ToString, FromString, ExcludeHeuristics)
	// clang-format on

	/// Position, typically VET_Float3
	VES_Position,
	/// Blending weights
	VES_BlendWeights,
	/// Blending indices
	VES_BlendIndices,
	/// Normal, typically VET_Float3
	VES_Normal,
	/// Colour, typically VET_Ubyte4
	VES_Color1,
	VES_Color2,
	VES_Color3,
	/// Texture coordinates, typically VET_Float2
	VES_TexCoords1,
	VES_TexCoords2,
	VES_TexCoords3,
	/// Binormal (Y axis if normal is Z)
	VES_Binormal,
	/// Tangent (X axis if normal is Z)
	VES_Tangent,
	/// Default semantic
	VES_Generic,
	VES_COUNT,
};

enum VertexElementType {
	// clang-format off
	BRUSSEL_ENUM(ToString, FromString, ExcludeHeuristics)
	// clang-format on

	VET_Float1,
	VET_Float2,
	VET_Float3,
	VET_Float4,

	VET_Short2,
	VET_Short4,
	VET_Ubyte4,

	// the following are not universally supported on all hardware:
	VET_Double1,
	VET_Double2,
	VET_Double3,
	VET_Double4,
	VET_Ushort2,
	VET_Ushort4,
	VET_Int1,
	VET_Int2,
	VET_Int3,
	VET_Int4,
	VET_Uint1,
	VET_Uint2,
	VET_Uint3,
	VET_Uint4,
	VET_Byte4, /// signed bytes

	VET_Byte4Norm, /// signed bytes (normalized to -1..1)
	VET_Ubyte4Norm, /// unsigned bytes (normalized to 0..1)
	VET_Short2Norm, /// signed shorts (normalized to -1..1)
	VET_Short4Norm,
	VET_Ushort2Norm, /// unsigned shorts (normalized to 0..1)
	VET_Ushort4Norm,
};
constexpr auto VET_NORM_BEGIN = VET_Byte4Norm;
constexpr auto VET_NORM_END = VET_Ushort4Norm;

int SizeOf(VertexElementType type);
int VectorLenOf(VertexElementType type);
GLenum FindGLType(VertexElementType type);
bool IsNormalized(VertexElementType type);

enum IndexType {
	IT_16Bit,
	IT_32Bit,
};

int SizeOf(IndexType type);
GLenum FindGLType(IndexType type);

enum TexFilter {
	// clang-format off
	BRUSSEL_ENUM(ToString, FromString, ExcludeHeuristics)
	// clang-format on

	TF_Linear,
	TF_Nearest,
};

std::string_view GLTypeToString(GLenum);
GLenum GLTypeFromString(std::string_view name);

constexpr auto kInvalidLocation = std::numeric_limits<GLuint>::max();
} // namespace Tags

#include <generated/GraphicsTags.gh.inl>