@chromatic-coherence/generative-charts-3d 0.12.0 → 0.12.2
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 +31 -17
- package/dist/index.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[generative-charts-2d](https://chromaticcoherence.ai/generative-charts) — `createWorld`, `line`,
|
|
5
|
-
`glow`, `face`, `grow`, the `draw*` living verbs, `cam`, `light`, `lights`, `pick` — rendered on
|
|
6
|
-
WebGL. Zero dependencies; the browser is still the whole runtime.
|
|
3
|
+
# generative-charts-3d
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
> a **real depth buffer** — occlusion is exact and always on, for solids *and* for light
|
|
10
|
-
> (a lamp behind a hill is hidden, no flags needed) — and **per-pixel light**: Lambert +
|
|
11
|
-
> point-light falloff evaluated in the fragment shader, so light sweeps smoothly ACROSS a
|
|
12
|
-
> face instead of flat-shading it. Deferred honestly: shadow maps, mirrors, `fade()` groups.
|
|
13
|
-
> Labels ride a synced 2D overlay (never occluded, as in 2d). Browser-only.
|
|
5
|
+
### The **3D · GPU** engine behind [Generative Charts](https://chromaticcoherence.ai/generative-charts) — the same API, on WebGL.
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/@chromatic-coherence/generative-charts-3d)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](#)
|
|
10
|
+
|
|
11
|
+
**[Live demo →](https://chromaticcoherence.ai/generative-charts)** · **[API docs →](https://chromaticcoherence.ai/documents/generative-charts-api)** · **[2D · CPU edition →](https://github.com/chromaticcoherence/generative-charts-2d)**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
One JSON payload in, a gorgeous animated chart out — rendered on WebGL with a real depth buffer and per-pixel light. The **same API** as the [2D · CPU edition](https://www.npmjs.com/package/@chromatic-coherence/generative-charts-2d), so one recipe runs on both.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @chromatic-coherence/generative-charts-3d
|
|
21
|
+
```
|
|
16
22
|
|
|
17
23
|
```ts
|
|
18
24
|
import { createWorld, v3 } from "@chromatic-coherence/generative-charts-3d";
|
|
19
25
|
|
|
20
26
|
const w = createWorld({ canvas, controls: true });
|
|
21
|
-
w.light.signed = true;
|
|
22
27
|
w.lights.push({ p: v3(0, 150, 0), intensity: 0.9, falloff: 300 });
|
|
23
28
|
w.face(v3(-100, 0, -100), v3(100, 0, -100), v3(0, 0, 100), { hue: 265, sat: 40, light: 32 });
|
|
24
|
-
w.grow((t
|
|
29
|
+
w.grow((t) => w.drawGlow(v3(Math.cos(t) * 80, 30, Math.sin(t) * 80), 40, 12, 0.9));
|
|
25
30
|
w.start();
|
|
26
31
|
```
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
**Why it's different:** real depth — occlusion exact, always on — and per-pixel Lambert + point lights in the fragment shader. No charting library, no third-party graphics. Zero dependencies; the browser is the only runtime.
|
|
34
|
+
|
|
35
|
+
> **Alpha (v0.12).** The GPU edition is early. For production today, the [2D · CPU edition](https://www.npmjs.com/package/@chromatic-coherence/generative-charts-2d) is feature-complete.
|
|
29
36
|
|
|
30
37
|
## Licence
|
|
31
38
|
|
|
32
39
|
**Source-available, not open source.** Free for individuals, charities and small businesses
|
|
33
40
|
(fewer than 25 people and under £1M annual revenue); a one-off **£100** covers any larger
|
|
34
41
|
organisation. Install and use it as-is, embedded in your app — you may not modify it or
|
|
35
|
-
redistribute it on its own. Full terms
|
|
42
|
+
redistribute it on its own. Full terms in [LICENSE](./LICENSE); commercial licensing:
|
|
43
|
+
[hello@chromaticcoherence.ai](mailto:hello@chromaticcoherence.ai).
|
|
44
|
+
|
|
45
|
+
> The engine source ships compiled on npm; this repository is the package's home page.
|
|
46
|
+
|
|
47
|
+
---
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
<div align="center">
|
|
50
|
+
<sub>© 2026 Chromatic Coherence. All rights reserved.</sub>
|
|
51
|
+
</div>
|
package/dist/index.js
CHANGED
|
@@ -766,6 +766,11 @@ export class World {
|
|
|
766
766
|
c();
|
|
767
767
|
this.cleanup = [];
|
|
768
768
|
this.overlay.remove();
|
|
769
|
+
// Release the GL context NOW — browsers cap live WebGL contexts per page (~16) and only
|
|
770
|
+
// reclaim them at GC, so a page that builds and disposes many worlds otherwise exhausts
|
|
771
|
+
// the pool and every later createWorld fails. A lost context is permanently dead on its
|
|
772
|
+
// canvas: mount a fresh canvas to build again.
|
|
773
|
+
this.gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
769
774
|
}
|
|
770
775
|
}
|
|
771
776
|
export function createWorld(o) { return new World(o); }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chromatic-coherence/generative-charts-3d",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "The second generative-charts engine — the same API as generative-charts-2d, rendered on WebGL: a real depth buffer (occlusion exact, always on, for solids and light) and per-pixel Lambert + point lights. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|