Unit CastleProjection

Description

Projection parameters (TProjection).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Record TProjection Projection determines how does the 3D world map onto 2D screen.

Functions and Procedures

function AdjustViewAngleDegToAspectRatio(const FirstViewAngleDeg, SecondToFirstRatio: Single): Single; deprecated 'use radians for everything throughout CGE';
function AdjustViewAngleRadToAspectRatio(const FirstViewAngleRad, SecondToFirstRatio: Single): Single;
function OrthoProjectionMatrix(const Dimensions: TFloatRectangle; const ZNear, ZFar: Single): TMatrix4; overload;
function OrthoProjectionMatrix(const left, right, bottom, top, ZNear, ZFar: Single): TMatrix4; overload; deprecated 'use the overloaded version that takes Dimensions as TFloatRectangle';
function Ortho2DProjectionMatrix(const Dimensions: TFloatRectangle): TMatrix4; overload; deprecated 'just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance';
function Ortho2DProjectionMatrix(const left, right, bottom, top: Single): TMatrix4; overload; deprecated 'just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance';
function FrustumProjectionMatrix(const Dimensions: TFloatRectangle; const ZNear, ZFar: Single): TMatrix4; overload;
function FrustumProjectionMatrix(const left, right, bottom, top, ZNear, ZFar: Single): TMatrix4; overload; deprecated 'use the overloaded version that takes Dimensions as TFloatRectangle';
function PerspectiveProjectionMatrixDeg(const fovyDeg, aspect, ZNear, ZFar: Single): TMatrix4;
function PerspectiveProjectionMatrixRad(const fovyRad, aspect, ZNear, ZFar: Single): TMatrix4;
function ProjectionTypeToStr(const ProjectionType: TProjectionTypeCore): String;

Types

TProjectionTypeCore = (...);
TProjectionType = ptOrthographic .. ptPerspective;

Constants

ZFarInfinity = 0.0;

Description

Functions and Procedures

function AdjustViewAngleDegToAspectRatio(const FirstViewAngleDeg, SecondToFirstRatio: Single): Single; deprecated 'use radians for everything throughout CGE';

Warning: this symbol is deprecated: use radians for everything throughout CGE

Calculate second viewing angle for perspective projection. Given one viewing angle of the camera (FirstViewAngleDeg) and aspect ratio of your window sizes (SecondToFirstRatio), calculate second viewing angle of the camera.

The intention is that when projecting camera view (with given view angles) on a screen with given aspect ratio), the image will not be distorted (squeezed horizontally or vertically).

For the "Deg" version both angles (given and returned) are in degress, for the "Rad" version both angles and in radians.

function AdjustViewAngleRadToAspectRatio(const FirstViewAngleRad, SecondToFirstRatio: Single): Single;

This item has no description.

function OrthoProjectionMatrix(const Dimensions: TFloatRectangle; const ZNear, ZFar: Single): TMatrix4; overload;

Functions to create 4x4 matrices used in 3D graphics for projection. That are equivalent to OpenGL glOrtho, glFrustum, gluPerspective.

The frustum and pespective generation (routines FrustumProjectionMatrix, PerspectiveProjectionMatrixDeg, PerspectiveProjectionMatrixRad) accept also a special value ZFarInfinity as the ZFar parameter. Then you get perspective projection matrix withour far clipping plane, which is very useful for the z-fail shadow volumes technique.

function OrthoProjectionMatrix(const left, right, bottom, top, ZNear, ZFar: Single): TMatrix4; overload; deprecated 'use the overloaded version that takes Dimensions as TFloatRectangle';

Warning: this symbol is deprecated: use the overloaded version that takes Dimensions as TFloatRectangle

This item has no description.

function Ortho2DProjectionMatrix(const Dimensions: TFloatRectangle): TMatrix4; overload; deprecated 'just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance';

Warning: this symbol is deprecated: just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance

This item has no description.

function Ortho2DProjectionMatrix(const left, right, bottom, top: Single): TMatrix4; overload; deprecated 'just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance';

Warning: this symbol is deprecated: just use OrthoProjectionMatrix, the 2D optimization is not really worth the maintenance

This item has no description.

function FrustumProjectionMatrix(const Dimensions: TFloatRectangle; const ZNear, ZFar: Single): TMatrix4; overload;

This item has no description.

function FrustumProjectionMatrix(const left, right, bottom, top, ZNear, ZFar: Single): TMatrix4; overload; deprecated 'use the overloaded version that takes Dimensions as TFloatRectangle';

Warning: this symbol is deprecated: use the overloaded version that takes Dimensions as TFloatRectangle

This item has no description.

function PerspectiveProjectionMatrixDeg(const fovyDeg, aspect, ZNear, ZFar: Single): TMatrix4;

This item has no description.

function PerspectiveProjectionMatrixRad(const fovyRad, aspect, ZNear, ZFar: Single): TMatrix4;

This item has no description.

function ProjectionTypeToStr(const ProjectionType: TProjectionTypeCore): String;

This item has no description.

Types

TProjectionTypeCore = (...);

Projection type, used by TProjection.ProjectionType.

Values
  • ptOrthographic
  • ptPerspective
  • ptFrustum
TProjectionType = ptOrthographic .. ptPerspective;

This item has no description.

Constants

ZFarInfinity = 0.0;

Special value that you can pass to various perspective-projection functions with the intention to set far plane at infinity. These functions include like FrustumProjectionMatrix, PerspectiveProjectionMatrixDeg, PerspectiveProjectionMatrixRad, PerspectiveProjection. You can pass ZFarInfinity as their ZFar parameter value.

Implementation note: It would be "cooler" to define this constant as Math.Infinity, but operating on Math.Infinity requires unnecessary turning off of some compiler checks. The point was only to have some special ZFar value, so 0 is as good as Infinity.


Generated by PasDoc 0.16.0-snapshot.