camera
FreeBodyEngine.core.camera
#
CAMERA_PROJECTION
#
Camera(projection, background_color, zoom)
#
Mixin holding the projection/background/matrix state shared by
Camera2D and Camera3D - always used alongside a Node2D/Node3D
base (see those classes), never on its own.
Stores the camera's settings and sets view_matrix/proj_matrix
to identity until the first matrix update runs.
Camera2D(position=Vector(), zoom=250, rotation=0, projection=CAMERA_PROJECTION.ORTHOGRAPHIC, background_color=Color('#060e08'))
#
A generic camera object. The camera doesn't draw anything, its only purpose is to provide matricies to the renderer.
:param position: The world position of the camera. :type position: vector
:param zoom: The zoom of the camera. The larger the zoom value, the larger the image. :type zoom: float
:param rotation: The rotation of the camera around the Z axis. :type rotation: float
:param background_color: The color that the background of the screen will be set to. :type background_color: Color
Initializes both the Node2D and Camera halves of this
object, since Camera2D doesn't use a single cooperative
super().__init__() chain.
on_initialize()
#
Builds the initial projection and view matrices once the camera
is attached to the scene tree (and so has a world_transform).
update()
#
Updates the node tree as usual, then rebuilds both matrices every frame so the camera tracks window resizes and its own movement/rotation/zoom without needing an explicit invalidation.
Camera3D(position=Vector3(), rotation=Vector3(), zoom=1.0, projection=CAMERA_PROJECTION.PERSPECTIVE, background_color=Color('#324848'))
#
A 3D counterpart to Camera2D.
Initializes both the Node3D and Camera halves of this
object, since Camera3D doesn't use a single cooperative
super().__init__() chain.
on_initialize()
#
Builds the initial projection and view matrices once the camera
is attached to the scene tree (and so has a world_transform).
update()
#
Updates the node tree as usual, then rebuilds both matrices every frame so the camera tracks window resizes and its own movement/rotation/zoom without needing an explicit invalidation.