Exemplo n.º 1
0
        /// <summary>
        /// Guess the correct upperbits using the supplied frame for its compressedPos as a starting point. Will find the upperbits that result in the least movement from that pos.
        /// </summary>
        public void CompletePosition(Frame frame)
        {
            if (msgType.IsPosLowerType())
            {
                compPos = compPos.GuessUpperBits(frame.compPos);
            }
            else if (!msgType.IsPosType())
            {
                compPos = frame.compPos;
            }

            //for (int i = 0l is < pre)

            pos = compPos.Decompress();
        }
Exemplo n.º 2
0
        public void AddFrameToBuffer(MsgType msgType, CompressedElement compPos, int packetid)
        {
            // If we are writing to the frame as it is mid-lerp - apply the correct upperbits.
            if (packetid == CurrentIndex && msgType.IsPosLowerType())
            {
                compPos = NSTCompressVector.GuessUpperBits(compPos, currentFrame.compPos);
            }

            int numOfFramesFromCurrent = CountFrames(CurrentIndex, packetid);
            // is this frame still a future event for interpolation, or has it already just guessed it?
            bool isStillPending = numOfFramesFromCurrent < halfBufferSize && numOfFramesFromCurrent > 0;
            bool isCurrentFrame = CurrentIndex == packetid;

            frames[packetid].ModifyFrame(msgType, compPos, compPos.Decompress(), Time.time);

            // Set as valid if 1. is not the frame currently rendering 2. is not in the past, unless the buffer is empty then we need to rewind
            SetBitInValidFrameMask(packetid, !isCurrentFrame && (isStillPending || validFrameMask == 0));
        }