diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/SCsub | 2 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 35 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.h | 5 | ||||
-rw-r--r-- | scene/3d/path.cpp | 2 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 23 | ||||
-rw-r--r-- | scene/3d/reflection_probe.h | 2 | ||||
-rw-r--r-- | scene/3d/skeleton.cpp | 2 | ||||
-rw-r--r-- | scene/3d/world_environment.cpp (renamed from scene/3d/scenario_fx.cpp) | 4 | ||||
-rw-r--r-- | scene/3d/world_environment.h (renamed from scene/3d/scenario_fx.h) | 2 |
9 files changed, 47 insertions, 30 deletions
diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 35cc7479d8..200cf4316f 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -7,6 +7,6 @@ if env['disable_3d']: env.scene_sources.append("3d/skeleton.cpp") env.scene_sources.append("3d/particles.cpp") env.scene_sources.append("3d/visual_instance.cpp") - env.scene_sources.append("3d/scenario_fx.cpp") + env.scene_sources.append("3d/world_environment.cpp") else: env.add_source_files(env.scene_sources, "*.cpp") diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index e18bcf9035..b4bb03ff43 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -38,7 +38,7 @@ void AudioStreamPlayer3D::_mix_audio() { if (!stream_playback.is_valid() || !active || - (stream_paused && !stream_paused_fade_out)) { + (stream_paused && !stream_fade_out)) { return; } @@ -53,7 +53,7 @@ void AudioStreamPlayer3D::_mix_audio() { AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); - if (stream_paused_fade_out) { + if (stream_fade_out) { // Short fadeout ramp buffer_size = MIN(buffer_size, 128); } @@ -109,10 +109,10 @@ void AudioStreamPlayer3D::_mix_audio() { int buffers = AudioServer::get_singleton()->get_channel_count(); for (int k = 0; k < buffers; k++) { - AudioFrame target_volume = stream_paused_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k]; - AudioFrame vol_prev = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k]; + AudioFrame target_volume = stream_fade_out ? AudioFrame(0.f, 0.f) : current.vol[k]; + AudioFrame vol_prev = stream_fade_in ? AudioFrame(0.f, 0.f) : prev_outputs[i].vol[k]; AudioFrame vol_inc = (target_volume - vol_prev) / float(buffer_size); - AudioFrame vol = stream_paused_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k]; + AudioFrame vol = stream_fade_in ? AudioFrame(0.f, 0.f) : current.vol[k]; if (!AudioServer::get_singleton()->thread_has_channel_mix_buffer(current.bus_index, k)) continue; //may have been deleted, will be updated on process @@ -198,9 +198,15 @@ void AudioStreamPlayer3D::_mix_audio() { active = false; } + if (stream_stop) { + active = false; + set_physics_process_internal(false); + setplay = -1; + } + output_ready = false; - stream_paused_fade_in = false; - stream_paused_fade_out = false; + stream_fade_in = false; + stream_fade_out = false; } float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const { @@ -656,6 +662,7 @@ float AudioStreamPlayer3D::get_pitch_scale() const { void AudioStreamPlayer3D::play(float p_from_pos) { if (stream_playback.is_valid()) { + stream_stop = false; active = true; setplay = p_from_pos; output_ready = false; @@ -673,9 +680,8 @@ void AudioStreamPlayer3D::seek(float p_seconds) { void AudioStreamPlayer3D::stop() { if (stream_playback.is_valid()) { - active = false; - set_physics_process_internal(false); - setplay = -1; + stream_stop = true; + stream_fade_out = true; } } @@ -869,8 +875,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_fade_in = stream_paused ? false : true; + stream_fade_out = stream_paused ? true : false; } } @@ -1008,8 +1014,9 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() { out_of_range_mode = OUT_OF_RANGE_MIX; doppler_tracking = DOPPLER_TRACKING_DISABLED; stream_paused = false; - stream_paused_fade_in = false; - stream_paused_fade_out = false; + stream_fade_in = false; + stream_fade_out = false; + stream_stop = false; velocity_tracker.instance(); AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed"); diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index 881652da64..e467c170fb 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -109,8 +109,9 @@ private: float pitch_scale; bool autoplay; bool stream_paused; - bool stream_paused_fade_in; - bool stream_paused_fade_out; + bool stream_fade_in; + bool stream_fade_out; + bool stream_stop; StringName bus; void _mix_audio(); diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index 9fae5a9a54..8abfb62d70 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -122,7 +122,7 @@ void PathFollow::_update_transform() { Vector3 pos = c->interpolate_baked(o, cubic); Transform t = get_transform(); // Vector3 pos_offset = Vector3(h_offset, v_offset, 0); not used in all cases - // will be replaced by "Vector3(h_offset, v_offset, 0)" where it was formely used + // will be replaced by "Vector3(h_offset, v_offset, 0)" where it was formerly used if (rotation_mode == ROTATION_ORIENTED) { diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 50abbd483a..f85b51af08 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1222,7 +1222,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve floor_velocity = collision.collider_vel; if (p_stop_on_slope) { - if (Vector3() == lv_n + p_floor_direction) { + if ((lv_n + p_floor_direction).length() < 0.01) { Transform gt = get_global_transform(); gt.origin -= collision.travel; set_global_transform(gt); @@ -1243,6 +1243,7 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve motion = motion.slide(p_floor_direction); lv = lv.slide(p_floor_direction); } else { + Vector3 n = collision.normal; motion = motion.slide(n); lv = lv.slide(n); @@ -1280,13 +1281,21 @@ Vector3 KinematicBody::move_and_slide_with_snap(const Vector3 &p_linear_velocity Transform gt = get_global_transform(); if (move_and_collide(p_snap, p_infinite_inertia, col, true)) { - gt.origin += col.travel; - if (p_floor_direction != Vector3() && Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) { - on_floor = true; - on_floor_body = col.collider_rid; - floor_velocity = col.collider_vel; + + bool apply = true; + if (p_floor_direction != Vector3()) { + if (Math::acos(p_floor_direction.normalized().dot(col.normal)) < p_floor_max_angle) { + on_floor = true; + on_floor_body = col.collider_rid; + floor_velocity = col.collider_vel; + } else { + apply = false; //snapped with floor direction, but did not snap to a floor, do not snap. + } + } + if (apply) { + gt.origin += col.travel; + set_global_transform(gt); } - set_global_transform(gt); } return ret; diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 2921a3a881..48d65b79f7 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -32,7 +32,7 @@ #define REFLECTIONPROBE_H #include "scene/3d/visual_instance.h" -#include "scene/resources/sky_box.h" +#include "scene/resources/sky.h" #include "scene/resources/texture.h" #include "servers/visual_server.h" diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 8caf4e8e39..2acd03fb98 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -232,7 +232,7 @@ void Skeleton::_notification(int p_what) { Bone *bonesptr = bones.ptrw(); int len = bones.size(); - vs->skeleton_allocate(skeleton, len); // if same size, nothin really happens + vs->skeleton_allocate(skeleton, len); // if same size, nothing really happens _update_process_order(); diff --git a/scene/3d/scenario_fx.cpp b/scene/3d/world_environment.cpp index ad9b61e1ff..3cd43cbf5b 100644 --- a/scene/3d/scenario_fx.cpp +++ b/scene/3d/world_environment.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* scenario_fx.cpp */ +/* world_environment.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "scenario_fx.h" +#include "world_environment.h" #include "scene/main/viewport.h" void WorldEnvironment::_notification(int p_what) { diff --git a/scene/3d/scenario_fx.h b/scene/3d/world_environment.h index 6317dae75d..bf36a0a532 100644 --- a/scene/3d/scenario_fx.h +++ b/scene/3d/world_environment.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* scenario_fx.h */ +/* world_environment.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ |