@combos-fun/plugin-renderer-3d-graphics 0.1.15 → 0.1.16

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/agent-skill.md +22 -67
  2. package/package.json +4 -4
package/agent-skill.md CHANGED
@@ -1,73 +1,28 @@
1
1
  # `@combos-fun/plugin-renderer-3d-graphics` — Agent notes
2
2
 
3
- Procedural primitives and compound primitive groups. Use this for plain or texture-mapped boxes, spheres, cylinders, planes, cones, tori, and capsules.
4
-
5
- Prerequisite: follow the parent `@combos-fun/plugin-renderer-3d` skill for system order, named resources, pose seeding, hierarchy, and stale-async handling.
6
-
7
- ## Public API
3
+ Primitives and compound groups. Parent: `plugin-renderer-3d`.
8
4
 
9
5
  ```ts
10
- import {
11
- Graphics3D,
12
- Graphics3DSystem,
13
- type Graphics3DParams,
14
- type Graphics3DPartParams,
15
- type Graphics3DMaterialKind,
16
- type Graphics3DShape,
17
- } from '@combos-fun/plugin-renderer-3d-graphics';
6
+ import { Graphics3D, Graphics3DSystem } from '@combos-fun/plugin-renderer-3d-graphics';
18
7
  ```
19
8
 
20
- `componentName = 'Graphics3D'`; `systemName = 'Graphics3DSystem'`.
21
-
22
- ## Parameters
23
-
24
- | Field | Type | Default |
25
- |-------|------|---------|
26
- | `shape` | `'box' \| 'sphere' \| 'cylinder' \| 'plane' \| 'cone' \| 'torus' \| 'capsule'` | `'box'` |
27
- | `color` | `number` | `0x00ff00` |
28
- | `wireframe` | `boolean` | `false` |
29
- | `width` / `height` / `depth` | `number` | `1` |
30
- | `radius` | `number` | `0.5` |
31
- | `segments` | `number` | `12` |
32
- | `tube` | `number` | `0`; torus resolves it to `0.4 × radius` |
33
- | `positionX/Y/Z` | `number` | `0` |
34
- | `rotationX/Y/Z` | `number` | `0` radians |
35
- | `scaleX/Y/Z` | `number` | `1` |
36
- | `opacity` | `number` | `1` |
37
- | `roughness` / `metalness` | `number` | `1` / `0` |
38
- | `emissive` | `number` | `0` |
39
- | `map` | `string` | `''` (`IMAGE` resource name) |
40
- | `doubleSide` | `boolean` | `false` |
41
- | `material` | `'standard' \| 'basic' \| 'lambert' \| 'toon'` | `'standard'` |
42
- | `parts` | `Graphics3DPartParams[]` | `undefined` |
43
-
44
- When non-empty, `parts` replaces the single primitive. Each part inherits component values and may override geometry, appearance, and its local pose; the component pose moves the resulting `Group`.
45
-
46
- Geometry mapping is direct to Three.js. Plane segments apply to both axes; capsule `height` is total height. Geometry and materials are reference-counted caches. Creating or rebuilding a mapped primitive is async; stale preparation releases acquired cache entries instead of attaching them.
47
-
48
- Non-pose changes rebuild the group. Pose changes are synchronized per frame without rebuilding. A sibling `Material3D` can replace the generated materials.
49
-
50
- ## Package-specific pitfalls
51
-
52
- - A plane is single-sided unless `doubleSide: true`.
53
- - A visual `PlaneGeometry` is finite; Cannon `Physics3DType.PLANE` is infinite unless `finite: true`.
54
- - Lit materials may look dark without enough light; `basic` is unlit.
55
- - Unknown ctor fields (`type`, `geometry`, a Three `material: { color }` bag, `as never`) are ignored and warned. They used to be `Object.assign`'d onto the component — a material object overwrites the shader string and the mesh vanishes. Use `shape` + sibling `color` / `roughness` / `metalness`.
56
- - Prefer `parts` for one compound visual. Use child GameObjects when parts need independent components or physics.
57
- - Physics and graphics should share a GameObject when physics owns its pose.
58
-
59
- ## Minimal example
60
-
61
- ```ts
62
- const house = new GameObject('house');
63
- house.addComponent(new Graphics3D({
64
- parts: [
65
- { shape: 'box', width: 2, height: 1.2, depth: 2, color: 0xc4a574 },
66
- { shape: 'cone', radius: 1.4, height: 1, color: 0x8b2942, positionY: 1.1 },
67
- ],
68
- }));
69
- ```
70
-
71
- ## Verification
72
-
73
- `pnpm --filter @combos-fun/plugin-renderer-3d-graphics run build`
9
+ `componentName = 'Graphics3D'`. `systemName = 'Graphics3DSystem'`.
10
+
11
+ | Field | Default |
12
+ | --- | --- |
13
+ | `shape` | `'box'` — `box \| sphere \| cylinder \| plane \| cone \| torus \| capsule` |
14
+ | `color` | `0x00ff00` |
15
+ | `material` | `'standard'` — `standard \| basic \| lambert \| toon` |
16
+ | `width` / `height` / `depth` | `1` |
17
+ | `radius` | `0.5` |
18
+ | `segments` | `12` |
19
+ | `tube` | `0` (torus uses `0.4 × radius`) |
20
+ | `roughness` / `metalness` | `1` / `0` |
21
+ | `emissive` | `0` |
22
+ | `opacity` | `1` |
23
+ | `map` | `''` — IMAGE resource name |
24
+ | `wireframe` / `doubleSide` | `false` |
25
+ | `position*` / `rotation*` / `scale*` | `0` / `0` / `1` |
26
+ | `parts` | replaces the single primitive; component pose moves the group |
27
+
28
+ `color`, `roughness`, `metalness`, and `emissive` are siblings of `material`. `type`, `geometry`, and a material object are ignored. Planes are single-sided unless `doubleSide: true`. A visual plane is finite; Cannon `PLANE` is not. `basic` is unlit; lit materials stay dark without light. Capsule `height` is total height. Plane `segments` apply to both axes. Each part inherits the component and can override geometry, look, and local pose. Use child GameObjects when parts need their own components or physics. Non-pose changes rebuild the mesh. Mapped textures load async and drop stale results.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-graphics",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Procedural 3D primitive shapes",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-graphics.esm.js",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "three": "^0.172.0",
30
- "@combos-fun/engine": "0.1.15",
31
- "@combos-fun/inspector-decorator": "0.1.15",
32
- "@combos-fun/plugin-renderer-3d": "0.1.15"
30
+ "@combos-fun/engine": "0.1.16",
31
+ "@combos-fun/plugin-renderer-3d": "0.1.16",
32
+ "@combos-fun/inspector-decorator": "0.1.16"
33
33
  },
34
34
  "keywords": [
35
35
  "combos-fun",