diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 1 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 6 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.h | 2 | ||||
-rw-r--r-- | scene/3d/camera.h | 2 | ||||
-rw-r--r-- | scene/3d/cpu_particles.cpp | 5 | ||||
-rw-r--r-- | scene/3d/cpu_particles.h | 2 | ||||
-rw-r--r-- | scene/3d/navigation.cpp | 1 | ||||
-rw-r--r-- | scene/3d/particles.cpp | 29 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 2 | ||||
-rw-r--r-- | scene/3d/soft_body.cpp | 1 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 1 | ||||
-rw-r--r-- | scene/3d/vehicle_body.cpp | 7 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 1 | ||||
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 4 |
14 files changed, 45 insertions, 19 deletions
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 95eec41fb2..dfa8fce9be 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -264,6 +264,7 @@ void ARVRController::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rumble"), &ARVRController::get_rumble); ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &ARVRController::set_rumble); ADD_PROPERTY(PropertyInfo(Variant::REAL, "rumble", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_rumble", "get_rumble"); + ADD_PROPERTY_DEFAULT("rumble", 0.0); ClassDB::bind_method(D_METHOD("get_mesh"), &ARVRController::get_mesh); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index ff8c218575..ff28f60d4f 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -93,7 +93,7 @@ void AudioStreamPlayer3D::_mix_audio() { } bool interpolate_filter = !started; - ; + if (!found) { //create new if was not used before if (prev_output_count < MAX_OUTPUTS) { @@ -872,8 +872,8 @@ void AudioStreamPlayer3D::set_stream_paused(bool p_pause) { if (p_pause != stream_paused) { stream_paused = p_pause; - stream_paused_fade_in = stream_paused ? false : true; - stream_paused_fade_out = stream_paused ? true : false; + stream_paused_fade_in = !stream_paused; + stream_paused_fade_out = stream_paused; } } diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 7a652ed65f..93954e758a 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -71,7 +71,7 @@ private: struct Output { AudioFilterSW filter; - AudioFilterSW::Processor filter_process[6]; + AudioFilterSW::Processor filter_process[8]; AudioFrame vol[4]; float filter_gain; float pitch_scale; diff --git a/scene/3d/camera.h b/scene/3d/camera.h index c0a4f77435..6460f17e85 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -113,7 +113,7 @@ public: void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far); void set_orthogonal(float p_size, float p_z_near, float p_z_far); - void set_frustum(float p_size, Vector2 p_offset, float p_near, float p_far); + void set_frustum(float p_size, Vector2 p_offset, float p_z_near, float p_z_far); void set_projection(Camera::Projection p_mode); void make_current(); diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 6dc1b93576..6ede9c10ef 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -225,6 +225,8 @@ void CPUParticles::restart() { frame_remainder = 0; cycle = 0; + set_emitting(true); + { int pc = particles.size(); PoolVector<Particle>::Write w = particles.write(); @@ -503,7 +505,8 @@ void CPUParticles::_particles_process(float p_delta) { time = Math::fmod(time, lifetime); cycle++; if (one_shot && cycle > 0) { - emitting = false; + set_emitting(false); + _change_notify(); } } diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h index 6f267102fa..6566792def 100644 --- a/scene/3d/cpu_particles.h +++ b/scene/3d/cpu_particles.h @@ -249,7 +249,7 @@ public: void set_color(const Color &p_color); Color get_color() const; - void set_color_ramp(const Ref<Gradient> &p_texture); + void set_color_ramp(const Ref<Gradient> &p_ramp); Ref<Gradient> get_color_ramp() const; void set_particle_flag(Flags p_flag, bool p_enable); diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index 612d91c6e1..12d562c0c6 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -90,7 +90,6 @@ void Navigation::_navmesh_link(int p_id) { if (!valid) { nm.polygons.pop_back(); ERR_CONTINUE(!valid); - continue; } p.center = center; diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 156560f802..2bcd0eaa46 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -47,6 +47,12 @@ PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { void Particles::set_emitting(bool p_emitting) { VS::get_singleton()->particles_set_emitting(particles, p_emitting); + + if (p_emitting && one_shot) { + set_process_internal(true); + } else if (!p_emitting) { + set_process_internal(false); + } } void Particles::set_amount(int p_amount) { @@ -66,8 +72,16 @@ void Particles::set_one_shot(bool p_one_shot) { one_shot = p_one_shot; VS::get_singleton()->particles_set_one_shot(particles, one_shot); - if (!one_shot && is_emitting()) - VisualServer::get_singleton()->particles_restart(particles); + + if (is_emitting()) { + + set_process_internal(true); + if (!one_shot) + VisualServer::get_singleton()->particles_restart(particles); + } + + if (!one_shot) + set_process_internal(false); } void Particles::set_pre_process_time(float p_time) { @@ -278,6 +292,7 @@ String Particles::get_configuration_warning() const { void Particles::restart() { VisualServer::get_singleton()->particles_restart(particles); + VisualServer::get_singleton()->particles_set_emitting(particles, true); } AABB Particles::capture_aabb() const { @@ -306,6 +321,16 @@ void Particles::_notification(int p_what) { VS::get_singleton()->particles_set_speed_scale(particles, 0); } } + + // Use internal process when emitting and one_shot are on so that when + // the shot ends the editor can properly update + if (p_what == NOTIFICATION_INTERNAL_PROCESS) { + + if (one_shot && !is_emitting()) { + _change_notify(); + set_process_internal(false); + } + } } void Particles::_bind_methods() { diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 3624e04434..d3aad7000d 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1470,7 +1470,7 @@ Vector3 KinematicCollision::get_remainder() const { return collision.remainder; } Object *KinematicCollision::get_local_shape() const { - ERR_FAIL_COND_V(!owner, NULL); + if (!owner) return NULL; uint32_t ownerid = owner->shape_find_owner(collision.local_shape); return owner->shape_owner_get_owner(ownerid); } diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 909d4fda34..a9d96292a1 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -699,7 +699,6 @@ bool SoftBody::is_ray_pickable() const { } SoftBody::SoftBody() : - MeshInstance(), physics_rid(PhysicsServer::get_singleton()->soft_body_create()), mesh_owner(false), collision_mask(1), diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 6b70eef662..9f73484b6a 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -163,6 +163,7 @@ float SpriteBase3D::get_opacity() const { void SpriteBase3D::set_axis(Vector3::Axis p_axis) { + ERR_FAIL_INDEX(p_axis, 3); axis = p_axis; _queue_update(); } diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 32b8219ee0..89e96e0227 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -585,7 +585,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec if (p_rollInfluence > 0.0) { // !BAS! But seeing we apply this frame by frame, makes more sense to me to make this time based // keeping in mind our anti roll factor if it is set - contactDamping = s->get_step() / p_rollInfluence; + contactDamping = MIN(contactDamping, s->get_step() / p_rollInfluence); } #define ONLY_USE_LINEAR_MASS @@ -723,7 +723,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { real_t rollingFriction = 0.f; if (wheelInfo.m_raycastInfo.m_isInContact) { - if (engine_force != 0.f && wheelInfo.engine_traction != false) { + if (engine_force != 0.f && wheelInfo.engine_traction) { rollingFriction = -engine_force * s->get_step(); } else { real_t defaultRollingFrictionImpulse = 0.f; @@ -928,8 +928,7 @@ void VehicleBody::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering"); } -VehicleBody::VehicleBody() : - RigidBody() { +VehicleBody::VehicleBody() { m_pitchControl = 0; m_currentVehicleSpeedKmHour = real_t(0.); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 4808470800..5141c84803 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -326,6 +326,7 @@ void GeometryInstance::_bind_methods() { BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_SHADOWS_ONLY); BIND_ENUM_CONSTANT(FLAG_USE_BAKED_LIGHT); + BIND_ENUM_CONSTANT(FLAG_DRAW_NEXT_FRAME_IF_VISIBLE); BIND_ENUM_CONSTANT(FLAG_MAX); } diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 75b419ca58..5fa8c43f9f 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -212,9 +212,7 @@ static bool fast_tri_box_overlap(const Vector3 &boxcenter, const Vector3 boxhalf /* compute plane equation of triangle: normal*x+d=0 */ normal = e0.cross(e1); d = -normal.dot(v0); /* plane eq: normal.x+d=0 */ - if (!planeBoxOverlap(normal, d, boxhalfsize)) return false; - - return true; /* box and triangle overlaps */ + return planeBoxOverlap(normal, d, boxhalfsize); /* if true, box and triangle overlaps */ } static _FORCE_INLINE_ void get_uv_and_normal(const Vector3 &p_pos, const Vector3 *p_vtx, const Vector2 *p_uv, const Vector3 *p_normal, Vector2 &r_uv, Vector3 &r_normal) { |