diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio/audio_rb_resampler.cpp | 32 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_filter.h | 13 | ||||
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.cpp | 48 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.cpp | 17 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.h | 4 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 19 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.h | 4 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_wrap_mt.h | 4 | ||||
-rw-r--r-- | servers/physics_2d_server.h | 2 | ||||
-rw-r--r-- | servers/physics_server.h | 10 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 2 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 13 | ||||
-rw-r--r-- | servers/visual/shader_language.h | 4 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.cpp | 22 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 11 | ||||
-rw-r--r-- | servers/visual_server.cpp | 2 | ||||
-rw-r--r-- | servers/visual_server.h | 2 |
17 files changed, 159 insertions, 50 deletions
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp index 84a87de2e2..d9b3579812 100644 --- a/servers/audio/audio_rb_resampler.cpp +++ b/servers/audio/audio_rb_resampler.cpp @@ -79,53 +79,27 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i p_dest[i] = AudioFrame(v0, v1); } - // For now, channels higher than stereo are almost ignored + // This will probably never be used, but added anyway if (C == 4) { - // FIXME: v2 and v3 are not being used (thus were commented out to prevent - // compilation warnings, but they should likely be uncommented *and* used). - // See also C == 6 with similar issues. float v0 = rb[(pos << 2) + 0]; float v1 = rb[(pos << 2) + 1]; - /* - float v2 = rb[(pos << 2) + 2]; - float v3 = rb[(pos << 2) + 3]; - */ float v0n = rb[(pos_next << 2) + 0]; float v1n = rb[(pos_next << 2) + 1]; - /* - float v2n = rb[(pos_next << 2) + 2]; - float v3n = rb[(pos_next << 2) + 3]; - */ - v0 += (v0n - v0) * frac; v1 += (v1n - v1) * frac; - /* - v2 += (v2n - v2) * frac; - v3 += (v3n - v3) * frac; - */ p_dest[i] = AudioFrame(v0, v1); } if (C == 6) { - // FIXME: Lot of unused assignments here, but it seems like intermediate calculations - // should be done as for C == 2 (C == 4 also has some unused assignments). float v0 = rb[(pos * 6) + 0]; float v1 = rb[(pos * 6) + 1]; - /* - float v2 = rb[(pos * 6) + 2]; - float v3 = rb[(pos * 6) + 3]; - float v4 = rb[(pos * 6) + 4]; - float v5 = rb[(pos * 6) + 5]; float v0n = rb[(pos_next * 6) + 0]; float v1n = rb[(pos_next * 6) + 1]; - float v2n = rb[(pos_next * 6) + 2]; - float v3n = rb[(pos_next * 6) + 3]; - float v4n = rb[(pos_next * 6) + 4]; - float v5n = rb[(pos_next * 6) + 5]; - */ + v0 += (v0n - v0) * frac; + v1 += (v1n - v1) * frac; p_dest[i] = AudioFrame(v0, v1); } } diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h index 11978882bc..e8f12e5efa 100644 --- a/servers/audio/effects/audio_effect_filter.h +++ b/servers/audio/effects/audio_effect_filter.h @@ -96,6 +96,11 @@ VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB) class AudioEffectLowPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter) + + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectLowPassFilter() : AudioEffectFilter(AudioFilterSW::LOWPASS) {} @@ -103,6 +108,10 @@ public: class AudioEffectHighPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter) + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectHighPassFilter() : AudioEffectFilter(AudioFilterSW::HIGHPASS) {} @@ -110,6 +119,10 @@ public: class AudioEffectBandPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter) + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectBandPassFilter() : AudioEffectFilter(AudioFilterSW::BANDPASS) {} diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 60505c08c5..3a965ff800 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -503,6 +503,24 @@ void Generic6DOFJointSW::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJoi case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: { // Not implemented in GodotPhysics backend } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: { + // Not implemented in GodotPhysics backend + } break; case PhysicsServer::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning } } @@ -585,6 +603,24 @@ real_t Generic6DOFJointSW::get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJ case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: { // Not implemented in GodotPhysics backend } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: { + // Not implemented in GodotPhysics backend + } break; case PhysicsServer::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning } return 0; @@ -610,6 +646,12 @@ void Generic6DOFJointSW::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJoin case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: { // Not implemented in GodotPhysics backend } break; + case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: { + // Not implemented in GodotPhysics backend + } break; case PhysicsServer::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning } } @@ -632,6 +674,12 @@ bool Generic6DOFJointSW::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJoin case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: { // Not implemented in GodotPhysics backend } break; + case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: { + // Not implemented in GodotPhysics backend + } break; + case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: { + // Not implemented in GodotPhysics backend + } break; case PhysicsServer::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning } diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 76a6138817..fddb531a4f 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -40,6 +40,12 @@ #include "joints/pin_joint_sw.h" #include "joints/slider_joint_sw.h" +#define FLUSH_QUERY_CHECK \ + if (flushing_queries) { \ + ERR_EXPLAIN("Can't change this state while flushing queries. Use call_deferred()/set_deferred() to change monitoring state instead"); \ + ERR_FAIL(); \ + } + RID PhysicsServerSW::shape_create(ShapeType p_shape) { ShapeSW *shape = NULL; @@ -352,6 +358,8 @@ void PhysicsServerSW::area_clear_shapes(RID p_area) { void PhysicsServerSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) { + FLUSH_QUERY_CHECK + AreaSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); ERR_FAIL_INDEX(p_shape_idx, area->get_shape_count()); @@ -435,6 +443,8 @@ void PhysicsServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) { void PhysicsServerSW::area_set_monitorable(RID p_area, bool p_monitorable) { + FLUSH_QUERY_CHECK + AreaSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -582,6 +592,8 @@ RID PhysicsServerSW::body_get_shape(RID p_body, int p_shape_idx) const { void PhysicsServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) { + FLUSH_QUERY_CHECK + BodySW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count()); @@ -1459,6 +1471,8 @@ void PhysicsServerSW::flush_queries() { doing_sync = true; + flushing_queries = true; + uint64_t time_beg = OS::get_singleton()->get_ticks_usec(); for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) { @@ -1467,6 +1481,8 @@ void PhysicsServerSW::flush_queries() { space->call_queries(); } + flushing_queries = false; + if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { uint64_t total_time[SpaceSW::ELAPSED_TIME_MAX]; @@ -1580,6 +1596,7 @@ PhysicsServerSW::PhysicsServerSW() { collision_pairs = 0; active = true; + flushing_queries = false; }; PhysicsServerSW::~PhysicsServerSW(){ diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index 4131c5e248..b3c61403aa 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -51,6 +51,8 @@ class PhysicsServerSW : public PhysicsServer { int active_objects; int collision_pairs; + bool flushing_queries; + StepSW *stepper; Set<const SpaceSW *> active_spaces; @@ -365,6 +367,8 @@ public: virtual void flush_queries(); virtual void finish(); + virtual bool is_flushing_queries() const { return flushing_queries; } + int get_process_info(ProcessInfo p_info); PhysicsServerSW(); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 2df09057c4..45310ec4b3 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -36,6 +36,12 @@ #include "core/project_settings.h" #include "core/script_language.h" +#define FLUSH_QUERY_CHECK \ + if (flushing_queries) { \ + ERR_EXPLAIN("Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead"); \ + ERR_FAIL(); \ + } + RID Physics2DServerSW::_shape_create(ShapeType p_shape) { Shape2DSW *shape = NULL; @@ -401,6 +407,8 @@ void Physics2DServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, co void Physics2DServerSW::area_set_shape_disabled(RID p_area, int p_shape, bool p_disabled) { + FLUSH_QUERY_CHECK + Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -539,6 +547,8 @@ void Physics2DServerSW::area_set_pickable(RID p_area, bool p_pickable) { void Physics2DServerSW::area_set_monitorable(RID p_area, bool p_monitorable) { + FLUSH_QUERY_CHECK + Area2DSW *area = area_owner.get(p_area); ERR_FAIL_COND(!area); @@ -617,6 +627,8 @@ RID Physics2DServerSW::body_get_space(RID p_body) const { void Physics2DServerSW::body_set_mode(RID p_body, BodyMode p_mode) { + FLUSH_QUERY_CHECK + Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -719,6 +731,8 @@ void Physics2DServerSW::body_clear_shapes(RID p_body) { void Physics2DServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) { + FLUSH_QUERY_CHECK + Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); @@ -1348,6 +1362,8 @@ void Physics2DServerSW::flush_queries() { if (!active) return; + flushing_queries = true; + uint64_t time_beg = OS::get_singleton()->get_ticks_usec(); for (Set<const Space2DSW *>::Element *E = active_spaces.front(); E; E = E->next()) { @@ -1356,6 +1372,8 @@ void Physics2DServerSW::flush_queries() { space->call_queries(); } + flushing_queries = false; + if (ScriptDebugger::get_singleton() && ScriptDebugger::get_singleton()->is_profiling()) { uint64_t total_time[Space2DSW::ELAPSED_TIME_MAX]; @@ -1434,6 +1452,7 @@ Physics2DServerSW::Physics2DServerSW() { active_objects = 0; collision_pairs = 0; using_threads = int(ProjectSettings::get_singleton()->get("physics/2d/thread_model")) == 2; + flushing_queries = false; }; Physics2DServerSW::~Physics2DServerSW(){ diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index f41c599579..4f33873219 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -54,6 +54,8 @@ class Physics2DServerSW : public Physics2DServer { bool using_threads; + bool flushing_queries; + Step2DSW *stepper; Set<const Space2DSW *> active_spaces; @@ -278,6 +280,8 @@ public: virtual void end_sync(); virtual void finish(); + virtual bool is_flushing_queries() const { return flushing_queries; } + int get_process_info(ProcessInfo p_info); Physics2DServerSW(); diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 58517bf1a7..e736854077 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -312,6 +312,10 @@ public: virtual void flush_queries(); virtual void finish(); + virtual bool is_flushing_queries() const { + return physics_2d_server->is_flushing_queries(); + } + int get_process_info(ProcessInfo p_info) { return physics_2d_server->get_process_info(p_info); } diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 2e91d89c53..32e1dd1a08 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -584,6 +584,8 @@ public: virtual void end_sync() = 0; virtual void finish() = 0; + virtual bool is_flushing_queries() const = 0; + enum ProcessInfo { INFO_ACTIVE_OBJECTS, diff --git a/servers/physics_server.h b/servers/physics_server.h index d80d76305a..15b353f768 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -697,6 +697,9 @@ public: G6DOF_JOINT_LINEAR_DAMPING, G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY, G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT, + G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, + G6DOF_JOINT_LINEAR_SPRING_DAMPING, + G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, G6DOF_JOINT_ANGULAR_LOWER_LIMIT, G6DOF_JOINT_ANGULAR_UPPER_LIMIT, G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, @@ -706,6 +709,9 @@ public: G6DOF_JOINT_ANGULAR_ERP, G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY, G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT, + G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, + G6DOF_JOINT_ANGULAR_SPRING_DAMPING, + G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, G6DOF_JOINT_MAX }; @@ -713,6 +719,8 @@ public: G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, + G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, + G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, G6DOF_JOINT_FLAG_ENABLE_MOTOR, G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR, G6DOF_JOINT_FLAG_MAX @@ -744,6 +752,8 @@ public: virtual void flush_queries() = 0; virtual void finish() = 0; + virtual bool is_flushing_queries() const = 0; + enum ProcessInfo { INFO_ACTIVE_OBJECTS, diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index f9beeb226c..4329203ccb 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -518,6 +518,8 @@ public: virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0; virtual void particles_restart(RID p_particles) = 0; + virtual bool particles_is_inactive(RID p_particles) const = 0; + virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) = 0; virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0; diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 0783d91a59..50e45963d9 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -131,7 +131,6 @@ const char *ShaderLanguage::token_names[TK_MAX] = { "TYPE_USAMPLER3D", "TYPE_SAMPLERCUBE", "INTERPOLATION_FLAT", - "INTERPOLATION_NO_PERSPECTIVE", "INTERPOLATION_SMOOTH", "PRECISION_LOW", "PRECISION_MID", @@ -271,7 +270,6 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = { { TK_TYPE_USAMPLER3D, "usampler3D" }, { TK_TYPE_SAMPLERCUBE, "samplerCube" }, { TK_INTERPOLATION_FLAT, "flat" }, - { TK_INTERPOLATION_NO_PERSPECTIVE, "noperspective" }, { TK_INTERPOLATION_SMOOTH, "smooth" }, { TK_PRECISION_LOW, "lowp" }, { TK_PRECISION_MID, "mediump" }, @@ -759,7 +757,6 @@ bool ShaderLanguage::is_token_interpolation(TokenType p_type) { return ( p_type == TK_INTERPOLATION_FLAT || - p_type == TK_INTERPOLATION_NO_PERSPECTIVE || p_type == TK_INTERPOLATION_SMOOTH); } @@ -767,8 +764,6 @@ ShaderLanguage::DataInterpolation ShaderLanguage::get_token_interpolation(TokenT if (p_type == TK_INTERPOLATION_FLAT) return INTERPOLATION_FLAT; - else if (p_type == TK_INTERPOLATION_NO_PERSPECTIVE) - return INTERPOLATION_NO_PERSPECTIVE; else return INTERPOLATION_SMOOTH; } @@ -2353,7 +2348,7 @@ bool ShaderLanguage::is_sampler_type(DataType p_type) { p_type == TYPE_SAMPLERCUBE; } -Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type) { +Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint) { if (p_value.size() > 0) { Variant value; switch (p_type) { @@ -2397,7 +2392,11 @@ Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::C value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real)); break; case ShaderLanguage::TYPE_VEC4: - value = Variant(Plane(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) { + value = Variant(Color(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + } else { + value = Variant(Plane(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real)); + } break; case ShaderLanguage::TYPE_MAT2: value = Variant(Transform2D(p_value[0].real, p_value[2].real, p_value[1].real, p_value[3].real, 0.0, 0.0)); diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index 9277dfa2cf..2d1851928e 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -80,7 +80,6 @@ public: TK_TYPE_USAMPLER3D, TK_TYPE_SAMPLERCUBE, TK_INTERPOLATION_FLAT, - TK_INTERPOLATION_NO_PERSPECTIVE, TK_INTERPOLATION_SMOOTH, TK_PRECISION_LOW, TK_PRECISION_MID, @@ -210,7 +209,6 @@ public: enum DataInterpolation { INTERPOLATION_FLAT, - INTERPOLATION_NO_PERSPECTIVE, INTERPOLATION_SMOOTH, }; @@ -550,7 +548,7 @@ public: static int get_cardinality(DataType p_type); static bool is_scalar_type(DataType p_type); static bool is_sampler_type(DataType p_type); - static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type); + static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint = ShaderLanguage::ShaderNode::Uniform::HINT_NONE); static void get_keyword_list(List<String> *r_keywords); static void get_builtin_funcs(List<String> *r_keywords); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 74a05ce4e4..734c295a72 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -51,7 +51,7 @@ void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Tra } } -void _collect_ysort_children(VisualServerCanvas::Item *p_canvas_item, Transform2D p_transform, VisualServerCanvas::Item **r_items, Transform2D *r_extra_transforms, int &r_index) { +void _collect_ysort_children(VisualServerCanvas::Item *p_canvas_item, Transform2D p_transform, VisualServerCanvas::Item **r_items, int &r_index) { int child_item_count = p_canvas_item->child_items.size(); VisualServerCanvas::Item **child_items = p_canvas_item->child_items.ptrw(); for (int i = 0; i < child_item_count; i++) { @@ -64,7 +64,7 @@ void _collect_ysort_children(VisualServerCanvas::Item *p_canvas_item, Transform2 r_index++; if (child_items[i]->sort_y) - _collect_ysort_children(child_items[i], p_transform * child_items[i]->xform, r_items, r_extra_transforms, r_index); + _collect_ysort_children(child_items[i], p_transform * child_items[i]->xform, r_items, r_index); } } @@ -100,7 +100,6 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item, const Transfor int child_item_count = ci->child_items.size(); Item **child_items = ci->child_items.ptrw(); - Transform2D *child_extra_transforms = NULL; if (ci->clip) { if (p_canvas_clip != NULL) { @@ -118,14 +117,14 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item, const Transfor if (ci->ysort_children_count == -1) { ci->ysort_children_count = 0; - _collect_ysort_children(ci, Transform2D(), NULL, NULL, ci->ysort_children_count); + _collect_ysort_children(ci, Transform2D(), NULL, ci->ysort_children_count); } child_item_count = ci->ysort_children_count; child_items = (Item **)alloca(child_item_count * sizeof(Item *)); int i = 0; - _collect_ysort_children(ci, Transform2D(), child_items, child_extra_transforms, i); + _collect_ysort_children(ci, Transform2D(), child_items, i); SortArray<Item *, ItemPtrSort> sorter; sorter.sort(child_items, child_item_count); @@ -336,7 +335,12 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) { Item *item_owner = canvas_item_owner.get(canvas_item->parent); item_owner->child_items.erase(canvas_item); - item_owner->ysort_children_count = -1; + + Item *ysort_owner = item_owner; + while (ysort_owner && ysort_owner->sort_y) { + item_owner->ysort_children_count = -1; + ysort_owner = canvas_item_owner.getornull(ysort_owner->parent); + } } canvas_item->parent = RID(); @@ -1346,6 +1350,12 @@ bool VisualServerCanvas::free(RID p_rid) { Item *item_owner = canvas_item_owner.get(canvas_item->parent); item_owner->child_items.erase(canvas_item); + + Item *ysort_owner = item_owner; + while (ysort_owner && ysort_owner->sort_y) { + item_owner->ysort_children_count = -1; + ysort_owner = canvas_item_owner.getornull(ysort_owner->parent); + } } } diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 13de92f226..1deca7bc66 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1912,9 +1912,14 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca if (ins->base_type == VS::INSTANCE_PARTICLES) { //particles visible? process them - VSG::storage->particles_request_process(ins->base); - //particles visible? request redraw - VisualServerRaster::redraw_request(); + if (VSG::storage->particles_is_inactive(ins->base)) { + //but if nothing is going on, don't do it. + keep = false; + } else { + VSG::storage->particles_request_process(ins->base); + //particles visible? request redraw + VisualServerRaster::redraw_request(); + } } if (geom->lighting_dirty) { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index ca5271190c..e1db123f58 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -343,7 +343,7 @@ RID VisualServer::get_white_texture() { #define SMALL_VEC2 Vector2(0.00001, 0.00001) #define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) -Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb) { +Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) { PoolVector<uint8_t>::Write vw = r_vertex_array.write(); diff --git a/servers/visual_server.h b/servers/visual_server.h index 59eb43da97..743e010034 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -61,7 +61,7 @@ protected: RID white_texture; RID test_material; - Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb); + Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb); static VisualServer *(*create_func)(); static void _bind_methods(); |