threejs-loaders

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

When to use this skill

何时使用此技能

ALWAYS use this skill when the user mentions:
  • GLTFLoader
    ,
    DRACOLoader
    ,
    KTX2Loader
    ,
    FBXLoader
    ,
    OBJLoader
    , progress and error handling
  • LoadingManager
    for global progress,
    Cache
    for HTTP caching control
  • Export:
    GLTFExporter
    ,
    OBJExporter
    , HDR/KTX2 export pipelines
  • 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 =
    Texture
    /
    DataTexture
    parameters, sampling, PMREM after you already have image buffers.
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
    、进度与错误处理
  • 用于全局进度管理的
    LoadingManager
    、用于HTTP缓存控制的
    Cache
  • 导出相关:
    GLTFExporter
    、
    OBJExporter
    、HDR/KTX2导出流水线
  • IES、UltraHDR或文档中Addons Loaders分类下的领域特定加载器
重要提示:加载器与纹理的区别
  • threejs-loaders = 负责获取/解码/解析文件并转换为three对象。
  • threejs-textures = 当你已有图像缓冲区后,处理
    Texture
    /
    DataTexture
    参数、采样、PMREM相关内容。
重要提示:加载器与开发配置的区别
  • 导入路径问题属于threejs-dev-setup技能范畴;此技能默认导入路径可正常解析。
触发短语包括:
  • "GLTFLoader"、"DRACO"、"KTX2"、"LoadingManager"、"export gltf"
  • "加载模型"、"导出"、"进度条"

How to use this skill

如何使用此技能

  1. Pick loader by format; prefer glTF for PBR interchange when possible.
  2. Wire LoadingManager for multi-asset batches; surface
    onStart
    /
    onLoad
    /
    onProgress
    /
    onError
    .
  3. glTF + Draco: instantiate
    DRACOLoader
    , set decoder path, attach to
    GLTFLoader.setDRACOLoader
    per current docs.
  4. glTF + KTX2: configure
    KTX2Loader
    with transcoder path and connect to
    GLTFLoader
    when using Basis textures.
  5. Export: use
    GLTFExporter
    with options matching round-trip needs; note large scenes and binary vs JSON.
  6. Security: only load user URLs with validation; mention CORS for cross-origin assets.
  7. After load: traverse scene for materials/meshes—hand off material tuning to threejs-materials.
See examples/workflow-gltf-draco.md.
  1. 根据格式选择加载器;尽可能优先使用glTF作为PBR交换格式。
  2. 接入LoadingManager处理多资源批量加载;暴露
    onStart
    /
    onLoad
    /
    onProgress
    /
    onError
    回调。
  3. glTF + Draco:实例化
    DRACOLoader
    ,设置解码器路径,按照当前文档将其挂载到
    GLTFLoader.setDRACOLoader
    。
  4. glTF + KTX2:配置
    KTX2Loader
    的转码器路径,在使用Basis纹理时将其连接到
    GLTFLoader
    。
  5. 导出:使用
    GLTFExporter
    并根据往返需求配置选项;注意大场景以及二进制与JSON格式的差异。
  6. 安全:仅加载经过验证的用户URL;跨域资源需提及CORS问题。
  7. 加载后:遍历场景获取材质/网格——材质调优工作请移交至threejs-materials技能。
参见examples/workflow-gltf-draco.md。

Doc map (official)

文档导航(官方)

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
    renderer.initTexture
    implications when cloning materials.
  • 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
GLTFLoader
+
DRACOLoader
/
KTX2Loader
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.
加载器与导出器的API(尤其是
GLTFLoader
与
DRACOLoader
/
KTX2Loader
的接入方式)在不同three.js版本间会有变化。请参考three.js文档中的Loaders章节以及Addons → Loaders / Exporters部分;解码器WASM路径与部署环境相关,并非仅由库版本决定。

Agent response checklist

Agent回复检查清单

When answering under this skill, prefer responses that:
  1. Link
    LoadingManager
    ,
    GLTFLoader
    , or the relevant format page on https://threejs.org/docs/.
  2. Separate loading (this skill) from texture/material tuning after decode (threejs-textures, threejs-materials).
  3. Document Draco/KTX2 decoder path and CORS when assets fail silently.
  4. Mention exporter limitations (custom shaders, extensions) honestly.
  5. Encourage
    dispose()
    when replacing entire loaded scenes.
在此技能下回答问题时,回复应优先满足以下要求:
  1. 提供
    LoadingManager
    、
    GLTFLoader
    或https://threejs.org/docs/上对应格式页面的链接。
  2. 区分加载(此技能范畴)与解码后的纹理/材质调优(对应threejs-textures、threejs-materials技能)。
  3. 当资源静默加载失败时,说明Draco/KTX2的解码器路径问题以及CORS相关事项。
  4. 如实提及导出器的限制(自定义着色器、扩展支持等)。
  5. 替换整个已加载场景时,建议使用
    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