导入3D场景到babylonJS场景、babylonJS

2023-09-08 10:36:59 作者:╰素顔乜傾城°

所以,我今天读到 babylonJS ,然后我被它吹走。我试图找出如何加载整个3D场景到巴比伦。我已经成功地出口蜘蛛侠的3D模型,并有.babylon文件,但然后呢?在该文件中,只规定从三维资产导入场景 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 文件,你可以调用这个函数:

Once you have a .babylon file, you can call this function:

BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) {
};

加载函数采用下列参数:

the Load function takes the following parameters:

在场景文件夹(可以为空,使用相同的文件夹作为页) 在场景文件名 引用发动机 的回调给你加载的场景(在我的情况,我用这个回调附加 相机到画布上,并推出我的渲染循环) 在回调的进度报告 scene folder (can be empty to use the same folder as your page) scene file name a reference to the engine a callback to give you the loaded scene (in my case, I use this callback to attach the camera to the canvas and to launch my render loop) a callback for progress report

更多细节在这里: http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx