Skip to content

Commit fc68156

Browse files
authored
Exampels: Clean up. (#21688)
1 parent 342946c commit fc68156

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

examples/webgl_gpgpu_birds.html

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@
378378
for ( let v = 0; v < triangles * 3; v ++ ) {
379379

380380
const triangleIndex = ~ ~ ( v / 3 );
381-
const birdIndex = ~ ~ ( triangleIndex / trianglesPerBird )
381+
const birdIndex = ~ ~ ( triangleIndex / trianglesPerBird );
382382
const x = ( birdIndex % WIDTH ) / WIDTH;
383383
const y = ~ ~ ( birdIndex / WIDTH ) / WIDTH;
384384

@@ -468,18 +468,18 @@
468468

469469
const valuesChanger = function () {
470470

471-
velocityUniforms[ "separationDistance" ].value = effectController.separation;
472-
velocityUniforms[ "alignmentDistance" ].value = effectController.alignment;
473-
velocityUniforms[ "cohesionDistance" ].value = effectController.cohesion;
474-
velocityUniforms[ "freedomFactor" ].value = effectController.freedom;
471+
velocityUniforms[ 'separationDistance' ].value = effectController.separation;
472+
velocityUniforms[ 'alignmentDistance' ].value = effectController.alignment;
473+
velocityUniforms[ 'cohesionDistance' ].value = effectController.cohesion;
474+
velocityUniforms[ 'freedomFactor' ].value = effectController.freedom;
475475

476476
};
477477

478478
valuesChanger();
479479

480-
gui.add( effectController, "separation", 0.0, 100.0, 1.0 ).onChange( valuesChanger );
481-
gui.add( effectController, "alignment", 0.0, 100, 0.001 ).onChange( valuesChanger );
482-
gui.add( effectController, "cohesion", 0.0, 100, 0.025 ).onChange( valuesChanger );
480+
gui.add( effectController, 'separation', 0.0, 100.0, 1.0 ).onChange( valuesChanger );
481+
gui.add( effectController, 'alignment', 0.0, 100, 0.001 ).onChange( valuesChanger );
482+
gui.add( effectController, 'cohesion', 0.0, 100, 0.025 ).onChange( valuesChanger );
483483
gui.close();
484484

485485
initBirds();
@@ -501,25 +501,25 @@
501501
fillPositionTexture( dtPosition );
502502
fillVelocityTexture( dtVelocity );
503503

504-
velocityVariable = gpuCompute.addVariable( "textureVelocity", document.getElementById( 'fragmentShaderVelocity' ).textContent, dtVelocity );
505-
positionVariable = gpuCompute.addVariable( "texturePosition", document.getElementById( 'fragmentShaderPosition' ).textContent, dtPosition );
504+
velocityVariable = gpuCompute.addVariable( 'textureVelocity', document.getElementById( 'fragmentShaderVelocity' ).textContent, dtVelocity );
505+
positionVariable = gpuCompute.addVariable( 'texturePosition', document.getElementById( 'fragmentShaderPosition' ).textContent, dtPosition );
506506

507507
gpuCompute.setVariableDependencies( velocityVariable, [ positionVariable, velocityVariable ] );
508508
gpuCompute.setVariableDependencies( positionVariable, [ positionVariable, velocityVariable ] );
509509

510510
positionUniforms = positionVariable.material.uniforms;
511511
velocityUniforms = velocityVariable.material.uniforms;
512512

513-
positionUniforms[ "time" ] = { value: 0.0 };
514-
positionUniforms[ "delta" ] = { value: 0.0 };
515-
velocityUniforms[ "time" ] = { value: 1.0 };
516-
velocityUniforms[ "delta" ] = { value: 0.0 };
517-
velocityUniforms[ "testing" ] = { value: 1.0 };
518-
velocityUniforms[ "separationDistance" ] = { value: 1.0 };
519-
velocityUniforms[ "alignmentDistance" ] = { value: 1.0 };
520-
velocityUniforms[ "cohesionDistance" ] = { value: 1.0 };
521-
velocityUniforms[ "freedomFactor" ] = { value: 1.0 };
522-
velocityUniforms[ "predator" ] = { value: new THREE.Vector3() };
513+
positionUniforms[ 'time' ] = { value: 0.0 };
514+
positionUniforms[ 'delta' ] = { value: 0.0 };
515+
velocityUniforms[ 'time' ] = { value: 1.0 };
516+
velocityUniforms[ 'delta' ] = { value: 0.0 };
517+
velocityUniforms[ 'testing' ] = { value: 1.0 };
518+
velocityUniforms[ 'separationDistance' ] = { value: 1.0 };
519+
velocityUniforms[ 'alignmentDistance' ] = { value: 1.0 };
520+
velocityUniforms[ 'cohesionDistance' ] = { value: 1.0 };
521+
velocityUniforms[ 'freedomFactor' ] = { value: 1.0 };
522+
velocityUniforms[ 'predator' ] = { value: new THREE.Vector3() };
523523
velocityVariable.material.defines.BOUNDS = BOUNDS.toFixed( 2 );
524524

525525
velocityVariable.wrapS = THREE.RepeatWrapping;
@@ -549,11 +549,11 @@
549549

550550
// For Vertex and Fragment
551551
birdUniforms = {
552-
"color": { value: new THREE.Color( 0xff2200 ) },
553-
"texturePosition": { value: null },
554-
"textureVelocity": { value: null },
555-
"time": { value: 1.0 },
556-
"delta": { value: 0.0 }
552+
'color': { value: new THREE.Color( 0xff2200 ) },
553+
'texturePosition': { value: null },
554+
'textureVelocity': { value: null },
555+
'time': { value: 1.0 },
556+
'delta': { value: 0.0 }
557557
};
558558

559559
// THREE.ShaderMaterial
@@ -652,22 +652,22 @@
652652
if ( delta > 1 ) delta = 1; // safety cap on large deltas
653653
last = now;
654654

655-
positionUniforms[ "time" ].value = now;
656-
positionUniforms[ "delta" ].value = delta;
657-
velocityUniforms[ "time" ].value = now;
658-
velocityUniforms[ "delta" ].value = delta;
659-
birdUniforms[ "time" ].value = now;
660-
birdUniforms[ "delta" ].value = delta;
655+
positionUniforms[ 'time' ].value = now;
656+
positionUniforms[ 'delta' ].value = delta;
657+
velocityUniforms[ 'time' ].value = now;
658+
velocityUniforms[ 'delta' ].value = delta;
659+
birdUniforms[ 'time' ].value = now;
660+
birdUniforms[ 'delta' ].value = delta;
661661

662-
velocityUniforms[ "predator" ].value.set( 0.5 * mouseX / windowHalfX, - 0.5 * mouseY / windowHalfY, 0 );
662+
velocityUniforms[ 'predator' ].value.set( 0.5 * mouseX / windowHalfX, - 0.5 * mouseY / windowHalfY, 0 );
663663

664664
mouseX = 10000;
665665
mouseY = 10000;
666666

667667
gpuCompute.compute();
668668

669-
birdUniforms[ "texturePosition" ].value = gpuCompute.getCurrentRenderTarget( positionVariable ).texture;
670-
birdUniforms[ "textureVelocity" ].value = gpuCompute.getCurrentRenderTarget( velocityVariable ).texture;
669+
birdUniforms[ 'texturePosition' ].value = gpuCompute.getCurrentRenderTarget( positionVariable ).texture;
670+
birdUniforms[ 'textureVelocity' ].value = gpuCompute.getCurrentRenderTarget( velocityVariable ).texture;
671671

672672
renderer.render( scene, camera );
673673

0 commit comments

Comments
 (0)