Skip to content

Commit

Permalink
use vmanip flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour committed Nov 6, 2024
1 parent cdf21d1 commit 828303c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/client/content_mapblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,11 @@ void MapblockMeshGenerator::generate()
for (cur_node.p.Z = 0; cur_node.p.Z < data->side_length; cur_node.p.Z++)
for (cur_node.p.Y = 0; cur_node.p.Y < data->side_length; cur_node.p.Y++)
for (cur_node.p.X = 0; cur_node.p.X < data->side_length; cur_node.p.X++) {
cur_node.n = data->m_vmanip.getNodeNoEx(blockpos_nodes + cur_node.p);
v3s16 p_abs = blockpos_nodes + cur_node.p;
if (!data->m_vmanip.m_area.contains(p_abs) ||
data->m_vmanip.getFlagsRefUnsafe(p_abs) & VMANIP_FLAG_MESHGEN_IGNORE)
continue;
cur_node.n = data->m_vmanip.getNodeNoEx(p_abs);
cur_node.f = &nodedef->get(cur_node.n);
drawNode();
}
Expand Down
2 changes: 2 additions & 0 deletions src/client/content_mapblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
struct MeshMakeData;
struct MeshCollector;

#define VMANIP_FLAG_MESHGEN_IGNORE VOXELFLAG_CHECKED1

struct LightPair {
u8 lightDay;
u8 lightNight;
Expand Down
20 changes: 12 additions & 8 deletions src/client/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,17 +625,21 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs

v3f offset = intToFloat((data->m_blockpos - mesh_grid.getMeshPos(data->m_blockpos)) * MAP_BLOCKSIZE, BS);
MeshCollector collector(m_bounding_sphere_center, offset);
/*
Add special graphics:
- torches
- flowing water
- fences
- whatever
*/

{ //tmp
v3s16 p = v3s16(0, 0, 0);
for (p.Y = 0; p.Y < data->side_length; p.Y++) {
v3s16 p_abs = data->m_blockpos * MAP_BLOCKSIZE + p;
if (!data->m_vmanip.m_area.contains(p_abs))
continue;
data->m_vmanip.getFlagsRefUnsafe(p_abs) |= VMANIP_FLAG_MESHGEN_IGNORE;
}
}

{
MapblockMeshGenerator(data, &collector,
client->getSceneManager()->getMeshManipulator()).generate();
client->getSceneManager()->getMeshManipulator())
.generate();
}

/*
Expand Down

0 comments on commit 828303c

Please sign in to comment.