@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
15 lines (14 loc) • 355 B
JavaScript
;
export function invertNormals(object) {
const geometry = object.geometry;
if (!geometry) {
return;
}
const normalAttribute = geometry.getAttribute("normal");
const array = normalAttribute.array;
const length = array.length;
for (let i = 0; i < length; i++) {
array[i] *= -1;
}
normalAttribute.needsUpdate = true;
}