Ejemplo n.º 1
0
 public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
 {
     CopyFrom(left);
     ScaleX = InterpolateUtility.Interpolate(((FreeDataComponent)left).ScaleX, ((FreeDataComponent)right).ScaleX, interpolationInfo.RatioWithOutClamp);
     ScaleY = InterpolateUtility.Interpolate(((FreeDataComponent)left).ScaleY, ((FreeDataComponent)right).ScaleY, interpolationInfo.RatioWithOutClamp);
     ScaleZ = InterpolateUtility.Interpolate(((FreeDataComponent)left).ScaleZ, ((FreeDataComponent)right).ScaleZ, interpolationInfo.RatioWithOutClamp);
 }
Ejemplo n.º 2
0
        //l,r are [0, 360)
        private static float InterpolateAngle(float l, float r, IInterpolationInfo interpolationInfo)
        {
            var delta = r - l;

            if (delta <= -180)
            {
                delta += 360;
            }
            else if (delta > 180)
            {
                delta -= 360;
            }
            var angle = l + InterpolateUtility.Interpolate(0, delta, interpolationInfo);

            if (angle >= 360)
            {
                angle -= 360;
            }
            else if (angle < 0)
            {
                angle += 360;
            }

            return(angle);
        }
Ejemplo n.º 3
0
        public virtual void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (VehicleDynamicDataComponent)left;
            var r = (VehicleDynamicDataComponent)right;

            if (IsSyncLatest)
            {
                return;
            }

            Flag = (int)VehicleFlag.RemoteSet;
            var rotio = interpolationInfo.Ratio;

            IsAccelerated = l.IsAccelerated && r.IsAccelerated;
            SteerInput    = InterpolateUtility.Interpolate(l.SteerInput, r.SteerInput, rotio);
            ThrottleInput = InterpolateUtility.Interpolate(l.ThrottleInput, r.ThrottleInput, rotio);

            Position = InterpolateUtility.Interpolate(l.Position, r.Position, rotio);
            Rotation = InterpolateUtility.Interpolate(l.Rotation, r.Rotation, rotio);

            LinearVelocity  = InterpolateUtility.Interpolate(l.LinearVelocity, r.LinearVelocity, rotio);
            AngularVelocity = InterpolateUtility.Interpolate(l.AngularVelocity, r.AngularVelocity, rotio);

            IsSleeping = l.IsSleeping;
        }
Ejemplo n.º 4
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            PositionComponent l = left as PositionComponent;
            PositionComponent r = right as PositionComponent;

            if (r.InterpolateType == 0)
            {
                Value = InterpolateUtility.Interpolate(l.Value, r.Value, interpolationInfo.RatioWithOutClamp);
            }
            else
            {
                InterpolateType = r.InterpolateType;
                ServerTime      = r.ServerTime;

                if (interpolationInfo.LeftServerTime <= r.ServerTime && interpolationInfo.RightServerTime >= r.ServerTime)
                {
                    if (interpolationInfo.CurrentRenderTime > r.ServerTime)
                    {
                        Value = r._value;
                    }
                    else
                    {
                        Value = l._value;
                    }
                }
                else
                {
                    Value = InterpolateUtility.Interpolate(l.Value, r.Value, interpolationInfo.RatioWithOutClamp);
                }
            }
        }
Ejemplo n.º 5
0
#pragma warning disable RefCounter001,RefCounter002 // possible reference counter error
        public GameEntityPlayBackDiffComparator Init(IEntityMapCompareHandler handler, IInterpolationInfo interpolationInfo, EntityMap localEntityMap)
        {
            base.Init(handler);
            _interpolationInfo = interpolationInfo;
            _localEntityMap    = localEntityMap;
            return(this);
        }
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var leftComp  = left as NetworkWeaponAnimationComponent;
            var rightComp = right as NetworkWeaponAnimationComponent;

            if (null == leftComp || null == rightComp)
            {
                return;
            }

            if (leftComp.FirstPersonAnimName.Equals(rightComp.FirstPersonAnimName))
            {
                FirstPersonAnimName     = leftComp.FirstPersonAnimName;
                FirstPersonAnimProgress = leftComp.FirstPersonAnimProgress +
                                          (rightComp.FirstPersonAnimProgress - leftComp.FirstPersonAnimProgress) * interpolationInfo.Ratio;
            }
            else
            {
                FirstPersonAnimName     = rightComp.FirstPersonAnimName;
                FirstPersonAnimProgress = rightComp.FirstPersonAnimProgress;
            }

            if (leftComp.ThirdPersonAnimName.Equals(rightComp.ThirdPersonAnimName))
            {
                ThirdPersonAnimName     = leftComp.ThirdPersonAnimName;
                ThirdPersonAnimProgress = leftComp.ThirdPersonAnimProgress +
                                          (rightComp.ThirdPersonAnimProgress - leftComp.ThirdPersonAnimProgress) * interpolationInfo.Ratio;
            }
            else
            {
                ThirdPersonAnimName     = rightComp.ThirdPersonAnimName;
                ThirdPersonAnimProgress = rightComp.ThirdPersonAnimProgress;
            }
        }
