@combos-fun/plugin-renderer-3d-model 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.
- package/agent-skill.md +14 -63
- package/package.json +4 -4
package/agent-skill.md
CHANGED
|
@@ -1,80 +1,31 @@
|
|
|
1
1
|
# `@combos-fun/plugin-renderer-3d-model` — 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 the normal stale-async contract.
|
|
6
|
-
|
|
7
|
-
## Public API and registration
|
|
3
|
+
Named models and embedded clips. Parent: `plugin-renderer-3d`. Formats: GLB/glTF (Draco, KTX2, meshopt), FBX, OBJ+MTL, STL, DAE, PLY. Prefer GLB.
|
|
8
4
|
|
|
9
5
|
```ts
|
|
10
|
-
import {
|
|
11
|
-
Model3D,
|
|
12
|
-
Model3DSystem,
|
|
13
|
-
type Model3DParams,
|
|
14
|
-
type ParsedModel,
|
|
15
|
-
type ModelResourceInstance,
|
|
16
|
-
} from '@combos-fun/plugin-renderer-3d-model';
|
|
6
|
+
import { Model3D, Model3DSystem } from '@combos-fun/plugin-renderer-3d-model';
|
|
17
7
|
```
|
|
18
8
|
|
|
19
|
-
`componentName = 'Model3D'
|
|
20
|
-
The standard package entry loads `Model3DSystem`, whose `parseModel` import
|
|
21
|
-
registers `RESOURCE_TYPE.MODEL` and `GLB`. Deep-importing only the component
|
|
22
|
-
bypasses that registration.
|
|
23
|
-
|
|
24
|
-
## Parameters
|
|
25
|
-
|
|
26
|
-
| Field | Type | Default | Behavior |
|
|
27
|
-
|-------|------|---------|----------|
|
|
28
|
-
| `resource` | `string` | `''` | MODEL name; empty on ADD is a silent no-op |
|
|
29
|
-
| `autoPlay` | `boolean` | `true` | Consulted only when a newly loaded model is attached; it is not a runtime play/pause control |
|
|
30
|
-
| `animationIndex` | `number` | `0` | Index into `animations` |
|
|
31
|
-
| `speed` | `number` | `1` | Assigned to the selected action's `timeScale` |
|
|
32
|
-
| `positionX/Y/Z` | `number` | `0` | Local pose compatibility fields |
|
|
33
|
-
| `rotationX/Y/Z` | `number` | `0` | Radians |
|
|
34
|
-
| `scaleX/Y/Z` | `number` | `1` | Model scale |
|
|
9
|
+
`componentName = 'Model3D'`. `systemName = 'Model3DSystem'`. Import the package entry so `RESOURCE_TYPE.MODEL` is registered.
|
|
35
10
|
|
|
36
|
-
|
|
11
|
+
| Field | Default | |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `resource` | `''` | MODEL name. Empty on add does nothing |
|
|
14
|
+
| `autoPlay` | `true` | only when the model attaches |
|
|
15
|
+
| `animationIndex` | `0` | |
|
|
16
|
+
| `speed` | `1` | `timeScale` |
|
|
17
|
+
| `position*` / `rotation*` / `scale*` | `0` / `0` / `1` | |
|
|
37
18
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Use a `model`, `glb`, or `gltf` source slot; parsed data may likewise be in `data.model`, `data.glb`, or `data.gltf`. OBJ may add an `mtl` slot. Relative glTF/OBJ sidecars are resolved from the main asset directory.
|
|
19
|
+
Changing `animationIndex` or `speed` restarts that clip, even when `autoPlay` is false. An out-of-range index stops playback. Load is async. Removing or replacing during parse can leave a stale clone.
|
|
41
20
|
|
|
42
21
|
```ts
|
|
43
22
|
resource.addResource([{
|
|
44
23
|
name: 'hero',
|
|
45
24
|
type: RESOURCE_TYPE.MODEL,
|
|
46
|
-
src: { model: { type: 'glb', url
|
|
25
|
+
src: { model: { type: 'glb', url } },
|
|
47
26
|
preload: true,
|
|
48
27
|
}]);
|
|
28
|
+
hero.addComponent(new Model3D({ resource: 'hero' }));
|
|
49
29
|
```
|
|
50
30
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- Parsing is async; no model is visible until it completes. Parsed resources are cached, then each GameObject receives a `SkeletonUtils.clone`.
|
|
54
|
-
- Each attached animated clone gets its own mixer in `ThreeContext`.
|
|
55
|
-
- `resource` replacement removes the prior model and loads a new clone. Removal stops its mixer and disposes clone geometry/materials.
|
|
56
|
-
- Unlike the normal parent contract, async-id validation happens after attachment; removing or replacing the component during parsing can leave a stale clone attached.
|
|
57
|
-
- Renderer shadows traverse every mesh in the clone.
|
|
58
|
-
|
|
59
|
-
## Package-specific pitfalls
|
|
60
|
-
|
|
61
|
-
- OBJ/STL/PLY commonly have no animation clips.
|
|
62
|
-
- Draco and KTX2 decoder assets are fetched from the configured Google/unpkg CDN paths, so CSP/network access must allow them.
|
|
63
|
-
- Exported model units vary; adjust `scaleX/Y/Z`.
|
|
64
|
-
- A sibling `Material3D` can override clone materials after load.
|
|
65
|
-
- A sibling Cannon `Physics3D` may derive an AABB/hull after load. Use trimesh only for static scenery; animation does not rebuild a collider.
|
|
66
|
-
|
|
67
|
-
## Minimal example
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
hero.addComponent(new Model3D({
|
|
71
|
-
resource: 'hero',
|
|
72
|
-
autoPlay: true,
|
|
73
|
-
animationIndex: 0,
|
|
74
|
-
speed: 1,
|
|
75
|
-
}));
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Verification
|
|
79
|
-
|
|
80
|
-
`pnpm --filter @combos-fun/plugin-renderer-3d-model run build`
|
|
31
|
+
OBJ may add an `mtl` slot. `glb` / `gltf` slots are also accepted. Relative glTF/OBJ sidecars resolve from the asset directory. Deep-importing only the component skips registration. OBJ/STL/PLY usually have no clips. Draco/KTX2 decoders load from CDN. Units vary; set `scale*`. Sibling `Material3D` overrides materials. Sibling `Physics3D` can build `aabb` / `hull` after load; `trimesh` is static only. Animation does not rebuild a collider. Each clone has its own mixer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-3d-model",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Named 3D model loader (glTF/GLB, FBX, OBJ, STL, Collada, PLY) and animator",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-3d-model.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.16",
|
|
31
|
+
"@combos-fun/inspector-decorator": "0.1.16",
|
|
32
|
+
"@combos-fun/plugin-renderer-3d": "0.1.16"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"combos-fun",
|