summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-20 00:49:52 +0200
committerGitHub <noreply@github.com>2022-06-20 00:49:52 +0200
commitff9a66067b6d3b82c5d30f1715e585fefe0463c1 (patch)
treecc5b18692793601e1c8ee32ef4619c9c46b44bbd /scene/resources
parentf58ff85f8f9e0cf878ef097c19c8eacde0c0585d (diff)
parent59029f1a3f52c52a887e2e96715d8b0e0851e4b3 (diff)
Merge pull request #62158 from MightiestGoat/particles-material-patch
Adding emission_tex_ofs calculation in process()
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/particles_material.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index c4b15df6bb..7a49b9b515 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -488,6 +488,12 @@ void ParticlesMaterial::_update_shader() {
code += " float degree_to_rad = pi / 180.0;\n";
code += "\n";
+ if (emission_shape == EMISSION_SHAPE_POINTS || emission_shape == EMISSION_SHAPE_DIRECTED_POINTS) {
+ code += " int point = min(emission_texture_point_count - 1, int(rand_from_seed(alt_seed) * float(emission_texture_point_count)));\n";
+ code += " ivec2 emission_tex_size = textureSize(emission_texture_points, 0);\n";
+ code += " ivec2 emission_tex_ofs = ivec2(point % emission_tex_size.x, point / emission_tex_size.x);\n";
+ }
+
code += " CUSTOM.y += DELTA / LIFETIME;\n";
code += " float tv = CUSTOM.y / CUSTOM.w;\n";
if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) {