Partial meshing is broken
parent
9bcded0383
commit
c955c07ab4
Binary file not shown.
|
@ -79,3 +79,11 @@
|
||||||
1 812 1676349209335934338 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
1 812 1676349209335934338 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||||
1 912 1676349209435937096 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
1 912 1676349209435937096 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
||||||
912 1010 1676349209535939851 FinalProject e2e3313cdc6f5890
|
912 1010 1676349209535939851 FinalProject e2e3313cdc6f5890
|
||||||
|
1 856 1676350055707248541 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
||||||
|
856 932 1676350055783250634 FinalProject e2e3313cdc6f5890
|
||||||
|
1 880 1676350137201492095 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
||||||
|
880 960 1676350137281494299 FinalProject e2e3313cdc6f5890
|
||||||
|
1 897 1676350155746002613 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
||||||
|
897 973 1676350155818004597 FinalProject e2e3313cdc6f5890
|
||||||
|
1 876 1676350201339257745 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86
|
||||||
|
876 961 1676350201423260057 FinalProject e2e3313cdc6f5890
|
||||||
|
|
Binary file not shown.
|
@ -1,3 +1,3 @@
|
||||||
Start testing: Feb 13 23:33 EST
|
Start testing: Feb 13 23:50 EST
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
End testing: Feb 13 23:33 EST
|
End testing: Feb 13 23:50 EST
|
||||||
|
|
|
@ -35,7 +35,18 @@ void fp::world::generateFullMesh(mesh_storage* mesh, fp::chunk* chunk) {
|
||||||
chunk->dirtiness = PARTIAL_MESH;
|
chunk->dirtiness = PARTIAL_MESH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void checkEdgeFaces(
|
||||||
|
fp::mesh_storage* mesh, fp::chunk* chunk, fp::chunk* neighbour, fp::face face, const fp::block_pos& pos, const fp::block_pos& neighbour_pos
|
||||||
|
) {
|
||||||
|
auto block = chunk->storage->get(pos);
|
||||||
|
if (!fp::registry::get(block).visibility) {
|
||||||
|
if (fp::registry::get(neighbour->storage->get(neighbour_pos)).visibility)
|
||||||
|
mesh->addFace(face, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void fp::world::generateEdgeMesh(mesh_storage* mesh, fp::chunk* chunk) {
|
void fp::world::generateEdgeMesh(mesh_storage* mesh, fp::chunk* chunk) {
|
||||||
|
BLT_TRACE("NOPE");
|
||||||
// don't try to regen the chunk mesh unless there is a chance all neighbours are not null
|
// don't try to regen the chunk mesh unless there is a chance all neighbours are not null
|
||||||
if (chunk->status != chunk_update_status::NEIGHBOUR_CREATE)
|
if (chunk->status != chunk_update_status::NEIGHBOUR_CREATE)
|
||||||
return;
|
return;
|
||||||
|
@ -43,6 +54,8 @@ void fp::world::generateEdgeMesh(mesh_storage* mesh, fp::chunk* chunk) {
|
||||||
chunk_neighbours neighbours{};
|
chunk_neighbours neighbours{};
|
||||||
getNeighbours(chunk->pos, neighbours);
|
getNeighbours(chunk->pos, neighbours);
|
||||||
|
|
||||||
|
BLT_TRACE("GOODBYE");
|
||||||
|
|
||||||
// if none of the neighbours exist we cannot continue!
|
// if none of the neighbours exist we cannot continue!
|
||||||
for (auto* neighbour : neighbours.neighbours) {
|
for (auto* neighbour : neighbours.neighbours) {
|
||||||
if (!neighbour)
|
if (!neighbour)
|
||||||
|
@ -51,15 +64,19 @@ void fp::world::generateEdgeMesh(mesh_storage* mesh, fp::chunk* chunk) {
|
||||||
|
|
||||||
for (int i = 0; i < CHUNK_SIZE; i++) {
|
for (int i = 0; i < CHUNK_SIZE; i++) {
|
||||||
for (int j = 0; j < CHUNK_SIZE; j++) {
|
for (int j = 0; j < CHUNK_SIZE; j++) {
|
||||||
auto block = chunk->storage->get({0, i, j});
|
checkEdgeFaces(mesh, chunk, neighbours[X_NEG], X_NEG, {0, i, j}, {CHUNK_SIZE - 1, i, j});
|
||||||
if (!fp::registry::get(block).visibility) {
|
checkEdgeFaces(mesh, chunk, neighbours[X_POS], X_POS, {CHUNK_SIZE-1, i, j}, {0, i, j});
|
||||||
auto neighbour = neighbours[X_NEG]->storage->get({CHUNK_SIZE-1, i, j});
|
|
||||||
if (fp::registry::get(neighbour).visibility)
|
checkEdgeFaces(mesh, chunk, neighbours[Y_NEG], Y_NEG, {i, 0, j}, {i, CHUNK_SIZE - 1, j});
|
||||||
mesh->addFace(X_NEG, {0, i, j});
|
checkEdgeFaces(mesh, chunk, neighbours[Y_POS], Y_POS, {i, CHUNK_SIZE-1, j}, {i, 0, j});
|
||||||
}
|
|
||||||
|
checkEdgeFaces(mesh, chunk, neighbours[Z_NEG], Z_NEG, {i, j, 0}, {i, j, CHUNK_SIZE - 1});
|
||||||
|
checkEdgeFaces(mesh, chunk, neighbours[Z_POS], Z_POS, {i, j, CHUNK_SIZE-1}, {i, j, 0});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLT_TRACE("HELLO");
|
||||||
|
|
||||||
chunk->status = NONE;
|
chunk->status = NONE;
|
||||||
chunk->dirtiness = REFRESH;
|
chunk->dirtiness = REFRESH;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +87,8 @@ void fp::world::generateChunkMesh(fp::chunk* chunk) {
|
||||||
|
|
||||||
if (chunk->dirtiness == FULL_MESH) { // full chunk mesh
|
if (chunk->dirtiness == FULL_MESH) { // full chunk mesh
|
||||||
generateFullMesh(chunk->mesh, chunk);
|
generateFullMesh(chunk->mesh, chunk);
|
||||||
} else if (chunk->dirtiness == PARTIAL_MESH){ // partial chunk mesh (had null neighbours)
|
}
|
||||||
|
if (chunk->dirtiness == PARTIAL_MESH) { // partial chunk mesh (had null neighbours)
|
||||||
generateEdgeMesh(chunk->mesh, chunk);
|
generateEdgeMesh(chunk->mesh, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue