将 3d 场景导入 babylonJS [英] Import a 3d scene into babylonJS
问题描述
所以我今天阅读了关于 babylonJS 我被它震撼了.我想弄清楚如何将整个 3d 场景加载到巴比伦.我已经成功导出了蜘蛛侠的 3d 模型并拥有 .babylon 文件,但接下来呢?在文档中它只声明
从 3D 资产导入场景
Babylon.js 可以从名为 .babylon 的文件格式加载场景.此文件格式基于 JSON,包含创建完整场景所需的所有数据."
So I read today about babylonJS and I was blown away by it. I'm trying to figure out how to load an entire 3d scene into babylon. I've managed to export a 3d model of spider man and have the .babylon file but then what? In the document it only states
"Importing scene from 3D assets
Babylon.js can load scenes from a file format called .babylon. This file format is based on JSON and contains all required data to create a complete scene."
关于如何实现这一目标的任何想法?谢谢
Any ideas on how to achieve this? Thanks
推荐答案
一旦你有了 .babylon
文件,你就可以调用 SceneLoader.Load功能:
Once you have a .babylon
file, you can call the SceneLoader.Load function:
BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) {
});
Load
函数采用以下参数:
- 场景文件夹(可以为空以使用与您的页面相同的文件夹)
- 场景文件名
- 对引擎的引用
- 一个回调来给你加载的场景(在我的例子中,我使用这个回调来附加相机到画布并启动我的渲染循环)
- 进度报告回调
更多细节在这里:https://www.eternalcoding.com/?p=313
这篇关于将 3d 场景导入 babylonJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!