matrix :: Matrix :: perspective
Using the given vertical field_of_view_y
in radians, the aspect_ratio
and the near
/far
world distances.
# Create a perspective transformation matrix
#
# Using the given vertical `field_of_view_y` in radians, the `aspect_ratio`
# and the `near`/`far` world distances.
new perspective(field_of_view_y, aspect_ratio, near, far: Float)
do
var frustum_height = (field_of_view_y/2.0).tan * near
var frustum_width = frustum_height * aspect_ratio
return new Matrix.frustum(-frustum_width, frustum_width,
-frustum_height, frustum_height,
near, far)
end
lib/matrix/projection.nit:43,2--55,4