diff options
author | Erik Johnson <ecmjohnson@hotmail.com> | 2023-03-20 20:40:13 -0400 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-24 16:28:30 +0200 |
commit | 410b503aace744ba1ea5b1f7a67d0d8600258481 (patch) | |
tree | 2f28bad499fba4e21920e517efc67b3455d1a8bf /drivers | |
parent | 3445fa7dbcddff1aabb73e0ee156d97227dbe41b (diff) |
Translate inactive particles to -INF
(cherry picked from commit 6229c2a1f99135b841ce43f2728b4ac35a9b1938)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/shaders/particles_copy.glsl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gles3/shaders/particles_copy.glsl b/drivers/gles3/shaders/particles_copy.glsl index f273cb7b64..774aa139b3 100644 --- a/drivers/gles3/shaders/particles_copy.glsl +++ b/drivers/gles3/shaders/particles_copy.glsl @@ -44,8 +44,12 @@ uniform highp mat4 inv_emission_transform; #define PARTICLE_FLAG_ACTIVE uint(1) +#define FLT_MAX float(3.402823466e+38) + void main() { - mat4 txform = mat4(vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); // zero scale, becomes invisible. + // Set scale to zero and translate to -INF so particle will be invisible + // even for materials that ignore rotation/scale (i.e. billboards). + mat4 txform = mat4(vec4(0.0), vec4(0.0), vec4(0.0), vec4(-FLT_MAX, -FLT_MAX, -FLT_MAX, 0.0)); if (bool(floatBitsToUint(velocity_flags.w) & PARTICLE_FLAG_ACTIVE)) { #ifdef MODE_3D txform = transpose(mat4(xform_1, xform_2, xform_3, vec4(0.0, 0.0, 0.0, 1.0))); @@ -102,9 +106,8 @@ void main() { // as they will be drawn with the node position as origin. txform = inv_emission_transform * txform; #endif - - txform = transpose(txform); } + txform = transpose(txform); instance_color_custom_data = uvec4(packHalf2x16(color.xy), packHalf2x16(color.zw), packHalf2x16(custom.xy), packHalf2x16(custom.zw)); out_xform_1 = txform[0]; |