camera module¶
- class camera.Camera(app, position=(0, 0, 4), yaw=-90, pitch=0)[source]¶
Bases:
objectFirst-person camera that handles view projection, movement, and rotation.
Provides matrix calculations for 3D scene rendering and user navigation.
- get_projection_matrix()[source]¶
Calculate perspective projection matrix.
- Returns:
Projection matrix for perspective transformation
- Return type:
mat4
- get_view_matrix()[source]¶
Calculate view matrix using camera position and orientation.
- Returns:
View matrix for transforming world coordinates to camera space
- Return type:
mat4
- move()[source]¶
Handle keyboard input for camera movement in 3D space.
Uses WASD for horizontal movement and QE for vertical movement.
- rotate()[source]¶
Update camera yaw and pitch based on mouse movement.
Applies sensitivity scaling and clamps pitch to prevent over-rotation.