@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.
28 lines (26 loc) • 993 B
JavaScript
const ext = {
id: "KHR_materials_sheen",
async applyMaterial(mat, ctx) {
const s = mat._rawMatDef?.extensions?.KHR_materials_sheen;
if (!s) {
return null;
}
const tex = await ctx._texture(s.sheenColorTexture, true);
const roughInfo = s.sheenRoughnessTexture;
const sameAsColor = roughInfo && s.sheenColorTexture && roughInfo.index === s.sheenColorTexture.index && roughInfo.extensions?.KHR_texture_transform === s.sheenColorTexture.extensions?.KHR_texture_transform;
const roughnessTexture = roughInfo && !sameAsColor ? await ctx._texture(roughInfo, false) : void 0;
return {
sheen: {
isEnabled: true,
color: s.sheenColorFactor ?? [0, 0, 0],
roughness: s.sheenRoughnessFactor ?? 0,
intensity: 1,
texture: tex,
...roughnessTexture ? { roughnessTexture } : void 0,
albedoScaling: true
}
};
}
};
export { ext as default };
//# sourceMappingURL=gltf-ext-sheen-CFu97G55.esm.js.map