summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-17 12:24:51 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-17 12:24:51 +0100
commit376290ea86b70c15452ec97e1cd1937c319383b1 (patch)
treec35aab9aa0a11069a78b306dbcd7a715e1344100 /servers/rendering/renderer_rd
parent740e5a6404571e0e5dc4dabdc0c7bad64801ae3f (diff)
parent99a159cd9bf51ba485064dd09a36e0b80db978b4 (diff)
Merge pull request #70163 from clayjohn/particles-sdf
Transform sdf xfrom by particle emission transform when particles are in global space
Diffstat (limited to 'servers/rendering/renderer_rd')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 8b1ff0a72a..9eac2c3b85 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -810,6 +810,15 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta
//2D collision
Transform2D xform = p_particles->sdf_collision_transform; //will use dotproduct manually so invert beforehand
+
+ if (!p_particles->use_local_coords) {
+ Transform2D emission;
+ emission.columns[0] = Vector2(p_particles->emission_transform.basis.get_column(0).x, p_particles->emission_transform.basis.get_column(0).y);
+ emission.columns[1] = Vector2(p_particles->emission_transform.basis.get_column(1).x, p_particles->emission_transform.basis.get_column(1).y);
+ emission.set_origin(Vector2(p_particles->emission_transform.origin.x, p_particles->emission_transform.origin.y));
+ xform = xform * emission.affine_inverse();
+ }
+
Transform2D revert = xform.affine_inverse();
frame_params.collider_count = 1;
frame_params.colliders[0].transform[0] = xform.columns[0][0];