@babylonjs/loaders 5.0.0-alpha.8 → 5.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/OBJ/index.d.ts +2 -0
- package/OBJ/index.js +4 -2
- package/OBJ/index.js.map +1 -1
- package/OBJ/mtlFileLoader.d.ts +4 -2
- package/OBJ/mtlFileLoader.js +7 -6
- package/OBJ/mtlFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.d.ts +12 -84
- package/OBJ/objFileLoader.js +50 -667
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objLoadingOptions.d.ts +43 -0
- package/OBJ/objLoadingOptions.js +2 -0
- package/OBJ/objLoadingOptions.js.map +1 -0
- package/OBJ/solidParser.d.ts +153 -0
- package/OBJ/solidParser.js +700 -0
- package/OBJ/solidParser.js.map +1 -0
- package/STL/index.js +1 -1
- package/STL/stlFileLoader.d.ts +6 -0
- package/STL/stlFileLoader.js +38 -11
- package/STL/stlFileLoader.js.map +1 -1
- package/glTF/1.0/glTFBinaryExtension.js +4 -4
- package/glTF/1.0/glTFLoader.d.ts +4 -4
- package/glTF/1.0/glTFLoader.js +60 -55
- package/glTF/1.0/glTFLoader.js.map +1 -1
- package/glTF/1.0/glTFLoaderInterfaces.d.ts +3 -1
- package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/1.0/glTFLoaderUtils.js +6 -6
- package/glTF/1.0/glTFMaterialsCommonExtension.js +12 -12
- package/glTF/1.0/index.js +5 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +8 -5
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +3 -3
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +1 -5
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +5 -21
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.js +2 -2
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +8 -4
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +9 -8
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +2 -2
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +46 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_materials_ior.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +0 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +3 -4
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_materials_specular.js +12 -6
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_translucency.js +6 -6
- package/glTF/2.0/Extensions/KHR_materials_translucency.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +93 -84
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +3 -3
- package/glTF/2.0/Extensions/KHR_materials_variants.js +70 -5
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +31 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js +79 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +1 -2
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +3 -4
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.js +2 -2
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +2 -2
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +6 -3
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +6 -7
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +2 -1
- package/glTF/2.0/Extensions/MSFT_lod.js +48 -8
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +2 -2
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +2 -2
- package/glTF/2.0/Extensions/index.d.ts +2 -0
- package/glTF/2.0/Extensions/index.js +26 -24
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/glTFLoader.d.ts +6 -11
- package/glTF/2.0/glTFLoader.js +129 -95
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +4 -2
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/glTF/2.0/index.d.ts +1 -1
- package/glTF/2.0/index.js +4 -4
- package/glTF/2.0/index.js.map +1 -1
- package/glTF/glTFFileLoader.d.ts +15 -9
- package/glTF/glTFFileLoader.js +62 -76
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFValidation.js +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/index.d.ts +2 -2
- package/glTF/index.js +4 -4
- package/glTF/index.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/legacy/legacy-glTF.js +4 -4
- package/legacy/legacy-glTF1.d.ts +1 -1
- package/legacy/legacy-glTF1.js +1 -1
- package/legacy/legacy-glTF1.js.map +1 -1
- package/legacy/legacy-glTF1FileLoader.js +2 -2
- package/legacy/legacy-glTF2.d.ts +1 -1
- package/legacy/legacy-glTF2.js +3 -3
- package/legacy/legacy-glTF2.js.map +1 -1
- package/legacy/legacy-glTF2FileLoader.js +2 -2
- package/legacy/legacy-glTFFileLoader.js +3 -3
- package/legacy/legacy-objFileLoader.d.ts +1 -1
- package/legacy/legacy-objFileLoader.js +2 -2
- package/legacy/legacy-objFileLoader.js.map +1 -1
- package/legacy/legacy-stlFileLoader.d.ts +1 -1
- package/legacy/legacy-stlFileLoader.js +2 -2
- package/legacy/legacy-stlFileLoader.js.map +1 -1
- package/legacy/legacy.js +6 -6
- package/package.json +16 -4
package/glTF/1.0/glTFLoader.js
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
import { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from "./glTFLoaderInterfaces";
|
2
|
-
import { Quaternion, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector";
|
3
|
-
import { Color3 } from '@babylonjs/core/Maths/math.color';
|
4
|
-
import { Tools } from "@babylonjs/core/Misc/tools";
|
5
|
-
import { Camera } from "@babylonjs/core/Cameras/camera";
|
6
|
-
import { FreeCamera } from "@babylonjs/core/Cameras/freeCamera";
|
7
|
-
import { Animation } from "@babylonjs/core/Animations/animation";
|
8
|
-
import { Bone } from "@babylonjs/core/Bones/bone";
|
9
|
-
import { Skeleton } from "@babylonjs/core/Bones/skeleton";
|
10
|
-
import { Effect } from "@babylonjs/core/Materials/effect";
|
11
|
-
import { Material } from "@babylonjs/core/Materials/material";
|
12
|
-
import { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial";
|
13
|
-
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
|
14
|
-
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial";
|
15
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
16
|
-
import { VertexData } from "@babylonjs/core/Meshes/mesh.vertexData";
|
17
|
-
import { VertexBuffer } from "@babylonjs/core/
|
18
|
-
import { Geometry } from "@babylonjs/core/Meshes/geometry";
|
19
|
-
import { SubMesh } from "@babylonjs/core/Meshes/subMesh";
|
20
|
-
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh";
|
21
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh";
|
22
|
-
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight";
|
23
|
-
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight";
|
24
|
-
import { PointLight } from "@babylonjs/core/Lights/pointLight";
|
25
|
-
import { SpotLight } from "@babylonjs/core/Lights/spotLight";
|
26
|
-
import { GLTFUtils } from "./glTFLoaderUtils";
|
27
|
-
import { GLTFFileLoader } from "../glTFFileLoader";
|
28
|
-
import { Constants } from '@babylonjs/core/Engines/constants';
|
1
|
+
import { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from "./glTFLoaderInterfaces.js";
|
2
|
+
import { Quaternion, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
3
|
+
import { Color3 } from '@babylonjs/core/Maths/math.color.js';
|
4
|
+
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
5
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
6
|
+
import { FreeCamera } from "@babylonjs/core/Cameras/freeCamera.js";
|
7
|
+
import { Animation } from "@babylonjs/core/Animations/animation.js";
|
8
|
+
import { Bone } from "@babylonjs/core/Bones/bone.js";
|
9
|
+
import { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
|
10
|
+
import { Effect } from "@babylonjs/core/Materials/effect.js";
|
11
|
+
import { Material } from "@babylonjs/core/Materials/material.js";
|
12
|
+
import { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial.js";
|
13
|
+
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
14
|
+
import { ShaderMaterial } from "@babylonjs/core/Materials/shaderMaterial.js";
|
15
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
16
|
+
import { VertexData } from "@babylonjs/core/Meshes/mesh.vertexData.js";
|
17
|
+
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
18
|
+
import { Geometry } from "@babylonjs/core/Meshes/geometry.js";
|
19
|
+
import { SubMesh } from "@babylonjs/core/Meshes/subMesh.js";
|
20
|
+
import { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
|
21
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
22
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
23
|
+
import { DirectionalLight } from "@babylonjs/core/Lights/directionalLight.js";
|
24
|
+
import { PointLight } from "@babylonjs/core/Lights/pointLight.js";
|
25
|
+
import { SpotLight } from "@babylonjs/core/Lights/spotLight.js";
|
26
|
+
import { GLTFUtils } from "./glTFLoaderUtils.js";
|
27
|
+
import { GLTFFileLoader } from "../glTFFileLoader.js";
|
28
|
+
import { Constants } from '@babylonjs/core/Engines/constants.js';
|
29
29
|
/**
|
30
30
|
* Tokenizer. Used for shaders compatibility
|
31
31
|
* Automatically map world, view, projection, worldViewProjection, attributes and so on
|
@@ -168,13 +168,13 @@ var loadAnimations = function (gltfRuntime) {
|
|
168
168
|
}
|
169
169
|
var bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);
|
170
170
|
var bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);
|
171
|
-
var
|
172
|
-
var targetNode = gltfRuntime.scene.
|
171
|
+
var targetId = channel.target.id;
|
172
|
+
var targetNode = gltfRuntime.scene.getNodeById(targetId);
|
173
173
|
if (targetNode === null) {
|
174
|
-
targetNode = gltfRuntime.scene.getNodeByName(
|
174
|
+
targetNode = gltfRuntime.scene.getNodeByName(targetId);
|
175
175
|
}
|
176
176
|
if (targetNode === null) {
|
177
|
-
Tools.Warn("Creating animation named " + anim + ". But cannot find node named " +
|
177
|
+
Tools.Warn("Creating animation named " + anim + ". But cannot find node named " + targetId + " to attach to");
|
178
178
|
continue;
|
179
179
|
}
|
180
180
|
var isBone = targetNode instanceof Bone;
|
@@ -205,7 +205,7 @@ var loadAnimations = function (gltfRuntime) {
|
|
205
205
|
modifyKey = true;
|
206
206
|
}
|
207
207
|
if (!modifyKey) {
|
208
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
208
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
209
209
|
babylonAnimation = new Animation(anim, isBone ? "_matrix" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);
|
210
210
|
gltfRuntime.scene._blockEntityCollection = false;
|
211
211
|
}
|
@@ -425,7 +425,7 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton, id) {
|
|
425
425
|
}
|
426
426
|
var id = jointNode.id;
|
427
427
|
// Optimize, if the bone already exists...
|
428
|
-
var existingBone = gltfRuntime.scene.
|
428
|
+
var existingBone = gltfRuntime.scene.getBoneById(id);
|
429
429
|
if (existingBone) {
|
430
430
|
newSkeleton.bones.push(existingBone);
|
431
431
|
continue;
|
@@ -499,8 +499,9 @@ var importSkeleton = function (gltfRuntime, skins, mesh, newSkeleton, id) {
|
|
499
499
|
*/
|
500
500
|
var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
501
501
|
if (!newMesh) {
|
502
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
502
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
503
503
|
newMesh = new Mesh(node.name || "", gltfRuntime.scene);
|
504
|
+
newMesh._parentContainer = gltfRuntime.assetContainer;
|
504
505
|
gltfRuntime.scene._blockEntityCollection = false;
|
505
506
|
newMesh.id = id;
|
506
507
|
}
|
@@ -514,8 +515,8 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
514
515
|
var indexStarts = new Array();
|
515
516
|
var indexCounts = new Array();
|
516
517
|
for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
517
|
-
var
|
518
|
-
var mesh = gltfRuntime.meshes[
|
518
|
+
var meshId = meshes[meshIndex];
|
519
|
+
var mesh = gltfRuntime.meshes[meshId];
|
519
520
|
if (!mesh) {
|
520
521
|
continue;
|
521
522
|
}
|
@@ -599,7 +600,7 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
599
600
|
vertexData.merge(tempVertexData);
|
600
601
|
}
|
601
602
|
// Sub material
|
602
|
-
var material_1 = gltfRuntime.scene.
|
603
|
+
var material_1 = gltfRuntime.scene.getMaterialById(primitive.material);
|
603
604
|
subMaterials.push(material_1 === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material_1);
|
604
605
|
// Update vertices start and index start
|
605
606
|
verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);
|
@@ -607,7 +608,7 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
607
608
|
}
|
608
609
|
}
|
609
610
|
var material;
|
610
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
611
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
611
612
|
if (subMaterials.length > 1) {
|
612
613
|
material = new MultiMaterial("multimat" + id, gltfRuntime.scene);
|
613
614
|
material.subMaterials = subMaterials;
|
@@ -618,6 +619,7 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
618
619
|
if (subMaterials.length === 1) {
|
619
620
|
material = subMaterials[0];
|
620
621
|
}
|
622
|
+
material._parentContainer = gltfRuntime.assetContainer;
|
621
623
|
if (!newMesh.material) {
|
622
624
|
newMesh.material = material;
|
623
625
|
}
|
@@ -629,8 +631,8 @@ var importMesh = function (gltfRuntime, node, meshes, id, newMesh) {
|
|
629
631
|
newMesh.subMeshes = [];
|
630
632
|
var index = 0;
|
631
633
|
for (var meshIndex = 0; meshIndex < meshes.length; meshIndex++) {
|
632
|
-
var
|
633
|
-
var mesh = gltfRuntime.meshes[
|
634
|
+
var meshId = meshes[meshIndex];
|
635
|
+
var mesh = gltfRuntime.meshes[meshId];
|
634
636
|
if (!mesh) {
|
635
637
|
continue;
|
636
638
|
}
|
@@ -691,7 +693,7 @@ var importNode = function (gltfRuntime, node, id, parent) {
|
|
691
693
|
if (node.meshes) {
|
692
694
|
var skin = gltfRuntime.skins[node.skin];
|
693
695
|
var newMesh = importMesh(gltfRuntime, node, node.meshes, id, node.babylonNode);
|
694
|
-
newMesh.skeleton = gltfRuntime.scene.
|
696
|
+
newMesh.skeleton = gltfRuntime.scene.getLastSkeletonById(node.skin);
|
695
697
|
if (newMesh.skeleton === null) {
|
696
698
|
newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton, node.skin);
|
697
699
|
if (!skin.babylonSkeleton) {
|
@@ -760,13 +762,14 @@ var importNode = function (gltfRuntime, node, id, parent) {
|
|
760
762
|
else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {
|
761
763
|
var camera = gltfRuntime.cameras[node.camera];
|
762
764
|
if (camera) {
|
763
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
765
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
764
766
|
if (camera.type === "orthographic") {
|
765
767
|
var orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);
|
766
768
|
orthoCamera.name = node.name || "";
|
767
769
|
orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;
|
768
770
|
orthoCamera.attachControl();
|
769
771
|
lastNode = orthoCamera;
|
772
|
+
orthoCamera._parentContainer = gltfRuntime.assetContainer;
|
770
773
|
}
|
771
774
|
else if (camera.type === "perspective") {
|
772
775
|
var perspectiveCamera = camera[camera.type];
|
@@ -781,6 +784,7 @@ var importNode = function (gltfRuntime, node, id, parent) {
|
|
781
784
|
persCamera.minZ = perspectiveCamera.znear;
|
782
785
|
}
|
783
786
|
lastNode = persCamera;
|
787
|
+
persCamera._parentContainer = gltfRuntime.assetContainer;
|
784
788
|
}
|
785
789
|
gltfRuntime.scene._blockEntityCollection = false;
|
786
790
|
}
|
@@ -791,8 +795,9 @@ var importNode = function (gltfRuntime, node, id, parent) {
|
|
791
795
|
return node.babylonNode;
|
792
796
|
}
|
793
797
|
else if (lastNode === null) {
|
794
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
798
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
795
799
|
var dummy = new Mesh(node.name || "", gltfRuntime.scene);
|
800
|
+
dummy._parentContainer = gltfRuntime.assetContainer;
|
796
801
|
gltfRuntime.scene._blockEntityCollection = false;
|
797
802
|
node.babylonNode = dummy;
|
798
803
|
lastNode = dummy;
|
@@ -885,7 +890,7 @@ var onBindShaderMaterial = function (mesh, gltfRuntime, unTreatedUniforms, shade
|
|
885
890
|
else if (uniform.semantic && (uniform.source || uniform.node)) {
|
886
891
|
var source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || "");
|
887
892
|
if (source === null) {
|
888
|
-
source = gltfRuntime.scene.
|
893
|
+
source = gltfRuntime.scene.getNodeById(uniform.source || uniform.node || "");
|
889
894
|
}
|
890
895
|
if (source === null) {
|
891
896
|
continue;
|
@@ -1040,7 +1045,7 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
1040
1045
|
loadedShaderCount: 0,
|
1041
1046
|
importOnlyMeshes: false,
|
1042
1047
|
dummyNodes: [],
|
1043
|
-
|
1048
|
+
assetContainer: null
|
1044
1049
|
};
|
1045
1050
|
// Parse
|
1046
1051
|
if (parsedData.extensions) {
|
@@ -1192,8 +1197,9 @@ var GLTFLoaderBase = /** @class */ (function () {
|
|
1192
1197
|
}
|
1193
1198
|
var technique = gltfRuntime.techniques[material.technique];
|
1194
1199
|
if (!technique) {
|
1195
|
-
gltfRuntime.scene._blockEntityCollection = gltfRuntime.
|
1200
|
+
gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;
|
1196
1201
|
var defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);
|
1202
|
+
defaultMaterial._parentContainer = gltfRuntime.assetContainer;
|
1197
1203
|
gltfRuntime.scene._blockEntityCollection = false;
|
1198
1204
|
defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);
|
1199
1205
|
defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;
|
@@ -1329,7 +1335,6 @@ export { GLTFLoaderBase };
|
|
1329
1335
|
*/
|
1330
1336
|
var GLTFLoader = /** @class */ (function () {
|
1331
1337
|
function GLTFLoader() {
|
1332
|
-
this.state = null;
|
1333
1338
|
}
|
1334
1339
|
GLTFLoader.RegisterExtension = function (extension) {
|
1335
1340
|
if (GLTFLoader.Extensions[extension.name]) {
|
@@ -1341,11 +1346,11 @@ var GLTFLoader = /** @class */ (function () {
|
|
1341
1346
|
GLTFLoader.prototype.dispose = function () {
|
1342
1347
|
// do nothing
|
1343
1348
|
};
|
1344
|
-
GLTFLoader.prototype._importMeshAsync = function (meshesNames, scene, data, rootUrl,
|
1349
|
+
GLTFLoader.prototype._importMeshAsync = function (meshesNames, scene, data, rootUrl, assetContainer, onSuccess, onProgress, onError) {
|
1345
1350
|
var _this = this;
|
1346
1351
|
scene.useRightHandedSystem = true;
|
1347
1352
|
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {
|
1348
|
-
gltfRuntime.
|
1353
|
+
gltfRuntime.assetContainer = assetContainer;
|
1349
1354
|
gltfRuntime.importOnlyMeshes = true;
|
1350
1355
|
if (meshesNames === "") {
|
1351
1356
|
gltfRuntime.importMeshesNames = [];
|
@@ -1397,16 +1402,16 @@ var GLTFLoader = /** @class */ (function () {
|
|
1397
1402
|
* Imports one or more meshes from a loaded gltf file and adds them to the scene
|
1398
1403
|
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
1399
1404
|
* @param scene the scene the meshes should be added to
|
1400
|
-
* @param
|
1405
|
+
* @param assetContainer defines the asset container to use (can be null)
|
1401
1406
|
* @param data gltf data containing information of the meshes in a loaded file
|
1402
1407
|
* @param rootUrl root url to load from
|
1403
1408
|
* @param onProgress event that fires when loading progress has occured
|
1404
1409
|
* @returns a promise containg the loaded meshes, particles, skeletons and animations
|
1405
1410
|
*/
|
1406
|
-
GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene,
|
1411
|
+
GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, assetContainer, data, rootUrl, onProgress) {
|
1407
1412
|
var _this = this;
|
1408
1413
|
return new Promise(function (resolve, reject) {
|
1409
|
-
_this._importMeshAsync(meshesNames, scene, data, rootUrl,
|
1414
|
+
_this._importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, function (meshes, skeletons) {
|
1410
1415
|
resolve({
|
1411
1416
|
meshes: meshes,
|
1412
1417
|
particleSystems: [],
|
@@ -1421,7 +1426,7 @@ var GLTFLoader = /** @class */ (function () {
|
|
1421
1426
|
});
|
1422
1427
|
});
|
1423
1428
|
};
|
1424
|
-
GLTFLoader.prototype._loadAsync = function (scene, data, rootUrl,
|
1429
|
+
GLTFLoader.prototype._loadAsync = function (scene, data, rootUrl, onSuccess, onProgress, onError) {
|
1425
1430
|
var _this = this;
|
1426
1431
|
scene.useRightHandedSystem = true;
|
1427
1432
|
GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, function (gltfRuntime) {
|
@@ -1456,7 +1461,7 @@ var GLTFLoader = /** @class */ (function () {
|
|
1456
1461
|
GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
|
1457
1462
|
var _this = this;
|
1458
1463
|
return new Promise(function (resolve, reject) {
|
1459
|
-
_this._loadAsync(scene, data, rootUrl,
|
1464
|
+
_this._loadAsync(scene, data, rootUrl, function () {
|
1460
1465
|
resolve();
|
1461
1466
|
}, onProgress, function (message) {
|
1462
1467
|
reject(new Error(message));
|