Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
BlamDirector Class Reference

Class representing the Director. More...

#include <director.h>

+ Inheritance diagram for BlamDirector:

Public Member Functions

 BlamDirector ()
 Initializes the camera. More...
 
 ~BlamDirector ()
 Destroys the camera. More...
 
void OnNewFrameEvent (NewFrameEvent *event)
 Called when the listener is subscribed to New Frame events, and a new NewFrameEvent is fired. More...
 
void OnTickEvent (TickEvent *event)
 Called when the listener is subscribed to Key Press events, and a new TickEvent is fired. More...
 
void OnMouseMoveEvent (MouseMoveEvent *event)
 Called when the listener is subscribed to Mouse Move events, and a new MouseMoveEvent is fired. More...
 
void OnMouseClickEvent (MouseClickEvent *event)
 Called when the listener is subscribed to Mouse Click events, and a new MouseClickEvent is fired. More...
 
void OnKeyPressEvent (KeyPressEvent *event)
 Called when the listener is subscribed to Key Press events, and a new KeyPressEvent is fired. More...
 
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...
 
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 look_sensetivity = 0.25f
 The camera's look sensetivity. 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...
 
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.

Constructor & Destructor Documentation

◆ BlamDirector()

BlamDirector::BlamDirector ( )

Initializes the camera.

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

◆ OnKeyPressEvent()

void BlamDirector::OnKeyPressEvent ( KeyPressEvent event)
virtual

Called when the listener is subscribed to Key Press events, and a new KeyPressEvent is fired.

Parameters
event- The event that was fired.

Reimplemented from BlamEventListener.

◆ OnMouseClickEvent()

void BlamDirector::OnMouseClickEvent ( MouseClickEvent event)
virtual

Called when the listener is subscribed to Mouse Click events, and a new MouseClickEvent is fired.

Parameters
event- The event that was fired.

Reimplemented from BlamEventListener.

◆ OnMouseMoveEvent()

void BlamDirector::OnMouseMoveEvent ( MouseMoveEvent event)
virtual

Called when the listener is subscribed to Mouse Move events, and a new MouseMoveEvent is fired.

Parameters
event- The event that was fired.

Reimplemented from BlamEventListener.

◆ OnNewFrameEvent()

void BlamDirector::OnNewFrameEvent ( NewFrameEvent event)
virtual

Called when the listener is subscribed to New Frame events, and a new NewFrameEvent is fired.

Parameters
event- The event that was fired.

Reimplemented from BlamEventListener.

◆ OnTickEvent()

void BlamDirector::OnTickEvent ( TickEvent event)
virtual

Called when the listener is subscribed to Key Press events, and a new TickEvent is fired.

Parameters
event- The event that was fired.

Reimplemented from BlamEventListener.

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

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

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

float BlamDirector::look_sensetivity = 0.25f

The camera's look sensetivity.

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

◆ speed

float BlamDirector::speed = 1.0f

The camera's current speed.

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