transformUv method
dynamic
transformUv(
- dynamic uv
Implementation
transformUv(uv) {
if (mapping != UVMapping) return uv;
uv.applyMatrix3(matrix);
if (uv.x < 0 || uv.x > 1) {
switch (wrapS) {
case RepeatWrapping:
uv.x = uv.x - Math.floor(uv.x);
break;
case ClampToEdgeWrapping:
uv.x = uv.x < 0 ? 0 : 1;
break;
case MirroredRepeatWrapping:
if (Math.abs(Math.floor(uv.x) % 2) == 1) {
uv.x = Math.ceil(uv.x) - uv.x;
} else {
uv.x = uv.x - Math.floor(uv.x);
}
break;
}
}
if (uv.y < 0 || uv.y > 1) {
switch (wrapT) {
case RepeatWrapping:
uv.y = uv.y - Math.floor(uv.y);
break;
case ClampToEdgeWrapping:
uv.y = uv.y < 0 ? 0 : 1;
break;
case MirroredRepeatWrapping:
if (Math.abs(Math.floor(uv.y) % 2) == 1) {
uv.y = Math.ceil(uv.y) - uv.y;
} else {
uv.y = uv.y - Math.floor(uv.y);
}
break;
}
}
if (flipY) {
uv.y = 1 - uv.y;
}
return uv;
}