123 lines
4.0 KiB
TypeScript
123 lines
4.0 KiB
TypeScript
// This file has been automatically generated by writeMessageClasses.js
|
|
|
|
import { UUID } from '../UUID';
|
|
import { Vector3 } from '../Vector3';
|
|
import { Quaternion } from '../Quaternion';
|
|
import { MessageFlags } from '../../enums/MessageFlags';
|
|
import { MessageBase } from '../MessageBase';
|
|
import { Message } from '../../enums/Message';
|
|
|
|
export class AgentUpdateMessage implements MessageBase
|
|
{
|
|
name = 'AgentUpdate';
|
|
messageFlags = MessageFlags.Zerocoded | MessageFlags.FrequencyHigh;
|
|
id = Message.AgentUpdate;
|
|
|
|
AgentData: {
|
|
AgentID: UUID;
|
|
SessionID: UUID;
|
|
BodyRotation: Quaternion;
|
|
HeadRotation: Quaternion;
|
|
State: number;
|
|
CameraCenter: Vector3;
|
|
CameraAtAxis: Vector3;
|
|
CameraLeftAxis: Vector3;
|
|
CameraUpAxis: Vector3;
|
|
Far: number;
|
|
ControlFlags: number;
|
|
Flags: number;
|
|
};
|
|
|
|
getSize(): number
|
|
{
|
|
return 114;
|
|
}
|
|
|
|
// @ts-ignore
|
|
writeToBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentData['BodyRotation'].writeToBuffer(buf, pos);
|
|
pos += 12;
|
|
this.AgentData['HeadRotation'].writeToBuffer(buf, pos);
|
|
pos += 12;
|
|
buf.writeUInt8(this.AgentData['State'], pos++);
|
|
this.AgentData['CameraCenter'].writeToBuffer(buf, pos, false);
|
|
pos += 12;
|
|
this.AgentData['CameraAtAxis'].writeToBuffer(buf, pos, false);
|
|
pos += 12;
|
|
this.AgentData['CameraLeftAxis'].writeToBuffer(buf, pos, false);
|
|
pos += 12;
|
|
this.AgentData['CameraUpAxis'].writeToBuffer(buf, pos, false);
|
|
pos += 12;
|
|
buf.writeFloatLE(this.AgentData['Far'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.AgentData['ControlFlags'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8(this.AgentData['Flags'], pos++);
|
|
return pos - startPos;
|
|
}
|
|
|
|
// @ts-ignore
|
|
readFromBuffer(buf: Buffer, pos: number): number
|
|
{
|
|
const startPos = pos;
|
|
const newObjAgentData: {
|
|
AgentID: UUID,
|
|
SessionID: UUID,
|
|
BodyRotation: Quaternion,
|
|
HeadRotation: Quaternion,
|
|
State: number,
|
|
CameraCenter: Vector3,
|
|
CameraAtAxis: Vector3,
|
|
CameraLeftAxis: Vector3,
|
|
CameraUpAxis: Vector3,
|
|
Far: number,
|
|
ControlFlags: number,
|
|
Flags: number
|
|
} = {
|
|
AgentID: UUID.zero(),
|
|
SessionID: UUID.zero(),
|
|
BodyRotation: Quaternion.getIdentity(),
|
|
HeadRotation: Quaternion.getIdentity(),
|
|
State: 0,
|
|
CameraCenter: Vector3.getZero(),
|
|
CameraAtAxis: Vector3.getZero(),
|
|
CameraLeftAxis: Vector3.getZero(),
|
|
CameraUpAxis: Vector3.getZero(),
|
|
Far: 0,
|
|
ControlFlags: 0,
|
|
Flags: 0
|
|
};
|
|
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentData['BodyRotation'] = new Quaternion(buf, pos);
|
|
pos += 12;
|
|
newObjAgentData['HeadRotation'] = new Quaternion(buf, pos);
|
|
pos += 12;
|
|
newObjAgentData['State'] = buf.readUInt8(pos++);
|
|
newObjAgentData['CameraCenter'] = new Vector3(buf, pos, false);
|
|
pos += 12;
|
|
newObjAgentData['CameraAtAxis'] = new Vector3(buf, pos, false);
|
|
pos += 12;
|
|
newObjAgentData['CameraLeftAxis'] = new Vector3(buf, pos, false);
|
|
pos += 12;
|
|
newObjAgentData['CameraUpAxis'] = new Vector3(buf, pos, false);
|
|
pos += 12;
|
|
newObjAgentData['Far'] = buf.readFloatLE(pos);
|
|
pos += 4;
|
|
newObjAgentData['ControlFlags'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjAgentData['Flags'] = buf.readUInt8(pos++);
|
|
this.AgentData = newObjAgentData;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
|