/// <summary> /// Calcule la matrice View actuellement vue par la caméra. /// </summary> /// <returns></returns> public Matrix ComputeView() { if (Position.Length() < Planet.AtmosphereRadius) { // Projection float aspectRatio = (float)Scene.Instance.ResolutionWidth / (float)Scene.Instance.ResolutionHeight; float fov = (float)Math.PI / 4.0f * aspectRatio * 0.75f;//0.75f;//3 / 4; Projection = Matrix.PerspectiveFovRH(fov, aspectRatio, 0.001f, 10f); } else { // Projection float aspectRatio = (float)Scene.Instance.ResolutionWidth / (float)Scene.Instance.ResolutionHeight; float fov = (float)Math.PI / 4.0f * aspectRatio * 0.75f;//0.75f;//0.75f;//3 / 4; Projection = Matrix.PerspectiveFovRH(fov, aspectRatio, 0.1f, 100f); } var view = Matrix.LookAtRH(m_position, m_position + m_front, m_up); Frustum = new Util.Frustum(view * Projection); return(view); }
/// <summary> /// Calcule la matrice View actuellement vue par la caméra. /// </summary> /// <returns></returns> public Matrix ComputeView() { if(Position.Length() < Planet.AtmosphereRadius) { // Projection float aspectRatio = (float)Scene.Instance.ResolutionWidth / (float)Scene.Instance.ResolutionHeight; float fov = (float)Math.PI / 4.0f * aspectRatio * 0.75f;//0.75f;//3 / 4; Projection = Matrix.PerspectiveFovRH(fov, aspectRatio, 0.001f, 10f); } else { // Projection float aspectRatio = (float)Scene.Instance.ResolutionWidth / (float)Scene.Instance.ResolutionHeight; float fov = (float)Math.PI / 4.0f * aspectRatio * 0.75f;//0.75f;//0.75f;//3 / 4; Projection = Matrix.PerspectiveFovRH(fov, aspectRatio, 0.1f, 100f); } var view = Matrix.LookAtRH(m_position, m_position + m_front, m_up); Frustum = new Util.Frustum(view * Projection); return view; }