diff options
Diffstat (limited to 'scene/3d/light_3d.cpp')
-rw-r--r-- | scene/3d/light_3d.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index 0aa0f7e5ac..1fa50b6872 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -35,12 +35,10 @@ #include "scene/resources/surface_tool.h" bool Light3D::_can_gizmo_scale() const { - return false; } void Light3D::set_param(Param p_param, float p_value) { - ERR_FAIL_INDEX(p_param, PARAM_MAX); param[p_param] = p_value; @@ -60,13 +58,11 @@ void Light3D::set_param(Param p_param, float p_value) { } float Light3D::get_param(Param p_param) const { - ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0); return param[p_param]; } void Light3D::set_shadow(bool p_enable) { - shadow = p_enable; RS::get_singleton()->light_set_shadow(light, p_enable); @@ -75,50 +71,41 @@ void Light3D::set_shadow(bool p_enable) { } } bool Light3D::has_shadow() const { - return shadow; } void Light3D::set_negative(bool p_enable) { - negative = p_enable; RS::get_singleton()->light_set_negative(light, p_enable); } bool Light3D::is_negative() const { - return negative; } void Light3D::set_cull_mask(uint32_t p_cull_mask) { - cull_mask = p_cull_mask; RS::get_singleton()->light_set_cull_mask(light, p_cull_mask); } uint32_t Light3D::get_cull_mask() const { - return cull_mask; } void Light3D::set_color(const Color &p_color) { - color = p_color; RS::get_singleton()->light_set_color(light, p_color); // The gizmo color depends on the light color, so update it. update_gizmo(); } Color Light3D::get_color() const { - return color; } void Light3D::set_shadow_color(const Color &p_shadow_color) { - shadow_color = p_shadow_color; RS::get_singleton()->light_set_shadow_color(light, p_shadow_color); } Color Light3D::get_shadow_color() const { - return shadow_color; } @@ -128,22 +115,17 @@ void Light3D::set_shadow_reverse_cull_face(bool p_enable) { } bool Light3D::get_shadow_reverse_cull_face() const { - return reverse_cull; } AABB Light3D::get_aabb() const { - if (type == RenderingServer::LIGHT_DIRECTIONAL) { - return AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); } else if (type == RenderingServer::LIGHT_OMNI) { - return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]); } else if (type == RenderingServer::LIGHT_SPOT) { - float len = param[PARAM_RANGE]; float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len; return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); @@ -153,7 +135,6 @@ AABB Light3D::get_aabb() const { } Vector<Face3> Light3D::get_faces(uint32_t p_usage_flags) const { - return Vector<Face3>(); } @@ -167,7 +148,6 @@ Light3D::BakeMode Light3D::get_bake_mode() const { } void Light3D::set_projector(const Ref<Texture2D> &p_texture) { - projector = p_texture; RID tex_id = projector.is_valid() ? projector->get_rid() : RID(); RS::get_singleton()->light_set_projector(light, tex_id); @@ -179,7 +159,6 @@ Ref<Texture2D> Light3D::get_projector() const { } void Light3D::_update_visibility() { - if (!is_inside_tree()) return; @@ -205,9 +184,7 @@ void Light3D::_update_visibility() { } void Light3D::_notification(int p_what) { - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - _update_visibility(); } @@ -217,18 +194,15 @@ void Light3D::_notification(int p_what) { } void Light3D::set_editor_only(bool p_editor_only) { - editor_only = p_editor_only; _update_visibility(); } bool Light3D::is_editor_only() const { - return editor_only; } void Light3D::_validate_property(PropertyInfo &property) const { - if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_size") { property.usage = 0; } @@ -243,7 +217,6 @@ void Light3D::_validate_property(PropertyInfo &property) const { } void Light3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_editor_only", "editor_only"), &Light3D::set_editor_only); ClassDB::bind_method(D_METHOD("is_editor_only"), &Light3D::is_editor_only); @@ -323,7 +296,6 @@ void Light3D::_bind_methods() { } Light3D::Light3D(RenderingServer::LightType p_type) { - type = p_type; switch (p_type) { case RS::LIGHT_DIRECTIONAL: @@ -373,13 +345,11 @@ Light3D::Light3D(RenderingServer::LightType p_type) { } Light3D::Light3D() { - type = RenderingServer::LIGHT_DIRECTIONAL; ERR_PRINT("Light3D should not be instanced directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead."); } Light3D::~Light3D() { - RS::get_singleton()->instance_set_base(get_instance(), RID()); if (light.is_valid()) @@ -388,13 +358,11 @@ Light3D::~Light3D() { ///////////////////////////////////////// void DirectionalLight3D::set_shadow_mode(ShadowMode p_mode) { - shadow_mode = p_mode; RS::get_singleton()->light_directional_set_shadow_mode(light, RS::LightDirectionalShadowMode(p_mode)); } DirectionalLight3D::ShadowMode DirectionalLight3D::get_shadow_mode() const { - return shadow_mode; } @@ -404,23 +372,19 @@ void DirectionalLight3D::set_shadow_depth_range(ShadowDepthRange p_range) { } DirectionalLight3D::ShadowDepthRange DirectionalLight3D::get_shadow_depth_range() const { - return shadow_depth_range; } void DirectionalLight3D::set_blend_splits(bool p_enable) { - blend_splits = p_enable; RS::get_singleton()->light_directional_set_blend_splits(light, p_enable); } bool DirectionalLight3D::is_blend_splits_enabled() const { - return blend_splits; } void DirectionalLight3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shadow_mode", "mode"), &DirectionalLight3D::set_shadow_mode); ClassDB::bind_method(D_METHOD("get_shadow_mode"), &DirectionalLight3D::get_shadow_mode); @@ -451,7 +415,6 @@ void DirectionalLight3D::_bind_methods() { DirectionalLight3D::DirectionalLight3D() : Light3D(RenderingServer::LIGHT_DIRECTIONAL) { - set_param(PARAM_SHADOW_MAX_DISTANCE, 100); set_param(PARAM_SHADOW_FADE_START, 0.8); set_shadow_mode(SHADOW_PARALLEL_4_SPLITS); @@ -461,13 +424,11 @@ DirectionalLight3D::DirectionalLight3D() : } void OmniLight3D::set_shadow_mode(ShadowMode p_mode) { - shadow_mode = p_mode; RS::get_singleton()->light_omni_set_shadow_mode(light, RS::LightOmniShadowMode(p_mode)); } OmniLight3D::ShadowMode OmniLight3D::get_shadow_mode() const { - return shadow_mode; } @@ -485,7 +446,6 @@ String OmniLight3D::get_configuration_warning() const { } void OmniLight3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shadow_mode", "mode"), &OmniLight3D::set_shadow_mode); ClassDB::bind_method(D_METHOD("get_shadow_mode"), &OmniLight3D::get_shadow_mode); @@ -500,7 +460,6 @@ void OmniLight3D::_bind_methods() { OmniLight3D::OmniLight3D() : Light3D(RenderingServer::LIGHT_OMNI) { - set_shadow_mode(SHADOW_CUBE); } @@ -526,7 +485,6 @@ String SpotLight3D::get_configuration_warning() const { } void SpotLight3D::_bind_methods() { - ADD_GROUP("Spot", "spot_"); ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "spot_range", PROPERTY_HINT_EXP_RANGE, "0,4096,0.1,or_greater"), "set_param", "get_param", PARAM_RANGE); ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "spot_attenuation", PROPERTY_HINT_EXP_EASING, "attenuation"), "set_param", "get_param", PARAM_ATTENUATION); |