@@ -120,7 +120,7 @@ visualSuite("WebGPU", function () {
120120 const model = p5 . buildGeometry ( ( ) => p5 . sphere ( 5 ) ) ;
121121 const shader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
122122 p5 . getWorldInputs ( ( inputs ) => {
123- inputs . position += ( p5 . instanceID ( ) - 1 ) * 15
123+ inputs . position += ( p5 . instanceIndex - 1 ) * 15
124124 return inputs ;
125125 } ) ;
126126 } , { p5 } ) ;
@@ -144,7 +144,7 @@ visualSuite("WebGPU", function () {
144144 }
145145
146146 function semiSphere ( ) {
147- let id = p5 . instanceID ( ) ;
147+ let id = p5 . instanceIndex ;
148148 let theta = rand2 ( [ id , 0.1234 ] ) * p5 . TWO_PI + time / 100000 ;
149149 let phi = rand2 ( [ id , 3.321 ] ) * p5 . PI + time / 50000 ;
150150
@@ -162,7 +162,7 @@ visualSuite("WebGPU", function () {
162162 } ) ;
163163
164164 p5 . getObjectInputs ( ( inputs ) => {
165- let size = 1 + 0.5 * p5 . sin ( time * 0.002 + p5 . instanceID ( ) ) ;
165+ let size = 1 + 0.5 * p5 . sin ( time * 0.002 + p5 . instanceIndex ) ;
166166 inputs . position *= size ;
167167 return inputs ;
168168 } ) ;
@@ -304,15 +304,15 @@ visualSuite("WebGPU", function () {
304304 const shader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
305305 // Vertex hook: position instances in a horizontal row
306306 p5 . getWorldInputs ( ( inputs ) => {
307- const id = p5 . instanceID ( ) ;
307+ const id = p5 . instanceIndex ;
308308 const spacing = 12 ;
309309 const offset = ( id - ( numInstances - 1 ) / 2.0 ) * spacing ;
310310 inputs . position . x += offset ;
311311 return inputs ;
312312 } ) ;
313313 // Fragment hook: color each instance based on instanceID
314314 p5 . getFinalColor ( ( color ) => {
315- const id = p5 . instanceID ( ) ;
315+ const id = p5 . instanceIndex ;
316316 const t = id / ( numInstances - 1.0 ) ;
317317 color = [ t , t , t , 1 ] ;
318318 return color ;
@@ -1196,7 +1196,7 @@ visualTest('randomGaussian() in a fragment loop averages to the mean (WebGPU)',
11961196 const sphereShader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
11971197 const posData = p5 . uniformStorage ( ) ;
11981198 p5 . getWorldInputs ( ( inputs ) => {
1199- const idx = p5 . instanceID ( ) ;
1199+ const idx = p5 . instanceIndex ;
12001200 inputs . position . x += posData [ idx * 2 ] ;
12011201 inputs . position . y += posData [ idx * 2 + 1 ] ;
12021202 return inputs ;
@@ -1304,7 +1304,7 @@ visualTest('randomGaussian() in a fragment loop averages to the mean (WebGPU)',
13041304 const sphereShader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
13051305 const buf = p5 . uniformStorage ( 'buf' , particles ) ;
13061306 p5 . getWorldInputs ( ( inputs ) => {
1307- const p = buf [ p5 . instanceID ( ) ] . position ;
1307+ const p = buf [ p5 . instanceIndex ] . position ;
13081308 inputs . position . x += p . x ;
13091309 inputs . position . y += p . y ;
13101310 return inputs ;
@@ -1337,7 +1337,7 @@ visualTest('randomGaussian() in a fragment loop averages to the mean (WebGPU)',
13371337 const sphereShader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
13381338 const buf = p5 . uniformStorage ( 'buf' , particles ) ;
13391339 p5 . getWorldInputs ( ( inputs ) => {
1340- const p = buf [ p5 . instanceID ( ) ] . position ;
1340+ const p = buf [ p5 . instanceIndex ] . position ;
13411341 inputs . position . x += p . x ;
13421342 inputs . position . y += p . y ;
13431343 return inputs ;
@@ -1370,7 +1370,7 @@ visualTest('randomGaussian() in a fragment loop averages to the mean (WebGPU)',
13701370 const sphereShader = p5 . baseMaterialShader ( ) . modify ( ( ) => {
13711371 const buf = p5 . uniformStorage ( 'buf' , { position : [ 0 , 0 ] } ) ;
13721372 p5 . getWorldInputs ( ( inputs ) => {
1373- const p = buf [ p5 . instanceID ( ) ] . position ;
1373+ const p = buf [ p5 . instanceIndex ] . position ;
13741374 inputs . position . x += p . x ;
13751375 inputs . position . y += p . y ;
13761376 return inputs ;
0 commit comments