KeyboardCamera¶
Methods¶
-
KeyboardCamera.
__init__
(keys: moderngl_window.context.base.keys.BaseKeys, fov=60.0, aspect_ratio=1.0, near=1.0, far=100.0)[source]¶ Initialize the camera
- Parameters
keys (BaseKeys) – The key constants for the current window type
- Keyword Arguments
fov (float) – Field of view
aspect_ratio (float) – Aspect ratio
near (float) – near plane
far (float) – far plane
-
KeyboardCamera.
key_input
(key, action, modifiers) → None[source]¶ Process key inputs and move camera
- Parameters
key – The key
action – key action release/press
modifiers – key modifier states such as ctrl or shit
-
KeyboardCamera.
move_left
(activate) → None[source]¶ The camera should be continiously moving to the left.
- Parameters
activate (bool) – Activate or deactivate this state
-
KeyboardCamera.
move_right
(activate) → None[source]¶ The camera should be continiously moving to the right.
- Parameters
activate (bool) – Activate or deactivate this state
-
KeyboardCamera.
move_forward
(activate) → None[source]¶ The camera should be continiously moving forward.
- Parameters
activate (bool) – Activate or deactivate this state
-
KeyboardCamera.
move_backward
(activate) → None[source]¶ The camera should be continiously moving backwards.
- Parameters
activate (bool) – Activate or deactivate this state
-
KeyboardCamera.
move_up
(activate) → None[source]¶ The camera should be continiously moving up.
- Parameters
activate (bool) – Activate or deactivate this state
-
KeyboardCamera.
move_down
(activate)[source]¶ The camera should be continiously moving down.
- Parameters
activate (bool) – Activate or deactivate this state
Inherited Methods¶
-
KeyboardCamera.
set_position
(x, y, z) → None¶ Set the 3D position of the camera.
- Parameters
x (float) – x position
y (float) – y position
z (float) – z position
-
KeyboardCamera.
look_at
(vec=None, pos=None) → numpy.ndarray¶ Look at a specific point
Either
vec
orpos
needs to be supplied.- Keyword Arguments
vec (pyrr.Vector3) – position
pos (tuple/list) – list of tuple
[x, y, x]
/(x, y, x)
- Returns
Camera matrix
- Return type
numpy.ndarray