module Geode::MatrixProjections(T)
Overview
Provides methods to construct 4x4 projection matrices.
A note about notation:
rh
means righhanded and lh
means lefthanded.
These indicate whether the matrix will be generated for right or lefthanded coordinate systems.
no
means "negative one to one" and zo
means "zero to one".
This indicates whether the zcoordinate will be normalized to (1..1)
or (0..1)
respectively.
If a 3D method does not have either of these tokens, then the method uses the default configuration.
The default configuration is controlled by compiler flags.
Righthanded orientation with normalization between 1 and 1 is the default (common in OpenGL).
Specify Dleft_handed
to use a lefthanded system.
Specify Dz_zero_one
to normalize zcoordinates to between 0 and 1.
This module should be extended.
Defined in:
geode/matrices/projections.crInstance Method Summary

#ortho(left : T, right : T, bottom : T, top : T, near : T, far : T) : self
Creates a 3D orthographic projection matrix.

#ortho(left : T, right : T, bottom : T, top : T) : self
Creates a 2D orthographic projection matrix.

#ortho_lh_no(left : T, right : T, bottom : T, top : T, near : T, far : T) : self
Creates a 3D orthographic projection matrix.

#ortho_lh_zo(left : T, right : T, bottom : T, top : T, near : T, far : T) : self
Creates a 3D orthographic projection matrix.

#ortho_rh_no(left : T, right : T, bottom : T, top : T, near : T, far : T) : self
Creates a 3D orthographic projection matrix.

#ortho_rh_zo(left : T, right : T, bottom : T, top : T, near : T, far : T) : self
Creates a 3D orthographic projection matrix.

#perspective(fov : Number  Angle, aspect : T, near : T, far : T) : self
Creates a 3D perspective projection matrix.

#perspective_lh_no(fov : Number  Angle, aspect : T, near : T, far : T) : self
Creates a 3D perspective projection matrix.

#perspective_lh_zo(fov : Number  Angle, aspect : T, near : T, far : T) : self
Creates a 3D perspective projection matrix.

#perspective_rh_no(fov : Number  Angle, aspect : T, near : T, far : T) : self
Creates a 3D perspective projection matrix.

