diff options
Diffstat (limited to 'scene/3d/reflection_probe.cpp')
-rw-r--r-- | scene/3d/reflection_probe.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index ad24f39bce..1bebd8e335 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -76,13 +76,13 @@ float ReflectionProbe::get_max_distance() const { return max_distance; } -void ReflectionProbe::set_lod_threshold(float p_pixels) { - lod_threshold = p_pixels; - RS::get_singleton()->reflection_probe_set_lod_threshold(probe, p_pixels); +void ReflectionProbe::set_mesh_lod_threshold(float p_pixels) { + mesh_lod_threshold = p_pixels; + RS::get_singleton()->reflection_probe_set_mesh_lod_threshold(probe, p_pixels); } -float ReflectionProbe::get_lod_threshold() const { - return lod_threshold; +float ReflectionProbe::get_mesh_lod_threshold() const { + return mesh_lod_threshold; } void ReflectionProbe::set_extents(const Vector3 &p_extents) { @@ -94,14 +94,14 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) { } if (extents[i] - 0.01 < ABS(origin_offset[i])) { - origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01); + origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01); } } RS::get_singleton()->reflection_probe_set_extents(probe, extents); RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset); - update_gizmo(); + update_gizmos(); } Vector3 ReflectionProbe::get_extents() const { @@ -113,13 +113,13 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) { for (int i = 0; i < 3; i++) { if (extents[i] - 0.01 < ABS(origin_offset[i])) { - origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01); + origin_offset[i] = SIGN(origin_offset[i]) * (extents[i] - 0.01); } } RS::get_singleton()->reflection_probe_set_extents(probe, extents); RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset); - update_gizmo(); + update_gizmos(); } Vector3 ReflectionProbe::get_origin_offset() const { @@ -178,16 +178,13 @@ AABB ReflectionProbe::get_aabb() const { return aabb; } -Vector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const { - return Vector<Face3>(); -} - void ReflectionProbe::_validate_property(PropertyInfo &property) const { if (property.name == "interior/ambient_color" || property.name == "interior/ambient_color_energy") { if (ambient_mode != AMBIENT_COLOR) { - property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL; + property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL; } } + VisualInstance3D::_validate_property(property); } void ReflectionProbe::_bind_methods() { @@ -206,8 +203,8 @@ void ReflectionProbe::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_distance", "max_distance"), &ReflectionProbe::set_max_distance); ClassDB::bind_method(D_METHOD("get_max_distance"), &ReflectionProbe::get_max_distance); - ClassDB::bind_method(D_METHOD("set_lod_threshold", "ratio"), &ReflectionProbe::set_lod_threshold); - ClassDB::bind_method(D_METHOD("get_lod_threshold"), &ReflectionProbe::get_lod_threshold); + ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "ratio"), &ReflectionProbe::set_mesh_lod_threshold); + ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &ReflectionProbe::get_mesh_lod_threshold); ClassDB::bind_method(D_METHOD("set_extents", "extents"), &ReflectionProbe::set_extents); ClassDB::bind_method(D_METHOD("get_extents"), &ReflectionProbe::get_extents); @@ -230,19 +227,19 @@ void ReflectionProbe::_bind_methods() { ClassDB::bind_method(D_METHOD("set_update_mode", "mode"), &ReflectionProbe::set_update_mode); ClassDB::bind_method(D_METHOD("get_update_mode"), &ReflectionProbe::get_update_mode); - ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Once,Always"), "set_update_mode", "get_update_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "update_mode", PROPERTY_HINT_ENUM, "Once (Fast),Always (Slow)"), "set_update_mode", "get_update_mode"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "intensity", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_intensity", "get_intensity"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_distance", PROPERTY_HINT_EXP_RANGE, "0,16384,0.1,or_greater"), "set_max_distance", "get_max_distance"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_distance", PROPERTY_HINT_RANGE, "0,16384,0.1,or_greater,exp"), "set_max_distance", "get_max_distance"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "origin_offset"), "set_origin_offset", "get_origin_offset"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "box_projection"), "set_enable_box_projection", "is_box_projection_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_as_interior", "is_set_as_interior"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enable_shadows"), "set_enable_shadows", "are_shadows_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_lod_threshold", "get_lod_threshold"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold"); ADD_GROUP("Ambient", "ambient_"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "ambient_mode", PROPERTY_HINT_ENUM, "Disabled,Environment,ConstantColor"), "set_ambient_mode", "get_ambient_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ambient_mode", PROPERTY_HINT_ENUM, "Disabled,Environment,Constant Color"), "set_ambient_mode", "get_ambient_mode"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "ambient_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_ambient_color", "get_ambient_color"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ambient_color_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_ambient_color_energy", "get_ambient_color_energy"); |