Skip to content

Commit

Permalink
fix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhhelgeson committed Aug 9, 2024
1 parent afdc117 commit dc9575b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions examples/webgpu_compute_birds.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
scene.background = new THREE.Color( 0xffffff );
scene.fog = new THREE.Fog( 0xffffff, 100, 1000 );

renderer = new THREE.WebGPURenderer( { forceWebGL: true } );
renderer = new THREE.WebGPURenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animate );
Expand Down Expand Up @@ -337,7 +337,7 @@
dirToCenter.y.mulAssign( 2.5 );
velocity.subAssign( normalize( dirToCenter ).mul( deltaTime ).mul( 5.0 ) );

Loop( { start: 0, end: BIRDS, type: 'uint', condition: '<' }, ( { i } ) => {
Loop( { start: uint( 0 ), end: uint( BIRDS ), type: 'uint', condition: '<' }, ( { i } ) => {

const birdPosition = positionStorage.element( i );
const dirToBird = birdPosition.sub( position );
Expand Down Expand Up @@ -421,9 +421,6 @@
const modValue = phase.add( deltaTime ).add( length( velocity.xz ).mul( deltaTime ).mul( 3.0 ) ).add( max( velocity.y, 0.0 ).mul( deltaTime ).mul( 6.0 ) );
phaseStorage.element( instanceIndex ).assign( modValue.mod( 62.83 ) );

const s = property( 'uint', 's' );
s.assign( uint( 4 ).remainder( 8 ) );

} )().compute( BIRDS );

scene.add( birdMesh );
Expand Down

0 comments on commit dc9575b

Please sign in to comment.