Как загрузить файлы gltf, используя три js - PullRequest
1 голос
/ 21 июня 2020
  var manager = new THREE.LoadingManager();
  const loader = new THREE.GLTFLoader(manager);

  // A reusable function to set up the models. We're passing in a position parameter
  // Load a glTF resource
**line90**      loader.load(
    // resource URL
    'static/ElmTree.gltf',
    // called when the resource is loaded
    function ( gltf ) {

    enter code here

        scene.add( gltf.scene );

    });

Привет, я изучаю три. js и получаю сообщения об ошибках при загрузке файлов внешних файлов gltf при помощи файла discoverthree. js. Я скачал файл из Google Poly, но не уверен, что делаю не так. Я получаю сообщение об ошибке ниже и также попробовал loadmanager, как указано в документации.

Я использую flask для запуска приложения, сообщите мне, если мне нужно добавить дополнительную информацию, чтобы понять проблему . заранее спасибо :)

three.js:49037 THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.
get @ three.js:49037
(anonymous) @ GLTFLoader.js:2161
Promise.then (async)
THREE.GLTFLoader.GLTFParser.loadTexture @ GLTFLoader.js:2157
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1829
THREE.GLTFLoader.GLTFParser.assignTexture @ GLTFLoader.js:2223
THREE.GLTFLoader.GLTFParser.loadMaterial @ GLTFLoader.js:2308
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1825
THREE.GLTFLoader.GLTFParser.loadMesh @ GLTFLoader.js:2675
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1809
(anonymous) @ GLTFLoader.js:3146
THREE.GLTFLoader.GLTFParser.loadNode @ GLTFLoader.js:3210
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1805
buildNodeHierachy @ GLTFLoader.js:3269
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
(anonymous) @ GLTFLoader.js:3351
Promise.then (async)
buildNodeHierachy @ GLTFLoader.js:3336
loadScene @ GLTFLoader.js:3383
THREE.GLTFLoader.GLTFParser.getDependency @ GLTFLoader.js:1801
(anonymous) @ GLTFLoader.js:1877
THREE.GLTFLoader.GLTFParser.getDependencies @ GLTFLoader.js:1875
THREE.GLTFLoader.GLTFParser.getMultiDependencies @ GLTFLoader.js:1902
THREE.GLTFLoader.GLTFParser.parse @ GLTFLoader.js:1703
parse @ GLTFLoader.js:221
(anonymous) @ GLTFLoader.js:75
(anonymous) @ three.js:36378
load (async)
load @ three.js:36356
load @ GLTFLoader.js:71
loadModels @ index.js:90
init @ index.js:21
(anonymous) @ index.js:142

1 Ответ

1 голос
/ 21 июня 2020

Кажется, что GLTFLoader и three.js в вашем коде из разных выпусков. Вы всегда должны убедиться, что версия ядра библиотеки и файлов примеров (например, GLTFLoader или OrbitControls) совпадают.

...