matrix :: Matrix :: orthogonal
left, right, bottom, top, near, far
defines the world clip planes.
# Create an orthogonal projection matrix
#
# `left, right, bottom, top, near, far` defines the world clip planes.
new orthogonal(left, right, bottom, top, near, far: Float)
do
var dx = right - left
var dy = top - bottom
var dz = far - near
assert dx != 0.0 and dy != 0.0 and dz != 0.0
var mat = new Matrix.identity(4)
mat[0, 0] = 2.0 / dx
mat[3, 0] = -(right + left) / dx
mat[1, 1] = 2.0 / dy
mat[3, 1] = -(top + bottom) / dy
mat[2, 2] = 2.0 / dz
mat[3, 2] = -(near + far) / dz
return mat
end
lib/matrix/projection.nit:22,2--41,4