@leejungkiin/awkit 1.5.5 → 1.6.0
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 +6 -4
- package/bin/awk.js +196 -8
- package/core/GEMINI.md +24 -8
- package/core/work-modes.json +45 -0
- package/package.json +3 -3
- package/skill-packs/cocos2d/pack.json +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/LICENSE.txt +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/SKILL.md +168 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/action.md +278 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/animation.md +220 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/event.md +133 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/input.md +291 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/label.md +184 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/node-scene.md +212 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/scene.md +228 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/sprite.md +206 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/texture.md +186 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/about-engine.md +53 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/installation.md +203 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/quick-start.md +134 -0
- package/skill-packs/electron/pack.json +9 -0
- package/skill-packs/electron/skills/electron/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron/SKILL.md +160 -0
- package/skill-packs/electron/skills/electron/api/app.md +83 -0
- package/skill-packs/electron/skills/electron/api/browser-window.md +84 -0
- package/skill-packs/electron/skills/electron/examples/advanced/packaging.md +140 -0
- package/skill-packs/electron/skills/electron/examples/api/browser-window.md +182 -0
- package/skill-packs/electron/skills/electron/examples/api/menu.md +187 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/installation.md +88 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/quick-start.md +104 -0
- package/skill-packs/electron/skills/electron/examples/processes/ipc-communication.md +140 -0
- package/skill-packs/electron/skills/electron/examples/processes/main-process.md +121 -0
- package/skill-packs/electron/skills/electron/templates/main-process.md +105 -0
- package/skill-packs/electron/skills/electron/templates/preload-script.md +84 -0
- package/skill-packs/electron/skills/electron-egg/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron-egg/SKILL.md +154 -0
- package/skill-packs/electron/skills/electron-egg/api/config-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/ipc-api.md +55 -0
- package/skill-packs/electron/skills/electron-egg/api/main-api.md +54 -0
- package/skill-packs/electron/skills/electron-egg/api/renderer-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/window-api.md +64 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/ipc-communication.md +84 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/main-process.md +89 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/renderer-process.md +74 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/build.md +77 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/configuration.md +88 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/installation.md +66 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/intro.md +47 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/project-structure.md +73 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/quick-start.md +78 -0
- package/skill-packs/electron/skills/electron-egg/templates/configuration.md +63 -0
- package/skill-packs/electron/skills/electron-egg/templates/installation.md +42 -0
- package/skill-packs/electron/skills/electron-egg/templates/project-setup.md +75 -0
- package/skill-packs/flutter/pack.json +9 -0
- package/skill-packs/flutter/skills/flutter/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter/SKILL.md +127 -0
- package/skill-packs/flutter/skills/flutter-project-creater/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter-project-creater/SKILL.md +106 -0
- package/skill-packs/threejs/pack.json +25 -0
- package/skill-packs/threejs/skills/README.md +95 -0
- package/skill-packs/threejs/skills/threejs-animation/SKILL.md +86 -0
- package/skill-packs/threejs/skills/threejs-animation/examples/workflow-mixer-action.md +20 -0
- package/skill-packs/threejs/skills/threejs-animation/references/official-sections.md +19 -0
- package/skill-packs/threejs/skills/threejs-audio/SKILL.md +112 -0
- package/skill-packs/threejs/skills/threejs-audio/examples/workflow-positional-audio.md +15 -0
- package/skill-packs/threejs/skills/threejs-audio/references/official-sections.md +16 -0
- package/skill-packs/threejs/skills/threejs-camera/SKILL.md +96 -0
- package/skill-packs/threejs/skills/threejs-camera/examples/workflow-perspective-resize.md +13 -0
- package/skill-packs/threejs/skills/threejs-controls/SKILL.md +101 -0
- package/skill-packs/threejs/skills/threejs-controls/examples/workflow-orbit-damping.md +15 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/examples/workflow-scaffold.md +24 -0
- package/skill-packs/threejs/skills/threejs-geometries/SKILL.md +108 -0
- package/skill-packs/threejs/skills/threejs-geometries/examples/workflow-extrude-shape.md +13 -0
- package/skill-packs/threejs/skills/threejs-helpers/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-helpers/examples/workflow-light-camera-helpers.md +13 -0
- package/skill-packs/threejs/skills/threejs-lights/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-lights/examples/workflow-directional-shadow.md +17 -0
- package/skill-packs/threejs/skills/threejs-loaders/SKILL.md +89 -0
- package/skill-packs/threejs/skills/threejs-loaders/examples/workflow-gltf-draco.md +22 -0
- package/skill-packs/threejs/skills/threejs-loaders/references/official-sections.md +27 -0
- package/skill-packs/threejs/skills/threejs-materials/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-materials/examples/workflow-pbr-transparent.md +15 -0
- package/skill-packs/threejs/skills/threejs-math/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-math/examples/workflow-ray-aabb.md +11 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/examples/workflow-tsl-entry.md +13 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/official-links.md +8 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/tsl-vs-classic.md +23 -0
- package/skill-packs/threejs/skills/threejs-objects/SKILL.md +111 -0
- package/skill-packs/threejs/skills/threejs-objects/examples/workflow-raycaster-pick.md +17 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/SKILL.md +116 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/examples/workflow-composer-bloom.md +15 -0
- package/skill-packs/threejs/skills/threejs-renderers/SKILL.md +91 -0
- package/skill-packs/threejs/skills/threejs-renderers/examples/workflow-renderer-resize.md +21 -0
- package/skill-packs/threejs/skills/threejs-renderers/references/official-sections.md +14 -0
- package/skill-packs/threejs/skills/threejs-scenes/SKILL.md +90 -0
- package/skill-packs/threejs/skills/threejs-scenes/examples/workflow-fog-background.md +13 -0
- package/skill-packs/threejs/skills/threejs-textures/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-textures/examples/workflow-pmrem-env.md +19 -0
- package/skill-packs/threejs/skills/threejs-webxr/SKILL.md +104 -0
- package/skill-packs/threejs/skills/threejs-webxr/examples/workflow-xr-button.md +15 -0
- package/skills/CATALOG.md +44 -49
- package/skills/TRIGGER_INDEX.md +30 -0
- package/skills/awf-session-restore/SKILL.md +19 -2
- package/skills/brainstorm-agent/SKILL.md +2 -0
- package/skills/code-review/SKILL.md +2 -0
- package/skills/code-review-system-principles/SKILL.md +154 -0
- package/skills/codex-conductor/SKILL.md +6 -4
- package/skills/gemini-conductor/SKILL.md +4 -3
- package/skills/gitnexus-intelligence/SKILL.md +2 -0
- package/skills/module-spec-writer/SKILL.md +2 -0
- package/skills/nm-memory-sync/SKILL.md +10 -0
- package/skills/skill-creator/SKILL.md +2 -0
- package/skills/spec-gate/SKILL.md +2 -0
- package/skills/symphony-enforcer/SKILL.md +9 -0
- package/skills/symphony-enforcer/examples/mindful-stop.md +141 -0
- package/skills/symphony-enforcer/examples/task-completion.md +11 -2
- package/skills/symphony-enforcer/examples/trigger-points.md +7 -0
- package/skills/symphony-orchestrator/SKILL.md +2 -0
- package/skills/telegram-notify/SKILL.md +1 -0
- package/skills/trello-sync/SKILL.md +7 -0
- package/skills/verification-gate/SKILL.md +2 -0
- package/skills/visual-design-gate/SKILL.md +2 -0
- package/templates/project-identity/android.json +26 -1
- package/templates/project-identity/backend-nestjs.json +26 -1
- package/templates/project-identity/expo.json +26 -1
- package/templates/project-identity/ios.json +26 -1
- package/templates/project-identity/web-nextjs.json +26 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Workflow: positional loop with loader
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. Create `AudioListener`, `camera.add(listener)`.
|
|
6
|
+
|
|
7
|
+
2. `const sound = new THREE.PositionalAudio(listener);`
|
|
8
|
+
|
|
9
|
+
3. `const loader = new THREE.AudioLoader();` (**threejs-loaders**) `loader.load('file.ogg', buffer => { sound.setBuffer(buffer); sound.setRefDistance(1); sound.play(); });`
|
|
10
|
+
|
|
11
|
+
4. Add `sound` as child of moving mesh or update position each frame.
|
|
12
|
+
|
|
13
|
+
5. Connect `AudioAnalyser` only if visualization required—extra CPU.
|
|
14
|
+
|
|
15
|
+
Browser autoplay: resume context on first click if needed.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Audio module (core)
|
|
2
|
+
|
|
3
|
+
Index: https://threejs.org/docs/#Audio
|
|
4
|
+
|
|
5
|
+
- https://threejs.org/docs/AudioListener.html
|
|
6
|
+
- https://threejs.org/docs/Audio.html
|
|
7
|
+
- https://threejs.org/docs/PositionalAudio.html
|
|
8
|
+
- https://threejs.org/docs/AudioAnalyser.html
|
|
9
|
+
|
|
10
|
+
**Loaders (decode buffers — see skill `threejs-loaders`)**
|
|
11
|
+
|
|
12
|
+
- https://threejs.org/docs/AudioLoader.html
|
|
13
|
+
|
|
14
|
+
**Addons (positional helper)**
|
|
15
|
+
|
|
16
|
+
- https://threejs.org/docs/PositionalAudioHelper.html
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-camera
|
|
3
|
+
description: "three.js cameras: Camera base, PerspectiveCamera, OrthographicCamera, CubeCamera, ArrayCamera, StereoCamera; projection matrices, aspect, FOV, orthographic frustum sizes, near/far planes, and dynamic environment maps with CubeCamera. Use when placing views, rendering reflections, or multi-view splits; for XR projections and eye matrices use threejs-webxr; for post pass camera tricks use threejs-postprocessing alongside threejs-renderers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Switching perspective vs orthographic, `fov`, `aspect`, `zoom`, `near`, `far`
|
|
11
|
+
- `CubeCamera` for real-time environment maps or reflections (update rate caveats)
|
|
12
|
+
- `ArrayCamera`/`StereoCamera` for multi-view or stereo off-axis projection (non-XR)
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: camera vs webxr vs post**
|
|
15
|
+
|
|
16
|
+
| Topic | Skill |
|
|
17
|
+
|-------|--------|
|
|
18
|
+
| Standard desktop projection | **threejs-camera** |
|
|
19
|
+
| XR reference spaces, IPD | **threejs-webxr** |
|
|
20
|
+
| Offscreen pass cameras inside composer | **threejs-postprocessing** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "PerspectiveCamera", "OrthographicCamera", "CubeCamera", "aspect", "near", "far"
|
|
25
|
+
- "透视相机", "正交", "立方体相机"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. **Perspective**: set `aspect` = width/height; update on resize (**threejs-renderers** example workflow).
|
|
30
|
+
2. **Orthographic**: define `left/right/top/bottom` in world units for CAD/2.5D views.
|
|
31
|
+
3. **Near/far**: balance depth precision vs containing scene bounds; relate to fog (**threejs-scenes**).
|
|
32
|
+
4. **CubeCamera**: position at reflection probe; call `update` when scene static enough; use render target outputs per docs.
|
|
33
|
+
5. **Stereo/Array**: advanced; cite docs for eye parameters; defer XR to **threejs-webxr**.
|
|
34
|
+
6. **Projection matrix**: call `updateProjectionMatrix()` after parameter edits.
|
|
35
|
+
7. **Helpers**: `CameraHelper` lives in **threejs-helpers**.
|
|
36
|
+
|
|
37
|
+
### Example: Resize handler with updateProjectionMatrix
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
window.addEventListener('resize', () => {
|
|
41
|
+
camera.aspect = window.innerWidth / window.innerHeight;
|
|
42
|
+
camera.updateProjectionMatrix();
|
|
43
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
See [examples/workflow-perspective-resize.md](examples/workflow-perspective-resize.md).
|
|
48
|
+
|
|
49
|
+
## Doc map (official)
|
|
50
|
+
|
|
51
|
+
| Docs section | Representative links |
|
|
52
|
+
|--------------|----------------------|
|
|
53
|
+
| Cameras (index) | https://threejs.org/docs/#Cameras |
|
|
54
|
+
| Cameras | https://threejs.org/docs/Camera.html |
|
|
55
|
+
| Perspective | https://threejs.org/docs/PerspectiveCamera.html |
|
|
56
|
+
| Orthographic | https://threejs.org/docs/OrthographicCamera.html |
|
|
57
|
+
| Cube | https://threejs.org/docs/CubeCamera.html |
|
|
58
|
+
| Multi-view | https://threejs.org/docs/ArrayCamera.html |
|
|
59
|
+
| Stereo (non-XR) | https://threejs.org/docs/StereoCamera.html |
|
|
60
|
+
|
|
61
|
+
## Scope
|
|
62
|
+
|
|
63
|
+
- **In scope:** Core camera classes and parameters; cube/array/stereo overview.
|
|
64
|
+
- **Out of scope:** WebXR reference spaces, eye matrices, session lifecycle (**threejs-webxr**); shadow map camera tuning (**threejs-lights**); pass-internal cameras in composer (**threejs-postprocessing**).
|
|
65
|
+
|
|
66
|
+
## Common pitfalls and best practices
|
|
67
|
+
|
|
68
|
+
- Wrong `aspect` after resize stretches image—always sync with canvas.
|
|
69
|
+
- Too small `near` hurts depth precision in large worlds.
|
|
70
|
+
- `CubeCamera` every frame is expensive—throttle for performance.
|
|
71
|
+
|
|
72
|
+
## Documentation and version
|
|
73
|
+
|
|
74
|
+
Camera parameters and `CubeCamera` update behavior follow the [Cameras](https://threejs.org/docs/#Cameras) section of [three.js docs](https://threejs.org/docs/). WebXR uses different projection paths—hand off to **threejs-webxr** when the user mentions headsets or reference spaces.
|
|
75
|
+
|
|
76
|
+
## Agent response checklist
|
|
77
|
+
|
|
78
|
+
When answering under this skill, prefer responses that:
|
|
79
|
+
|
|
80
|
+
1. Link `PerspectiveCamera`, `OrthographicCamera`, or `CubeCamera` as relevant.
|
|
81
|
+
2. Pair resize with **threejs-renderers** `setSize` / DPR patterns when relevant.
|
|
82
|
+
3. Route `XR`/`WebXRManager` questions to **threejs-webxr** after one-line renderer mention.
|
|
83
|
+
4. Mention `updateProjectionMatrix()` after intrinsic changes.
|
|
84
|
+
5. Use **threejs-helpers** `CameraHelper` for shadow frustum debug when discussing lights.
|
|
85
|
+
|
|
86
|
+
## References
|
|
87
|
+
|
|
88
|
+
- https://threejs.org/docs/#Cameras
|
|
89
|
+
- https://threejs.org/docs/PerspectiveCamera.html
|
|
90
|
+
- https://threejs.org/docs/CubeCamera.html
|
|
91
|
+
|
|
92
|
+
## Keywords
|
|
93
|
+
|
|
94
|
+
**English:** perspectivecamera, orthographiccamera, cubecamera, projection, aspect, near, far, three.js
|
|
95
|
+
|
|
96
|
+
**中文:** 相机、透视、正交、投影、近裁剪、远裁剪、CubeCamera、three.js
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Workflow: perspective camera on window resize
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. Store `PerspectiveCamera` reference.
|
|
6
|
+
|
|
7
|
+
2. On resize: `camera.aspect = width / height; camera.updateProjectionMatrix();`
|
|
8
|
+
|
|
9
|
+
3. Pair with renderer `setSize` from **threejs-renderers** examples.
|
|
10
|
+
|
|
11
|
+
4. For orthographic cameras, recompute `left/right/top/bottom` if using fit-to-view logic.
|
|
12
|
+
|
|
13
|
+
This is the standard pattern used across three.js examples.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-controls
|
|
3
|
+
description: "Addon camera and object manipulation controls: OrbitControls, MapControls, FlyControls, FirstPersonControls, TrackballControls, ArcballControls, DragControls, PointerLockControls, TransformControls; damping, target focal point, and integration with the animation loop. Use for editor-style navigation and gizmos—not a full game character controller stack; pair with Raycaster selection patterns in threejs-objects when transforming selections."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Orbiting/panning/dolly around a target, inertia/damping, min/max distance/polar angles
|
|
11
|
+
- Map-like pan (MapControls) or flying (FlyControls)
|
|
12
|
+
- Transform gizmo translate/rotate/scale with `TransformControls`
|
|
13
|
+
- Dragging objects in plane (DragControls), pointer lock FPS (PointerLockControls)
|
|
14
|
+
|
|
15
|
+
**IMPORTANT: controls vs webxr**
|
|
16
|
+
|
|
17
|
+
| Context | Skill |
|
|
18
|
+
|---------|--------|
|
|
19
|
+
| Desktop/browser camera nav | **threejs-controls** |
|
|
20
|
+
| XR controller poses | **threejs-webxr** |
|
|
21
|
+
|
|
22
|
+
**Trigger phrases include:**
|
|
23
|
+
|
|
24
|
+
- "OrbitControls", "TransformControls", "MapControls", "PointerLockControls"
|
|
25
|
+
- "轨道", "变换控制器", "漫游"
|
|
26
|
+
|
|
27
|
+
## How to use this skill
|
|
28
|
+
|
|
29
|
+
1. **Import** from addons path (**threejs-dev-setup**).
|
|
30
|
+
2. **Construct** with `(camera, domElement)`; for `TransformControls` also attach to renderer events.
|
|
31
|
+
3. **Animation loop**: when `enableDamping`, call `controls.update()` each frame.
|
|
32
|
+
4. **TransformControls**: wire `dragging-changed` to disable Orbit temporarily; sync with selection from **threejs-objects**.
|
|
33
|
+
5. **Constraints**: set min/max distance/angles to avoid flipping or underground views.
|
|
34
|
+
6. **Dispose**: `controls.dispose()` when tearing down.
|
|
35
|
+
|
|
36
|
+
### Example: OrbitControls with damping
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
40
|
+
|
|
41
|
+
const controls = new OrbitControls(camera, renderer.domElement);
|
|
42
|
+
controls.enableDamping = true;
|
|
43
|
+
controls.dampingFactor = 0.05;
|
|
44
|
+
controls.minDistance = 2;
|
|
45
|
+
controls.maxDistance = 50;
|
|
46
|
+
|
|
47
|
+
// Must call update() each frame when damping is enabled
|
|
48
|
+
function animate() {
|
|
49
|
+
controls.update();
|
|
50
|
+
renderer.render(scene, camera);
|
|
51
|
+
}
|
|
52
|
+
renderer.setAnimationLoop(animate);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
See [examples/workflow-orbit-damping.md](examples/workflow-orbit-damping.md).
|
|
56
|
+
|
|
57
|
+
## Doc map (official)
|
|
58
|
+
|
|
59
|
+
| Docs section | Representative links |
|
|
60
|
+
|--------------|----------------------|
|
|
61
|
+
| Controls | https://threejs.org/docs/OrbitControls.html |
|
|
62
|
+
| Controls | https://threejs.org/docs/TransformControls.html |
|
|
63
|
+
| Controls | https://threejs.org/docs/MapControls.html |
|
|
64
|
+
| Controls (index) | https://threejs.org/docs/#Controls |
|
|
65
|
+
|
|
66
|
+
## Scope
|
|
67
|
+
|
|
68
|
+
- **In scope:** Official addons controls usage patterns.
|
|
69
|
+
- **Out of scope:** Full physics character motor; mobile gesture frameworks.
|
|
70
|
+
|
|
71
|
+
## Common pitfalls and best practices
|
|
72
|
+
|
|
73
|
+
- Forgetting `update()` with damping enabled causes drift never settling.
|
|
74
|
+
- TransformControls fighting with Orbit—pause one while using the other.
|
|
75
|
+
- Pointer lock requires user gesture and exit handling.
|
|
76
|
+
|
|
77
|
+
## Documentation and version
|
|
78
|
+
|
|
79
|
+
Controls are under [Controls](https://threejs.org/docs/#Controls) (Addons) in [three.js docs](https://threejs.org/docs/). API details (`enableDamping`, events) evolve—link `OrbitControls` / `TransformControls` pages for the user’s three.js version.
|
|
80
|
+
|
|
81
|
+
## Agent response checklist
|
|
82
|
+
|
|
83
|
+
When answering under this skill, prefer responses that:
|
|
84
|
+
|
|
85
|
+
1. Link the specific controls class from the docs.
|
|
86
|
+
2. State `controls.update()` when damping is on, every frame.
|
|
87
|
+
3. Coordinate `TransformControls` with selection / **threejs-objects** raycasting.
|
|
88
|
+
4. Separate desktop navigation from **threejs-webxr** locomotion.
|
|
89
|
+
5. Call `dispose()` on controls when unmounting canvas.
|
|
90
|
+
|
|
91
|
+
## References
|
|
92
|
+
|
|
93
|
+
- https://threejs.org/docs/#Controls
|
|
94
|
+
- https://threejs.org/docs/OrbitControls.html
|
|
95
|
+
- https://threejs.org/docs/TransformControls.html
|
|
96
|
+
|
|
97
|
+
## Keywords
|
|
98
|
+
|
|
99
|
+
**English:** orbitcontrols, transformcontrols, mapcontrols, damping, camera controls, three.js
|
|
100
|
+
|
|
101
|
+
**中文:** OrbitControls、轨道、TransformControls、变换控制器、阻尼、three.js
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Workflow: OrbitControls with damping
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. `const controls = new OrbitControls(camera, renderer.domElement);`
|
|
6
|
+
|
|
7
|
+
2. `controls.enableDamping = true; controls.dampingFactor = 0.05;`
|
|
8
|
+
|
|
9
|
+
3. Each frame before render: `controls.update();`
|
|
10
|
+
|
|
11
|
+
4. Listen to `controls.addEventListener('change', render)` only if using lazy rendering; continuous apps already render in rAF.
|
|
12
|
+
|
|
13
|
+
5. On destroy: `controls.dispose()`.
|
|
14
|
+
|
|
15
|
+
API: https://threejs.org/docs/OrbitControls.html
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-dev-setup
|
|
3
|
+
description: "Bootstrap and toolchain guidance for three.js applications using npm, Vite/Webpack/Rollup, bare ESM import maps, and TypeScript. Covers canonical import paths for three core versus three/addons/ (examples/jsm re-exports), version alignment with threejs.org docs, and fixing module not found for loaders and controls. Use when scaffolding a new 3D project, migrating bundler, or debugging resolution of addons; do not use for rendering API details (see threejs-renderers) or asset loading logic (see threejs-loaders)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Creating or configuring a new three.js project, Vite/Webpack/Rollup entry, or browser `importmap`
|
|
11
|
+
- Installing the `three` package, aligning version with documentation, or TypeScript setup (`@types/three` where applicable)
|
|
12
|
+
- Import errors for `three/addons/...`, `examples/jsm`, ESM vs CJS interop, or bare specifier resolution
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: this skill vs runtime topics**
|
|
15
|
+
|
|
16
|
+
- **threejs-dev-setup** = install paths, bundler, module graph, and where to import addons from.
|
|
17
|
+
- **threejs-renderers** = `WebGLRenderer` / `WebGPURenderer`, canvas, pixel ratio, render loop—after the project loads.
|
|
18
|
+
- **threejs-loaders** = `GLTFLoader`, `DRACOLoader`, progress callbacks—after imports resolve.
|
|
19
|
+
|
|
20
|
+
**Trigger phrases include:**
|
|
21
|
+
|
|
22
|
+
- "vite three.js", "webpack three", "import map", "three/addons", "cannot find module", "jsm"
|
|
23
|
+
- "新建项目", "安装 three", "找不到模块", "ESM", "TypeScript three"
|
|
24
|
+
|
|
25
|
+
## How to use this skill
|
|
26
|
+
|
|
27
|
+
1. **Confirm delivery model**: SPA bundler (Vite/Webpack), Node tooling, or static HTML with `importmap`—each affects how `three/addons/` resolves.
|
|
28
|
+
2. **Pin `three` version** to a release compatible with the docs the user cites; note that addon paths follow the published package layout.
|
|
29
|
+
3. **Show canonical imports**: core from `three`; controls/loaders/effects from `three/addons/...` (mapped to `examples/jsm` in source tree). See [examples/workflow-scaffold.md](examples/workflow-scaffold.md).
|
|
30
|
+
4. **Minimal loop**: create renderer + scene + camera + one mesh to verify toolchain works.
|
|
31
|
+
5. **TypeScript**: enable `moduleResolution` appropriate for bundler; reference types from `three` package typings; avoid duplicating global script tag patterns unless user targets no-bundler HTML.
|
|
32
|
+
6. **On failure**: distinguish missing dependency vs wrong path vs SSR context (no `window`/`document`).
|
|
33
|
+
7. **Deepening**: link user to [three.js manual](https://threejs.org/manual/) first chapter after scaffold works.
|
|
34
|
+
|
|
35
|
+
### Example: Vite + three.js minimal verification
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm create vite@latest my-3d-app -- --template vanilla && cd my-3d-app
|
|
39
|
+
npm install three
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// main.js — canonical imports and minimal render loop
|
|
44
|
+
import * as THREE from 'three';
|
|
45
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
46
|
+
|
|
47
|
+
const scene = new THREE.Scene();
|
|
48
|
+
const camera = new THREE.PerspectiveCamera(75, innerWidth / innerHeight, 0.1, 100);
|
|
49
|
+
camera.position.z = 3;
|
|
50
|
+
|
|
51
|
+
const renderer = new THREE.WebGLRenderer();
|
|
52
|
+
renderer.setSize(innerWidth, innerHeight);
|
|
53
|
+
document.body.appendChild(renderer.domElement);
|
|
54
|
+
|
|
55
|
+
const mesh = new THREE.Mesh(
|
|
56
|
+
new THREE.BoxGeometry(),
|
|
57
|
+
new THREE.MeshStandardMaterial({ color: 0x00ff00 })
|
|
58
|
+
);
|
|
59
|
+
scene.add(mesh, new THREE.AmbientLight(0xffffff, 0.5));
|
|
60
|
+
|
|
61
|
+
renderer.setAnimationLoop(() => renderer.render(scene, camera));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Doc map (official)
|
|
65
|
+
|
|
66
|
+
| Docs section | Representative links |
|
|
67
|
+
|--------------|----------------------|
|
|
68
|
+
| Manual (getting started) | https://threejs.org/manual/ |
|
|
69
|
+
| Docs index | https://threejs.org/docs/ |
|
|
70
|
+
| Package / install context | https://www.npmjs.com/package/three |
|
|
71
|
+
|
|
72
|
+
## Scope
|
|
73
|
+
|
|
74
|
+
- **In scope:** npm/install, bundlers, import maps, TypeScript basics for three, addon import paths, minimal verification snippet.
|
|
75
|
+
- **Out of scope:** WebGL theory, full render target or post stack (threejs-renderers, threejs-postprocessing), physics, deployment beyond "build runs".
|
|
76
|
+
|
|
77
|
+
## Common pitfalls and best practices
|
|
78
|
+
|
|
79
|
+
- Mixing multiple `three` copies in one page breaks singletons; dedupe with bundler aliases.
|
|
80
|
+
- Importing addons from deep `node_modules/.../examples/jsm` paths is fragile; prefer package exports `three/addons/...` when available.
|
|
81
|
+
- Always match **r152+** style color management docs when giving snippet defaults (output color space)—point to threejs-renderers/textures for details.
|
|
82
|
+
- SSR frameworks need dynamic import or client-only components for WebGL context.
|
|
83
|
+
|
|
84
|
+
## Documentation and version
|
|
85
|
+
|
|
86
|
+
Toolchain and import paths follow the **three** npm package version the user installs. The [Manual](https://threejs.org/manual/) and [docs](https://threejs.org/docs/) are updated with the library; addon paths (`three/addons/...`) must match the package layout for that release—when in doubt, cite the version number and the exact import line from the current docs.
|
|
87
|
+
|
|
88
|
+
## Agent response checklist
|
|
89
|
+
|
|
90
|
+
When answering under this skill, prefer responses that:
|
|
91
|
+
|
|
92
|
+
1. Name the bundler or runtime (Vite, Webpack, bare ESM, `importmap`) and the intended `three` version.
|
|
93
|
+
2. Link https://threejs.org/manual/ and/or https://threejs.org/docs/ for authoritative setup context.
|
|
94
|
+
3. Distinguish **threejs-dev-setup** (resolution) from **threejs-renderers** (runtime API) failures.
|
|
95
|
+
4. Never assume global script tags unless the user explicitly uses CDN/no-bundler HTML.
|
|
96
|
+
5. Recommend deduplicating `three` in `package.json` / lockfile when duplicate singleton issues appear.
|
|
97
|
+
|
|
98
|
+
## Keywords
|
|
99
|
+
|
|
100
|
+
**English:** three.js, vite, webpack, rollup, import map, typescript, npm, three/addons, examples jsm, module resolution, scaffold
|
|
101
|
+
|
|
102
|
+
**中文:** three.js 安装、构建、importmap、模块解析、three/addons、脚手架、Vite、Webpack
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Workflow: minimal scaffold (toolchain check)
|
|
2
|
+
|
|
3
|
+
Use after `three` is installed and the bundler resolves `three` and `three/addons/...`.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Import core and one addon (e.g. `OrbitControls`) using your bundler’s supported syntax.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import * as THREE from 'three';
|
|
11
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Create `WebGLRenderer`, append `domElement`, size to canvas container.
|
|
15
|
+
|
|
16
|
+
3. Create `Scene`, `PerspectiveCamera`, add a `Mesh` with `BoxGeometry` + `MeshStandardMaterial`.
|
|
17
|
+
|
|
18
|
+
4. Instantiate `OrbitControls(camera, renderer.domElement)` and drive `requestAnimationFrame` calling `controls.update()` then `renderer.render(scene, camera)`.
|
|
19
|
+
|
|
20
|
+
5. If this runs without module errors, **threejs-dev-setup** is satisfied; tune color space and lighting via **threejs-renderers** and **threejs-lights**.
|
|
21
|
+
|
|
22
|
+
## Official examples (reference only)
|
|
23
|
+
|
|
24
|
+
Browse live examples under the three.js repository `examples/`—do not paste entire files; pick patterns matching your bundler.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-geometries
|
|
3
|
+
description: "three.js geometry authoring: BufferGeometry, typed BufferAttribute and interleaved layouts, InstancedBufferGeometry, primitive Geometries (box/sphere/torus/etc.), ExtrudeGeometry and Shape/Path/Curve from Extras, WireframeGeometry, and addon geometries such as TextGeometry, DecalGeometry, RoundedBoxGeometry. Use when building custom buffer geometries, extruding shapes, or using primitive geometry constructors; for animation morph targets see threejs-animation; for merging buffers see BufferGeometryUtils addon."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Building or modifying `BufferGeometry`, attributes, index buffers, draw ranges
|
|
11
|
+
- Instancing via `InstancedBufferAttribute` / `InstancedMesh` geometry side (**threejs-objects** for mesh wrapper)
|
|
12
|
+
- Extruding `Shape` along paths, `TubeGeometry`, `LatheGeometry`, `ExtrudeGeometry`
|
|
13
|
+
- Text or decal addon geometries
|
|
14
|
+
|
|
15
|
+
**IMPORTANT: geometries vs math**
|
|
16
|
+
|
|
17
|
+
- **threejs-geometries** = GPU-ready triangle data.
|
|
18
|
+
- **threejs-math** = `Box3`, `Sphere`, `Ray` tests without mesh topology.
|
|
19
|
+
|
|
20
|
+
**Trigger phrases include:**
|
|
21
|
+
|
|
22
|
+
- "BufferGeometry", "BufferAttribute", "ExtrudeGeometry", "Shape", "Curve"
|
|
23
|
+
- "几何体", "缓冲几何", "挤出", "文字几何"
|
|
24
|
+
|
|
25
|
+
## How to use this skill
|
|
26
|
+
|
|
27
|
+
1. **Choose geometry type** — prefer built-in primitives (`BoxGeometry`, `SphereGeometry`, etc.) when they fit before custom buffers.
|
|
28
|
+
2. **Custom BufferGeometry** — create geometry, set `position`, `normal`, `uv`, optional `index`; compute bounding volumes for frustum culling.
|
|
29
|
+
3. **Validate normals** — verify normals exist before adding to scene; missing normals break lighting silently.
|
|
30
|
+
4. **Instancing** — align instanced attribute divisor/count with `InstancedMesh` patterns in **threejs-objects**.
|
|
31
|
+
5. **Extrusion** — build `Shape`/`Path`, extrude or lathe per docs; consult Extras **Curve** family for path sampling.
|
|
32
|
+
6. **Addon geometries** — for NURBS, text, decals, follow Addons pages; cite docs instead of copying full APIs.
|
|
33
|
+
7. **Dispose** — call `geometry.dispose()` when replacing meshes to avoid GPU memory leaks.
|
|
34
|
+
|
|
35
|
+
### Example: Custom BufferGeometry with validation
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import * as THREE from 'three';
|
|
39
|
+
|
|
40
|
+
// Create a simple triangle with custom BufferGeometry
|
|
41
|
+
const geometry = new THREE.BufferGeometry();
|
|
42
|
+
const vertices = new Float32Array([
|
|
43
|
+
-1, -1, 0, 1, -1, 0, 0, 1, 0
|
|
44
|
+
]);
|
|
45
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
46
|
+
geometry.computeVertexNormals(); // Always compute normals for correct lighting
|
|
47
|
+
|
|
48
|
+
// Validate: ensure bounding sphere exists for frustum culling
|
|
49
|
+
geometry.computeBoundingSphere();
|
|
50
|
+
if (!geometry.boundingSphere) {
|
|
51
|
+
console.warn('Bounding sphere computation failed — check vertex data');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const material = new THREE.MeshStandardMaterial({ color: 0x00ff00 });
|
|
55
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
56
|
+
scene.add(mesh);
|
|
57
|
+
|
|
58
|
+
// Cleanup when done
|
|
59
|
+
// geometry.dispose(); material.dispose();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See [examples/workflow-extrude-shape.md](examples/workflow-extrude-shape.md).
|
|
63
|
+
|
|
64
|
+
## Doc map (official)
|
|
65
|
+
|
|
66
|
+
| Docs section | Representative links |
|
|
67
|
+
|--------------|----------------------|
|
|
68
|
+
| Core | https://threejs.org/docs/BufferGeometry.html |
|
|
69
|
+
| Geometries | https://threejs.org/docs/BoxGeometry.html |
|
|
70
|
+
| Extrude | https://threejs.org/docs/ExtrudeGeometry.html |
|
|
71
|
+
| Shape | https://threejs.org/docs/Shape.html |
|
|
72
|
+
|
|
73
|
+
## Scope
|
|
74
|
+
|
|
75
|
+
- **In scope:** Core geometries, buffer core, curve/shape/extrusion workflows, selected addon geometries.
|
|
76
|
+
- **Out of scope:** Physics collision mesh baking; full CAD import pipelines.
|
|
77
|
+
|
|
78
|
+
## Common pitfalls and best practices
|
|
79
|
+
|
|
80
|
+
- Missing normals break lighting; compute or import consistently.
|
|
81
|
+
- Wrong winding order flips faces—check side/culling.
|
|
82
|
+
- Huge attribute counts need LOD or simplification (modifiers in addons—mention only if user asks).
|
|
83
|
+
|
|
84
|
+
## Documentation and version
|
|
85
|
+
|
|
86
|
+
Primitives and `BufferGeometry` live under [Geometries](https://threejs.org/docs/#Geometries) and [BufferGeometry](https://threejs.org/docs/BufferGeometry.html) in [three.js docs](https://threejs.org/docs/). Curve, `Shape`, and extrusion APIs appear under **Extras** and **Geometries**—Addons **Curves** / **Geometries** document NURBS and text meshes; link those instead of copying long signatures.
|
|
87
|
+
|
|
88
|
+
## Agent response checklist
|
|
89
|
+
|
|
90
|
+
When answering under this skill, prefer responses that:
|
|
91
|
+
|
|
92
|
+
1. Link `BufferGeometry`, a primitive, or `ExtrudeGeometry` / `Shape` as appropriate.
|
|
93
|
+
2. Point **instancing** usage to **threejs-objects** for `InstancedMesh` patterns.
|
|
94
|
+
3. Point morph targets and tracks to **threejs-animation** when deformation is time-driven.
|
|
95
|
+
4. Reference `BufferGeometryUtils` (Addons **Utils**) only by name + docs link when merging/splitting.
|
|
96
|
+
5. Emphasize `dispose()` when replacing large custom buffers.
|
|
97
|
+
|
|
98
|
+
## References
|
|
99
|
+
|
|
100
|
+
- https://threejs.org/docs/#Geometries
|
|
101
|
+
- https://threejs.org/docs/BufferGeometry.html
|
|
102
|
+
- https://threejs.org/docs/ExtrudeGeometry.html
|
|
103
|
+
|
|
104
|
+
## Keywords
|
|
105
|
+
|
|
106
|
+
**English:** buffergeometry, extrude, shape, path, curve, primitives, instancing, three.js
|
|
107
|
+
|
|
108
|
+
**中文:** 几何体、BufferGeometry、挤出、Shape、曲线、实例化、three.js
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Workflow: extrude a 2D shape
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. Create `THREE.Shape()` and draw with `moveTo` / `lineTo` / `quadraticCurveTo` / `bezierCurveTo` or holes via `shape.holes.push(innerShape)`.
|
|
6
|
+
|
|
7
|
+
2. Build `ExtrudeGeometry(shape, { depth, bevelEnabled, ... })` per [ExtrudeGeometry](https://threejs.org/docs/ExtrudeGeometry.html).
|
|
8
|
+
|
|
9
|
+
3. Center/pivot by wrapping in `Object3D` or translating geometry once.
|
|
10
|
+
|
|
11
|
+
4. Assign `MeshStandardMaterial` (**threejs-materials**) and add lights (**threejs-lights**).
|
|
12
|
+
|
|
13
|
+
For path-based tubes use `TubeGeometry` + `Curve` subclasses instead.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: threejs-helpers
|
|
3
|
+
description: "Debug and visualization helpers in three.js Core Helpers (AxesHelper, GridHelper, CameraHelper, light helpers, SkeletonHelper, bounding box helpers, PlaneHelper, PolarGridHelper, ArrowHelper) and Addons Helpers (VertexNormalsHelper, VertexTangentsHelper, RectAreaLightHelper, LightProbeHelper, ViewHelper, OctreeHelper, TextureHelper, PositionalAudioHelper, AnimationPathHelper, RapierHelper). Use only for development and editor overlays—not for shipping art; for gizmo-style manipulation use threejs-controls."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## When to use this skill
|
|
7
|
+
|
|
8
|
+
**ALWAYS use this skill when the user mentions:**
|
|
9
|
+
|
|
10
|
+
- Visualizing axes, grids, camera frusta, shadow cameras, light directions
|
|
11
|
+
- Showing skeleton bones, bounding boxes, normals/tangents for mesh inspection
|
|
12
|
+
- Light probe or rect area visualization via helper classes
|
|
13
|
+
|
|
14
|
+
**IMPORTANT: helpers vs production meshes**
|
|
15
|
+
|
|
16
|
+
- Helpers are **debug** objects; do not use as final scene geometry.
|
|
17
|
+
|
|
18
|
+
**Trigger phrases include:**
|
|
19
|
+
|
|
20
|
+
- "AxesHelper", "GridHelper", "CameraHelper", "SkeletonHelper", "VertexNormalsHelper"
|
|
21
|
+
- "辅助线", "法线显示", "包围盒调试"
|
|
22
|
+
|
|
23
|
+
## How to use this skill
|
|
24
|
+
|
|
25
|
+
1. **Attach** helper to the object it describes (e.g., `CameraHelper(light.shadow.camera)`).
|
|
26
|
+
2. **Update** when targets move — some helpers need per-frame refresh.
|
|
27
|
+
3. **Gate behind debug flags** — remove helpers in production builds to save draw calls.
|
|
28
|
+
4. **Performance** — helpers add draw calls; disable when profiling performance issues.
|
|
29
|
+
5. **Addons** — import from `three/addons/helpers/...` paths per **threejs-dev-setup**.
|
|
30
|
+
|
|
31
|
+
### Example: Debug flag pattern for conditional helpers
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import * as THREE from 'three';
|
|
35
|
+
|
|
36
|
+
const DEBUG = import.meta.env.DEV; // Vite-style; adapt for your bundler
|
|
37
|
+
const debugGroup = new THREE.Group();
|
|
38
|
+
debugGroup.visible = DEBUG;
|
|
39
|
+
scene.add(debugGroup);
|
|
40
|
+
|
|
41
|
+
// Add helpers only in development
|
|
42
|
+
if (DEBUG) {
|
|
43
|
+
debugGroup.add(new THREE.AxesHelper(5));
|
|
44
|
+
debugGroup.add(new THREE.GridHelper(10, 10));
|
|
45
|
+
|
|
46
|
+
// Shadow camera helper for directional light
|
|
47
|
+
const shadowHelper = new THREE.CameraHelper(directionalLight.shadow.camera);
|
|
48
|
+
debugGroup.add(shadowHelper);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Toggle helpers at runtime via console or GUI
|
|
52
|
+
// debugGroup.visible = !debugGroup.visible;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
See [examples/workflow-light-camera-helpers.md](examples/workflow-light-camera-helpers.md).
|
|
56
|
+
|
|
57
|
+
## Doc map (official)
|
|
58
|
+
|
|
59
|
+
| Docs section | Representative links |
|
|
60
|
+
|--------------|----------------------|
|
|
61
|
+
| Helpers | https://threejs.org/docs/AxesHelper.html |
|
|
62
|
+
| Helpers | https://threejs.org/docs/GridHelper.html |
|
|
63
|
+
| Helpers | https://threejs.org/docs/CameraHelper.html |
|
|
64
|
+
| Helpers | https://threejs.org/docs/SkeletonHelper.html |
|
|
65
|
+
|
|
66
|
+
## Scope
|
|
67
|
+
|
|
68
|
+
- **In scope:** Core + Addons helpers for visualization.
|
|
69
|
+
- **Out of scope:** Production meshes or shipping art (**threejs-geometries**, **threejs-lights**); orbit/transform gizmo behavior (**threejs-controls**); editor UX parity with DCC tools; physics debug beyond helper stubs.
|
|
70
|
+
|
|
71
|
+
## Common pitfalls and best practices
|
|
72
|
+
|
|
73
|
+
- Too many helpers obscures view—toggle per subsystem.
|
|
74
|
+
- Wrong attachment parent misaligns helper transforms.
|
|
75
|
+
- Helpers inherit scene graph transforms—parent under a debug group to batch hide/show.
|
|
76
|
+
- Some helpers duplicate geometry cost; strip in production or use `#ifdef DEBUG` style flags.
|
|
77
|
+
- `CameraHelper` for shadow cameras must reference `light.shadow.camera`, not the main view camera.
|
|
78
|
+
|
|
79
|
+
## Documentation and version
|
|
80
|
+
|
|
81
|
+
Helpers are listed under [Helpers](https://threejs.org/docs/#Helpers) (core) and **Addons → Helpers** in [three.js docs](https://threejs.org/docs/). They are for **debug** only; production meshes and lighting should use real geometry/lights (**threejs-geometries**, **threejs-lights**).
|
|
82
|
+
|
|
83
|
+
## Agent response checklist
|
|
84
|
+
|
|
85
|
+
When answering under this skill, prefer responses that:
|
|
86
|
+
|
|
87
|
+
1. Link the helper class (`AxesHelper`, `CameraHelper`, …) being used.
|
|
88
|
+
2. State that helpers are not shipping art—strip or gate behind debug flags.
|
|
89
|
+
3. Pair shadow/light helpers with **threejs-lights** tuning workflows.
|
|
90
|
+
4. Mention performance cost when many helpers are enabled.
|
|
91
|
+
5. Import paths follow **threejs-dev-setup** addon conventions.
|
|
92
|
+
|
|
93
|
+
## References
|
|
94
|
+
|
|
95
|
+
- Manual (debug workflow context): https://threejs.org/manual/
|
|
96
|
+
- Docs index (Helpers group): https://threejs.org/docs/#Helpers
|
|
97
|
+
- Examples: https://threejs.org/docs/DirectionalLightHelper.html
|
|
98
|
+
|
|
99
|
+
## Keywords
|
|
100
|
+
|
|
101
|
+
**English:** helper, debug, axes, grid, skeleton, normals, light helper, three.js
|
|
102
|
+
|
|
103
|
+
**中文:** 辅助、调试、坐标轴、网格、骨架、法线、Helper、three.js
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Workflow: shadow + camera debug
|
|
2
|
+
|
|
3
|
+
## Steps
|
|
4
|
+
|
|
5
|
+
1. `const ch = new THREE.CameraHelper(light.shadow.camera); scene.add(ch);`
|
|
6
|
+
|
|
7
|
+
2. `const lh = new THREE.DirectionalLightHelper(light, size); scene.add(lh);`
|
|
8
|
+
|
|
9
|
+
3. Remove helpers once shadow frustum is tuned (**threejs-lights**).
|
|
10
|
+
|
|
11
|
+
4. Use `SkeletonHelper(boneRoot)` for skinning issues (**threejs-animation** / **threejs-objects**).
|
|
12
|
+
|
|
13
|
+
Official pages: CameraHelper, DirectionalLightHelper.
|