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.
- package/README.md +7 -0
- package/README.zh-CN.md +3 -3
- package/dist/core/buffer.d.ts +1 -1
- package/dist/core/buffer.js +109 -0
- package/dist/core/context.d.ts +2 -0
- package/dist/core/context.js +62 -0
- package/dist/core/errors.js +42 -0
- package/dist/core/kernel.js +197 -0
- package/dist/core/layout.d.ts +5 -1
- package/dist/core/layout.js +69 -0
- package/dist/core/pingpong.js +61 -0
- package/dist/core/raw.js +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -1510
- package/dist/interop/three.js +29 -0
- package/dist/media.js +70 -0
- package/dist/observe.d.ts +19 -0
- package/dist/observe.js +76 -0
- package/dist/packs/fields/index.js +230 -0
- package/dist/packs/image/index.js +250 -0
- package/dist/packs/life/boids.js +367 -0
- package/dist/packs/life/index.js +8 -0
- package/dist/packs/life/map.js +110 -0
- package/dist/packs/life/physarum.js +228 -0
- package/dist/packs/life/tentacles.js +238 -0
- package/dist/packs/life/turing.js +203 -0
- package/dist/packs/particles/config.d.ts +1 -0
- package/dist/packs/particles/config.js +36 -0
- package/dist/packs/particles/grid.js +248 -0
- package/dist/packs/particles/index.js +361 -0
- package/dist/packs/particles/presets.js +75 -0
- package/dist/packs/particles/render.js +116 -0
- package/dist/packs/particles/wgsl.js +175 -0
- package/dist/react/index.js +36 -0
- package/dist/vite.js +27 -28
- package/package.json +1 -1
- package/dist/fields.js +0 -585
- package/dist/image.js +0 -318
- package/dist/life.js +0 -1407
- package/dist/particles.js +0 -1245
- package/dist/react.js +0 -1289
- 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
|
-
};
|