Skip to content

2. Setting the transform data

theproadam edited this page Apr 5, 2020 · 3 revisions

To display an image. renderXF needs to know what kind of projection it should use. renderXF supports only orthographic or perspective projection.

Basic projection

renderXF can take custom vertical and horizontal FOV/Size, or it can take a global FOV/Size. For a global FOV/Size renderXF will automatically scale the hFOV/hSize through the render aspect ratio.

//Global FOV/Size
GL.SetMatrixData(FOV, Size);

//Individual FOV/Size
GL.SetMatrixData(hFOV, vFOV, hSize, vSize);

Interpolating perspective and orthographic

renderXF also allows you to interpolate between two projections. Using the i value from the SetMatrixData() function, the perspective can be interpolated.

GL.SetMatrixData(FOV, Size, 1f);  // Orthographic
GL.SetMatrixData(FOV, Size, 0f);  // Perspective
GL.SetMatrixData(FOV, Size, 0.5f);// In between
WARNING: Leaving the i value at near 1 can introduce floating point precision errors. It is recommended to either have it at 0 or 1.

Built in camera transformations

For performance reasons, by default renderXF will automatically handle the camera position and rotation vectors. These vectors can be set via the ForceCameraPosition() and ForceCameraRotation() functions.

GL.ForceCameraPosition(new Vector3(0, 0, 0)); //Set camera position
GL.ForceCameraRotation(new Vector3(0, 0, 0)); //Set camera rotation
Please note that the renderXF camera transform system can always be overwritten in the shader config.
Clone this wiki locally