@ascii-fx/react-three 0.2.0 → 0.3.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 (2) hide show
  1. package/README.md +27 -12
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,24 +1,39 @@
1
1
  # @ascii-fx/react-three
2
2
 
3
- React Three Fiber bindings (kept separate from `@ascii-fx/react` so plain React apps never pull Three). Requires an R3F v9 `<Canvas>` running `THREE.WebGPURenderer`.
3
+ [`@ascii-fx/three`](../three) as React Three Fiber components.
4
+
5
+ ```sh
6
+ pnpm add @ascii-fx/react-three three @react-three/fiber
7
+ ```
4
8
 
5
9
  ```tsx
6
10
  import { Canvas } from '@react-three/fiber'
7
11
  import * as THREE from 'three/webgpu'
8
12
  import { AsciiEffect } from '@ascii-fx/react-three'
9
13
 
10
- ;<Canvas
11
- gl={async (props) => {
12
- const renderer = new THREE.WebGPURenderer(props as never)
13
- await renderer.init()
14
- return renderer
15
- }}
16
- >
17
- <mesh>{/* your scene */}</mesh>
18
- <AsciiEffect profile={profileRef} columns={180} interaction="reveal" />
14
+ ;<Canvas gl={(canvas) => new THREE.WebGPURenderer({ canvas })}>
15
+ <mesh>
16
+ <torusKnotGeometry />
17
+ <meshNormalMaterial />
18
+ </mesh>
19
+ <AsciiEffect profile={profile} columns={160} />
19
20
  </Canvas>
20
21
  ```
21
22
 
22
- `<AsciiEffect>` takes over the render loop while mounted (AsciiPass under the hood), auto-wires the R3F pointer, and resizes with the canvas. `useAsciiEffect(options)` returns the pass for imperative control (`captureFrame`, `set`).
23
+ Drop `<AsciiEffect>` inside a `<Canvas>` and everything rendered before it comes out as ASCII.
24
+
25
+ ## Why it's a separate package
26
+
27
+ This is the only entry point in the project that pulls in `three` _and_ `@react-three/fiber`. Folding it into [`@ascii-fx/react`](../react) would put both in the dependency graph of every plain React app that just wanted `<AsciiImage>` — so it lives here, and you install it only if you're already in R3F.
28
+
29
+ ## Components
30
+
31
+ - **`<AsciiEffect>`** — post-processes the scene through the exact matcher on the renderer's own device, no readback.
32
+ - **`<AsciiGlyphs>`** — an instanced glyph mesh you can place, light, and move within the scene.
33
+ - **`useAsciiEffect`** — the hook underneath, when you want the pass without the component.
34
+
35
+ Requires an R3F v9 `<Canvas>` running `THREE.WebGPURenderer`; see [`@ascii-fx/three`](../three) for why WebGL isn't supported.
36
+
37
+ ## License
23
38
 
24
- `<AsciiGlyphs profile={profile} columns={80} rows={45} frame={frame} />` renders the instanced 3D glyph field from a matched frame.
39
+ [MIT](../../LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascii-fx/react-three",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "React Three Fiber bindings for ASCII FX: <AsciiEffect>, <AsciiGlyphs>, useAsciiEffect (WebGPURenderer only).",
5
5
  "keywords": [
6
6
  "ascii",
@@ -39,9 +39,9 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@ascii-fx/three": "0.2.0",
43
- "@ascii-fx/gpu": "0.2.0",
44
- "@ascii-fx/core": "0.2.0"
42
+ "@ascii-fx/core": "0.3.1",
43
+ "@ascii-fx/three": "0.3.1",
44
+ "@ascii-fx/gpu": "0.3.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@react-three/fiber": "^9.7.0",