Fusion.Engine.Graphics.Camera.GetProjectionMatrix C# (CSharp) Method

GetProjectionMatrix() public method

Gets projection matrix for given stereo eye.
public GetProjectionMatrix ( StereoEye stereoEye ) : System.Matrix
stereoEye StereoEye
return System.Matrix
		public Matrix GetProjectionMatrix ( StereoEye stereoEye )
		{
			if (stereoEye==StereoEye.Mono) return projMatrix;
			if (stereoEye==StereoEye.Left) return projMatrixL;
			if (stereoEye==StereoEye.Right) return projMatrixR;
			throw new ArgumentException("stereoEye");
		}

Usage Example

Example #1
0
        /// <summary>
        /// Renders sky with specified technique
        /// </summary>
        /// <param name="rendCtxt"></param>
        /// <param name="techName"></param>
        internal void Render(Camera camera, StereoEye stereoEye, HdrFrame frame, SkySettings settings)
        {
            using (new PixEvent("Sky Rendering")) {
                var scale    = Matrix.Scaling(settings.SkySphereSize);
                var rotation = Matrix.Identity;

                var sunPos   = settings.SunPosition;
                var sunColor = settings.SunGlowColor;

                device.ResetStates();

                //rs.DepthStencilState = depthBuffer==null? DepthStencilState.None : DepthStencilState.Default ;

                device.SetTargets(frame.DepthBuffer.Surface, frame.HdrBuffer.Surface);

                var viewMatrix = camera.GetViewMatrix(stereoEye);
                var projMatrix = camera.GetProjectionMatrix(stereoEye);

                skyConstsData.MatrixWVP    = scale * rotation * MathUtil.Transformation(viewMatrix.Right, viewMatrix.Up, viewMatrix.Backward) * projMatrix;
                skyConstsData.SunPosition  = sunPos;
                skyConstsData.SunColor     = sunColor;
                skyConstsData.Turbidity    = settings.SkyTurbidity;
                skyConstsData.Temperature  = Temperature.Get(settings.SunTemperature);
                skyConstsData.SkyIntensity = settings.SkyIntensity;

                skyConstsCB.SetData(skyConstsData);

                device.VertexShaderConstants[0] = skyConstsCB;
                device.PixelShaderConstants[0]  = skyConstsCB;


                //
                //	Sky :
                //
                SkyFlags flags = SkyFlags.SKY;

                ApplyColorSpace(ref flags, settings);

                device.PipelineState = factory[(int)flags];

                device.SetupVertexInput(skyVB, null);
                device.Draw(skyVB.Capacity, 0);

                device.ResetStates();
            }
        }
All Usage Examples Of Fusion.Engine.Graphics.Camera::GetProjectionMatrix