Esempio n. 1
0
        /// <summary>
        /// mtx is from camera to world space (a point in camera space)
        /// inverse is from world to camera space (a point in the world)
        /// </summary>
        public void GetModelViewMatrix(float frame, out Matrix mtx, out Matrix inverse)
        {
            CameraAnimationFrame f = GetAnimFrame(frame);
            Vector3 r = f.GetRotation(Type);
            Vector3 t = f.Pos;

            mtx     = Matrix.ReverseTransformMatrix(new Vector3(1.0f), r, t);
            inverse = Matrix.TransformMatrix(new Vector3(1.0f), r, t);
        }
Esempio n. 2
0
        public void SetCamera(ModelPanelViewport v, float frame, bool retainAspect)
        {
            ViewportProjection proj = (ViewportProjection)(int)ProjectionType;

            if (v.ViewType != proj)
            {
                v.SetProjectionType(proj);
            }

            GLCamera             cam = v.Camera;
            CameraAnimationFrame f   = GetAnimFrame(frame);

            cam.Reset();
            cam.Translate(f.Pos);

            Vector3 rotate = f.GetRotation(Type);

            cam.Rotate(rotate);

            float aspect = retainAspect ? cam.Aspect : f.Aspect;

            cam.SetProjectionParams(aspect, f.FovY, f.FarZ, f.NearZ);
        }
        private void RefreshPage()
        {
            if (_target != null)
            {
                _currentFrame = _target.GetAnimFrame(_currentPage);

                numPosX.Value = _currentFrame.Pos._x;
                numPosY.Value = _currentFrame.Pos._y;
                numPosZ.Value = _currentFrame.Pos._z;

                numRotX.Value = _currentFrame.Rot._x;
                numRotY.Value = _currentFrame.Rot._y;
                numRotZ.Value = _currentFrame.Rot._z;

                numAimX.Value = _currentFrame.Aim._x;
                numAimY.Value = _currentFrame.Aim._y;
                numAimZ.Value = _currentFrame.Aim._z;

                numTwist.Value = _currentFrame.Twist;
                numFovY.Value = _currentFrame.FovY;
                numHeight.Value = _currentFrame.Height;
                numAspect.Value = _currentFrame.Aspect;
                numNearZ.Value = _currentFrame.NearZ;
                numFarZ.Value = _currentFrame.FarZ;

                for (int i = 0; i < 15; i++)
                    UpdateBox(i);

                btnPrev.Enabled = _currentPage > 0;
                btnNext.Enabled = _currentPage < (_numFrames - 1);

                listKeyframes.SelectedIndex = FindKeyframe(_currentPage);
            }
        }
        private unsafe void btnCut_Click(object sender, EventArgs e)
        {
            CameraAnimationFrame frame = new CameraAnimationFrame();
            float* p = (float*)&frame;

            for (int i = 0; i < 15; i++)
            {
                p[i] = _transBoxes[2][i].Value;
                _transBoxes[2][i].Value = float.NaN;
                BoxChanged(_transBoxes[2][i], null);
            }

            _tempCameraFrame = frame;
        }
        private unsafe void btnCopy_Click(object sender, EventArgs e)
        {
            CameraAnimationFrame frame = new CameraAnimationFrame();
            float* p = (float*)&frame;

            for (int i = 0; i < 15; i++)
                p[i] = _transBoxes[2][i].Value;

            _tempCameraFrame = frame;
        }