Ejemplo n.º 7
0
        public virtual void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            AbstractNetworkAnimator leftComponent  = (AbstractNetworkAnimator)left;
            AbstractNetworkAnimator rightComponent = (AbstractNetworkAnimator)right;

            InitFields(leftComponent);

            BaseServerTime       = leftComponent.BaseServerTime;
            NeedChangeServerTime = leftComponent.NeedChangeServerTime;

            // 当动画状态机切换时(人<->怪物),不做插值,使用left,目前未对动画状态机切换做处理
            // 此处只是避免出错
            if (leftComponent.AnimatorLayers.Count == rightComponent.AnimatorLayers.Count)
            {
                AssignAnimatorLayers(leftComponent.AnimatorLayers,
                                     rightComponent.AnimatorLayers,
                                     leftComponent.BaseServerTime,
                                     interpolationInfo.CurrentRenderTime,
                                     rightComponent.BaseServerTime,
                                     interpolationInfo.Ratio);
//                AssignAnimatorParameters(leftComponent.FloatAnimatorParameters, rightComponent.FloatAnimatorParameters,
//                    interpolationInfo.Ratio);
                AssignAnimatorParameters(leftComponent.AnimatorParameters, rightComponent.AnimatorParameters, interpolationInfo.Ratio);
            }
        }
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            CharacterBoneComponent leftComponent  = (CharacterBoneComponent)left;
            CharacterBoneComponent rightComponent = (CharacterBoneComponent)right;
            var ratio = interpolationInfo.Ratio;

            PitchHeadAngle = leftComponent.PitchHeadAngle +
                             (rightComponent.PitchHeadAngle - leftComponent.PitchHeadAngle) * ratio;
            RotHeadAngle = leftComponent.RotHeadAngle +
                           (rightComponent.RotHeadAngle - leftComponent.RotHeadAngle) * ratio;
            CurrentPitchHandAngle = leftComponent.CurrentPitchHandAngle +
                                    (rightComponent.CurrentPitchHandAngle - leftComponent.CurrentPitchHandAngle) * ratio;
            WeaponPitch = leftComponent.WeaponPitch + (rightComponent.WeaponPitch - leftComponent.WeaponPitch) * ratio;
            WeaponRot   = leftComponent.WeaponRot + (rightComponent.WeaponRot - leftComponent.WeaponRot) * ratio;
            ScreenRatio = leftComponent.ScreenRatio + (rightComponent.ScreenRatio - leftComponent.ScreenRatio) * ratio;

            FirstPersonPositionOffset = leftComponent.FirstPersonPositionOffset +
                                        (rightComponent.FirstPersonPositionOffset -
                                         leftComponent.FirstPersonPositionOffset) * ratio;
            FirstPersonRotationOffset = leftComponent.FirstPersonRotationOffset +
                                        (rightComponent.FirstPersonRotationOffset -
                                         leftComponent.FirstPersonRotationOffset) * ratio;
            FirstPersonSightOffset = leftComponent.FirstPersonSightOffset +
                                     (rightComponent.FirstPersonSightOffset - leftComponent.FirstPersonSightOffset) *
                                     ratio;

            NeedChangeOffset = leftComponent.NeedChangeOffset;
            RealWeaponId     = leftComponent.RealWeaponId;

            EnableIK = leftComponent.EnableIK;

            IsWeaponRotState = leftComponent.IsWeaponRotState;
        }
