导入3D场景到babylonJS

导入3D场景到babylonJS

本文介绍了导入3D场景到babylonJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我今天读到<一href="http://blogs.msdn.com/b/eternalcoding/archive/2013/06/27/babylon-js-a-complete-javascript-framework-for-building-3d-games-with-html-5-and-webgl.aspx?CommentPosted=true#commentmessage"相对=nofollow> 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 thecamera 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

这篇关于导入3D场景到babylonJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 23:12