- Add LLWearable parsing

- Remove ExtraParams, TextureAnim, ParticleSystem binary data from GameObjects, instead encode on the fly when needed
- Add XML object decoding (WIP)
- Move FlexibleData, LightDate, LightImageData, MeshData, SculptData inside ExtraParams class
-
This commit is contained in:
Casper Warden
2018-11-05 11:45:04 +00:00
parent 65e3aef3f9
commit 4740b07e11
24 changed files with 1596 additions and 353 deletions

View File

@@ -22,6 +22,12 @@ export class Utils
return buf.toString('utf8');
}
}
static Clamp(value: number, min: number, max: number)
{
value = (value > max) ? max : value;
value = (value < min) ? min : value;
return value;
}
static JSONStringify(obj: object, space: number)
{
const cache: any[] = [];
@@ -137,7 +143,13 @@ export class Utils
return '';
}
}
static FloatToByte(val: number, lower: number, upper: number)
{
val = Utils.Clamp(val, lower, upper);
val -= lower;
val /= (upper - lower);
return Math.round(val * 255);
}
static ByteToFloat(byte: number, lower: number, upper: number)
{
const ONE_OVER_BYTEMAX: number = 1.0 / 255;