Ejemplo n.º 9
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l     = (CarHitBoxComponent)left;
            var r     = (CarHitBoxComponent)right;
            var ratio = interpolationInfo.Ratio;

            BodyPosition = InterpolateUtility.Interpolate(l.BodyPosition, r.BodyPosition, ratio);
            BodyRotation = InterpolateUtility.Interpolate(l.BodyRotation, r.BodyRotation, ratio);

            int count = FlexiblePositionList.Length;

            for (int i = 0; i < count; ++i)
            {
                FlexiblePositionList[i] =
                    InterpolateUtility.Interpolate(l.FlexiblePositionList[i], r.FlexiblePositionList[i], ratio);
                FlexibleRotationList[i] =
                    InterpolateUtility.Interpolate(l.FlexibleRotationList[i], r.FlexibleRotationList[i], ratio);
            }

            count = WheelPositionList.Length;
            for (int i = 0; i < count; ++i)
            {
                WheelPositionList[i] =
                    InterpolateUtility.Interpolate(l.WheelPositionList[i], r.WheelPositionList[i], ratio);
                WheelRotationList[i] =
                    InterpolateUtility.Interpolate(l.WheelRotationList[i], r.WheelRotationList[i], ratio);
            }
        }
Ejemplo n.º 10
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = left as FreeMoveController;
            var r = right as FreeMoveController;

            FocusOnPosition = InterpolateUtility.Interpolate(l.FocusOnPosition, r.FocusOnPosition, interpolationInfo);
            ControllType    = r.ControllType;
        }
#pragma warning disable RefCounter001,RefCounter002 // possible reference counter error
        public GameEntityPlayBackCompareAgent Init(IEntityMapDiffHandler handler, IInterpolationInfo interpolationInfo,
                                                   EntityMap localEntityMap)
        {
            base.Init(handler);
            this.interpolationInfo = interpolationInfo;
            this.localEntityMap    = localEntityMap;
            return(this);
        }
Ejemplo n.º 12
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = left as BulletDataComponent;
            var r = right as BulletDataComponent;

            Distance = InterpolateUtility.Interpolate(l.Distance, r.Distance, interpolationInfo);
            Velocity = r.Velocity;
        }
Ejemplo n.º 13
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (left as NormalComponent);
            var r = right as NormalComponent;

            Value = InterpolateUtility.Interpolate(l.Value,
                                                   r.Value, interpolationInfo);
        }
Ejemplo n.º 14
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (DoorDataComponent)left;
            var r = (DoorDataComponent)right;

            State    = l.State;
            Rotation = InterpolateAngle(l.Rotation, r.Rotation, interpolationInfo);
        }
Ejemplo n.º 15
0
        public static FixedVector3 Interpolate(FixedVector3 l, FixedVector3 r, IInterpolationInfo interpolationInfo)
        {
            var ratio = interpolationInfo.Ratio;

            return(new FixedVector3(
                       l.x + (r.x - l.x) * ratio,
                       l.y + (r.y - l.y) * ratio,
                       l.z + (r.z - l.z) * ratio));
        }
Ejemplo n.º 16
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (DestructibleDataComponent)left;
            var r = (DestructibleDataComponent)right;

            StartAsWhole             = l.StartAsWhole || r.StartAsWhole;
            LastSyncDestructionState = l.LastSyncDestructionState | r.LastSyncDestructionState;
            ResetCount = r.ResetCount;
        }
Ejemplo n.º 17
0
#pragma warning disable RefCounter001,RefCounter002 // possible reference counter error
        public PlaybackIntroplateHandler init(EntityMap localEntityMap,
                                              IInterpolationInfo interpolationInfo, List <PlayBackInfo> playBackInfos)
        {
            _localEntityMap    = localEntityMap;
            _interpolationInfo = interpolationInfo;
            _playBackInfos     = playBackInfos;
            _playBackInfos.Clear();
            return(this);
        }
