Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.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)
 
void OnTickEvent (TickEvent *event)
 
void OnMouseMoveEvent (MouseMoveEvent *event)
 
void OnMouseClickEvent (MouseClickEvent *event)
 
void OnKeyPressEvent (KeyPressEvent *event)
 
void 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 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_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 = false
 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
 

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

◆ MoveCamera()

void 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)
+ Here is the call graph for this function:

◆ OnMouseClickEvent()

void BlamDirector::OnMouseClickEvent ( MouseClickEvent *  event)

◆ OnMouseMoveEvent()

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

◆ OnNewFrameEvent()

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

◆ OnTickEvent()

void BlamDirector::OnTickEvent ( TickEvent *  event)
+ 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 = false

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.

◆ 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_normal

float BlamDirector::fov_normal = 70.0f

The camera's default field of view.

◆ 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_acceleration

bool BlamDirector::look_acceleration = false

Whether or not camera looking should use acceleration.

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

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

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

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