diff --git a/.gitignore b/.gitignore index 3632ddb..6427b92 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ assets/blender/scripts/*.blend* .*.swp *.kra~ *.png~ +godot/astream/road_lines.json.* + diff --git a/src/flecs b/src/flecs index de96203..71bba92 160000 --- a/src/flecs +++ b/src/flecs @@ -1 +1 @@ -Subproject commit de96203869d45cb14f1ce95692f0fcf779e79b35 +Subproject commit 71bba92ed3f987e84948711980655623c28d8818 diff --git a/src/godot b/src/godot index 585909e..95a494c 160000 --- a/src/godot +++ b/src/godot @@ -1 +1 @@ -Subproject commit 585909ef69cb2bac0c278da8d5dfafa3fec8956d +Subproject commit 95a494c8e500bc2cbea4f1d16308080185f086db diff --git a/src/meshoptimizer b/src/meshoptimizer index fdd22f8..8764552 160000 --- a/src/meshoptimizer +++ b/src/meshoptimizer @@ -1 +1 @@ -Subproject commit fdd22f8117c5e3ee14b01fdf07cd258b7a2af2e2 +Subproject commit 8764552531e55588a049b2d5f171db33200ac512 diff --git a/src/modules/stream/buildings/element_data.h b/src/modules/stream/buildings/element_data.h index 6d1af87..a357c4d 100644 --- a/src/modules/stream/buildings/element_data.h +++ b/src/modules/stream/buildings/element_data.h @@ -13,9 +13,11 @@ template 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)); diff --git a/src/modules/stream/flecs/SCsub b/src/modules/stream/flecs/SCsub index 04ea685..dd955d0 100644 --- a/src/modules/stream/flecs/SCsub +++ b/src/modules/stream/flecs/SCsub @@ -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"]) diff --git a/src/modules/stream/stream.cpp b/src/modules/stream/stream.cpp index a83c954..5cf01af 100644 --- a/src/modules/stream/stream.cpp +++ b/src/modules/stream/stream.cpp @@ -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,8 +114,8 @@ 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) + " " + - itos(kz)); + print_verbose("erase tile: " + itos(kx) + " " + + itos(kz)); erase_tile(kx, kz); it = loaded_tiles.erase(it); } else @@ -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,8 +147,8 @@ void StreamWorld::load_tile(int tx, int ty) std::tuple key = std::make_tuple(tx, ty); const std::vector &items = tiles[key]; for (i = 0; i < (int)items.size(); i++) { - print_line("load item: " + itos(i) + ": key: " + (items[i]) + - ": " /* + data()->get_building(items[i]).id */); + print_verbose("load item: " + itos(i) + ": key: " + (items[i]) + + ": " /* + data()->get_building(items[i]).id */); const String &bkey = items[i]; load_building(bkey); } @@ -160,8 +160,8 @@ void StreamWorld::erase_tile(int tx, int ty) std::tuple key = std::make_tuple(tx, ty); const std::vector &items = tiles[key]; for (i = 0; i < (int)items.size(); i++) { - print_line("unload item: " + itos(i) + ": key: " + items[i] + - ": " /* + data()->get_building(items[i]).id */); + 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,8 +321,8 @@ 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 + - " from: " + old_type + " to: " + new_type); + print_verbose("changed building: key:" + key + + " from: " + old_type + " to: " + new_type); } else if (command == "create_building") { if (args.size() == 0) { print_error("bad command: not enough args: " + command); @@ -360,8 +360,8 @@ void StreamWorld::run_command(const String &command, } }, nullptr); - print_line("delete buildings: " + itos(erased_keys.size()) + - " prefix: " + prefix); + print_verbose("delete buildings: " + itos(erased_keys.size()) + + " prefix: " + prefix); for (i = erased_keys.size() - 1; i >= 0; i--) { unload_building(erased_keys[i]); data()->destroy_building(erased_keys[i]); @@ -383,8 +383,8 @@ void StreamWorld::run_command(const String &command, } }, nullptr); - print_line("delete buildings: " + itos(erased_keys.size()) + - " prefix: " + prefix); + print_verbose("delete buildings: " + itos(erased_keys.size()) + + " prefix: " + prefix); for (i = erased_keys.size() - 1; i >= 0; i--) { unload_building(erased_keys[i]); data()->destroy_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()); @@ -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,9 +529,9 @@ StreamWorld::StreamWorld() while (map_it != tiles.end()) { std::tuple key = map_it->first; std::vector &tile_buildings = map_it->second; - print_line("x: " + itos(std::get<0>(key)) + - " y: " + itos(std::get<1>(key)) + " " + - itos(tile_buildings.size())); + print_verbose("x: " + itos(std::get<0>(key)) + + " y: " + itos(std::get<1>(key)) + " " + + itos(tile_buildings.size())); map_it++; } view_distance = config.get_value("world", "view_distance");