summaryrefslogtreecommitdiff
path: root/scene/3d/light.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/light.cpp')
-rw-r--r--scene/3d/light.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 977f1f81a7..b4a62138fb 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "light.h"
+#include "engine.h"
#include "project_settings.h"
#include "scene/resources/surface_tool.h"
@@ -106,6 +107,16 @@ Color Light::get_shadow_color() const {
return shadow_color;
}
+void Light::set_shadow_reverse_cull_face(bool p_enable) {
+ reverse_cull = p_enable;
+ VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
+}
+
+bool Light::get_shadow_reverse_cull_face() const {
+
+ return reverse_cull;
+}
+
Rect3 Light::get_aabb() const {
if (type == VisualServer::LIGHT_DIRECTIONAL) {
@@ -140,7 +151,7 @@ void Light::_update_visibility() {
#ifdef TOOLS_ENABLED
if (editor_only) {
- if (!get_tree()->is_editor_hint()) {
+ if (!Engine::get_singleton()->is_editor_hint()) {
editor_ok = false;
} else {
editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root()));
@@ -202,6 +213,9 @@ void Light::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_color", "color"), &Light::set_color);
ClassDB::bind_method(D_METHOD("get_color"), &Light::get_color);
+ ClassDB::bind_method(D_METHOD("set_shadow_reverse_cull_face", "enable"), &Light::set_shadow_reverse_cull_face);
+ ClassDB::bind_method(D_METHOD("get_shadow_reverse_cull_face"), &Light::get_shadow_reverse_cull_face);
+
ClassDB::bind_method(D_METHOD("set_shadow_color", "shadow_color"), &Light::set_shadow_color);
ClassDB::bind_method(D_METHOD("get_shadow_color"), &Light::get_shadow_color);
@@ -217,6 +231,7 @@ void Light::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face");
ADD_GROUP("Editor", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
ADD_GROUP("", "");
@@ -244,6 +259,8 @@ Light::Light(VisualServer::LightType p_type) {
light = VisualServer::get_singleton()->light_create(p_type);
VS::get_singleton()->instance_set_base(get_instance(), light);
+ reverse_cull = false;
+
editor_only = false;
set_color(Color(1, 1, 1, 1));
set_shadow(false);