arx-level-generator
Version:
A tool for creating Arx Fatalis maps
14 lines • 573 B
JavaScript
import { BufferAttribute } from 'three';
/**
* @param offset Vector2 with the 2 values representing X and Y axis. Both axis are expected to be
* floats between 0 and 1
*/
export const translateUV = (offset, geometry) => {
const uv = geometry.getAttribute('uv');
const newUV = [];
for (let i = 0; i < uv.count; i++) {
newUV.push(uv.array[i * uv.itemSize] + offset.x, uv.array[i * uv.itemSize + 1] + offset.y);
}
geometry.setAttribute('uv', new BufferAttribute(Float32Array.from(newUV), uv.itemSize));
};
//# sourceMappingURL=translateUV.js.map