threejs-loaders
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to use this skill
何时使用此技能
ALWAYS use this skill when the user mentions:
- ,
GLTFLoader,DRACOLoader,KTX2Loader,FBXLoader, progress and error handlingOBJLoader - for global progress,
LoadingManagerfor HTTP caching controlCache - Export: ,
GLTFExporter, HDR/KTX2 export pipelinesOBJExporter - IES, UltraHDR, or domain-specific loaders listed under Addons Loaders in docs
IMPORTANT: loaders vs textures
- threejs-loaders = fetch/decode/parse files into three objects.
- threejs-textures = /
Textureparameters, sampling, PMREM after you already have image buffers.DataTexture
IMPORTANT: loaders vs dev-setup
- Import path issues belong to threejs-dev-setup; this skill assumes imports resolve.
Trigger phrases include:
- "GLTFLoader", "DRACO", "KTX2", "LoadingManager", "export gltf"
- "加载模型", "导出", "进度条"
当用户提及以下内容时,务必使用此技能:
- 、
GLTFLoader、DRACOLoader、KTX2Loader、FBXLoader、进度与错误处理OBJLoader - 用于全局进度管理的、用于HTTP缓存控制的
LoadingManagerCache - 导出相关:、
GLTFExporter、HDR/KTX2导出流水线OBJExporter - IES、UltraHDR或文档中Addons Loaders分类下的领域特定加载器
重要提示:加载器与纹理的区别
- threejs-loaders = 负责获取/解码/解析文件并转换为three对象。
- threejs-textures = 当你已有图像缓冲区后,处理/
Texture参数、采样、PMREM相关内容。DataTexture
重要提示:加载器与开发配置的区别
- 导入路径问题属于threejs-dev-setup技能范畴;此技能默认导入路径可正常解析。
触发短语包括:
- "GLTFLoader"、"DRACO"、"KTX2"、"LoadingManager"、"export gltf"
- "加载模型"、"导出"、"进度条"
How to use this skill
如何使用此技能
- Pick loader by format; prefer glTF for PBR interchange when possible.
- Wire LoadingManager for multi-asset batches; surface /
onStart/onLoad/onProgress.onError - glTF + Draco: instantiate , set decoder path, attach to
DRACOLoaderper current docs.GLTFLoader.setDRACOLoader - glTF + KTX2: configure with transcoder path and connect to
KTX2Loaderwhen using Basis textures.GLTFLoader - Export: use with options matching round-trip needs; note large scenes and binary vs JSON.
GLTFExporter - Security: only load user URLs with validation; mention CORS for cross-origin assets.
- After load: traverse scene for materials/meshes—hand off material tuning to threejs-materials.
See examples/workflow-gltf-draco.md.
- 根据格式选择加载器;尽可能优先使用glTF作为PBR交换格式。
- 接入LoadingManager处理多资源批量加载;暴露/
onStart/onLoad/onProgress回调。onError - glTF + Draco:实例化,设置解码器路径,按照当前文档将其挂载到
DRACOLoader。GLTFLoader.setDRACOLoader - glTF + KTX2:配置的转码器路径,在使用Basis纹理时将其连接到
KTX2Loader。GLTFLoader - 导出:使用并根据往返需求配置选项;注意大场景以及二进制与JSON格式的差异。
GLTFExporter - 安全:仅加载经过验证的用户URL;跨域资源需提及CORS问题。
- 加载后:遍历场景获取材质/网格——材质调优工作请移交至threejs-materials技能。
参见examples/workflow-gltf-draco.md。
Doc map (official)
文档导航(官方)
| Docs section | Representative links |
|---|---|
| Core Loaders | https://threejs.org/docs/LoadingManager.html |
| Core Loaders | https://threejs.org/docs/GLTFLoader.html |
| Addons Exporters | https://threejs.org/docs/GLTFExporter.html |
| Addons Loaders | https://threejs.org/docs/DRACOLoader.html |
Extended list: references/official-sections.md.
扩展列表:references/official-sections.md。
Scope
适用范围
- In scope: Loader and exporter classes, manager/cache, format choice, plugin wiring for Draco/KTX2, export basics.
- Out of scope: Server-side transcoding pipelines; physics or game engine asset tooling outside three docs.
- 适用范围: 加载器与导出器类、管理器/缓存、格式选择、Draco/KTX2的插件接入、基础导出操作。
- 不适用范围: 服务端转码流水线;three文档之外的物理引擎或游戏引擎资源工具。
Common pitfalls and best practices
常见陷阱与最佳实践
- Draco/KTX2 decoder paths must match deployed files; broken paths fail silently until onError surfaces.
- Duplicate texture instances after merge—consider implications when cloning materials.
renderer.initTexture - Exporters may not round-trip custom shaders; document limitations.
- Always dispose geometries/materials when replacing loaded scenes to avoid GPU leaks.
- Draco/KTX2的解码器路径必须与部署文件匹配;路径错误会静默失败,直到触发onError才会显现。
- 合并后出现重复纹理实例——克隆材质时需考虑的影响。
renderer.initTexture - 导出器可能无法实现自定义着色器的往返兼容;需说明相关限制。
- 替换已加载的场景时,务必释放几何体/材质,避免GPU内存泄漏。
Documentation and version
文档与版本
Loader and exporter APIs (especially + / wiring) change between three.js versions. Follow Loaders and Addons → Loaders / Exporters in three.js docs; decoder WASM paths are deployment-specific, not library-version alone.
GLTFLoaderDRACOLoaderKTX2Loader加载器与导出器的API(尤其是与/的接入方式)在不同three.js版本间会有变化。请参考three.js文档中的Loaders章节以及Addons → Loaders / Exporters部分;解码器WASM路径与部署环境相关,并非仅由库版本决定。
GLTFLoaderDRACOLoaderKTX2LoaderAgent response checklist
Agent回复检查清单
When answering under this skill, prefer responses that:
- Link ,
LoadingManager, or the relevant format page on https://threejs.org/docs/.GLTFLoader - Separate loading (this skill) from texture/material tuning after decode (threejs-textures, threejs-materials).
- Document Draco/KTX2 decoder path and CORS when assets fail silently.
- Mention exporter limitations (custom shaders, extensions) honestly.
- Encourage when replacing entire loaded scenes.
dispose()
在此技能下回答问题时,回复应优先满足以下要求:
- 提供、
LoadingManager或https://threejs.org/docs/上对应格式页面的链接。GLTFLoader - 区分加载(此技能范畴)与解码后的纹理/材质调优(对应threejs-textures、threejs-materials技能)。
- 当资源静默加载失败时,说明Draco/KTX2的解码器路径问题以及CORS相关事项。
- 如实提及导出器的限制(自定义着色器、扩展支持等)。
- 替换整个已加载场景时,建议使用释放资源。
dispose()
References
参考资料
Keywords
关键词
English: gltf, gltfloader, dracoloader, ktx2, loadingmanager, cache, exporter, asset pipeline, three.js
中文: GLTFLoader、加载器、Draco、KTX2、导出、资源、进度、three.js
英文: gltf, gltfloader, dracoloader, ktx2, loadingmanager, cache, exporter, asset pipeline, three.js
中文: GLTFLoader、加载器、Draco、KTX2、导出、资源、进度、three.js