FBX / GLTF模型加载三,js

时间:2019-09-20 06:41:12

标签: three.js

无法加载任何类型的模型,例如(gltf,fbx)也使用https://threejs.org/docs/index.html#manual/en/introduction/Loading-3D-models文档,但无法加载模型,但是几何加载没有问题

<!DOCTYPE html>
<html>
  <head>
    <meta charset=UTF-8 />
  </head>
  <body>
   
     <script src="three.js"></script>
    <script src="OrbitControls.js"></script>
    
    <script src="js/GLTFLoader.js"></script>
    <script src="js/FBXLoader.js"></script>
   
    <script>
      let scene, camera, renderer;
      function init() {
        scene = new THREE.Scene();
        scene.background = new THREE.Color(0xdddddd);
        camera = new THREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1,5000);
        hlight = new THREE.AmbientLight (0x404040,100);
        scene.add(hlight);

        renderer = new THREE.WebGLRenderer({antialias:true});
        renderer.setSize(window.innerWidth,window.innerHeight);
        document.body.appendChild(renderer.domElement);

        var loader = new THREE.GLTFLoader();

		loader.load( 'SimpleSkinning.gltf', function ( gltf ) {

			scene.add( gltf.scene );

		}, undefined, function ( error ) {

			console.error( error );

		} );
      }
      function animate() {
        renderer.render(scene,camera);
        requestAnimationFrame(animate);
      }
      init();
    </script>
  </body>
</html>

0 个答案:

没有答案