Files
Game-studio/references/gltf-loading-starter.md
Rocky aaf6656b49 Initial release: game-studio plugin for Claude Code
Repackaged from OpenAI's game-studio Codex plugin (MIT) for Claude Code.

Changes from upstream:
- Added .claude-plugin/plugin.json (Claude Code plugin manifest)
- Removed .codex-plugin/plugin.json (Codex CLI specific)
- Removed skills/*/agents/openai.yaml (Codex CLI specific)
- Added scripts/requirements.txt (Pillow dependency for sprite-pipeline)
- Added Chinese README with installation guide
2026-04-30 13:41:36 +02:00

44 lines
1023 B
Markdown

# GLB Loading Starter
Use this as the canonical minimal pattern for loading shipped 3D content.
## Vanilla Three.js
```ts
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
const draco = new DRACOLoader();
draco.setDecoderPath("/draco/");
const gltfLoader = new GLTFLoader();
gltfLoader.setDRACOLoader(draco);
gltfLoader.load("/assets/hero.glb", (gltf) => {
const root = gltf.scene;
root.traverse((node) => {
if ("castShadow" in node) {
node.castShadow = true;
node.receiveShadow = true;
}
});
scene.add(root);
});
```
## React Three Fiber
```tsx
import { useGLTF } from "@react-three/drei";
function HeroModel() {
const gltf = useGLTF("/assets/hero.glb");
return <primitive object={gltf.scene} />;
}
```
## Notes
- Default shipping format is GLB or glTF 2.0.
- Keep optimization upstream in the asset pipeline; loader code should stay boring.