예제 #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);
        }
예제 #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);
        }