Ejemplo n.º 18
0
        public virtual void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            AbstractNetworkAnimator leftComponent  = (AbstractNetworkAnimator)left;
            AbstractNetworkAnimator rightComponent = (AbstractNetworkAnimator)right;

            InitFields(leftComponent);

            BaseServerTime       = leftComponent.BaseServerTime;
            BaseClientTime       = leftComponent.BaseClientTime;
            NeedChangeServerTime = leftComponent.NeedChangeServerTime;

            if (AnimatorLayers.Count > 0 && _networkAnimatorLogger.IsDebugEnabled)
            {
                _networkAnimatorLogger.DebugFormat("EntityName:{0}, before Interpolate, layer 0:{1}", _entityName,
                                                   AnimatorLayers[0].ToString());
            }

            if (leftComponent.AnimatorLayers.Count > 0 && _networkAnimatorLogger.IsDebugEnabled)
            {
                _networkAnimatorLogger.DebugFormat("EntityName:{2},Interpolate\n left layer 0:{0}\nright layer 0:{1}",
                                                   leftComponent.AnimatorLayers[0], rightComponent.AnimatorLayers[0], _entityName);
            }

            AssignAnimatorLayers(leftComponent.AnimatorLayers,
                                 rightComponent.AnimatorLayers,
                                 leftComponent.BaseServerTime,
                                 interpolationInfo.LeftServerTime,
                                 interpolationInfo.CurrentRenderTime,
                                 rightComponent.BaseServerTime,
                                 interpolationInfo.RightServerTime,
                                 interpolationInfo.Ratio);
            AssignAnimatorParameters(leftComponent.AnimatorParameters);

            if (AnimatorLayers.Count > 0 && _networkAnimatorLogger.IsDebugEnabled)
            {
                _networkAnimatorLogger.DebugFormat("EntityName:{1},after Interpolate, layer 0:{0}", AnimatorLayers[0], _entityName);
            }

            if (_networkAnimatorLogger.IsDebugEnabled)
            {
                _networkAnimatorLogger.DebugFormat(
                    "EntityName:{9},NetworkAnimatorComponent Interpolate, left.BaseServerTime:{0},right.BaseServerTime:{1},  baseServerTime delta:{2}\n interpolate.LeftServerTime:{3}, interpolate.RightServerTime:{4},interpolate.renderTime:{5},interpolate.Ratio:{6}\n interpolate deltaTime:{7}, render time delta:{8} ",
                    leftComponent.BaseServerTime,
                    rightComponent.BaseServerTime,
                    rightComponent.BaseServerTime - leftComponent.BaseServerTime,
                    interpolationInfo.LeftServerTime,
                    interpolationInfo.RightServerTime,
                    interpolationInfo.CurrentRenderTime,
                    interpolationInfo.Ratio,
                    interpolationInfo.RightServerTime - interpolationInfo.LeftServerTime,
                    interpolationInfo.CurrentRenderTime - _prevRenderTime,
                    _entityName
                    );
            }

            _prevRenderTime = interpolationInfo.CurrentRenderTime;
        }
#pragma warning disable RefCounter001,RefCounter002 // possible reference counter error
        public PlaybackLMapIntroplateDiffHandler init(EntityMap localEntityMap, IInterpolationInfo interpolationInfo,
                                                      List <PlayBackInfo> playBackInfos)
        {
            this.localEntityMap    = localEntityMap;
            this.interpolationInfo = interpolationInfo;
            this.playBackInfos     = playBackInfos;
            this.playBackInfos.Clear();
            return(this);
        }
Ejemplo n.º 20
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = left as ObserveCameraComponent;
            var r = right as ObserveCameraComponent;

            Fov              = InterpolateUtility.Interpolate(l.Fov, r.Fov, interpolationInfo);
            CameraPosition   = InterpolateUtility.Interpolate(l.CameraPosition, r.CameraPosition, interpolationInfo);
            CameraEularAngle =
                InterpolateUtility.Interpolate(l.CameraEularAngle, r.CameraEularAngle, interpolationInfo);
        }
Ejemplo n.º 21
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (GlassyDataComponent)left;
            var r = (GlassyDataComponent)right;

            BrokenState0 = CombineState(l.BrokenState0, r.BrokenState0);
            BrokenState1 = CombineState(l.BrokenState1, r.BrokenState1);
            BrokenState2 = CombineState(l.BrokenState2, r.BrokenState2);
            BrokenState3 = CombineState(l.BrokenState3, r.BrokenState3);
        }
Ejemplo n.º 22
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = left as DamageHintComponent;
            var r = right as DamageHintComponent;

            Damage    = r.Damage;
            DamageAdd = r.DamageAdd;
            HeadShoot = r.HeadShoot;

            PlayerPos = InterpolateUtility.Interpolate(l.PlayerPos,
                                                       r.PlayerPos, interpolationInfo);
        }
