Now we can generate 3D layouts

This commit is contained in:
2024-12-05 22:00:18 +03:00
parent 770a163c63
commit b427de968f
14 changed files with 1541 additions and 33 deletions

View File

@@ -100,9 +100,6 @@ growth_module::growth_module(flecs::world &ecs)
west_id, north_id, east_id, south_id
};
bool outside = false;
#if 0
bool border = false;
#endif
for (i = 0; i < (int)neighbors.size(); i++) {
int id = neighbors[i];
print_line("id=" + itos(id));
@@ -114,31 +111,31 @@ growth_module::growth_module(flecs::world &ecs)
.ptr());
if (!neighbor_e.is_valid()) {
outside = true;
if (id == west_id)
if (id == west_id) {
e.add<WorldEditor::components::
outside_wall_west>();
else if (id == east_id)
e.add<WorldEditor::components::
internal_wall_west>();
} else if (id == east_id) {
e.add<WorldEditor::components::
outside_wall_east>();
else if (id == north_id)
e.add<WorldEditor::components::
internal_wall_east>();
} else if (id == north_id) {
e.add<WorldEditor::components::
outside_wall_north>();
else if (id == south_id)
e.add<WorldEditor::components::
internal_wall_north>();
} else if (id == south_id) {
e.add<WorldEditor::components::
outside_wall_south>();
e.add<WorldEditor::components::
internal_wall_south>();
}
}
#if 0
if (!e.parent()
.get<WorldEditor::components::
buildings_layout_grid_floor>()
->cells.has(id)) {
outside = true;
break;
}
#endif
}
bool border = false;
flecs::log::dbg("outside: %d", outside);
#ifdef MAKE_BORDER
for (i = 0; i < (int)neighbors.size(); i++) {
int id = neighbors[i];
print_line("id=" + itos(id));
@@ -156,10 +153,20 @@ growth_module::growth_module(flecs::world &ecs)
buildings_layout_grid_cell>();
if (cell.type != neighbor_cell->type) {
border = true;
break;
if (id == west_id)
e.add<WorldEditor::components::
internal_wall_west>();
else if (id == east_id)
e.add<WorldEditor::components::
internal_wall_east>();
else if (id == north_id)
e.add<WorldEditor::components::
internal_wall_north>();
else if (id == south_id)
e.add<WorldEditor::components::
internal_wall_south>();
}
}
#endif
if (outside) {
e.add<WorldEditor::components::
outside_wall>();
@@ -168,10 +175,8 @@ growth_module::growth_module(flecs::world &ecs)
} else
e.add<WorldEditor::components::
final_cell>();
#if 0
if (border)
e.add<WorldEditor::components::border>();
#endif
if (border)
e.add<WorldEditor::components::border>();
print_line("outside: " + itos(outside));
print_line("position: " +
(position.operator String()));