summaryrefslogtreecommitdiff
path: root/scene/resources/particles_material.cpp
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2019-02-24 23:55:37 +0100
committerHein-Pieter van Braam <hp@tmm.cx>2019-02-24 23:35:10 +0000
commita83e77fdedb235a5c3dea91530f9e2bd2cc23a56 (patch)
tree7f61ccefc60ad9d8cc6563ccb23907d8482dfefc /scene/resources/particles_material.cpp
parent69c0d32b93fc8ec3a3f6c08de2b3c518e38d8a56 (diff)
Explicitly use floating point numbers in the our shaders
We need to be explicit about using floating point numbers in our shaders for compatibility with mobile GLES drivers.
Diffstat (limited to 'scene/resources/particles_material.cpp')
-rw-r--r--scene/resources/particles_material.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 59fde7787e..ef67e6ea80 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -311,8 +311,8 @@ void ParticlesMaterial::_update_shader() {
//initiate velocity spread in 3D
code += " float angle1_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad;\n";
code += " float angle2_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad * (1.0 - flatness);\n";
- code += " vec3 direction_xz = vec3(sin(angle1_rad), 0, cos(angle1_rad));\n";
- code += " vec3 direction_yz = vec3(0, sin(angle2_rad), cos(angle2_rad));\n";
+ code += " vec3 direction_xz = vec3(sin(angle1_rad), 0.0, cos(angle1_rad));\n";
+ code += " vec3 direction_yz = vec3(0.0, sin(angle2_rad), cos(angle2_rad));\n";
code += " direction_yz.z = direction_yz.z / max(0.0001,sqrt(abs(direction_yz.z))); // better uniform distribution\n";
code += " vec3 direction = vec3(direction_xz.x * direction_yz.z, direction_yz.y, direction_xz.z * direction_yz.z);\n";
code += " direction = normalize(direction);\n";
@@ -347,7 +347,7 @@ void ParticlesMaterial::_update_shader() {
code += " VELOCITY.xy = rotm * VELOCITY.xy;\n";
} else {
code += " vec3 normal = texelFetch(emission_texture_normal, emission_tex_ofs, 0).xyz;\n";
- code += " vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0, 1.0, 0.0);\n";
+ code += " vec3 v0 = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);\n";
code += " vec3 tangent = normalize(cross(v0, normal));\n";
code += " vec3 bitangent = normalize(cross(tangent, normal));\n";
code += " VELOCITY = mat3(tangent, bitangent, normal) * VELOCITY;\n";