diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/interpolated_camera.cpp | 6 | ||||
-rw-r--r-- | scene/3d/light.cpp | 19 | ||||
-rw-r--r-- | scene/3d/light.h | 4 | ||||
-rw-r--r-- | scene/3d/path.cpp | 6 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 6 | ||||
-rw-r--r-- | scene/3d/ray_cast.cpp | 8 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 7 | ||||
-rw-r--r-- | scene/3d/visibility_notifier.cpp | 6 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 19 | ||||
-rw-r--r-- | scene/3d/visual_instance.h | 1 |
11 files changed, 47 insertions, 37 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 6abc2caac8..e86a07c60f 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { velocity_tracker->reset(get_global_transform().origin); AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 36a6660bf9..a481018890 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -29,12 +29,14 @@ /*************************************************************************/ #include "interpolated_camera.h" +#include "engine.h" + void InterpolatedCamera::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - if (get_tree()->is_editor_hint() && enabled) + if (Engine::get_singleton()->is_editor_hint() && enabled) set_fixed_process(false); } break; @@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) { return; enabled = p_enable; if (p_enable) { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; set_process(true); } else 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); diff --git a/scene/3d/light.h b/scene/3d/light.h index 22ff5c0763..788e948536 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -69,6 +69,7 @@ private: Color shadow_color; bool shadow; bool negative; + bool reverse_cull; uint32_t cull_mask; VS::LightType type; bool editor_only; @@ -110,6 +111,9 @@ public: void set_shadow_color(const Color &p_shadow_color); Color get_shadow_color() const; + void set_shadow_reverse_cull_face(bool p_enable); + bool get_shadow_reverse_cull_face() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index f8df21004e..c40f73541e 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "path.h" + +#include "engine.h" #include "scene/scene_string_names.h" void Path::_notification(int p_what) { #if 0 - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && Engine::get_singleton()->is_editor_hint()) { //draw the curve!! for(int i=0;i<curve->get_point_count();i++) { @@ -53,7 +55,7 @@ void Path::_notification(int p_what) { void Path::_curve_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update_gizmo(); } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index dc8f72d77e..e1371e9ed6 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "physics_body.h" + +#include "engine.h" #include "method_bind_ext.gen.inc" #include "scene/scene_string_names.h" @@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) { #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_notify_local_transform(true); //used for warnings and only in editor } } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 67e7fb0e12..b0aab6cc4d 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -30,12 +30,14 @@ #include "ray_cast.h" #include "collision_object.h" +#include "engine.h" #include "mesh_instance.h" #include "servers/physics_server.h" + void RayCast::set_cast_to(const Vector3 &p_point) { cast_to = p_point; - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) update_gizmo(); if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); @@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const { void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; - if (is_inside_tree() && !get_tree()->is_editor_hint()) + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided = false; @@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_tree()->is_editor_hint()) { + if (enabled && !Engine::get_singleton()->is_editor_hint()) { set_fixed_process(true); if (get_tree()->is_debugging_collisions_hint()) diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 848b08eb8f..6498238e12 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "spatial.h" +#include "engine.h" #include "message_queue.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" @@ -134,7 +135,7 @@ void Spatial::_notification(int p_what) { else data.C = NULL; - if (data.toplevel && !get_tree()->is_editor_hint()) { + if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); @@ -178,7 +179,7 @@ void Spatial::_notification(int p_what) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0); } #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); @@ -492,7 +493,7 @@ void Spatial::set_as_toplevel(bool p_enabled) { if (data.toplevel == p_enabled) return; - if (is_inside_tree() && !get_tree()->is_editor_hint()) { + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { if (p_enabled) set_transform(get_global_transform()); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index cc81a4cb56..2fea451fe7 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "visibility_notifier.h" +#include "engine.h" #include "scene/3d/camera.h" #include "scene/3d/physics_body.h" #include "scene/animation/animation_player.h" #include "scene/scene_string_names.h" -#include "scene/scene_string_names.h" void VisibilityNotifier::_enter_camera(Camera *p_camera) { @@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Node *from = this; @@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) { diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 1a294d016a..7d61006529 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -231,14 +231,6 @@ void GeometryInstance::_notification(int p_what) { void GeometryInstance::set_flag(Flags p_flag, bool p_value) { ERR_FAIL_INDEX(p_flag, FLAG_MAX); - if (p_flag == FLAG_CAST_SHADOW) { - if (p_value == true) { - set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON); - } else { - set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF); - } - } - if (flags[p_flag] == p_value) return; @@ -252,14 +244,6 @@ bool GeometryInstance::get_flag(Flags p_flag) const { ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false); - if (p_flag == FLAG_CAST_SHADOW) { - if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) { - return false; - } else { - return true; - } - } - return flags[p_flag]; } @@ -330,7 +314,6 @@ void GeometryInstance::_bind_methods() { //ADD_SIGNAL( MethodInfo("visibility_changed")); - BIND_CONSTANT(FLAG_CAST_SHADOW); BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS); BIND_CONSTANT(FLAG_MAX); @@ -350,8 +333,6 @@ GeometryInstance::GeometryInstance() { flags[i] = false; } - flags[FLAG_CAST_SHADOW] = true; - shadow_casting_setting = SHADOW_CASTING_SETTING_ON; extra_cull_margin = 0; //VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index 9318198e54..694d0c2499 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -84,7 +84,6 @@ class GeometryInstance : public VisualInstance { public: enum Flags { - FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW, FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT, FLAG_MAX = VS::INSTANCE_FLAG_MAX, |