1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Discrete Level of Detail

Add scene side discrete level of detail.

New node `LOD` for UI, and `LODManager` within `World` for automatically updating child visibilities based on distance from cameras.
This commit is contained in:
lawnjelly
2023-11-27 07:07:01 +00:00
parent 354404db60
commit 1b5fa74e39
30 changed files with 713 additions and 134 deletions

View File

@@ -1347,7 +1347,17 @@ void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) {
void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
EditorProgress save("save", TTR("Saving Scene"), 4);
Ref<World> edited_world;
if (editor_data.get_edited_scene_root() != nullptr) {
// Allow a generic mechanism for the engine to make changes prior, and after saving.
if (editor_data.get_edited_scene_root()->get_tree() && editor_data.get_edited_scene_root()->get_tree()->get_root()) {
edited_world = editor_data.get_edited_scene_root()->get_tree()->get_root()->get_world();
if (edited_world.is_valid()) {
edited_world->notify_saving(true);
}
}
save.step(TTR("Analyzing"), 0);
int c2d = 0;
@@ -1428,6 +1438,10 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
save.step(TTR("Saving Scene"), 4);
_save_scene(p_file, p_idx);
if (edited_world.is_valid()) {
edited_world->notify_saving(false);
}
if (!singleton->cmdline_export_mode) {
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}