Fix MapBlock mesh neighbor face culling
parent
7ae0264a8e
commit
1f8adc5b6d
|
@ -92,7 +92,7 @@ static Array make_vertices(MapBlock *block)
|
|||
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,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include "mesh.h"
|
||||
|
||||
Mesh *mesh_create(Vertex *vertices, GLsizei count)
|
||||
|
@ -50,9 +51,9 @@ static void mesh_configure(Mesh *mesh)
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue