Camera

The camera is used to calculate the viewing frustum in 3D space. All cameras inherit from the Camera class which itself is of the type Node3D and can be added to the scene graph.

Camera

class pysg.camera.Camera

Base class of all camera types used in pysg.

projection_matrix

The current projection matrix of the camera.

Returns:Projection matrix of camera in OpenGL format:

m00 m04 m08 m12

m01 m05 m09 m13

m02 m06 m10 m14

m03 m07 m11 m15

Return type:Matrix44

Perspective Camera

class pysg.camera.PerspectiveCamera(*, fov: float, aspect: float, near: float, far: float)

Camera which uses frustum for the projection matrix.

Parameters:
  • fov (float) – Vertical field of view for the perspective camera in degrees.
  • aspect (float) – Aspect ratio of camera sensor (with/height).
  • near (float) – Camera frustum near plane. Everything closer will be culled.
  • far (float) – Camera frustum far plane. Everything farther away will be culled.

Orthographic Camera

class pysg.camera.OrthographicCamera(*, left: float, right: float, top: float, bottom: float, near: float, far: float)

Camera using a box geometry for the projection matrix.

Parameters:
  • left (float) – Camera volume left (usually -screen_width/2).
  • right (float) – Camera volume right (usually screen_width/2).
  • top (float) – Camera volume top (usually screen_height/2).
  • bottom (float) – Camera volume bottom (usually -screen_height/2)..
  • near (float) – Camera frustum near plane. Everything closer will be culled.
  • far (float) – Camera frustum far plane. Everything farther away will be culled.