diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-17 20:26:50 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-17 20:26:50 +0200 |
| commit | 54ba8d68825be244fcad90c0809cc39931af5e01 (patch) | |
| tree | e95e97f9bc61573bc0b646e807ab1a57ad8f0b64 /scene/3d | |
| parent | 26d8ae08495cdf4d933ff5d405a22e2088fe2d91 (diff) | |
| parent | f8d08a83760d2b847de271c80c13d800b4a97aab (diff) | |
| download | redot-engine-54ba8d68825be244fcad90c0809cc39931af5e01.tar.gz | |
Merge pull request #90810 from Arnklit/particles_processing_ring_shape_emission_axis_fix
Fix shader crash on zero vector and negative x vector in particles processing
Diffstat (limited to 'scene/3d')
| -rw-r--r-- | scene/3d/cpu_particles_3d.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index e7b6aa1dba..0dc9834539 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -881,9 +881,9 @@ void CPUParticles3D::_particles_process(double p_delta) { case EMISSION_SHAPE_RING: { real_t ring_random_angle = Math::randf() * Math_TAU; real_t ring_random_radius = Math::randf() * (emission_ring_radius - emission_ring_inner_radius) + emission_ring_inner_radius; - Vector3 axis = emission_ring_axis.normalized(); + Vector3 axis = emission_ring_axis == Vector3(0.0, 0.0, 0.0) ? Vector3(0.0, 0.0, 1.0) : emission_ring_axis.normalized(); Vector3 ortho_axis; - if (axis == Vector3(1.0, 0.0, 0.0)) { + if (axis.abs() == Vector3(1.0, 0.0, 0.0)) { ortho_axis = Vector3(0.0, 1.0, 0.0).cross(axis); } else { ortho_axis = Vector3(1.0, 0.0, 0.0).cross(axis); |
