gamnit :: Camera :: defaultinit
gamnit :: Camera :: mvp_matrix
The Model-View-Projection matrix created by this cameracore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
gamnit :: Camera :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
gamnit :: Camera :: mvp_matrix
The Model-View-Projection matrix created by this cameracore :: Object :: output_class_name
Display class name on stdout (debug only).pitch, yaw, roll
)
# A camera with a point of view on the world
abstract class Camera
# TODO make this a physical object in the world
# The host `GamnitDisplay`
var display: GamnitDisplay
# Position of this camera in world space
var position = new Point3d[Float](0.0, 0.0, 0.0)
# 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
end
lib/gamnit/cameras.nit:23,1--39,3
redef class Camera
private var mvp_matrix_cache: nullable Matrix = null
private var position_cache = new Point3d[Float](0.0, 0.0, 0.0)
# Has `position` changed from `position_cache`? Update the cache at the same time
private fun check_position_changed: Bool
do
if position.x != position_cache.x or
position.y != position_cache.y or
position.z != position_cache.z then
position_cache.x = position.x
position_cache.y = position.y
position_cache.z = position.z
return true
end
return false
end
end
lib/gamnit/cameras_cache.nit:20,1--38,3