You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
fix: avoid shader crash on null vector and negative x vector
This commit is contained in:
@@ -635,9 +635,9 @@ void ParticleProcessMaterial::_update_shader() {
|
||||
code += " \n";
|
||||
code += " float ring_spawn_angle = rand_from_seed(alt_seed) * 2.0 * pi;\n";
|
||||
code += " float ring_random_radius = rand_from_seed(alt_seed) * (emission_ring_radius - emission_ring_inner_radius) + emission_ring_inner_radius;\n";
|
||||
code += " vec3 axis = normalize(emission_ring_axis);\n";
|
||||
code += " vec3 axis = emission_ring_axis == vec3(0.0) ? vec3(0.0, 0.0, 1.0) : normalize(emission_ring_axis);\n";
|
||||
code += " vec3 ortho_axis = vec3(0.0);\n";
|
||||
code += " if (axis == vec3(1.0, 0.0, 0.0)) {\n";
|
||||
code += " if (abs(axis) == vec3(1.0, 0.0, 0.0)) {\n";
|
||||
code += " ortho_axis = cross(axis, vec3(0.0, 1.0, 0.0));\n";
|
||||
code += " } else {\n";
|
||||
code += " ortho_axis = cross(axis, vec3(1.0, 0.0, 0.0));\n";
|
||||
|
||||
Reference in New Issue
Block a user