![]() |
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
|
Class representing the Director. More...
#include <director.h>
Inheritance diagram for BlamDirector:
Collaboration diagram for BlamDirector:Public Member Functions | |
| BlamDirector () | |
| Initializes the camera. More... | |
| ~BlamDirector () | |
| Destroys the camera. More... | |
| void | OnNewFrameEvent (NewFrameEvent *event) override |
| void | OnTickEvent (TickEvent *event) override |
| void | OnMouseMoveEvent (MouseMoveEvent *event) override |
| void | OnMouseClickEvent (MouseClickEvent *event) override |
| void | OnKeyPressEvent (KeyPressEvent *event) override |
| BlamVector3 | MoveCamera (BlamDirection direction, float acceleration) |
| Moves the camera one "step" in the given direction. More... | |
| void | ValidateCameraCoords () |
If auto_verify_coords is set to true, this will verify all camera coordinates. More... | |
| void | CalculateCameraAngles () |
| void | SetCameraSpeed (float _speed) |
| Sets the camera's speed, while also sending a log message indicating that the speed has been changed. More... | |
Public Attributes | |
| BlamVector3 | camera_pos = BlamVector3() |
| The current position of the camera. More... | |
| BlamVector3 | camera_angle = BlamVector3() |
| The current looking angle of the camera. X is yaw, Y is pitch, Z is roll (unused atm). More... | |
| bool | auto_verify_coords = true |
Whether or not camera_front and camera_right should be automatically calculated. More... | |
| BlamVector3 | camera_front = BlamVector3() |
| The calculated point representing the front of the camera. More... | |
| BlamVector3 | camera_right = BlamVector3() |
| The calculated point representing the right of the camera. More... | |
| bool | mouse_capture_ready = false |
| Whether or not the mouse is ready to be captured. More... | |
| int | mouse_capture_delay_ticks = 3 |
| The remaining number of game ticks to wait before truly capturing the mouse. More... | |
| bool | mouse_captured = false |
| Whether or not the mouse is currently being captured by the camera. More... | |
| float | fov = 70.0f |
| The camera's current field of view. More... | |
| float | fov_normal = 70.0f |
| The camera's default field of view. More... | |
| float | fov_zoomed = 20.0f |
| The camera's field of view while zoomed in. More... | |
| float | speed = 1.0f |
| The camera's current speed. More... | |
| float | zoom_increment_count = 30 |
| The number of steps/increments to use when zooming in and out. Lower numbers will cause the camera to zoom faster. More... | |
| bool | lock_camera = false |
| Whether or not the camera is locked. If locked, all keyboard/mouse input is ignored. More... | |
| bool | pancam = true |
| Whether or not the camera is currently in pan-cam mode. Pan-cam locks Z movement of the camera when not moving up/down. More... | |
| bool | pancam_lock_xy = false |
| Whether or not the camera should be locked to X/Y axis when in pan-cam mode. More... | |
| bool | move_acceleration = true |
| Whether or not camera movements should use acceleration. More... | |
| bool | look_acceleration = false |
| Whether or not camera looking should use acceleration. More... | |
| float | accel_increment_count = 30 |
| The number of steps/increments to use when accelerating and decelerating. Lower numbers will cause the camera to accelerate faster. More... | |
| bool | camera_bouncing = true |
| Whether or not the camera should have a bounce/rubber effect when moving and looking around. More... | |
| bool | zoomed = false |
| Whether or not the camera is currently zoomed in. More... | |
| float | look_sensetivity_vertical = 0.35f |
| The camera's vertical look sensetivity. More... | |
| float | look_sensetivity_horizontal = 0.7f |
| The camera's horizontal look sensetivity. More... | |
| bool | persistent_look_motion = false |
| Whether or not to use persistent camera look motion. Only applies when using tick based looking. More... | |
| bool | tick_based_looking = false |
| Whether or not camera looking should be driven by the game tick. More... | |
| bool | calculate_angle = true |
| float | horizontal_angle = 0.0f |
| float | vertical_angle = 0.0f |
| float | near_clip_plane_distance = 0.1f |
| float | far_clip_plane_distance = 100.0f |
| bool | enable_movement_spring = true |
| Whether or not movement springiness is enabled. Gives camera movement a subtle "bounciness". More... | |
| float | spring_stiffness = 0.3f |
Spring stiffness for camera movement. Only used when enable_movement_spring is true. More... | |
| float | damping = 0.6f |
Spring damping for camera movement. Only used when enable_movement_spring is true. More... | |
| float | movement_spring_scale = 1.0f |
Scale factor to use when calculating movement springiness. Only used when enable_movement_spring is true. More... | |
| bool | enable_look_spring = true |
| Whether or not look springiness is enabled. Gives camera rotation a subtle "bounciness". More... | |
| float | look_spring_stiffness = 0.3f |
Spring stiffness for camera rotation. Only used when enable_look_spring is true. More... | |
| float | look_damping = 0.6f |
Spring damping for camera rotation. Only used when enable_look_spring is true. More... | |
| float | look_accel_rate = 0.3f |
Acceleration rate to use when rotating camera. Only used when enable_look_spring is true. More... | |
| bool | enable_zoom_spring = true |
| Whether or not zoom springiness is enabled. Gives camera zooming a subtle "bounciness". More... | |
| float | fov_spring_stiffness = 0.05f |
Spring stiffness for camera zooming. Only used when enable_zoom_spring is true. More... | |
| float | fov_damping = 0.8f |
Spring damping for camera zooming. Only used when enable_zoom_spring is true. More... | |
| float | fov_spring_scale = 0.45f |
Scale factor to use when calculating zoom springiness. Only used when enable_zoom_spring is true. More... | |
Class representing the Director.
The Director is the default flying camera the engine uses. In normal gameplay, the camera would be disabled and instead camera behavior would be defined by a camera_track tag instead.
Normally we wouldn't use a class for something that will only ever have one instance, but we need to be able to listen for specific events - so using a class here is the only way to (comfortably) do that.
| BlamDirector::BlamDirector | ( | ) |
Initializes the camera.
Here is the call graph for this function:| BlamDirector::~BlamDirector | ( | ) |
Destroys the camera.
| void BlamDirector::CalculateCameraAngles | ( | ) |
Here is the caller graph for this function:| BlamVector3 BlamDirector::MoveCamera | ( | BlamDirection | direction, |
| float | acceleration | ||
| ) |
Moves the camera one "step" in the given direction.
The way the camera moves depends on whether pan-cam is enabled, as well as whether X/Y axis locking is enabled. If pan-cam is disabled, all movements are relative to where the camera is looking. If pan-cam is enabled, the Z axis is locked when not explicitly moving Up and Down. If the X/Y axis lock is enabled, then the camera will move along the axis that is being most looked at (while still ignoring Z axis except for up/down movement).
| direction | - The direction to move the camera. |
| accel_direction | - The direction to pull acceleration values from. This should usually be the same as direction. |
| acceleration | - The level of acceleration to use when moving the camera. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
override |
Here is the call graph for this function:
|
override |
|
override |
Here is the call graph for this function:
|
override |
Here is the call graph for this function:
|
override |
Here is the call graph for this function:| void BlamDirector::SetCameraSpeed | ( | float | _speed | ) |
Sets the camera's speed, while also sending a log message indicating that the speed has been changed.
| _speed | - The new camera speed. |
Here is the call graph for this function:
Here is the caller graph for this function:| void BlamDirector::ValidateCameraCoords | ( | ) |
If auto_verify_coords is set to true, this will verify all camera coordinates.
It will ensure that yaw bounds are clamped from 0 to 360, that pitch is clamped from -90 to 90 (full 180 degrees up/down), and will use those values to calculate the appropriate vectors used to change where the camera is actually looking (camera_front, camera_right).
Here is the caller graph for this function:| float BlamDirector::accel_increment_count = 30 |
The number of steps/increments to use when accelerating and decelerating. Lower numbers will cause the camera to accelerate faster.
| bool BlamDirector::auto_verify_coords = true |
Whether or not camera_front and camera_right should be automatically calculated.
| bool BlamDirector::calculate_angle = true |
| BlamVector3 BlamDirector::camera_angle = BlamVector3() |
The current looking angle of the camera. X is yaw, Y is pitch, Z is roll (unused atm).
| bool BlamDirector::camera_bouncing = true |
Whether or not the camera should have a bounce/rubber effect when moving and looking around.
| BlamVector3 BlamDirector::camera_front = BlamVector3() |
The calculated point representing the front of the camera.
| BlamVector3 BlamDirector::camera_pos = BlamVector3() |
The current position of the camera.
| BlamVector3 BlamDirector::camera_right = BlamVector3() |
The calculated point representing the right of the camera.
| float BlamDirector::damping = 0.6f |
Spring damping for camera movement. Only used when enable_movement_spring is true.
| bool BlamDirector::enable_look_spring = true |
Whether or not look springiness is enabled. Gives camera rotation a subtle "bounciness".
| bool BlamDirector::enable_movement_spring = true |
Whether or not movement springiness is enabled. Gives camera movement a subtle "bounciness".
| bool BlamDirector::enable_zoom_spring = true |
Whether or not zoom springiness is enabled. Gives camera zooming a subtle "bounciness".
| float BlamDirector::far_clip_plane_distance = 100.0f |
| float BlamDirector::fov = 70.0f |
The camera's current field of view.
| float BlamDirector::fov_damping = 0.8f |
Spring damping for camera zooming. Only used when enable_zoom_spring is true.
| float BlamDirector::fov_normal = 70.0f |
The camera's default field of view.
| float BlamDirector::fov_spring_scale = 0.45f |
Scale factor to use when calculating zoom springiness. Only used when enable_zoom_spring is true.
| float BlamDirector::fov_spring_stiffness = 0.05f |
Spring stiffness for camera zooming. Only used when enable_zoom_spring is true.
| float BlamDirector::fov_zoomed = 20.0f |
The camera's field of view while zoomed in.
| float BlamDirector::horizontal_angle = 0.0f |
| bool BlamDirector::lock_camera = false |
Whether or not the camera is locked. If locked, all keyboard/mouse input is ignored.
| float BlamDirector::look_accel_rate = 0.3f |
Acceleration rate to use when rotating camera. Only used when enable_look_spring is true.
| bool BlamDirector::look_acceleration = false |
Whether or not camera looking should use acceleration.
| float BlamDirector::look_damping = 0.6f |
Spring damping for camera rotation. Only used when enable_look_spring is true.
| float BlamDirector::look_sensetivity_horizontal = 0.7f |
The camera's horizontal look sensetivity.
| float BlamDirector::look_sensetivity_vertical = 0.35f |
The camera's vertical look sensetivity.
| float BlamDirector::look_spring_stiffness = 0.3f |
Spring stiffness for camera rotation. Only used when enable_look_spring is true.
| int BlamDirector::mouse_capture_delay_ticks = 3 |
The remaining number of game ticks to wait before truly capturing the mouse.
| bool BlamDirector::mouse_capture_ready = false |
Whether or not the mouse is ready to be captured.
| bool BlamDirector::mouse_captured = false |
Whether or not the mouse is currently being captured by the camera.
| bool BlamDirector::move_acceleration = true |
Whether or not camera movements should use acceleration.
| float BlamDirector::movement_spring_scale = 1.0f |
Scale factor to use when calculating movement springiness. Only used when enable_movement_spring is true.
| float BlamDirector::near_clip_plane_distance = 0.1f |
| bool BlamDirector::pancam = true |
Whether or not the camera is currently in pan-cam mode. Pan-cam locks Z movement of the camera when not moving up/down.
| bool BlamDirector::pancam_lock_xy = false |
Whether or not the camera should be locked to X/Y axis when in pan-cam mode.
| bool BlamDirector::persistent_look_motion = false |
Whether or not to use persistent camera look motion. Only applies when using tick based looking.
| float BlamDirector::speed = 1.0f |
The camera's current speed.
| float BlamDirector::spring_stiffness = 0.3f |
Spring stiffness for camera movement. Only used when enable_movement_spring is true.
| bool BlamDirector::tick_based_looking = false |
Whether or not camera looking should be driven by the game tick.
| float BlamDirector::vertical_angle = 0.0f |
| float BlamDirector::zoom_increment_count = 30 |
The number of steps/increments to use when zooming in and out. Lower numbers will cause the camera to zoom faster.
| bool BlamDirector::zoomed = false |
Whether or not the camera is currently zoomed in.