示例#1
0
        public Camera(Vector3 position, Vector3 lookAt, float focalLength, float screenWidth, float screenHeight)
        {
            Position     = position;
            LookAt       = lookAt;
            FocalLength  = focalLength;
            ScreenWidth  = screenWidth;
            ScreenHeight = screenHeight;

            Vector3 relPos = position - lookAt;
            float   dist   = Vector3.Distance(position, lookAt);

            sphericalPosition = new Vector3(dist, XMath.Acos(relPos.Y / dist), XMath.Atan2(relPos.Z, relPos.X));
        }