@buley/hexgrid-3d 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -353,17 +353,20 @@ export class FluidSimulation3DGPU {
|
|
|
353
353
|
// In reality, should run a 'splat' shader or write a region.
|
|
354
354
|
// Partial write using writeTexture:
|
|
355
355
|
const data = new Float32Array([amount, amount, amount, 1.0]);
|
|
356
|
-
const
|
|
356
|
+
const x_int = Math.floor(x);
|
|
357
|
+
const y_int = Math.floor(y);
|
|
358
|
+
const z_int = Math.floor(z);
|
|
359
|
+
const origin = { x: x_int, y: y_int, z: z_int };
|
|
357
360
|
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
+
if (x_int >= 0 && x_int < this.width &&
|
|
362
|
+
y_int >= 0 && y_int < this.height &&
|
|
363
|
+
z_int >= 0 && z_int < this.depth) {
|
|
361
364
|
|
|
362
365
|
this.device.queue.writeTexture(
|
|
363
366
|
{ texture: this.densityTextures[0], origin },
|
|
364
367
|
data,
|
|
365
|
-
{ bytesPerRow: 16, rowsPerImage: 1 },
|
|
366
|
-
{ width: 1, height: 1,
|
|
368
|
+
{ bytesPerRow: 16, rowsPerImage: 1 } as GPUImageDataLayout,
|
|
369
|
+
{ width: 1, height: 1, depthOrArrayLayers: 1 }
|
|
367
370
|
);
|
|
368
371
|
}
|
|
369
372
|
}
|
|
@@ -372,17 +375,20 @@ export class FluidSimulation3DGPU {
|
|
|
372
375
|
if (!this.velocityTextures || !this.device) return;
|
|
373
376
|
|
|
374
377
|
const data = new Float32Array([force.x, force.y, force.z, 0.0]);
|
|
375
|
-
const
|
|
378
|
+
const x_int = Math.floor(pos.x);
|
|
379
|
+
const y_int = Math.floor(pos.y);
|
|
380
|
+
const z_int = Math.floor(pos.z);
|
|
381
|
+
const origin = { x: x_int, y: y_int, z: z_int };
|
|
376
382
|
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
|
|
383
|
+
if (x_int >= 0 && x_int < this.width &&
|
|
384
|
+
y_int >= 0 && y_int < this.height &&
|
|
385
|
+
z_int >= 0 && z_int < this.depth) {
|
|
380
386
|
|
|
381
387
|
this.device.queue.writeTexture(
|
|
382
388
|
{ texture: this.velocityTextures[0], origin },
|
|
383
389
|
data,
|
|
384
|
-
{ bytesPerRow: 16, rowsPerImage: 1 },
|
|
385
|
-
{ width: 1, height: 1,
|
|
390
|
+
{ bytesPerRow: 16, rowsPerImage: 1 } as GPUImageDataLayout,
|
|
391
|
+
{ width: 1, height: 1, depthOrArrayLayers: 1 }
|
|
386
392
|
);
|
|
387
393
|
}
|
|
388
394
|
}
|
package/src/components/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,21 +10,17 @@ export * from './utils/image-utils';
|
|
|
10
10
|
// Export additional types that aren't in components/stores
|
|
11
11
|
export type { WorkerDebug, Photo, GridItem } from './types';
|
|
12
12
|
|
|
13
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
14
|
-
// ENHANCED HEXGRID EXPORTS
|
|
15
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
16
|
-
|
|
17
13
|
// Math library
|
|
18
14
|
export * from './math';
|
|
19
15
|
|
|
20
16
|
// Algorithms (graph, clustering, flow, particles, fluid)
|
|
21
17
|
export * from './algorithms';
|
|
22
18
|
|
|
19
|
+
// Enhanced HexGrid
|
|
20
|
+
export * from './HexGridEnhanced';
|
|
21
|
+
|
|
23
22
|
// WASM acceleration layer
|
|
24
23
|
export * from './wasm';
|
|
25
24
|
|
|
26
25
|
// Unified Snapshot API
|
|
27
26
|
export * from './Snapshot';
|
|
28
|
-
|
|
29
|
-
// Enhanced HexGrid engine with all features integrated
|
|
30
|
-
export * from './HexGridEnhanced';
|