Beispiel #1
0
        public void DrawFrame(float time, bool render, bool lights)
        {
            if (lights)
            {
                GLContext.MakeCurrent();
            }

            GL.PushMatrix();

            GL.ClearColor(Program.ActiveProject.BackColor);

            GL.Clear(ClearBufferMask.ColorBufferBit);

            if (Program.Form_Main.PreviewCamera || render)
            {
                Camera.State state = (Camera.State)Program.ActiveProject.Layers[0].FindCurrentState(time);

                if (state == null)
                {
                    GLContext.SwapBuffers();
                    return;
                }

                GL.Translate(-state.Location.X * 1 / state.Scale, -state.Location.Y * 1 / state.Scale, 0.0f);
                GL.Scale(1 / state.Scale, 1 / state.Scale, 1.0);
                GL.Rotate(state.Angle, 1.0, 0.0, 0.0);
            }

            Program.ActiveProject.Draw(time, render, lights);

            GL.PopMatrix();

            GLContext.SwapBuffers();
        }
Beispiel #2
0
        PointF UnprojectMousePos(PointF location)
        {
            Camera.State state = (Camera.State)Program.ActiveProject.Layers[0].FindCurrentState(Program.MainTimeline.SelectedKeyframe.Time);

            PointF translate = Program.Form_Main.PreviewCamera ? state.Location : new PointF(0, 0);
            float  scale     = Program.Form_Main.PreviewCamera ? state.Scale : 1;
            float  angle     = Program.Form_Main.PreviewCamera ? state.Angle : 0;

            return(MathUtil.TranslatePoint(MathUtil.ScalePoint(MathUtil.Rotate(location, angle), scale), translate));
        }
Beispiel #3
0
        private void btn_cameraFitToCanvas_Click(object sender, EventArgs e)
        {
            if (Program.MainTimeline.SelectedKeyframe == null)
            {
                return;
            }
            if (Program.MainTimeline.SelectedKeyframe.State.GetType() != typeof(Camera.State))
            {
                return;
            }

            Camera.State state = Program.MainTimeline.SelectedKeyframe.State as Camera.State;

            state.Location = new PointF(0, 0);
            state.Scale    = 1.0f;

            Program.MainTimeline.GLContext.Invalidate();
        }