From 17d5b091c9b2901ac96f5eee0da6af07228ae690 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sun, 10 Apr 2022 23:00:36 -0700 Subject: Changeset: 5 Add shader and corresponding editor components --- source/GraphicsTags.hpp | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 source/GraphicsTags.hpp (limited to 'source/GraphicsTags.hpp') diff --git a/source/GraphicsTags.hpp b/source/GraphicsTags.hpp new file mode 100644 index 0000000..465c57d --- /dev/null +++ b/source/GraphicsTags.hpp @@ -0,0 +1,85 @@ +#pragma once + +#include +#include +#include + +namespace Tags { +/// Vertex element semantics, used to identify the meaning of vertex buffer contents +enum VertexElementSemantic { + /// 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, + /// Secondary colour. Generally free for custom data. Means specular with OpenGL FFP. + VES_Color2, + /// Texture coordinates, typically VET_Float2 + VES_Texture_coordinates, + /// Binormal (Y axis if normal is Z) + VES_Binormal, + /// Tangent (X axis if normal is Z) + VES_Tangent, + /// Default semantic + VES_Generic, + VES_COUNT, +}; + +std::string_view NameOf(VertexElementSemantic semantic); +VertexElementSemantic FindVertexElementSemantic(std::string_view name); + +enum VertexElementType { + 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_NORM_BEGIN, + VET_Byte4Norm = VET_NORM_BEGIN, /// 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, + VET_NORM_END = VET_Ushort4Norm, +}; + +int SizeOf(VertexElementType type); +bool IsNormalized(VertexElementType type); + +enum IndexType { + IT_16Bit, + IT_32Bit, +}; + +int SizeOf(IndexType type); + +std::string_view NameOfGLType(GLenum); +GLenum FindGLType(std::string_view name); +} // namespace Tags -- cgit v1.2.3-70-g09d2