@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
23 lines (21 loc) • 773 B
JavaScript
const ext = {
id: "KHR_materials_pbrSpecularGlossiness",
async applyMaterial(mat, ctx) {
const sg = mat._rawMatDef?.extensions?.KHR_materials_pbrSpecularGlossiness;
if (!sg) {
return null;
}
const [diffuse, specGloss] = await Promise.all([ctx._texture(sg.diffuseTexture, true), ctx._texture(sg.specularGlossinessTexture, true)]);
const sf = sg.specularFactor;
const out = { metallicFactor: 0, roughnessFactor: 1 - (sg.glossinessFactor ?? 1), reflectance: sf ? Math.max(sf[0], sf[1], sf[2]) : 1 };
if (diffuse) {
out.baseColorTexture = diffuse;
}
if (specGloss) {
out.specGlossTexture = specGloss;
}
return out;
}
};
export { ext as default };
//# sourceMappingURL=gltf-ext-spec-gloss-HSzoR1ZR.esm.js.map