Camera
- moderngl_window.scene.Camera[source]
Simple camera class containing projection.
# create a camera camera = Camera(fov=60.0, aspect_ratio=1.0, near=1.0, far=100.0) # Get the current camera matrix as numpy array print(camera.matrix) # Get projection matrix as numpy array print(camera.projection.matrix)
Methods
- Camera.__init__(fov=60.0, aspect_ratio=1.0, near=1.0, far=100.0)[source]
Initialize camera using a specific projection
- Keyword Arguments:
fov (float) – Field of view
aspect_ratio (float) – Aspect ratio
near (float) – Near plane
far (float) – Far plane
- Camera.set_position(x, y, z) None [source]
Set the 3D position of the camera.
- Parameters:
x (float) – x position
y (float) – y position
z (float) – z position
Attributes
- Camera.pitch
The current pitch angle.
- Type:
float
- Camera.yaw
The current yaw angle.
- Type:
float
- Camera.matrix
The current view matrix for the camera
- Type:
numpy.ndarray
- Camera.projection
The 3D projection
- Type: