update build

This commit is contained in:
2025-04-01 11:58:46 +03:00
parent c727a1912c
commit 64424e3111
7 changed files with 38 additions and 30 deletions

2
.gitignore vendored
View File

@@ -11,3 +11,5 @@ assets/blender/scripts/*.blend*
.*.swp
*.kra~
*.png~
godot/astream/road_lines.json.*

View File

@@ -13,9 +13,11 @@
template <class T> T *get_as_node(const String &path)
{
Node *scene;
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint())
scene = EditorNode::get_singleton()->get_edited_scene();
else
#endif
scene = SceneTree::get_singleton()->get_current_scene();
assert(scene);
Node *node = scene->get_node(NodePath(path));

View File

@@ -9,3 +9,7 @@ lib = env.add_library("flecs", env.stream_building_sources)
env.Prepend(LIBS=[lib])
env.Prepend(CPPPATH=["../../../flecs/distr"])
env.Prepend(CFLAGS=["-Wno-shadow=compatible-local", "-Wno-maybe-uninitialized"])
env.Append(CDEFS=["FLECS_DEBUG"])
env.Append(CPPDEFS=["FLECS_DEBUG"])
env.Append(CFLAGS=["-UNDEBUG"])
env.Append(CPPFLAGS=["-UNDEBUG"])

View File

@@ -39,7 +39,7 @@ void StreamWorld::create_tilemap()
}
},
nullptr);
print_line("Tile count: " + itos(tiles.size()));
print_verbose("Tile count: " + itos(tiles.size()));
}
void StreamWorld::update_view()
@@ -84,7 +84,7 @@ void StreamWorld::update_view()
int tile_x = int(eye.x / tile_size);
int tile_z = int(eye.z / tile_size);
if (current_x != tile_x || current_z != tile_z) {
print_line("tile: " + itos(tile_x) + " " + itos(tile_z));
print_verbose("tile: " + itos(tile_x) + " " + itos(tile_z));
for (i = tile_z - view_distance; i < tile_z + view_distance + 1;
i++)
for (j = tile_x - view_distance;
@@ -94,7 +94,7 @@ void StreamWorld::update_view()
if (tiles.find(key) != tiles.end()) {
if (loaded_tiles.find(key) ==
loaded_tiles.end()) {
print_line(
print_verbose(
"load tile: " +
itos(j) + " " +
itos(i) + " = " +
@@ -114,7 +114,7 @@ void StreamWorld::update_view()
int lx = kx - tile_x;
int lz = kz - tile_z;
if (lx * lx > ed2 || lz * lz > ed2) {
print_line("erase tile: " + itos(kx) + " " +
print_verbose("erase tile: " + itos(kx) + " " +
itos(kz));
erase_tile(kx, kz);
it = loaded_tiles.erase(it);
@@ -136,7 +136,7 @@ void StreamWorld::viewer_dead()
void StreamWorld::terrain_dead()
{
print_line("terrain dead");
print_verbose("terrain dead");
terrain = nullptr;
set_process(false);
}
@@ -147,7 +147,7 @@ void StreamWorld::load_tile(int tx, int ty)
std::tuple<int, int> key = std::make_tuple(tx, ty);
const std::vector<String> &items = tiles[key];
for (i = 0; i < (int)items.size(); i++) {
print_line("load item: " + itos(i) + ": key: " + (items[i]) +
print_verbose("load item: " + itos(i) + ": key: " + (items[i]) +
": " /* + data()->get_building(items[i]).id */);
const String &bkey = items[i];
load_building(bkey);
@@ -160,7 +160,7 @@ void StreamWorld::erase_tile(int tx, int ty)
std::tuple<int, int> key = std::make_tuple(tx, ty);
const std::vector<String> &items = tiles[key];
for (i = 0; i < (int)items.size(); i++) {
print_line("unload item: " + itos(i) + ": key: " + items[i] +
print_verbose("unload item: " + itos(i) + ": key: " + items[i] +
": " /* + data()->get_building(items[i]).id */);
const String &bkey = items[i];
unload_building(bkey);
@@ -183,27 +183,27 @@ void StreamWorld::request_item(int type, const String &bkey)
/* bkey can contain "::"'s so need to replae them with underscores */
String ekey = bkey;
if (bkey.begins_with("road__")) {
print_line("loading building: " + ekey);
print_verbose("loading building: " + ekey);
debug = true;
}
String id = data()->get_building(ekey).id;
if (debug)
print_line("building id: " + id);
print_verbose("building id: " + id);
if (id == "empty")
return;
switch (type) {
case 0:
if (debug)
print_line("add to scene id: " + id);
print_verbose("add to scene id: " + id);
if (!data()->has_scene(id))
data()->create_scene_data(id, ekey);
else
data()->add_scene_item(id, ekey);
if (debug)
print_line("added to scene id: " + id);
print_verbose("added to scene id: " + id);
break;
case 1: {
print_line("Removing key:" + ekey);
print_verbose("Removing key:" + ekey);
if (data()->has_scene(id)) {
data()->remove_scene_item(id, ekey);
}
@@ -321,7 +321,7 @@ void StreamWorld::run_command(const String &command,
data()->get_building(key).id = new_type;
load_building(key);
update_items();
print_line("changed building: key:" + key +
print_verbose("changed building: key:" + key +
" from: " + old_type + " to: " + new_type);
} else if (command == "create_building") {
if (args.size() == 0) {
@@ -360,7 +360,7 @@ void StreamWorld::run_command(const String &command,
}
},
nullptr);
print_line("delete buildings: " + itos(erased_keys.size()) +
print_verbose("delete buildings: " + itos(erased_keys.size()) +
" prefix: " + prefix);
for (i = erased_keys.size() - 1; i >= 0; i--) {
unload_building(erased_keys[i]);
@@ -383,7 +383,7 @@ void StreamWorld::run_command(const String &command,
}
},
nullptr);
print_line("delete buildings: " + itos(erased_keys.size()) +
print_verbose("delete buildings: " + itos(erased_keys.size()) +
" prefix: " + prefix);
for (i = erased_keys.size() - 1; i >= 0; i--) {
unload_building(erased_keys[i]);
@@ -409,10 +409,10 @@ void StreamWorld::run_command(const String &command,
},
nullptr);
#endif
print_line("road_rebuild done");
print_verbose("road_rebuild done");
} else if (command == "remove_road_meshes") {
RoadProcessing::remove_road_meshes(this);
print_line("remove_road_meshes done");
print_verbose("remove_road_meshes done");
} else if (command == "nudge_generator") {
auto gen = terrain->get_generator();
terrain->set_generator(Ref<VoxelGenerator>());
@@ -479,7 +479,7 @@ void StreamWorld::_notification(int which)
if (frame_count % 60 == 0) {
float fmon = Performance::get_singleton()->get_monitor(
Performance::RENDER_DRAW_CALLS_IN_FRAME);
print_line("Draw calls: " + String::num(fmon));
print_verbose("Draw calls: " + String::num(fmon));
}
frame_count++;
if (Engine::get_singleton()->is_editor_hint())
@@ -529,7 +529,7 @@ StreamWorld::StreamWorld()
while (map_it != tiles.end()) {
std::tuple<int, int> key = map_it->first;
std::vector<String> &tile_buildings = map_it->second;
print_line("x: " + itos(std::get<0>(key)) +
print_verbose("x: " + itos(std::get<0>(key)) +
" y: " + itos(std::get<1>(key)) + " " +
itos(tile_buildings.size()));
map_it++;