Parcourir la source

Also apply to examples/webgl_gpgpu_birds.html

gonnavis il y a 4 ans
Parent
commit
5780351cab
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      examples/webgl_gpgpu_birds.html

+ 3 - 1
examples/webgl_gpgpu_birds.html

@@ -184,7 +184,9 @@
 
 							// Attraction / Cohesion - move closer
 							float threshDelta = 1.0 - alignmentThresh;
-							float adjustedPercent = ( percent - alignmentThresh ) / threshDelta;
+							float adjustedPercent;
+							if( threshDelta == 0. ) adjustedPercent = 1.;
+							else adjustedPercent = ( percent - alignmentThresh ) / threshDelta;
 
 							f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta;