fix: clamp vector pack

This commit is contained in:
cha0s 2019-10-10 23:50:02 -05:00
parent a852a906be
commit 768102d481

View File

@ -381,5 +381,7 @@ export function unpackFromUint32(uint32) {
}
export function packToUint32(v) {
return (v[1] << 16) | v[0];
const x = Math.min(65535, Math.max(0, v[0]));
const y = Math.min(65535, Math.max(0, v[1]));
return (y << 16) | x;
}