@combos-fun/plugin-renderer-3d-model 0.0.6 → 0.0.8
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 +27 -0
- package/agent-skill.md +69 -0
- package/combos-plugin.json +11 -0
- package/package.json +19 -5
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @combos-fun/plugin-renderer-3d-model
|
|
2
|
+
|
|
3
|
+
@combos-fun/plugin-renderer-3d-model — part of the Combos Fun engine monorepo.
|
|
4
|
+
|
|
5
|
+
Keywords: `3d`, `model`, `glb`, `gltf`, `animation`, `mesh`.
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
- Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
|
|
10
|
+
- Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
|
|
11
|
+
(validated against `schemas/combos-plugin.schema.json` in the repo
|
|
12
|
+
root)
|
|
13
|
+
- Entry skill (single source of truth for AI agents working with this
|
|
14
|
+
monorepo): `skills/combos-engine-development/SKILL.md`
|
|
15
|
+
|
|
16
|
+
When consumed from npm, the manifest and agent notes are exposed as
|
|
17
|
+
stable subpaths:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import manifest from '@combos-fun/plugin-renderer-3d-model/plugin-manifest';
|
|
21
|
+
// or fetch the markdown directly:
|
|
22
|
+
// require.resolve('@combos-fun/plugin-renderer-3d-model/agent-skill')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
Internal workspace package, part of the Combos Fun engine monorepo.
|
package/agent-skill.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# `@combos-fun/plugin-renderer-3d-model` — Agent notes
|
|
2
|
+
|
|
3
|
+
GLB / GLTF 3D model loader and animator. Loads via `ThreeContext.loadGLB()` (GLTFLoader) and drives included animations through Three.js `AnimationMixer`.
|
|
4
|
+
|
|
5
|
+
## When to read
|
|
6
|
+
|
|
7
|
+
Read for any 3D character / prop / scenery model: loading GLB / GLTF files, choosing animation clips, scrubbing animation speed.
|
|
8
|
+
|
|
9
|
+
## Public API
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Model3D, GLBSystem, type Model3DParams } from '@combos-fun/plugin-renderer-3d-model';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`componentName = 'Model3D'`, `systemName = 'GLBSystem'`.
|
|
16
|
+
|
|
17
|
+
### `Model3DParams`
|
|
18
|
+
|
|
19
|
+
| Field | Type | Default | Notes |
|
|
20
|
+
|-------|------|---------|-------|
|
|
21
|
+
| `resource` | `string` | `''` | GLB / GLTF URL (direct, not engine resource name) |
|
|
22
|
+
| `autoPlay` | `boolean` | `true` | |
|
|
23
|
+
| `animationIndex` | `number` | `0` | Index into the GLB's `animations` array |
|
|
24
|
+
| `speed` | `number` | `1` | `AnimationMixer.timeScale` |
|
|
25
|
+
| `positionX` / `Y` / `Z` | `number` | `0` |
|
|
26
|
+
| `rotationX` / `Y` / `Z` | `number` | `0` |
|
|
27
|
+
| `scaleX` / `Y` / `Z` | `number` | `1` |
|
|
28
|
+
|
|
29
|
+
Changing `animationIndex` or `speed` restarts the animation cleanly.
|
|
30
|
+
|
|
31
|
+
## Required setup
|
|
32
|
+
|
|
33
|
+
`Renderer3DSystem` then `GLBSystem`. URL must be CORS-accessible and return valid binary GLB / JSON GLTF.
|
|
34
|
+
|
|
35
|
+
## Runtime behaviour
|
|
36
|
+
|
|
37
|
+
- Loading is async. While the GLB is loading, the GameObject has no
|
|
38
|
+
visible mesh.
|
|
39
|
+
- The system uses `increaseAsyncId` / `validateAsyncId` to drop stale
|
|
40
|
+
loads if the component is removed mid-fetch.
|
|
41
|
+
- The `AnimationMixer` is owned by the system; switching
|
|
42
|
+
`animationIndex` calls `mixer.stopAllAction()` then plays the new clip.
|
|
43
|
+
|
|
44
|
+
## Common pitfalls
|
|
45
|
+
|
|
46
|
+
| Symptom | Fix |
|
|
47
|
+
|---------|-----|
|
|
48
|
+
| Model not visible | Loaded at origin; adjust `position*` or check camera distance (camera is at z=5 by default) |
|
|
49
|
+
| Wrong scale | Use `scaleX` / `Y` / `Z`; many GLBs export at meter scale |
|
|
50
|
+
| Animation doesn't play | `autoPlay: true` is the default — check `animationIndex` is within `animations.length` |
|
|
51
|
+
| Slow / stuttery animation | Lower-end GPU; reduce model polygon count or set `speed < 1` |
|
|
52
|
+
| 404 / CORS | Verify URL returns valid GLB binary; check network tab |
|
|
53
|
+
|
|
54
|
+
## Minimal example
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const hero = new GameObject('hero');
|
|
58
|
+
hero.addComponent(new Model3D({
|
|
59
|
+
resource: '/assets/hero.glb',
|
|
60
|
+
autoPlay: true,
|
|
61
|
+
animationIndex: 0,
|
|
62
|
+
speed: 1,
|
|
63
|
+
positionY: 0,
|
|
64
|
+
}));
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Verification
|
|
68
|
+
|
|
69
|
+
`pnpm --filter @combos-fun/plugin-renderer-3d-model run build`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@combos-fun/plugin-renderer-3d-model",
|
|
3
|
+
"pluginId": "renderer-3d-model",
|
|
4
|
+
"category": "rendering",
|
|
5
|
+
"dimension": "3d",
|
|
6
|
+
"isCore": false,
|
|
7
|
+
"keywords": ["3d", "model", "glb", "gltf", "animation", "mesh"],
|
|
8
|
+
"agentSkill": "./agent-skill.md",
|
|
9
|
+
"requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer-3d"],
|
|
10
|
+
"exports": ["Model3D", "GLBSystem"]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-3d-model",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "@combos-fun/plugin-renderer-3d-model",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-3d-model.esm.js",
|
|
@@ -9,13 +9,27 @@
|
|
|
9
9
|
"types": "dist/plugin-renderer-3d-model.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"index.js",
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"agent-skill.md",
|
|
14
|
+
"combos-plugin.json"
|
|
13
15
|
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/plugin-renderer-3d-model.esm.js",
|
|
19
|
+
"require": "./index.js",
|
|
20
|
+
"types": "./dist/plugin-renderer-3d-model.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./plugin-manifest": "./combos-plugin.json",
|
|
23
|
+
"./agent-skill": "./agent-skill.md"
|
|
24
|
+
},
|
|
25
|
+
"combos": {
|
|
26
|
+
"pluginManifest": "./combos-plugin.json"
|
|
27
|
+
},
|
|
14
28
|
"dependencies": {
|
|
15
29
|
"three": "^0.172.0",
|
|
16
|
-
"@combos-fun/engine": "0.0.
|
|
17
|
-
"@combos-fun/inspector-decorator": "0.0.
|
|
18
|
-
"@combos-fun/plugin-renderer-3d": "0.0.
|
|
30
|
+
"@combos-fun/engine": "0.0.8",
|
|
31
|
+
"@combos-fun/inspector-decorator": "0.0.8",
|
|
32
|
+
"@combos-fun/plugin-renderer-3d": "0.0.8"
|
|
19
33
|
},
|
|
20
34
|
"scripts": {
|
|
21
35
|
"build": "node ../../scripts/build-package.mjs"
|