pos.y + noff->y,
pos.z + noff->z,
};
- if (VALIDPOS(npos) && ! GNODDEF(block, npos.x, npos.y, npos.z).visible) {
+ if (! VALIDPOS(npos) || ! GNODDEF(block, npos.x, npos.y, npos.z).visible) {
for (int v = 0; v < 6; v++) {
Vertex vertex = {
vpos[f][v].x + offset.x,
#include <stdlib.h>
+#include <stddef.h>
#include "mesh.h"
Mesh *mesh_create(Vertex *vertices, GLsizei count)
glBufferData(GL_ARRAY_BUFFER, mesh->count * sizeof(Vertex), mesh->vertices, GL_STATIC_DRAW);
- glVertexAttribPointer(0, 3, GL_FLOAT, false, sizeof(Vertex), (GLvoid *)(0 * sizeof(GLfloat)));
+ glVertexAttribPointer(0, 3, GL_FLOAT, false, sizeof(Vertex), (GLvoid *) offsetof(Vertex, x));
glEnableVertexAttribArray(0);
- glVertexAttribPointer(1, 3, GL_FLOAT, false, sizeof(Vertex), (GLvoid *)(3 * sizeof(GLfloat)));
+ glVertexAttribPointer(1, 3, GL_FLOAT, false, sizeof(Vertex), (GLvoid *) offsetof(Vertex, r));
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, 0);