1
0
Fork 0
Univerxel/src/client/render/gl/buffer/VertexData.hpp

36 lines
1.1 KiB
C++

#pragma once
#include <glm/glm.hpp>
#include <string.h> // for memcmp
#include <GL/gl3w.h>
namespace buffer {
/// Vertex properties
struct VertexData {
VertexData(const glm::vec3 &position, GLushort material, const glm::vec3 &normal):
Position(position), Material(material), Normal(normal) { }
glm::vec3 Position;
GLushort Material;
glm::vec3 Normal;
};
/// Quantized vertex properties
struct PackedVertexData {
PackedVertexData(GLushort x, GLushort y, GLushort z, GLushort mat, GLushort nx, GLushort ny, GLushort nz, GLushort nw = 0) {
PosMat[0] = x;
PosMat[1] = y;
PosMat[2] = z;
PosMat[3] = mat;
Nrm[0] = nx;
Nrm[1] = ny;
Nrm[2] = nz;
Nrm[3] = nw;
}
GLushort PosMat[4];
GLushort Nrm[4]; //NOTE: Triplanar does not handle 10_10_10_2_REV
bool operator<(const PackedVertexData that) const {
return memcmp((void *)this, (void *)&that, sizeof(PackedVertexData)) > 0;
};
};
}