VoxelEngine
 
Loading...
Searching...
No Matches
Vertex.h
1#pragma once
2
3#include <LWGL/buffer/VertexLayout.h>
4#include <glm/glm.hpp>
5
6namespace engine {
7 struct Vertex {
8 Vertex(glm::vec3 pos, glm::vec3 n, glm::vec2 uv, int textureID, int ao);
9 Vertex(glm::vec3 pos, glm::vec3 n, glm::vec2 uv);
10
11 void translate(glm::vec3 t);
12 void rotate(glm::vec3 axis, float angle);
13 void data(int textureID, int ao);
14
15 glm::vec3 pos, normal;
16 glm::vec2 uv;
18 unsigned int m_data;
19
20 static gl::VertexLayout layout() {
21 return {
22 sizeof(Vertex), // stride
23 {
24 {0, gl::VertexAttribute::Float, 3, offsetof(Vertex, pos)},
25 {1, gl::VertexAttribute::Float, 3, offsetof(Vertex, normal)},
26 {2, gl::VertexAttribute::Float, 2, offsetof(Vertex, uv)},
27 {3, gl::VertexAttribute::UInt, 1, offsetof(Vertex, m_data)},
28 },
29 };
30 }
31 };
32} // namespace engine
Definition Vertex.h:7
unsigned int m_data
Holds TextureID (0-15bits) and AO (16-17)
Definition Vertex.h:18