@combos-fun/plugin-renderer-3d-graphics 0.1.15 → 0.1.17
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/agent-skill.md +22 -67
- 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
|
-
|
|
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'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
|
|
39
|
-
|
|
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.
|
|
3
|
+
"version": "0.1.17",
|
|
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.
|
|
31
|
-
"@combos-fun/
|
|
32
|
-
"@combos-fun/
|
|
30
|
+
"@combos-fun/engine": "0.1.17",
|
|
31
|
+
"@combos-fun/plugin-renderer-3d": "0.1.17",
|
|
32
|
+
"@combos-fun/inspector-decorator": "0.1.17"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"combos-fun",
|