diff --git a/docs/examples/en/loaders/GLTFLoader.html b/docs/examples/en/loaders/GLTFLoader.html index f2761b13ea246299a4a7977c1c4ed6b731e0307d..7a859a804a54c428403ff3a6d21ace0f2d750e80 100644 --- a/docs/examples/en/loaders/GLTFLoader.html +++ b/docs/examples/en/loaders/GLTFLoader.html @@ -72,8 +72,8 @@ scene.add( gltf.scene ); gltf.animations; // Array<THREE.AnimationClip> - gltf.scene; // THREE.Scene - gltf.scenes; // Array<THREE.Scene> + gltf.scene; // THREE.Group + gltf.scenes; // Array<THREE.Group> gltf.cameras; // Array<THREE.Camera> gltf.asset; // Object @@ -199,7 +199,7 @@ [page:Function onError] — (optional) A function to be called if an error occurs during parsing. The function receives error as an argument.

- Parse a glTF-based ArrayBuffer or JSON String and fire [page:Function onLoad] callback when complete. The argument to [page:Function onLoad] will be an [page:object] that contains loaded parts: .[page:Scene scene], .[page:Array scenes], .[page:Array cameras], .[page:Array animations], and .[page:Object asset]. + Parse a glTF-based ArrayBuffer or JSON String and fire [page:Function onLoad] callback when complete. The argument to [page:Function onLoad] will be an [page:object] that contains loaded parts: .[page:Group scene], .[page:Array scenes], .[page:Array cameras], .[page:Array animations], and .[page:Object asset].

Source

diff --git a/docs/examples/zh/loaders/GLTFLoader.html b/docs/examples/zh/loaders/GLTFLoader.html index 0288aa6b17efc1e64d7de12156d9f6e72ba82b03..cc1920d577ac660f280b6bd8e3c2156fd3c0bb2a 100644 --- a/docs/examples/zh/loaders/GLTFLoader.html +++ b/docs/examples/zh/loaders/GLTFLoader.html @@ -71,8 +71,8 @@ scene.add( gltf.scene ); gltf.animations; // Array<THREE.AnimationClip> - gltf.scene; // THREE.Scene - gltf.scenes; // Array<THREE.Scene> + gltf.scene; // THREE.Group + gltf.scenes; // Array<THREE.Group> gltf.cameras; // Array<THREE.Camera> gltf.asset; // Object @@ -124,7 +124,7 @@

自定义扩展

- 来自未知扩展的元数据会被保存到Object3D、Scene和Material实例中上的“.userData.gltfExtensions”, + 来自未知扩展的元数据会被保存到Object3D、Group和Material实例中上的“.userData.gltfExtensions”, 或被附加到 response “gltf”对象。示例:

@@ -194,7 +194,7 @@ [page:Function onError] — (可选)若在解析过程发生错误,将被调用的函数。该函数接收error来作为参数。

- 解析基于glTF的ArrayBuffer或JSON字符串,并在完成后触发[page:Function onLoad]回调。[page:Function onLoad]的参数将是一个包含有已加载部分的[page:object]:.[page:Scene scene]、 .[page:Array scenes]、 .[page:Array cameras]、 .[page:Array animations] 和 .[page:Object asset]。 + 解析基于glTF的ArrayBuffer或JSON字符串,并在完成后触发[page:Function onLoad]回调。[page:Function onLoad]的参数将是一个包含有已加载部分的[page:object]:.[page:Group scene]、 .[page:Array scenes]、 .[page:Array cameras]、 .[page:Array animations] 和 .[page:Object asset]。

源代码

diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index 48d976bcef1d2198fefa68e392ddc92dc3dc8b96..648592deef5add89d85b1cf01d97995e49443898 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -3042,7 +3042,7 @@ THREE.GLTFLoader = ( function () { /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes * @param {number} sceneIndex - * @return {Promise} + * @return {Promise} */ GLTFParser.prototype.loadScene = function () { @@ -3151,7 +3151,9 @@ THREE.GLTFLoader = ( function () { var sceneDef = this.json.scenes[ sceneIndex ]; var parser = this; - var scene = new THREE.Scene(); + // Loader returns Group, not Scene. + // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172 + var scene = new THREE.Group(); if ( sceneDef.name ) scene.name = sceneDef.name; assignExtrasToUserData( scene, sceneDef ); diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index fd6a052ad6060ba1f22e64b89a0cb66e22501204..a02fb6b9774ffec0a591a63719497a9942b5c95b 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -55,7 +55,6 @@ import { RGBAFormat, RGBFormat, RepeatWrapping, - Scene, Skeleton, SkinnedMesh, Sphere, @@ -3106,7 +3105,7 @@ var GLTFLoader = ( function () { /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes * @param {number} sceneIndex - * @return {Promise} + * @return {Promise} */ GLTFParser.prototype.loadScene = function () { @@ -3215,7 +3214,9 @@ var GLTFLoader = ( function () { var sceneDef = this.json.scenes[ sceneIndex ]; var parser = this; - var scene = new Scene(); + // Loader returns Group, not Scene. + // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172 + var scene = new Group(); if ( sceneDef.name ) scene.name = sceneDef.name; assignExtrasToUserData( scene, sceneDef );