GitHub – takahirox/three-gltf-extensions:非官方Three.js glTF 加载器/导出器插件
| Name | ||
|---|---|---|
|
|
3 years ago
|
|
|
|
3 years ago
|
|
|
|
3 years ago
|
|
|
|
3 years ago
|
|
|
|
4 years ago
|
|
|
|
4 years ago
|
|
|
|
3 years ago
|
|
|
|
3 years ago
|
|
|
|
3 years ago
|
|
存储库文件导航
glTF 加载器和导出器Three.js插件系统,为用户提供扩展机制。glTF 扩展可以通过插件系统进行处理。
一些用于主要和稳定扩展的插件内置在加载器和导出器中。但是其他扩展(还)不支持它们作为内置扩展,例如,该规范不太适合Three.js API 或结构,或者规范尚未最终确定。
如果你想使用这样的扩展,你需要自己编写插件,但需要了解 glTF 规范、扩展规范、Three.js核心 API 或 glTF 加载器/导出器 API Three.js知识。对于某些用户来说,这可能很困难。
该项目为您提供Three.js glTF 加载器/扩展插件,即使是此类扩展。您不再需要自己编写插件。
- 提供可重用性和易用性,即使对于规范不太适合 API 或结构的扩展Three.js也是如此
- 允许早期试用规范尚未最终确定的 glTF 扩展
- 向 Three.js glTF 加载器/导出器插件系统 API 发送反馈
在线演示
- KHR_materials_variants
- EXT_mesh_gpu_instancing
- EXT_text(仅限装载机)
- EXT_texture_video(仅限加载器)
- MSFT_lod(仅限加载程序,正在进行中)
- MSFT_texture_dds(仅限加载器)
取决于普尔金。请参阅每个插件的自述文件。
GLTFLoader 插件
// Import Three.js
<script type="importmap">
{
"imports": {
"three": "path_to_three.module.js"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import {GLTFLoader} from 'path_to_GLTFLoader.js';
// Import three-gltf-extensions loader plugins
import GLTFFooExtension from 'path_to_three-gltf-extensions/loaders/Foo_extension/Foo_extension.js';
// Register the plugin to the loader and then load glTF
const loader = new GLTFLoader();
loader.register(parser => new GLTFFooExtension(parser));
loader.load(path_to_gltf_asset, gltf => {
...
});
</script>
GLTFExporter 插件
// Import Three.js
<script type="importmap">
{
"imports": {
"three": "path_to_three.module.js"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import {GLTFExporter} from 'path_to_GLTFExporter.js';
// Import three-gltf-extensions exporter plugins
import GLTFExporterFooExtension from 'path_to_three-gltf-extensions/exporters/Foo_extension/Foo_extension_exporter.js';
// Register the plugin to the exporter and then export Three.js objects
const exporter = new GLTFExporter();
exporter.register(writer => new GLTFExporterFooExtension(writer));
exporter.parse(scene, result => {
...
});
</script>
有关更多详细信息,请参阅每个插件的自述文件。
$ npm install
$ npm start
# Access http://localhost:8080/examples/index.html
单元测试
$ npm install
$ npm run test-install
$ npm run test-build
$ npm start
# Access http://localhost:8080/test/index.html
$ npm run test-install
$ npm run test
请注意,依赖于 Web 的单元测试不会运行。我建议在 Web 浏览器上运行单元测试。
如上所述,某些扩展不太适合Three.js API 或结构。因此,它们的插件可能有一些限制。如果它们不涵盖您的用例,请分叉存储库并自行自定义。
2. 分享目的仅供大家学习和交流,请不要用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员!
8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载
声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性
GLB下载网 - GLB/GLTF模型与格式资源免费下载,支持在线浏览与转换 » 非官方Three.js glTF 加载器/导出器插件
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载要提取码
- 分享过期和重复下载怎么办
- 模型和平台不兼容怎么办