Cogs.Core
VertexFormats.h
1#pragma once
2
3#include "Base.h"
4
5#include "Rendering/Common.h"
6#include "Rendering/VertexFormat.h"
7
8#include <glm/glm.hpp>
9#include <glm/packing.hpp>
10
11#pragma pack(push)
12#pragma pack(1)
13
14namespace Cogs::Core
15{
16 struct COGSCORE_DLL_API VertexFormats
17 {
18 static void initialize();
19
20 static VertexFormatHandle Pos2f;
21 static VertexFormatHandle Pos3f;
22 static VertexFormatHandle Pos4f;
23 static VertexFormatHandle Norm3f;
24 static VertexFormatHandle Norm4s8;
25 static VertexFormatHandle Norm10;
26 static VertexFormatHandle Tang3f;
27 static VertexFormatHandle Tang4f;
28 static VertexFormatHandle Bitang3f;
29 static VertexFormatHandle Tex2f;
30 static VertexFormatHandle Tex2f1;
31 static VertexFormatHandle Color4f;
32
33 static VertexFormatHandle Pos4fColor4f;
34
35 static VertexFormatHandle Pos3fNorm3f;
36 static VertexFormatHandle Pos3fNorm3fTex2f;
37 static VertexFormatHandle Pos3fNorm8Tex2f;
40 static VertexFormatHandle Pos3fNorm3fTex4f;
41 static VertexFormatHandle Pos3fNorm4fTex4f;
42 static VertexFormatHandle Pos4fNorm4fTex4f;
43
44 static VertexFormatHandle Pos3fNorm3fTan3fTex2f;
45
46 static VertexFormatHandle Pos3fNorm3fColor4fTex2f;
47 static VertexFormatHandle Pos3fNorm3fColor4f;
48
49 static VertexFormatHandle Pos3fTex2f;
50
51 static VertexFormatHandle BoneIndex4i;
52 static VertexFormatHandle BoneWeight4f;
53
54 static VertexFormatHandle InstancePos3f;
55 static VertexFormatHandle InstanceMat4f;
56 static VertexFormatHandle InstanceColor4f;
57 };
58
60 {
61 glm::vec3 position;
62
63 static VertexFormatHandle getVertexFormat()
64 {
65 return VertexFormats::Pos3f;
66 }
67 };
68
70 {
71 glm::vec4 position;
72 glm::vec4 color;
73
74 static VertexFormatHandle getVertexFormat()
75 {
76 return VertexFormats::Pos4fColor4f;
77 }
78 };
79
81 {
82 glm::vec3 position;
83 glm::vec3 normal;
84
85 static VertexFormatHandle getVertexFormat()
86 {
87 return VertexFormats::Pos3fNorm3f;
88 }
89 };
90
92 {
93 glm::vec3 position;
94 glm::vec3 normal;
95 glm::vec2 tex;
96
97 static VertexFormatHandle getVertexFormat()
98 {
99 return VertexFormats::Pos3fNorm3fTex2f;
100 }
101 };
102
104 {
105 uint32_t x : 10;
106 uint32_t y : 10;
107 uint32_t z : 10;
108 uint32_t w : 2;
109 };
110
112 {
113 uint64_t position;
114 vec1010102 normal;
115 glm::vec2 tex;
116
117 static VertexFormatHandle getVertexFormat()
118 {
119 return VertexFormats::Pos4hNorm10Tex2f;
120 }
121 };
122
124 {
125 uint64_t position;
126 struct
127 {
128 int8_t x, y, z, w;
129 } normal;
130 glm::vec2 tex;
131
132 static VertexFormatHandle getVertexFormat()
133 {
134 return VertexFormats::Pos4hNorm8Tex2f;
135 }
136 };
137
139 {
140 glm::vec3 position;
141 glm::vec3 normal;
142 glm::vec4 color;
143
144 static VertexFormatHandle getVertexFormat()
145 {
146 return VertexFormats::Pos3fNorm3fColor4f;
147 }
148 };
149
151 {
152 BillboardVertex() {}
153 BillboardVertex(glm::vec3 position, glm::vec2 texCoord) : position(position), texCoord(texCoord) {}
154
155 glm::vec3 position;
156 glm::vec2 texCoord;
157
158 static VertexFormatHandle getVertexFormat()
159 {
160 return VertexFormats::Pos3fTex2f;
161 }
162 };
163
166}
167
168#pragma pack(pop)
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....