|
@@ -85,7 +85,7 @@ module BABYLON.GLTF2 {
|
|
|
|
|
|
// IE 11 Compatibility.
|
|
// IE 11 Compatibility.
|
|
private static _progressEventFactory: (name: string, data: IProgressEventData) => ProgressEvent;
|
|
private static _progressEventFactory: (name: string, data: IProgressEventData) => ProgressEvent;
|
|
-
|
|
|
|
|
|
+
|
|
private static _createProgressEventByConstructor(name: string, data: IProgressEventData): ProgressEvent {
|
|
private static _createProgressEventByConstructor(name: string, data: IProgressEventData): ProgressEvent {
|
|
return new ProgressEvent(name, data);
|
|
return new ProgressEvent(name, data);
|
|
}
|
|
}
|
|
@@ -320,8 +320,8 @@ module BABYLON.GLTF2 {
|
|
switch (this._parent.coordinateSystemMode) {
|
|
switch (this._parent.coordinateSystemMode) {
|
|
case GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
case GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
if (!this._babylonScene.useRightHandedSystem) {
|
|
if (!this._babylonScene.useRightHandedSystem) {
|
|
- this._rootNode.rotation = [ 0, 1, 0, 0 ];
|
|
|
|
- this._rootNode.scale = [ 1, 1, -1 ];
|
|
|
|
|
|
+ this._rootNode.rotation = [0, 1, 0, 0];
|
|
|
|
+ this._rootNode.scale = [1, 1, -1];
|
|
this._loadTransform(this._rootNode);
|
|
this._loadTransform(this._rootNode);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -474,7 +474,7 @@ module BABYLON.GLTF2 {
|
|
};
|
|
};
|
|
});
|
|
});
|
|
|
|
|
|
- if (primitives.length === 1) {
|
|
|
|
|
|
+ if (primitives.length === 1) {
|
|
const primitive = primitives[0];
|
|
const primitive = primitives[0];
|
|
if (primitive.material == null) {
|
|
if (primitive.material == null) {
|
|
node.babylonMesh.material = this._getDefaultMaterial();
|
|
node.babylonMesh.material = this._getDefaultMaterial();
|
|
@@ -484,14 +484,14 @@ module BABYLON.GLTF2 {
|
|
if (!material) {
|
|
if (!material) {
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
this._loadMaterial("#/materials/" + material.index, material, (babylonMaterial, isNew) => {
|
|
this._loadMaterial("#/materials/" + material.index, material, (babylonMaterial, isNew) => {
|
|
if (isNew && this._parent.onMaterialLoaded) {
|
|
if (isNew && this._parent.onMaterialLoaded) {
|
|
this._parent.onMaterialLoaded(babylonMaterial);
|
|
this._parent.onMaterialLoaded(babylonMaterial);
|
|
}
|
|
}
|
|
node.babylonMesh.material = babylonMaterial;
|
|
node.babylonMesh.material = babylonMaterial;
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
const multiMaterial = new MultiMaterial(node.babylonMesh.name, this._babylonScene);
|
|
const multiMaterial = new MultiMaterial(node.babylonMesh.name, this._babylonScene);
|
|
@@ -499,7 +499,7 @@ module BABYLON.GLTF2 {
|
|
const subMaterials = multiMaterial.subMaterials;
|
|
const subMaterials = multiMaterial.subMaterials;
|
|
for (let index = 0; index < primitives.length; index++) {
|
|
for (let index = 0; index < primitives.length; index++) {
|
|
const primitive = primitives[index];
|
|
const primitive = primitives[index];
|
|
-
|
|
|
|
|
|
+
|
|
if (primitive.material == null) {
|
|
if (primitive.material == null) {
|
|
subMaterials[index] = this._getDefaultMaterial();
|
|
subMaterials[index] = this._getDefaultMaterial();
|
|
}
|
|
}
|
|
@@ -508,12 +508,12 @@ module BABYLON.GLTF2 {
|
|
if (!material) {
|
|
if (!material) {
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
throw new Error(context + ": Failed to find material " + primitive.material);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
this._loadMaterial("#/materials/" + material.index, material, (babylonMaterial, isNew) => {
|
|
this._loadMaterial("#/materials/" + material.index, material, (babylonMaterial, isNew) => {
|
|
if (isNew && this._parent.onMaterialLoaded) {
|
|
if (isNew && this._parent.onMaterialLoaded) {
|
|
this._parent.onMaterialLoaded(babylonMaterial);
|
|
this._parent.onMaterialLoaded(babylonMaterial);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
subMaterials[index] = babylonMaterial;
|
|
subMaterials[index] = babylonMaterial;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -806,7 +806,7 @@ module BABYLON.GLTF2 {
|
|
// Tangent data for morph targets is stored as xyz delta.
|
|
// Tangent data for morph targets is stored as xyz delta.
|
|
// The vertexData.tangent is stored as xyzw.
|
|
// The vertexData.tangent is stored as xyzw.
|
|
// So we need to skip every fourth vertexData.tangent.
|
|
// So we need to skip every fourth vertexData.tangent.
|
|
- for (let i = 0, j = 0; i < values.length; i++, j++) {
|
|
|
|
|
|
+ for (let i = 0, j = 0; i < values.length; i++ , j++) {
|
|
values[i] += vertexData.tangents![j];
|
|
values[i] += vertexData.tangents![j];
|
|
if ((i + 1) % 3 == 0) {
|
|
if ((i + 1) % 3 == 0) {
|
|
j++;
|
|
j++;
|
|
@@ -1349,7 +1349,7 @@ module BABYLON.GLTF2 {
|
|
this._loaderTrackers.push(tracker);
|
|
this._loaderTrackers.push(tracker);
|
|
|
|
|
|
this._addLoaderPendingData(tracker);
|
|
this._addLoaderPendingData(tracker);
|
|
-
|
|
|
|
|
|
+
|
|
action();
|
|
action();
|
|
|
|
|
|
this._removeLoaderPendingData(tracker);
|
|
this._removeLoaderPendingData(tracker);
|
|
@@ -1653,7 +1653,7 @@ module BABYLON.GLTF2 {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private static _AssignIndices(array?: Array<{index: number}>): void {
|
|
|
|
|
|
+ private static _AssignIndices(array?: Array<{ index: number }>): void {
|
|
if (array) {
|
|
if (array) {
|
|
for (let index = 0; index < array.length; index++) {
|
|
for (let index = 0; index < array.length; index++) {
|
|
array[index].index = index;
|
|
array[index].index = index;
|