@@ -145,7 +145,8 @@ export class Fluid extends GPUAbstractRunner {
145145 this . div . GetCommandBuffer ( ) ,
146146 this . poisson . GetCommandBuffer ( ) ,
147147 this . project . GetCommandBuffer ( ) ,
148- this . scene . GetCommandBuffer ( ) ,
148+
149+ //this.scene.GetCommandBuffer(),
149150 //this.light.GetCommandBuffer(),
150151 ] )
151152 //await GPU.Render(this.transport.texturea);
@@ -197,7 +198,7 @@ export class Fluid extends GPUAbstractRunner {
197198 }
198199
199200 async InitCell ( ) {
200- let flags = new Uint32Array ( this . width * this . height * 4 ) ;
201+ let flags = new Int32Array ( this . width * this . height ) ;
201202
202203 const F = 0x0001 // is Fluid
203204 const B_u = 0x0002 // obstacle cells adjacent to fluid cells
@@ -207,27 +208,27 @@ export class Fluid extends GPUAbstractRunner {
207208
208209 for ( let j = 0 ; j < this . height ; j ++ )
209210 for ( let i = 0 ; i < this . width ; i ++ ) {
210- flags [ ( j * this . width + i ) * 4 ] = 0 ;
211+ flags [ j * this . width + i ] = 0 ;
211212 }
212213
213214 // is fluid
214215 for ( let j = 1 ; j < this . height - 1 ; j ++ )
215216 for ( let i = 1 ; i < this . width - 1 ; i ++ ) {
216- flags [ ( j * this . width + i ) * 4 ] = F ; // is fluid
217+ flags [ j * this . width + i ] = F ; // is fluid
217218 }
218219
219220 for ( let i = 1 ; i < this . width - 1 ; i ++ ) {
220221 let j = 1 ;
221- flags [ ( j * this . width + i ) ] |= B_d ;
222+ flags [ j * this . width + i ] |= B_d ;
222223 j = this . height - 2 ;
223- flags [ ( j * this . width + i ) ] |= B_u ;
224+ flags [ j * this . width + i ] |= B_u ;
224225 }
225226
226227 for ( let j = 1 ; j < this . height - 1 ; j ++ ) {
227228 let i = 1 ;
228- flags [ ( j * this . width + i ) ] |= B_l ;
229+ flags [ j * this . width + i ] |= B_l ;
229230 i = this . width - 2 ;
230- flags [ ( j * this . width + i ) ] |= B_r ;
231+ flags [ j * this . width + i ] |= B_r ;
231232 }
232233
233234 this . flags = await GPU . CreateTextureFromArrayBuffer ( this . width , this . height , "r32sint" , flags . buffer ) ;
0 commit comments