|
@@ -395,11 +395,11 @@ module BABYLON.GLTF2 {
|
|
this.loadMaterial(primitive.material, (babylonSubMaterial: Material) => {
|
|
this.loadMaterial(primitive.material, (babylonSubMaterial: Material) => {
|
|
if (this._renderReady) {
|
|
if (this._renderReady) {
|
|
babylonSubMaterial.forceCompilation(babylonMesh, babylonSubMaterial => {
|
|
babylonSubMaterial.forceCompilation(babylonMesh, babylonSubMaterial => {
|
|
- this._assignMaterial(babylonMultiMaterial, i, babylonSubMaterial);
|
|
|
|
|
|
+ babylonMultiMaterial.subMaterials[i] = babylonSubMaterial;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- this._assignMaterial(babylonMultiMaterial, i, babylonSubMaterial);
|
|
|
|
|
|
+ babylonMultiMaterial.subMaterials[i] = babylonSubMaterial;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -416,14 +416,6 @@ module BABYLON.GLTF2 {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private _assignMaterial(multiMaterial: MultiMaterial, index: number, subMaterial: Material): void {
|
|
|
|
- multiMaterial.subMaterials[index] = subMaterial;
|
|
|
|
-
|
|
|
|
- if (this._parent.onMaterialLoaded) {
|
|
|
|
- this._parent.onMaterialLoaded(subMaterial);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private _loadVertexDataAsync(primitive: IGLTFMeshPrimitive, onSuccess: (vertexData: VertexData) => void): void {
|
|
private _loadVertexDataAsync(primitive: IGLTFMeshPrimitive, onSuccess: (vertexData: VertexData) => void): void {
|
|
var attributes = primitive.attributes;
|
|
var attributes = primitive.attributes;
|
|
if (!attributes) {
|
|
if (!attributes) {
|
|
@@ -936,6 +928,11 @@ module BABYLON.GLTF2 {
|
|
this.createPbrMaterial(material);
|
|
this.createPbrMaterial(material);
|
|
this.loadMaterialBaseProperties(material);
|
|
this.loadMaterialBaseProperties(material);
|
|
this._loadMaterialMetallicRoughnessProperties(material);
|
|
this._loadMaterialMetallicRoughnessProperties(material);
|
|
|
|
+
|
|
|
|
+ if (this._parent.onMaterialLoaded) {
|
|
|
|
+ this._parent.onMaterialLoaded(material.babylonMaterial);
|
|
|
|
+ }
|
|
|
|
+
|
|
assign(material.babylonMaterial);
|
|
assign(material.babylonMaterial);
|
|
}
|
|
}
|
|
|
|
|