gamnit :: Camera :: mvp_matrix
This method should only be called by the display at the moment of drawing to the screen.
# The Model-View-Projection matrix created by this camera
#
# This method should only be called by the display at the moment
# of drawing to the screen.
fun mvp_matrix: Matrix is abstract
lib/gamnit/cameras.nit:34,2--38,35
redef fun mvp_matrix
do
var view = new Matrix.identity(4)
# Translate the world away from the camera
view.translate(-position.x, -position.y, -position.z)
# Rotate the camera, first by looking left or right, then up or down
view = view * rotation_matrix
# Use a projection matrix with a depth
var projection = new Matrix.perspective(field_of_view_y,
display.aspect_ratio, near, far)
return view * projection
end
lib/gamnit/cameras.nit:125,2--140,4
# The returned matrix must not be modified as it is cached.
redef fun mvp_matrix
do
var m = mvp_matrix_cache
if m == null or check_position_changed then
m = super
mvp_matrix_cache = m
end
return m
end
lib/gamnit/cameras_cache.nit:41,2--50,4
redef fun mvp_matrix
do
var view = new Matrix.identity(4)
# Translate the world away from the camera
view.translate(-position.x, -position.y, -position.z)
# Use a projection matrix with a depth
var projection = new Matrix.orthogonal(0.0, width, -height, 0.0, near, far)
return view * projection
end
lib/gamnit/cameras.nit:265,2--276,4
# The returned matrix must not be modified as it is cached.
redef fun mvp_matrix
do
var m = mvp_matrix_cache
if m == null or check_position_changed then
m = super
mvp_matrix_cache = m
end
return m
end
lib/gamnit/cameras_cache.nit:90,2--99,4
redef fun mvp_matrix
do
var m = mvp_matrix_cache
if m == null or check_position_changed then
m = create_mvp_matrix
mvp_matrix_cache = m
end
return m
end
lib/gamnit/depth/more_lights.nit:75,2--83,4