Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix undefined behavior with atan in GPU Particles #36031
Setting the direction of particles should behave as expected with that fix, including when the direction is Vec3(x != 0, y != 0, 0).
Not sure if it would be considered breaking/changing existing projects though, since the behavior of particles when the direction is Vec3(x != 0, y != 0, 0) gets changed (to the correct behavior).
The special case atan(y,0) of the built-in shader function atan(y,x) returns different results on different devices. So this commit will add checks when the atan(y,x) function is used in ParticlesMaterial to set the direction of GPU Particles to make sure the desired values are returned (act as atan2(y,x)).