Ejemplo n.º 23
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            ThirdPersonAppearanceComponent leftComponent  = left as ThirdPersonAppearanceComponent;
            ThirdPersonAppearanceComponent rightComponent = right as ThirdPersonAppearanceComponent;

            CopyFrom(rightComponent);
            PeekDegree      = Mathf.Lerp(leftComponent.PeekDegree, rightComponent.PeekDegree, interpolationInfo.Ratio);
            CharacterHeight = Mathf.Lerp(leftComponent.CharacterHeight, rightComponent.CharacterHeight,
                                         interpolationInfo.Ratio);
            CharacterRadius = Mathf.Lerp(leftComponent.CharacterRadius, rightComponent.CharacterRadius,
                                         interpolationInfo.Ratio);
        }
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = left as ShipRudderDynamicData;
            var r = right as ShipRudderDynamicData;

            if (IsSyncLatest)
            {
                return;
            }

            Angle = InterpolateUtility.Interpolate(l.Angle, r.Angle, interpolationInfo);
        }
Ejemplo n.º 25
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var leftServerTime  = interpolationInfo.LeftServerTime;
            var rightServerTime = interpolationInfo.RightServerTime;
            var serverTime      = leftServerTime + (rightServerTime - leftServerTime) * interpolationInfo.Ratio;

            var l = (ControlledVehicleComponent)left;
            var r = (ControlledVehicleComponent)right;

            var comp = r.ExecuteTime > serverTime ? l : r;

            CopyFrom(comp);
        }
Ejemplo n.º 26
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var leftComp  = left as NetworkWeaponAnimationComponent;
            var rightComp = right as NetworkWeaponAnimationComponent;

            FirstPersonAnimName     = leftComp.FirstPersonAnimName;
            FirstPersonAnimProgress = leftComp.FirstPersonAnimProgress +
                                      (rightComp.FirstPersonAnimProgress - leftComp.FirstPersonAnimProgress) * interpolationInfo.Ratio;

            ThirdPersonAnimName     = leftComp.ThirdPersonAnimName;
            ThirdPersonAnimProgress = leftComp.ThirdPersonAnimProgress +
                                      (rightComp.ThirdPersonAnimProgress - leftComp.ThirdPersonAnimProgress) * interpolationInfo.Ratio;
        }
Ejemplo n.º 27
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l     = left as OrientationComponent;
            var r     = right as OrientationComponent;
            var rotio = interpolationInfo.Ratio;

            Yaw        = ShortInterpolateAngle(l.Yaw, r.Yaw, rotio);
            Pitch      = InterpolateUtility.Interpolate(l.Pitch, r.Pitch, rotio);
            Roll       = InterpolateUtility.Interpolate(l.Roll, r.Roll, rotio);
            PunchYaw   = InterpolateUtility.Interpolate(l.PunchYaw, r.PunchYaw, rotio);
            PunchPitch = InterpolateUtility.Interpolate(l.PunchPitch, r.PunchPitch, rotio);
            ModelPitch = ShortInterpolateAngle(l.ModelPitch, r.ModelPitch, rotio);
            ModelYaw   = ShortInterpolateAngle(l.ModelYaw, r.ModelYaw, rotio);
        }
Ejemplo n.º 28
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            if (Events == null)
            {
                Events = new PlayerEvents();
            }

            if (Events.ServerTime != interpolationInfo.LeftServerTime)
            {
                var l = left as RemoteEventsComponent;
                Events.CopyFrom(l.Events);
                Events.HasHandler = false;
                Events.ServerTime = interpolationInfo.LeftServerTime;
            }
        }
        public override void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            base.Interpolate(left, right, interpolationInfo);

            var l = (CarRewindDataComponent)left;
            var r = (CarRewindDataComponent)right;

            var rotio = interpolationInfo.Ratio;

            IsHornOn       = l.IsHornOn && r.IsHornOn;
            BrakeInput     = InterpolateUtility.Interpolate(l.BrakeInput, r.BrakeInput, rotio);
            HandbrakeInput = InterpolateUtility.Interpolate(l.HandbrakeInput, r.HandbrakeInput, rotio);

            SteerAngle = InterpolateUtility.Interpolate(l.SteerAngle, r.SteerAngle, rotio);

            Crashed = r.Crashed;
        }
Ejemplo n.º 30
0
        public void Interpolate(object left, object right, IInterpolationInfo interpolationInfo)
        {
            var l = (CarWheelComponent)left;
            var r = (CarWheelComponent)right;

            if (IsSyncLatest)
            {
                return;
            }

            CopyFrom(r);
            var rotio = interpolationInfo.Ratio;

            ColliderSteerAngle =
                InterpolateUtility.Interpolate(l.ColliderSteerAngle, r.ColliderSteerAngle, rotio);
            SteerAngle = InterpolateUtility.Interpolate(l.SteerAngle, r.SteerAngle, rotio);
        }