wgpu-kit 0.9.11 → 1.0.1

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.
Files changed (42) hide show
  1. package/README.md +7 -0
  2. package/README.zh-CN.md +3 -3
  3. package/dist/core/buffer.d.ts +1 -1
  4. package/dist/core/buffer.js +109 -0
  5. package/dist/core/context.d.ts +2 -0
  6. package/dist/core/context.js +62 -0
  7. package/dist/core/errors.js +42 -0
  8. package/dist/core/kernel.js +197 -0
  9. package/dist/core/layout.d.ts +5 -1
  10. package/dist/core/layout.js +69 -0
  11. package/dist/core/pingpong.js +61 -0
  12. package/dist/core/raw.js +38 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +11 -1510
  15. package/dist/interop/three.js +29 -0
  16. package/dist/media.js +70 -0
  17. package/dist/observe.d.ts +19 -0
  18. package/dist/observe.js +76 -0
  19. package/dist/packs/fields/index.js +230 -0
  20. package/dist/packs/image/index.js +250 -0
  21. package/dist/packs/life/boids.js +367 -0
  22. package/dist/packs/life/index.js +8 -0
  23. package/dist/packs/life/map.js +110 -0
  24. package/dist/packs/life/physarum.js +228 -0
  25. package/dist/packs/life/tentacles.js +238 -0
  26. package/dist/packs/life/turing.js +203 -0
  27. package/dist/packs/particles/config.d.ts +1 -0
  28. package/dist/packs/particles/config.js +36 -0
  29. package/dist/packs/particles/grid.js +248 -0
  30. package/dist/packs/particles/index.js +361 -0
  31. package/dist/packs/particles/presets.js +75 -0
  32. package/dist/packs/particles/render.js +116 -0
  33. package/dist/packs/particles/wgsl.js +175 -0
  34. package/dist/react/index.js +36 -0
  35. package/dist/vite.js +27 -28
  36. package/package.json +1 -1
  37. package/dist/fields.js +0 -585
  38. package/dist/image.js +0 -318
  39. package/dist/life.js +0 -1407
  40. package/dist/particles.js +0 -1245
  41. package/dist/react.js +0 -1289
  42. package/dist/three.js +0 -33
package/dist/three.js DELETED
@@ -1,33 +0,0 @@
1
- // src/interop/three.ts
2
- function threePoints(sim, THREE, opts = {}) {
3
- const { pos } = sim.buffers();
4
- const count = pos.length;
5
- const positions = new Float32Array(count * 3);
6
- const geometry = new THREE.BufferGeometry();
7
- const attr = new THREE.BufferAttribute(positions, 3);
8
- geometry.setAttribute("position", attr);
9
- const material = new THREE.PointsMaterial({
10
- size: opts.size ?? 0.015,
11
- color: opts.color ?? 9417983,
12
- sizeAttenuation: true
13
- });
14
- const points = new THREE.Points(geometry, material);
15
- return {
16
- points,
17
- async update() {
18
- const data = await pos.read();
19
- for (let i = 0; i < count; i++) {
20
- positions[i * 3] = data[i * 2] ?? 0;
21
- positions[i * 3 + 1] = data[i * 2 + 1] ?? 0;
22
- positions[i * 3 + 2] = 0;
23
- }
24
- attr.needsUpdate = true;
25
- },
26
- dispose() {
27
- sim.destroy();
28
- }
29
- };
30
- }
31
- export {
32
- threePoints
33
- };