#perspective_rh_zo(fov : Number  Angle, aspect : T, near : T, far : T) : self
Creates a 3D perspective projection matrix.
Instance Method Detail
Creates a 3D orthographic projection matrix.
Each argument is the distance to its respective clip plane. left and right represent the distance along the xaxis, bottom and top along the yaxis, and near and far along the zaxis.
The handedness and zcoordinate normalization are controlled by compiler flags.
Righthanded orientation with normalization between 1 and 1 is the default (common in OpenGL).
Specify Dleft_handed
to use a lefthanded system.
Specify Dz_zero_one
to normalize zcoordinates to between 0 and 1.
Matrix4F.ortho(400, 400, 300, 300, 0.1, 100)
Creates a 2D orthographic projection matrix.
Matrix4F.ortho(400, 400, 300, 300)
Creates a 3D orthographic projection matrix.
Each argument is the distance to its respective clip plane. left and right represent the distance along the xaxis, bottom and top along the yaxis, and near and far along the zaxis.
The matrix produced is for lefthanded systems. The zcoordinate is normalized to the range 1 to 1.
Matrix4F.ortho_lh_no(400, 400, 300, 300, 0.1, 100)
Creates a 3D orthographic projection matrix.
Each argument is the distance to its respective clip plane. left and right represent the distance along the xaxis, bottom and top along the yaxis, and near and far along the zaxis.
The matrix produced is for lefthanded systems. The zcoordinate is normalized to the range 0 to 1.
Matrix4F.ortho_lh_zo(400, 400, 300, 300, 0.1, 100)
Creates a 3D orthographic projection matrix.
Each argument is the distance to its respective clip plane. left and right represent the distance along the xaxis, bottom and top along the yaxis, and near and far along the zaxis.
The matrix produced is for righthanded systems. The zcoordinate is normalized to the range 1 to 1.
Matrix4F.ortho_rh_no(400, 400, 300, 300, 0.1, 100)
Creates a 3D orthographic projection matrix.
Each argument is the distance to its respective clip plane. left and right represent the distance along the xaxis, bottom and top along the yaxis, and near and far along the zaxis.
The matrix produced is for righthanded systems. The zcoordinate is normalized to the range 0 to 1.
Matrix4F.ortho_rh_zo(400, 400, 300, 300, 0.1, 100)
Creates a 3D perspective projection matrix.
fov is the vertical fieldofview.
It must be a Number
in radians or an Angle
(any unit).
The aspect defines the ratio of width to height.
For instance, if the display is 16:9, then aspect should be 16 / 9
.
Alternatively, just provide the screen width divided by the height (1920 / 1080
).
The near and far arguments control the normalization of zcoordinates. far is the distance to the far clip plane and near is the distance to the near clip plane.
The handedness and zcoordinate normalization are controlled by compiler flags.
Righthanded orientation with normalization between 1 and 1 is the default (common in OpenGL).
Specify Dleft_handed
to use a lefthanded system.
Specify Dz_zero_one
to normalize zcoordinates to between 0 and 1.
Matrix4F.perspective(90.degrees, 800 / 600, 0.1, 100)
Creates a 3D perspective projection matrix.
fov is the vertical fieldofview.
It must be a Number
in radians or an Angle
(any unit).
The aspect defines the ratio of width to height.
For instance, if the display is 16:9, then aspect should be 16 / 9
.
Alternatively, just provide the screen width divided by the height (1920 / 1080
).
The near and far arguments control the normalization of zcoordinates. far is the distance to the far clip plane and near is the distance to the near clip plane.
The matrix produced is for lefthanded systems. The zcoordinate is normalized to the range 1 to 1.
Matrix4F.perspective_lh_no(90.degrees, 800 / 600, 0.1, 100)
Creates a 3D perspective projection matrix.
fov is the vertical fieldofview.
It must be a Number
in radians or an Angle
(any unit).
The aspect defines the ratio of width to height.
For instance, if the display is 16:9, then aspect should be 16 / 9
.
Alternatively, just provide the screen width divided by the height (1920 / 1080
).
The near and far arguments control the normalization of zcoordinates. far is the distance to the far clip plane and near is the distance to the near clip plane.
The matrix produced is for lefthanded systems. The zcoordinate is normalized to the range 0 to 1.
Matrix4F.perspective_lh_zo(90.degrees, 800 / 600, 0.1, 100)
Creates a 3D perspective projection matrix.
fov is the vertical fieldofview.
It must be a Number
in radians or an Angle
(any unit).
The aspect defines the ratio of width to height.
For instance, if the display is 16:9, then aspect should be 16 / 9
.
Alternatively, just provide the screen width divided by the height (1920 / 1080
).
The near and far arguments control the normalization of zcoordinates. far is the distance to the far clip plane and near is the distance to the near clip plane.
The matrix produced is for righthanded systems. The zcoordinate is normalized to the range 1 to 1.
Matrix4F.perspective_rh_no(90.degrees, 800 / 600, 0.1, 100)
Creates a 3D perspective projection matrix.
fov is the vertical fieldofview.
It must be a Number
in radians or an Angle
(any unit).
The aspect defines the ratio of width to height.
For instance, if the display is 16:9, then aspect should be 16 / 9
.
Alternatively, just provide the screen width divided by the height (1920 / 1080
).
The near and far arguments control the normalization of zcoordinates. far is the distance to the far clip plane and near is the distance to the near clip plane.
The matrix produced is for righthanded systems. The zcoordinate is normalized to the range 0 to 1.
Matrix4F.perspective_rh_zo(90.degrees, 800 / 600, 0.1, 100)