normalize static method
dynamic
normalize(
- dynamic value,
- dynamic array
Implementation
static normalize(value, array) {
switch (array) {
case Float32Array:
return value;
case Uint16Array:
return Math.round(value * 65535.0);
case Uint8Array:
return Math.round(value * 255.0);
case Int16Array:
return Math.round(value * 32767.0);
case Int8Array:
return Math.round(value * 127.0);
default:
throw ('Invalid component type.');
}
}