예제 #1
0
        public void CameraViewPositionTest()
        {
            var raw = new Raw.Components.Project.Camera()
            {
                CurrentStatus = new Raw.Components.Project.CurrentCameraState()
                {
                    CenterPosition = new Vector3(0, 10, 0),
                    Rotation       = new Vector3(0, 0, 0).ToRad(),
                    OffsetPosition = new Vector3(0, 0, -30)
                },
                InitialKeyFrame = new Raw.Components.Project.CameraKeyFrame()
                {
                    Interpolation = new Raw.Components.Project.CameraInterpolationImpl(),
                    Value         = new Raw.Components.Project.CameraState()
                },
                KeyFrames = new List <Raw.Components.Project.CameraKeyFrame>()
            };
            var conv = new Scallion.Internal.Converters.Project.CameraConverter(false);
            var dest = conv.Convert(raw);

            Assert.AreEqual(30, dest.CurrentStatus.Distance);
            Assert.AreEqual(raw.CurrentStatus.OffsetPosition, conv.ConvertBack(dest).CurrentStatus.OffsetPosition);
        }
예제 #2
0
        public void ModelViewPositionTest(Vector3 centerPos, float dist, Vector3 ang, Vector3 worldPos, Vector3 localPos)
        {
            var raw = new Raw.Components.Project.Camera()
            {
                CurrentStatus = new Raw.Components.Project.CurrentCameraState()
                {
                    CenterPosition = centerPos,
                    Rotation       = ang.ToRad(),
                    OffsetPosition = localPos
                },
                InitialKeyFrame = new Raw.Components.Project.CameraKeyFrame()
                {
                    Interpolation = new Raw.Components.Project.CameraInterpolationImpl(),
                    Value         = new Raw.Components.Project.CameraState()
                },
                KeyFrames = new List <Raw.Components.Project.CameraKeyFrame>()
            };
            var conv = new Scallion.Internal.Converters.Project.CameraConverter(true);
            var dest = conv.Convert(raw);

            Assert.AreEqual(dist, dest.CurrentStatus.Distance, 0.005f);
            localPos.AssertEquals(conv.ConvertBack(dest).CurrentStatus.OffsetPosition, 0.005f);
        }