Skip to content

Commit 673fdc7

Browse files
authored
Merge pull request #15863 from paulmasson/patch-1
Code cleanup re: whitespace
2 parents 54e019e + f61bc20 commit 673fdc7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/webgl_gpgpu_birds.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107

108108
const float SPEED_LIMIT = 9.0;
109109

110-
float rand(vec2 co){
111-
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
110+
float rand( vec2 co ){
111+
return fract( sin( dot( co.xy, vec2(12.9898,78.233) ) ) * 43758.5453 );
112112
}
113113

114114
void main() {
@@ -150,7 +150,7 @@
150150

151151

152152
// move birds away from predator
153-
if (dist < preyRadius) {
153+
if ( dist < preyRadius ) {
154154

155155
f = ( distSquared / preyRadiusSq - 1.0 ) * delta * 100.;
156156
velocity += normalize( dir ) * f;
@@ -170,28 +170,28 @@
170170
dir.y *= 2.5;
171171
velocity -= normalize( dir ) * delta * 5.;
172172

173-
for (float y=0.0;y<height;y++) {
174-
for (float x=0.0;x<width;x++) {
173+
for ( float y = 0.0; y < height; y++ ) {
174+
for ( float x = 0.0; x < width; x++ ) {
175175

176176
vec2 ref = vec2( x + 0.5, y + 0.5 ) / resolution.xy;
177177
birdPosition = texture2D( texturePosition, ref ).xyz;
178178

179179
dir = birdPosition - selfPosition;
180-
dist = length(dir);
180+
dist = length( dir );
181181

182-
if (dist < 0.0001) continue;
182+
if ( dist < 0.0001 ) continue;
183183

184184
distSquared = dist * dist;
185185

186-
if (distSquared > zoneRadiusSquared ) continue;
186+
if ( distSquared > zoneRadiusSquared ) continue;
187187

188188
percent = distSquared / zoneRadiusSquared;
189189

190190
if ( percent < separationThresh ) { // low
191191

192192
// Separation - Move apart for comfort
193-
f = (separationThresh / percent - 1.0) * delta;
194-
velocity -= normalize(dir) * f;
193+
f = ( separationThresh / percent - 1.0 ) * delta;
194+
velocity -= normalize( dir ) * f;
195195

196196
} else if ( percent < alignmentThresh ) { // high
197197

@@ -202,7 +202,7 @@
202202
birdVelocity = texture2D( textureVelocity, ref ).xyz;
203203

204204
f = ( 0.5 - cos( adjustedPercent * PI_2 ) * 0.5 + 0.5 ) * delta;
205-
velocity += normalize(birdVelocity) * f;
205+
velocity += normalize( birdVelocity ) * f;
206206

207207
} else {
208208

@@ -212,7 +212,7 @@
212212

213213
f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta;
214214

215-
velocity += normalize(dir) * f;
215+
velocity += normalize( dir ) * f;
216216

217217
}
218218

0 commit comments

Comments
 (0)