Esempio n. 1
0
        void UpdateProjectionMatrix(float width, float height)
        {
            viewportWidth  = width;
            viewportHeight = height;

            double aspect = viewportWidth / viewportHeight;

            double nearHeight = camNear * Math.Tan(DMathUtil.DegreesToRadians(camFov / 2));
            double nearWidth  = nearHeight * aspect;

            //float offset = separation / planeDist * near / 2;

            frustumWidth  = nearWidth;
            frustumHeight = nearHeight;
            frustumZNear  = camNear;
            frustumZFar   = camFar;

            projMatrix = DMatrix.PerspectiveOffCenterRH(-nearWidth / 2, nearWidth / 2, -nearHeight / 2, nearHeight / 2, frustumZNear, frustumZFar);
        }