Skip to content

Commit

Permalink
Remove dead code (#12408)
Browse files Browse the repository at this point in the history
  • Loading branch information
deltakosh committed Apr 19, 2022
1 parent 7fe91d0 commit 6e77ec7
Showing 1 changed file with 0 additions and 96 deletions.
96 changes: 0 additions & 96 deletions packages/dev/serializers/src/glTF/2.0/glTFMaterialExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,102 +411,6 @@ export class _GLTFMaterialExporter {
});
}

/**
* Converts a Babylon PBR Metallic Roughness Material to a glTF Material
* @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material
* @param mimeType mime type to use for the textures
* @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
*/
public _convertPBRMetallicRoughnessMaterialAsync(
babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial,
mimeType: ImageMimeType,
hasTextureCoords: boolean
): Promise<IMaterial> {
const materialMap = this._exporter._materialMap;
const materials = this._exporter._materials;
const promises: Promise<void>[] = [];
const glTFPbrMetallicRoughness: IMaterialPbrMetallicRoughness = {};

if (babylonPBRMetalRoughMaterial.baseColor) {
glTFPbrMetallicRoughness.baseColorFactor = [
babylonPBRMetalRoughMaterial.baseColor.r,
babylonPBRMetalRoughMaterial.baseColor.g,
babylonPBRMetalRoughMaterial.baseColor.b,
babylonPBRMetalRoughMaterial.alpha,
];
}

if (babylonPBRMetalRoughMaterial.metallic != null && babylonPBRMetalRoughMaterial.metallic !== 1) {
glTFPbrMetallicRoughness.metallicFactor = babylonPBRMetalRoughMaterial.metallic;
}
if (babylonPBRMetalRoughMaterial.roughness != null && babylonPBRMetalRoughMaterial.roughness !== 1) {
glTFPbrMetallicRoughness.roughnessFactor = babylonPBRMetalRoughMaterial.roughness;
}

const glTFMaterial: IMaterial = {
name: babylonPBRMetalRoughMaterial.name,
};
if (babylonPBRMetalRoughMaterial.doubleSided) {
glTFMaterial.doubleSided = babylonPBRMetalRoughMaterial.doubleSided;
}
_GLTFMaterialExporter._SetAlphaMode(glTFMaterial, babylonPBRMetalRoughMaterial);
if (hasTextureCoords) {
if (babylonPBRMetalRoughMaterial.baseTexture != null) {
promises.push(
this._exportTextureAsync(babylonPBRMetalRoughMaterial.baseTexture, mimeType).then((glTFTexture) => {
if (glTFTexture) {
glTFPbrMetallicRoughness.baseColorTexture = glTFTexture;
}
})
);
}
if (babylonPBRMetalRoughMaterial.normalTexture) {
promises.push(
this._exportTextureAsync(babylonPBRMetalRoughMaterial.normalTexture, mimeType).then((glTFTexture) => {
if (glTFTexture) {
glTFMaterial.normalTexture = glTFTexture;
if (babylonPBRMetalRoughMaterial.normalTexture.level !== 1) {
glTFMaterial.normalTexture.scale = babylonPBRMetalRoughMaterial.normalTexture.level;
}
}
})
);
}
if (babylonPBRMetalRoughMaterial.occlusionTexture) {
promises.push(
this._exportTextureAsync(babylonPBRMetalRoughMaterial.occlusionTexture, mimeType).then((glTFTexture) => {
if (glTFTexture) {
glTFMaterial.occlusionTexture = glTFTexture;
if (babylonPBRMetalRoughMaterial.occlusionStrength != null) {
glTFMaterial.occlusionTexture.strength = babylonPBRMetalRoughMaterial.occlusionStrength;
}
}
})
);
}
if (babylonPBRMetalRoughMaterial.emissiveTexture) {
promises.push(
this._exportTextureAsync(babylonPBRMetalRoughMaterial.emissiveTexture, mimeType).then((glTFTexture) => {
if (glTFTexture) {
glTFMaterial.emissiveTexture = glTFTexture;
}
})
);
}
}

if (_GLTFMaterialExporter._FuzzyEquals(babylonPBRMetalRoughMaterial.emissiveColor, Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
glTFMaterial.emissiveFactor = babylonPBRMetalRoughMaterial.emissiveColor.asArray();
}

glTFMaterial.pbrMetallicRoughness = glTFPbrMetallicRoughness;

materials.push(glTFMaterial);
materialMap[babylonPBRMetalRoughMaterial.uniqueId] = materials.length - 1;

return this._finishMaterial(promises, glTFMaterial, babylonPBRMetalRoughMaterial, mimeType);
}

/**
* Converts an image typed array buffer to a base64 image
* @param buffer typed array buffer
Expand Down

0 comments on commit 6e77ec7

Please sign in to comment.