示例#1
0
            public static (Vector3 Start, Vector3 End) UndoConstrict(Vector3 start, Vector3 end, float ratio)
            {
                Vector3 center = (start + end) / 2;

                return(XnaExtensions.GetLerpValARequiredForResult(center, start, 1 - ratio),
                       XnaExtensions.GetLerpValARequiredForResult(center, end, 1 - ratio));
            }
示例#2
0
            private void BakeKeyframesToLiveMod(List <DummyPolyBladePos> positions)
            {
                var posLowHzToLive = (CurrentPosLive.End - CurrentPos.End);
                var rotLowHzToLive = Matrix.CreateFromQuaternion(XnaExtensions.GetQuatOfBladePosDelta(CurrentPos, CurrentPosLive));

                var asList = Keyframes.ToList();

                for (int i = 0; i < asList.Count - 1; i++)
                {
                    DummyPolyBladePos bakedPos = new DummyPolyBladePos();

                    if (positions.Count < asList.Count)
                    {
                        bakedPos = positions[i];
                    }
                    else
                    {
                        if (i < positions.Count - 1)
                        {
                            bakedPos = positions[i + 1];
                        }
                        else
                        {
                            bakedPos = CurrentPos;
                        }
                    }

                    var mod        = KeyframeMods[i + 1];
                    var finalEnd   = bakedPos.End;
                    var finalStart = bakedPos.Start;


                    //var dir = Vector3.Transform(asList[i].Start - asList[i].End, rotLowHzToLive);
                    //var finalEnd = asList[i].End + posLowHzToLive;
                    //var finalStart = finalEnd + (dir);

                    //UN - constrict
                    (finalStart, finalEnd) = UndoConstrict(finalStart, finalEnd, mod.Constrict);

                    //UN - Lerp
                    finalStart = XnaExtensions.GetLerpValARequiredForResult(CurrentPos.Start, finalStart, mod.DistanceLerp);
                    finalEnd   = XnaExtensions.GetLerpValARequiredForResult(CurrentPos.End, finalEnd, mod.DistanceLerp);



                    asList[i] = new DummyPolyBladePos()
                    {
                        Start   = finalStart,
                        End     = finalEnd,
                        Opacity = Opacity * asList[i].Opacity,
                    };
                }
                Keyframes = new Queue <DummyPolyBladePos>(asList);
            }