@glyphcss/react 0.0.1 → 0.0.3

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 CHANGED
@@ -16,49 +16,60 @@ Requires React 18 or 19 as a peer dependency.
16
16
 
17
17
  ```tsx
18
18
  import {
19
- GlyphcssScene,
20
- GlyphcssCamera,
21
- GlyphcssMesh,
22
- GlyphcssOrbitControls,
19
+ GlyphCamera,
20
+ GlyphScene,
21
+ GlyphMesh,
22
+ GlyphOrbitControls,
23
23
  } from "@glyphcss/react";
24
24
 
25
25
  export function App() {
26
26
  return (
27
- <GlyphcssScene cols={80} rows={40}>
28
- <GlyphcssCamera rotX={65} rotY={45}>
29
- <GlyphcssOrbitControls />
30
- <GlyphcssMesh src="/cottage.glb" />
31
- </GlyphcssCamera>
32
- </GlyphcssScene>
27
+ <GlyphCamera rotX={0.4} zoom={0.32}>
28
+ <GlyphScene cols={80} rows={40}>
29
+ <GlyphOrbitControls />
30
+ <GlyphMesh src="/cottage.glb" />
31
+ </GlyphScene>
32
+ </GlyphCamera>
33
33
  );
34
34
  }
35
35
  ```
36
36
 
37
37
  ## Component reference
38
38
 
39
- ### `<GlyphcssScene>`
39
+ ### `<GlyphCamera>` / `<GlyphOrthographicCamera>`
40
40
 
41
- Root of every React glyphcss render tree. Owns the `<pre>` output element and rasterizes all meshes on camera or state change.
41
+ Orthographic camera. `GlyphCamera` is the ergonomic default alias. Wraps
42
+ `<GlyphScene>` — the camera is always the outermost element.
42
43
 
43
44
  | Prop | Type | Default | Description |
44
45
  |---|---|---|---|
45
- | `cols` | `number` | `80` | Grid width in character cells |
46
- | `rows` | `number` | `40` | Grid height in character cells |
47
- | `mode` | `"wireframe" \| "solid" \| "voxel"` | `"solid"` | Render mode |
48
- | `className` | `string` | — | CSS class on the `<pre>` container |
46
+ | `rotX` | `number` | `0` | Tilt in radians |
47
+ | `rotY` | `number` | `0` | Azimuth in radians |
48
+ | `zoom` | `number` | `0.4` | Mesh fraction of min(cols, rows) |
49
49
 
50
- ### `<GlyphcssCamera>` / `<GlyphcssPerspectiveCamera>`
50
+ ### `<GlyphPerspectiveCamera>`
51
51
 
52
- Perspective camera. `GlyphcssCamera` is the ergonomic alias.
52
+ Perspective (foreshortened) camera. Required for `<GlyphFirstPersonControls>`.
53
53
 
54
54
  | Prop | Type | Default | Description |
55
55
  |---|---|---|---|
56
- | `fov` | `number` | `60` | Vertical field of view in degrees |
57
- | `rotX` | `number` | `35` | Tilt in degrees |
58
- | `rotY` | `number` | `45` | Azimuth in degrees |
59
- | `zoom` | `number` | `1` | Zoom multiplier |
56
+ | `rotX` | `number` | `0` | Tilt in radians |
57
+ | `rotY` | `number` | `0` | Azimuth in radians |
58
+ | `distance` | `number` | `3` | Perspective distance in world units |
59
+ | `zoom` | `number` | `0.4` | Mesh fraction of min(cols, rows) |
60
+
61
+ ### `<GlyphScene>`
62
+
63
+ Root of every React glyphcss render tree. Owns the `<pre>` output element and rasterizes all meshes on camera or state change. Must be a child of a camera component.
64
+
65
+ | Prop | Type | Default | Description |
66
+ |---|---|---|---|
67
+ | `cols` | `number` | `80` | Grid width in character cells |
68
+ | `rows` | `number` | `40` | Grid height in character cells |
69
+ | `mode` | `"wireframe" \| "solid" \| "voxel"` | `"solid"` | Render mode |
70
+ | `className` | `string` | — | CSS class on the `<pre>` container |
60
71
 
61
- ### `<GlyphcssMesh>`
72
+ ### `<GlyphMesh>`
62
73
 
63
74
  Loads and displays a 3D mesh. Supports `.obj`, `.glb`, `.gltf`, `.vox`.
64
75
 
@@ -67,16 +78,16 @@ Loads and displays a 3D mesh. Supports `.obj`, `.glb`, `.gltf`, `.vox`.
67
78
  | `src` | `string` | URL of the mesh file |
68
79
  | `color` | `string` | Override mesh color |
69
80
 
70
- ### `<GlyphcssOrbitControls>` / `<GlyphcssMapControls>`
81
+ ### `<GlyphOrbitControls>` / `<GlyphMapControls>`
71
82
 
72
83
  Mouse/touch/keyboard camera controls.
73
84
 
74
85
  ### Hooks
75
86
 
76
- - `useGlyphcssCamera()` — access the camera context
77
- - `useGlyphcssSceneContext()` — access scene state
78
- - `useGlyphcssMesh(handle)` — mesh state and imperative API
79
- - `useGlyphcssAnimation(clips, controller)` — three.js-style animation mixer
87
+ - `useGlyphCamera()` — access the camera context
88
+ - `useGlyphSceneContext()` — access scene state
89
+ - `useGlyphMesh(handle)` — mesh state and imperative API
90
+ - `useGlyphAnimation(clips, controller)` — three.js-style animation mixer
80
91
 
81
92
  ## License
82
93