Exemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="b"></param>
        /// <param name="sensor"></param>
        /// <returns></returns>
        static Offset <FQTObs> Serialise(FlatBufferBuilder b, IHasQuaternionTransform sensor)
        {
            var pos       = sensor.Position;
            var rot       = sensor.Rotation;
            var pos_range = sensor.PositionSpace;
            var rot_range = sensor.RotationSpace;

            FQTObs.StartFQTObs(b);
            FQTObs.AddPosRange(b,
                               FRange.CreateFRange(b,
                                                   pos_range.DecimalGranularity,
                                                   pos_range.Max,
                                                   pos_range.Min,
                                                   pos_range.NormalisedBool));
            FQTObs.AddRotRange(b,
                               FRange.CreateFRange(b,
                                                   rot_range.DecimalGranularity,
                                                   rot_range.Max,
                                                   rot_range.Min,
                                                   rot_range.NormalisedBool));
            FQTObs.AddTransform(b,
                                FQuaternionTransform.CreateFQuaternionTransform(b,
                                                                                pos.x,
                                                                                pos.y,
                                                                                pos.z,
                                                                                rot.x,
                                                                                rot.y,
                                                                                rot.z,
                                                                                rot.w));

            return(FQTObs.EndFQTObs(b));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="b"></param>
        /// <param name="observer"></param>
        /// <returns></returns>
        static Offset <FQT> serialise_quaternion_transform(FlatBufferBuilder b, IHasQuaternionTransform observer)
        {
            var pos = observer.Position;
            var rot = observer.Rotation;

            FQT.StartFQT(b);
            FQT.AddTransform(
                b,
                FQuaternionTransform.CreateFQuaternionTransform(
                    b,
                    pos.x,
                    pos.y,
                    pos.z,
                    rot.x,
                    rot.y,
                    rot.z,
                    rot.w));
            return(FQT.EndFQT(b));
        }