diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/light_2d.cpp | 8 | ||||
-rw-r--r-- | scene/2d/light_2d.h | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index a147ac0780..8e425b62da 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -445,10 +445,6 @@ void PointLight2D::_bind_methods() { PointLight2D::PointLight2D() { RS::get_singleton()->canvas_light_set_mode(_get_light(), RS::CANVAS_LIGHT_MODE_POINT); - _scale = 1.0; -} - -PointLight2D::~PointLight2D() { } ////////// @@ -457,6 +453,7 @@ void DirectionalLight2D::set_max_distance(float p_distance) { max_distance = p_distance; RS::get_singleton()->canvas_light_set_directional_distance(_get_light(), max_distance); } + float DirectionalLight2D::get_max_distance() const { return max_distance; } @@ -468,7 +465,8 @@ void DirectionalLight2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_distance", PROPERTY_HINT_RANGE, "0,16384.0,1.0,or_greater"), "set_max_distance", "get_max_distance"); } + DirectionalLight2D::DirectionalLight2D() { RS::get_singleton()->canvas_light_set_mode(_get_light(), RS::CANVAS_LIGHT_MODE_DIRECTIONAL); - set_max_distance(10000.0); + set_max_distance(max_distance); // Update RenderingServer. } diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 5f53fa227a..7dfeddc8e5 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -58,7 +58,6 @@ private: Color color; Color shadow_color; float height; - float _scale; float energy; int z_min; int z_max; @@ -139,7 +138,7 @@ class PointLight2D : public Light2D { GDCLASS(PointLight2D, Light2D); private: - float _scale; + float _scale = 1.0; Ref<Texture2D> texture; Vector2 texture_offset; @@ -172,7 +171,6 @@ public: String get_configuration_warning() const override; PointLight2D(); - ~PointLight2D(); }; class DirectionalLight2D : public Light2D { |