Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
BlamDirector Class Reference

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...
 

Detailed Description

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.

Note
apparently director in blam is a sphere within the physics engine and is set to collide with literally everything including air, and that is most likely what results in the rubber-y movement it has. To emulate this, we could potentially check acceleration/deceleration based on historical data (ie, we check velocity of x amount of ticks ago) and somehow use that to emulate the rubber bouncing effect

Constructor & Destructor Documentation

◆ BlamDirector()

BlamDirector::BlamDirector ( )

Initializes the camera.

+ Here is the call graph for this function:

◆ ~BlamDirector()

BlamDirector::~BlamDirector ( )

Destroys the camera.

Member Function Documentation

◆ CalculateCameraAngles()

void BlamDirector::CalculateCameraAngles ( )
+ Here is the caller graph for this function:

◆ MoveCamera()

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).

Parameters
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:

◆ OnKeyPressEvent()

void BlamDirector::OnKeyPressEvent ( KeyPressEvent *  event)
override
+ Here is the call graph for this function:

◆ OnMouseClickEvent()

void BlamDirector::OnMouseClickEvent ( MouseClickEvent *  event)
override

◆ OnMouseMoveEvent()

void BlamDirector::OnMouseMoveEvent ( MouseMoveEvent *  event)
override
+ Here is the call graph for this function:

◆ OnNewFrameEvent()

void BlamDirector::OnNewFrameEvent ( NewFrameEvent *  event)
override
+ Here is the call graph for this function:

◆ OnTickEvent()

void BlamDirector::OnTickEvent ( TickEvent *  event)
override
+ Here is the call graph for this function:

◆ SetCameraSpeed()

void BlamDirector::SetCameraSpeed ( float  _speed)

Sets the camera's speed, while also sending a log message indicating that the speed has been changed.

Parameters
_speed- The new camera speed.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ValidateCameraCoords()

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:

Member Data Documentation

◆ accel_increment_count

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.

◆ auto_verify_coords

bool BlamDirector::auto_verify_coords = true

Whether or not camera_front and camera_right should be automatically calculated.

◆ calculate_angle

bool BlamDirector::calculate_angle = true

◆ camera_angle

BlamVector3 BlamDirector::camera_angle = BlamVector3()

The current looking angle of the camera. X is yaw, Y is pitch, Z is roll (unused atm).

◆ camera_bouncing

bool BlamDirector::camera_bouncing = true

Whether or not the camera should have a bounce/rubber effect when moving and looking around.

◆ camera_front

BlamVector3 BlamDirector::camera_front = BlamVector3()

The calculated point representing the front of the camera.

◆ camera_pos

BlamVector3 BlamDirector::camera_pos = BlamVector3()

The current position of the camera.

◆ camera_right

BlamVector3 BlamDirector::camera_right = BlamVector3()

The calculated point representing the right of the camera.

◆ damping

float BlamDirector::damping = 0.6f

Spring damping for camera movement. Only used when enable_movement_spring is true.

◆ enable_look_spring

bool BlamDirector::enable_look_spring = true

Whether or not look springiness is enabled. Gives camera rotation a subtle "bounciness".

◆ enable_movement_spring

bool BlamDirector::enable_movement_spring = true

Whether or not movement springiness is enabled. Gives camera movement a subtle "bounciness".

◆ enable_zoom_spring

bool BlamDirector::enable_zoom_spring = true

Whether or not zoom springiness is enabled. Gives camera zooming a subtle "bounciness".

◆ far_clip_plane_distance

float BlamDirector::far_clip_plane_distance = 100.0f

◆ fov

float BlamDirector::fov = 70.0f

The camera's current field of view.

◆ fov_damping

float BlamDirector::fov_damping = 0.8f

Spring damping for camera zooming. Only used when enable_zoom_spring is true.

◆ fov_normal

float BlamDirector::fov_normal = 70.0f

The camera's default field of view.

◆ fov_spring_scale

float BlamDirector::fov_spring_scale = 0.45f

Scale factor to use when calculating zoom springiness. Only used when enable_zoom_spring is true.

◆ fov_spring_stiffness

float BlamDirector::fov_spring_stiffness = 0.05f

Spring stiffness for camera zooming. Only used when enable_zoom_spring is true.

◆ fov_zoomed

float BlamDirector::fov_zoomed = 20.0f

The camera's field of view while zoomed in.

◆ horizontal_angle

float BlamDirector::horizontal_angle = 0.0f

◆ lock_camera

bool BlamDirector::lock_camera = false

Whether or not the camera is locked. If locked, all keyboard/mouse input is ignored.

◆ look_accel_rate

float BlamDirector::look_accel_rate = 0.3f

Acceleration rate to use when rotating camera. Only used when enable_look_spring is true.

◆ look_acceleration

bool BlamDirector::look_acceleration = false

Whether or not camera looking should use acceleration.

◆ look_damping

float BlamDirector::look_damping = 0.6f

Spring damping for camera rotation. Only used when enable_look_spring is true.

◆ look_sensetivity_horizontal

float BlamDirector::look_sensetivity_horizontal = 0.7f

The camera's horizontal look sensetivity.

◆ look_sensetivity_vertical

float BlamDirector::look_sensetivity_vertical = 0.35f

The camera's vertical look sensetivity.

◆ look_spring_stiffness

float BlamDirector::look_spring_stiffness = 0.3f

Spring stiffness for camera rotation. Only used when enable_look_spring is true.

◆ mouse_capture_delay_ticks

int BlamDirector::mouse_capture_delay_ticks = 3

The remaining number of game ticks to wait before truly capturing the mouse.

◆ mouse_capture_ready

bool BlamDirector::mouse_capture_ready = false

Whether or not the mouse is ready to be captured.

◆ mouse_captured

bool BlamDirector::mouse_captured = false

Whether or not the mouse is currently being captured by the camera.

◆ move_acceleration

bool BlamDirector::move_acceleration = true

Whether or not camera movements should use acceleration.

◆ movement_spring_scale

float BlamDirector::movement_spring_scale = 1.0f

Scale factor to use when calculating movement springiness. Only used when enable_movement_spring is true.

◆ near_clip_plane_distance

float BlamDirector::near_clip_plane_distance = 0.1f

◆ pancam

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.

◆ pancam_lock_xy

bool BlamDirector::pancam_lock_xy = false

Whether or not the camera should be locked to X/Y axis when in pan-cam mode.

◆ persistent_look_motion

bool BlamDirector::persistent_look_motion = false

Whether or not to use persistent camera look motion. Only applies when using tick based looking.

◆ speed

float BlamDirector::speed = 1.0f

The camera's current speed.

◆ spring_stiffness

float BlamDirector::spring_stiffness = 0.3f

Spring stiffness for camera movement. Only used when enable_movement_spring is true.

◆ tick_based_looking

bool BlamDirector::tick_based_looking = false

Whether or not camera looking should be driven by the game tick.

◆ vertical_angle

float BlamDirector::vertical_angle = 0.0f

◆ zoom_increment_count

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.

◆ zoomed

bool BlamDirector::zoomed = false

Whether or not the camera is currently zoomed in.


The documentation for this class was generated from the following files: