- Add "GET" method to Caps
- New events: ObjectPhysicsDataEvent, ParcelPropertiesEvent, NewObjectEvent, ObjectUpdateEvent, ObjectKilledEvent
- Added getXML function to Color4, Vector2, Vector3, Vector4, GameObject, Region, Quaternion, UUID for opensim-compatible XML export
- Added TextureAnim and ParticleSystem decoding to the "full" ObjectStore
- Object store will automatically request missing "parent" prims
- "setPersist" - When persist is TRUE, the ObjectStore will not forget about "killed" prims - useful for region scanning
- Support for Flexible params, Light params, LightImage params, Mesh data, Sculpt maps
- Fixed object scale being incorrectly calculated
- Add terrain decoding (this was a ballache)
- Add parcel map decoding
- Add support for region windlight settings (region.environment)
- Add support for materials (normal / specular maps)
- Add getBuffer, getLong and bitwiseOr to UUID
- Added a circular-reference-safe JSONStringify to Utils
- Add XferFile capability to Circuit
PUBLIC API:
AssetCommands:
- Rework "downloadAsset" to detect failures
- NEW: downloadInventoryAsset() - uses TransferRequest for prim inventory items
- NEW: getMaterials() - resolves material UUIDs
RegionCommands:
- NEW: getTerrainTextures()
- NEW: exportSettings() - OpenSim XML export of region settings
- NEW: async getTerrain() - Get binary terrain heightmap, 256x256 float32
- resolveObjects() - now fetches task inventory contents too.
- resolveObjects() - fix calculation of land impact
- NEW: getObjectByLocalID(localID: number, timeout: number)
- NEW: getObjectByUUID(uuid: UUID, timeout: number)
- NEW: getParcels();
- NEW: pruneObjects - removes missing GameObjects from a list
- NEW: setPersist - prevent objectstore from forgetting about killed gameobjects
2018-10-31 11:28:24 +00:00
|
|
|
export class BitPack
|
|
|
|
|
{
|
|
|
|
|
static MAX_BITS = 8;
|
|
|
|
|
static ON = [1];
|
|
|
|
|
static OFF = [0];
|
|
|
|
|
|
|
|
|
|
private bitPos = 0;
|
|
|
|
|
|
|
|
|
|
constructor(private Data: Buffer, private bytePos: number)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get BytePos(): number
|
|
|
|
|
{
|
|
|
|
|
if (this.bytePos !== 0 && this.bitPos === 0)
|
|
|
|
|
{
|
|
|
|
|
return this.bytePos - 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return this.bytePos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get BitPos(): number
|
|
|
|
|
{
|
|
|
|
|
return this.bitPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackFloat(): number
|
|
|
|
|
{
|
|
|
|
|
const output = this.UnpackBitsBuffer(32);
|
|
|
|
|
return output.readFloatLE(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackBits(count: number): number
|
|
|
|
|
{
|
|
|
|
|
const output = this.UnpackBitsBuffer(count);
|
|
|
|
|
return output.readInt32LE(0);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-23 17:14:23 +01:00
|
|
|
UnpackUBits(count: number): number
|
- Add "GET" method to Caps
- New events: ObjectPhysicsDataEvent, ParcelPropertiesEvent, NewObjectEvent, ObjectUpdateEvent, ObjectKilledEvent
- Added getXML function to Color4, Vector2, Vector3, Vector4, GameObject, Region, Quaternion, UUID for opensim-compatible XML export
- Added TextureAnim and ParticleSystem decoding to the "full" ObjectStore
- Object store will automatically request missing "parent" prims
- "setPersist" - When persist is TRUE, the ObjectStore will not forget about "killed" prims - useful for region scanning
- Support for Flexible params, Light params, LightImage params, Mesh data, Sculpt maps
- Fixed object scale being incorrectly calculated
- Add terrain decoding (this was a ballache)
- Add parcel map decoding
- Add support for region windlight settings (region.environment)
- Add support for materials (normal / specular maps)
- Add getBuffer, getLong and bitwiseOr to UUID
- Added a circular-reference-safe JSONStringify to Utils
- Add XferFile capability to Circuit
PUBLIC API:
AssetCommands:
- Rework "downloadAsset" to detect failures
- NEW: downloadInventoryAsset() - uses TransferRequest for prim inventory items
- NEW: getMaterials() - resolves material UUIDs
RegionCommands:
- NEW: getTerrainTextures()
- NEW: exportSettings() - OpenSim XML export of region settings
- NEW: async getTerrain() - Get binary terrain heightmap, 256x256 float32
- resolveObjects() - now fetches task inventory contents too.
- resolveObjects() - fix calculation of land impact
- NEW: getObjectByLocalID(localID: number, timeout: number)
- NEW: getObjectByUUID(uuid: UUID, timeout: number)
- NEW: getParcels();
- NEW: pruneObjects - removes missing GameObjects from a list
- NEW: setPersist - prevent objectstore from forgetting about killed gameobjects
2018-10-31 11:28:24 +00:00
|
|
|
{
|
|
|
|
|
const output = this.UnpackBitsBuffer(count);
|
|
|
|
|
return output.readUInt32LE(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpsckShort(): number
|
|
|
|
|
{
|
|
|
|
|
return this.UnpackBits(16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackUShort(): number
|
|
|
|
|
{
|
|
|
|
|
return this.UnpackUBits(16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackInt(): number
|
|
|
|
|
{
|
|
|
|
|
return this.UnpackBits(32);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackUInt(): number
|
|
|
|
|
{
|
|
|
|
|
return this.UnpackUBits(32);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackByte(): number
|
|
|
|
|
{
|
|
|
|
|
const output = this.UnpackBitsBuffer(8);
|
|
|
|
|
return output[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackFixed(signed: boolean, intBits: number, fracBits: number): number
|
|
|
|
|
{
|
|
|
|
|
let totalBits = intBits + fracBits;
|
|
|
|
|
|
|
|
|
|
if (signed)
|
|
|
|
|
{
|
|
|
|
|
totalBits++;
|
|
|
|
|
}
|
2021-09-23 17:14:23 +01:00
|
|
|
const maxVal = 1 << intBits;
|
- Add "GET" method to Caps
- New events: ObjectPhysicsDataEvent, ParcelPropertiesEvent, NewObjectEvent, ObjectUpdateEvent, ObjectKilledEvent
- Added getXML function to Color4, Vector2, Vector3, Vector4, GameObject, Region, Quaternion, UUID for opensim-compatible XML export
- Added TextureAnim and ParticleSystem decoding to the "full" ObjectStore
- Object store will automatically request missing "parent" prims
- "setPersist" - When persist is TRUE, the ObjectStore will not forget about "killed" prims - useful for region scanning
- Support for Flexible params, Light params, LightImage params, Mesh data, Sculpt maps
- Fixed object scale being incorrectly calculated
- Add terrain decoding (this was a ballache)
- Add parcel map decoding
- Add support for region windlight settings (region.environment)
- Add support for materials (normal / specular maps)
- Add getBuffer, getLong and bitwiseOr to UUID
- Added a circular-reference-safe JSONStringify to Utils
- Add XferFile capability to Circuit
PUBLIC API:
AssetCommands:
- Rework "downloadAsset" to detect failures
- NEW: downloadInventoryAsset() - uses TransferRequest for prim inventory items
- NEW: getMaterials() - resolves material UUIDs
RegionCommands:
- NEW: getTerrainTextures()
- NEW: exportSettings() - OpenSim XML export of region settings
- NEW: async getTerrain() - Get binary terrain heightmap, 256x256 float32
- resolveObjects() - now fetches task inventory contents too.
- resolveObjects() - fix calculation of land impact
- NEW: getObjectByLocalID(localID: number, timeout: number)
- NEW: getObjectByUUID(uuid: UUID, timeout: number)
- NEW: getParcels();
- NEW: pruneObjects - removes missing GameObjects from a list
- NEW: setPersist - prevent objectstore from forgetting about killed gameobjects
2018-10-31 11:28:24 +00:00
|
|
|
let fixedVal = 0;
|
|
|
|
|
if (totalBits <= 8)
|
|
|
|
|
{
|
|
|
|
|
fixedVal = this.UnpackByte();
|
|
|
|
|
}
|
|
|
|
|
else if (totalBits <= 16)
|
|
|
|
|
{
|
|
|
|
|
fixedVal = this.UnpackUBits(16);
|
|
|
|
|
}
|
|
|
|
|
else if (totalBits <= 31)
|
|
|
|
|
{
|
|
|
|
|
fixedVal = this.UnpackUBits(32);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fixedVal /= (1 << fracBits);
|
|
|
|
|
if (signed)
|
|
|
|
|
{
|
|
|
|
|
fixedVal -= maxVal;
|
|
|
|
|
}
|
|
|
|
|
return fixedVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UnpackBitsBuffer(totalCount: number): Buffer
|
|
|
|
|
{
|
|
|
|
|
const newBuf = Buffer.alloc(4, 0);
|
|
|
|
|
let count = 0;
|
|
|
|
|
let curBytePos = 0;
|
|
|
|
|
let curBitPos = 0;
|
|
|
|
|
|
|
|
|
|
while (totalCount > 0)
|
|
|
|
|
{
|
|
|
|
|
if (totalCount > BitPack.MAX_BITS)
|
|
|
|
|
{
|
|
|
|
|
count = BitPack.MAX_BITS;
|
|
|
|
|
totalCount -= BitPack.MAX_BITS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
count = totalCount;
|
|
|
|
|
totalCount = 0;
|
|
|
|
|
}
|
|
|
|
|
while (count > 0)
|
|
|
|
|
{
|
|
|
|
|
newBuf[curBytePos] <<= 1;
|
|
|
|
|
if ((this.Data[this.bytePos] & (0x80 >> this.bitPos++)) !== 0)
|
|
|
|
|
{
|
|
|
|
|
++newBuf[curBytePos];
|
|
|
|
|
}
|
|
|
|
|
--count;
|
|
|
|
|
++curBitPos;
|
|
|
|
|
if (this.bitPos >= BitPack.MAX_BITS)
|
|
|
|
|
{
|
|
|
|
|
this.bitPos = 0;
|
|
|
|
|
++this.bytePos;
|
|
|
|
|
}
|
|
|
|
|
if (curBitPos >= BitPack.MAX_BITS)
|
|
|
|
|
{
|
|
|
|
|
curBitPos = 0;
|
|
|
|
|
++curBytePos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return newBuf;
|
|
|
|
|
}
|
|
|
|
|
}
|