/// <summary> /// Create this packet from a stream. /// </summary> /// <param name="br">The stream.</param> /// <param name="flag">Packet flag.</param> public TODLightSourcePacketData(BinaryReader br, int flag) : base(flag) { DirX = new FixedPoint32Bit(br.ReadBytes(4)); DirY = new FixedPoint32Bit(br.ReadBytes(4)); DirZ = new FixedPoint32Bit(br.ReadBytes(4)); Color = br.ReadBytes(3); br.ReadByte(); // skip the last byte }
/// <summary> /// Create this packet from a stream. /// </summary> /// <param name="br">The stream.</param> /// <param name="flag">Packet flag.</param> public TODMatrixPacketData(BinaryReader br, int flag) : base(flag) { Rotation = new FixedPoint16Bit[3, 3]; for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { Rotation[y, x] = new FixedPoint16Bit(br.ReadBytes(2)); } } br.ReadBytes(2); // skip 2 bytes Translation = new FixedPoint32Bit[3]; for (int i = 0; i < 3; i++) { Translation[i] = new FixedPoint32Bit(br.ReadBytes(4)); } }
/// <summary> /// Create this packet from a stream. /// </summary> /// <param name="br">The binary stream.</param> /// <param name="flag">Packet flag.</param> public TODCameraPacketData(BinaryReader br, int flag) : base(flag) { if (CameraType == CameraTypes.PositionAndAngle) { if (HasPosAndRef) { TransX = new FixedPoint32Bit(br.ReadBytes(4)); TransY = new FixedPoint32Bit(br.ReadBytes(4)); TransZ = new FixedPoint32Bit(br.ReadBytes(4)); RotX = new FixedPoint32Bit(br.ReadBytes(4)); RotY = new FixedPoint32Bit(br.ReadBytes(4)); RotZ = new FixedPoint32Bit(br.ReadBytes(4)); } if (HasZAngle) { ZAngle = new FixedPoint32Bit(br.ReadBytes(4)); } } else { if (HasRotation) { RotX = new FixedPoint32Bit(br.ReadBytes(4)); RotY = new FixedPoint32Bit(br.ReadBytes(4)); RotZ = new FixedPoint32Bit(br.ReadBytes(4)); } if (HasTranslation) { TransX = new FixedPoint32Bit(br.ReadBytes(4)); TransY = new FixedPoint32Bit(br.ReadBytes(4)); TransZ = new FixedPoint32Bit(br.ReadBytes(4)); } } }