mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03: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:
@@ -266,42 +266,6 @@ GeometryInstance::LightmapScale GeometryInstance::get_lightmap_scale() const {
|
||||
return lightmap_scale;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_min_distance(float p_dist) {
|
||||
lod_min_distance = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_min_distance() const {
|
||||
return lod_min_distance;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_max_distance(float p_dist) {
|
||||
lod_max_distance = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_max_distance() const {
|
||||
return lod_max_distance;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_min_hysteresis(float p_dist) {
|
||||
lod_min_hysteresis = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_min_hysteresis() const {
|
||||
return lod_min_hysteresis;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_max_hysteresis(float p_dist) {
|
||||
lod_max_hysteresis = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_max_hysteresis() const {
|
||||
return lod_max_hysteresis;
|
||||
}
|
||||
|
||||
void GeometryInstance::_notification(int p_what) {
|
||||
}
|
||||
|
||||
@@ -367,18 +331,6 @@ void GeometryInstance::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_lightmap_scale", "scale"), &GeometryInstance::set_lightmap_scale);
|
||||
ClassDB::bind_method(D_METHOD("get_lightmap_scale"), &GeometryInstance::get_lightmap_scale);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_max_hysteresis", "mode"), &GeometryInstance::set_lod_max_hysteresis);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_max_hysteresis"), &GeometryInstance::get_lod_max_hysteresis);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_max_distance", "mode"), &GeometryInstance::set_lod_max_distance);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_max_distance"), &GeometryInstance::get_lod_max_distance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_min_hysteresis", "mode"), &GeometryInstance::set_lod_min_hysteresis);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_min_hysteresis"), &GeometryInstance::get_lod_min_hysteresis);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_min_distance", "mode"), &GeometryInstance::set_lod_min_distance);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_min_distance"), &GeometryInstance::get_lod_min_distance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin);
|
||||
ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin);
|
||||
|
||||
@@ -397,12 +349,6 @@ void GeometryInstance::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate_lightmap"), "set_generate_lightmap", "get_generate_lightmap");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lightmap_scale", PROPERTY_HINT_ENUM, "1x,2x,4x,8x"), "set_lightmap_scale", "get_lightmap_scale");
|
||||
|
||||
ADD_GROUP("LOD", "lod_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_distance", "get_lod_min_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_min_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_min_hysteresis", "get_lod_min_hysteresis");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_distance", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_distance", "get_lod_max_distance");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_max_hysteresis", PROPERTY_HINT_RANGE, "0,32768,0.01"), "set_lod_max_hysteresis", "get_lod_max_hysteresis");
|
||||
|
||||
//ADD_SIGNAL( MethodInfo("visibility_changed"));
|
||||
|
||||
BIND_ENUM_CONSTANT(LIGHTMAP_SCALE_1X);
|
||||
@@ -422,11 +368,6 @@ void GeometryInstance::_bind_methods() {
|
||||
}
|
||||
|
||||
GeometryInstance::GeometryInstance() {
|
||||
lod_min_distance = 0;
|
||||
lod_max_distance = 0;
|
||||
lod_min_hysteresis = 0;
|
||||
lod_max_hysteresis = 0;
|
||||
|
||||
for (int i = 0; i < FLAG_MAX; i++) {
|
||||
flags[i] = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user