threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
35 lines • 1.41 kB
JavaScript
// todo needs testing with some more files maybe
export function legacySeparateMapSamplerUVFix(config, objs) {
const version = (config.version ? config.version : '0.0.0').split('.').map(v => parseInt(v));
// separate texture map sampler properties added for materials in this version.
if (!(config.type === 'ViewerApp' && version[0] === 0 && (version[1] < 7 || version[1] === 7 && version[2].toString()[0] < '6'))) {
return;
}
const materials = new Set();
objs.forEach(o1 => o1.traverse((o) => {
if (o.material)
materials.add(o.material);
}));
materials.forEach(material => {
const map = material.map;
if (!map)
return;
const repeat = map.repeat;
const offset = map.offset;
const center = map.center;
const rotation = map.rotation;
const others = ['alphaMap', 'aoMap', 'bumpMap', 'displacementMap', 'emissiveMap', 'lightMap', 'metalnessMap', 'normalMap', 'roughnessMap', 'transmissionMap'];
others.forEach(k => {
const m = material[k];
if (m) {
m.repeat.copy(repeat);
m.offset.copy(offset);
m.center.copy(center);
m.rotation = rotation;
m.needsUpdate = true;
}
});
material.needsUpdate = true;
});
}
//# sourceMappingURL=legacy.js.map