Ejemplo n.º 1
0
        public override void Initialize()
        {
            KeyFrameControl.Initialize();

            BackgroundColor = Color.CornflowerBlue;
            Camera = new EditorCamera(new Vector3(12, 12, 12), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
            RailCamera = new RailCamera(new Vector3(2, 4, 1), new Vector3(0, 0, 0), new Vector3(0, 1, 0));

            base.Initialize();
        }
Ejemplo n.º 2
0
        public static RailCamera Parse(String[] input)
        {
            RailCamera camera = new RailCamera(Vector3.UnitZ, Vector3.Zero, Vector3.UnitY);

            int keyFrameIndex = 0;
            var keyFrameControl = Editor.Instance.KeyFrameControl;
            for (int i = 0; i < input.Length; ++i)
            {
                var line = input[i];
                string[] tokens = line.Split(' ');

                if (tokens[0].StartsWith("keyframe"))
                {
                    keyFrameIndex = int.Parse( tokens[0].Substring("keyframe".Length) );
                    keyFrameControl.InsertKeyFrame(camera.model, keyFrameIndex);
                    keyFrameControl.InsertKeyFrame(camera.focusModel, keyFrameIndex);
                }
                if (tokens[0] == "eye") keyFrameControl.SetTransformation(camera.model, keyFrameIndex, Transformation.CreateTranslation(ParseHelper.ParseVector3(tokens[1])));
                if (tokens[0] == "focus") keyFrameControl.SetTransformation(camera.focusModel, keyFrameIndex, Transformation.CreateTranslation(ParseHelper.ParseVector3(tokens[1])));
            }

            return camera;
        }