lemon_babylon_3dmax

功能描述

Babylonjs模型3D设计,让HTML5可以开发3D效果,并支持 3DMax 大型3D渲染

依赖的模块

  1. Babylonjs

快速使用

  1. <script src="./script/babylon.custom.js"></script>
  2. <canvas id="renderCanvas" touch-action="none"></canvas>
  3. <script type="text/javascript">
  4. var createScene = function () {
  5. var scene = new BABYLON.Scene(engine);
  6. var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 3, BABYLON.Vector3.Zero(), scene);
  7. camera.attachControl(canvas, true);
  8. camera.useAutoRotationBehavior = true;
  9. camera.autoRotationBehavior.idleRotationSpeed = 1; //自动旋转速度
  10. camera.autoRotationBehavior.idleRotationWaitTime = 1000; //用户交互后多少时间开启自动旋转(毫秒)
  11. camera.autoRotationBehavior.idleRotationSpinupTime = 1000; //从开始自动旋转到设置的旋转速度所需要的时间(毫秒)
  12. camera.autoRotationBehavior.zoomStopsAnimation = true; //设置缩放是否会停止自动旋转
  13. var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
  14. var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), scene);
  15. var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {}, scene);
  16. return scene;
  17. };
  18. var demo = {
  19. constructor: createScene,
  20. onload: function () {
  21. }
  22. };
  23. </script>

特别说明

  1. 使用本模块注意会与同Babylonjs模块冲突,请开发者谨慎选择,本模块为1.0版本,后续会陆续更新。