Tramway SDK
Public Member Functions | Protected Attributes | List of all members
tram::Ext::Camera::FirstPersonCamera Class Reference

#include <firstperson.h>

Inheritance diagram for tram::Ext::Camera::FirstPersonCamera:
tram::Ext::Camera::Camera

Public Member Functions

 FirstPersonCamera ()
 
 ~FirstPersonCamera ()
 
void Update ()
 
void SetTilt (float tilt)
 
void SetMouselook (bool mouselook)
 
void SetRotateFollowing (bool rotate_following)
 
void SetBobbing (float bobbing_weight)
 Sets the weight of the bobbing. More...
 
void SetBobbingDistance (float bobbing_distance)
 Sets the distance bobbed during bobbing. More...
 
void SetBobbingTilt (float bobbing_tilt)
 Sets the tilt bobbed during bobbing. More...
 
void SetBobbingCallback (void(*bob_callback)(FirstPersonCamera *))
 Sets the bobbing callback. More...
 
void SetBobSpeed (float speed)
 Sets the speed of the bobs during bobbing. More...
 
float GetBob ()
 
float GetWeight ()
 
void SetFollowingInterpolation (float following_interpolation)
 
void SetFollowingOffset (vec3 offset)
 
- Public Member Functions inherited from tram::Ext::Camera::Camera
void SetActive ()
 
void SetFollowing (Entity *)
 
id_t GetFollowing ()
 
void SetPosition (vec3 position)
 
void SetRotation (quat rotation)
 
vec3 GetPosition ()
 
quat GetRotation ()
 
void SetViewTransform ()
 
void SetListenerTransform ()
 
void SetFollowingLookat (quat new_lookat)
 
void SetLayerMask (uint32_t layer_mask)
 
virtual ~Camera ()
 

Protected Attributes

float tilt = 0.0f
 
float tilt_goal = 0.0f
 
float tilt_last = 0.0f
 
float bob = 0.0f
 
float bobbing_weight_goal = 0.0f
 
float bobbing_weight = 0.0f
 
float bobbing_distance = 0.2f
 
float bobbing_tilt_goal = 0.0f
 
float bobbing_tilt = 0.0f
 
float bob_speed = 0.1f
 
int callback_count = 0
 
void(* bob_callback )(FirstPersonCamera *) = nullptr
 
bool mouselook = false
 
bool rotate_following = false
 
float yaw = 0.0f
 
float pitch = 0.0f
 
vec3 following_offset = vec3 (0.0f, 0.0f, 0.0f)
 
float following_interpolation = 1.0f
 
- Protected Attributes inherited from tram::Ext::Camera::Camera
vec3 position = {0.0f, 0.0f, 0.0f}
 
quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 
listener_t following_listener = 0
 
uint32_t layer_mask = 1 + 2
 
id_t following = 0
 
quat following_lookat = {1.0f, 0.0f, 0.0f, 0.0f}
 

Constructor & Destructor Documentation

◆ FirstPersonCamera()

tram::Ext::Camera::FirstPersonCamera::FirstPersonCamera ( )
inline

◆ ~FirstPersonCamera()

tram::Ext::Camera::FirstPersonCamera::~FirstPersonCamera ( )
inline

Member Function Documentation

◆ GetBob()

float tram::Ext::Camera::FirstPersonCamera::GetBob ( )

◆ GetWeight()

float tram::Ext::Camera::FirstPersonCamera::GetWeight ( )

◆ SetBobbing()

void tram::Ext::Camera::FirstPersonCamera::SetBobbing ( float  bobbing_weight)

Sets the weight of the bobbing.

The larger the weight, the more exaggerated the bobbing will be. This parameter can be used to change the ammount of bobbing for different activities, e.g. 1.0f for walking, 2.0f for running and 0.0f for standing.

◆ SetBobbingCallback()

void tram::Ext::Camera::FirstPersonCamera::SetBobbingCallback ( void(*)(FirstPersonCamera *)  bob_callback)

Sets the bobbing callback.

The bobbing callback is called every time a full view bob is performed. This callback is very effective when used to trigger footstep sound effects.

◆ SetBobbingDistance()

void tram::Ext::Camera::FirstPersonCamera::SetBobbingDistance ( float  bobbing_distance)

Sets the distance bobbed during bobbing.

Parameters
bobbing_distanceBest if set to between 0.0f and 0.5f.

◆ SetBobbingTilt()

void tram::Ext::Camera::FirstPersonCamera::SetBobbingTilt ( float  bobbing_tilt)

Sets the tilt bobbed during bobbing.

The camera will be tilted back and forth along the Z, i.e. forward axis.

Note
Try not to throw up if you set this value too high.
Parameters
bobbing_tiltTilt, in radians.

◆ SetBobSpeed()

void tram::Ext::Camera::FirstPersonCamera::SetBobSpeed ( float  speed)

Sets the speed of the bobs during bobbing.

◆ SetFollowingInterpolation()

void tram::Ext::Camera::FirstPersonCamera::SetFollowingInterpolation ( float  following_interpolation)
inline

◆ SetFollowingOffset()

void tram::Ext::Camera::FirstPersonCamera::SetFollowingOffset ( vec3  offset)
inline

◆ SetMouselook()

void tram::Ext::Camera::FirstPersonCamera::SetMouselook ( bool  mouselook)

◆ SetRotateFollowing()

void tram::Ext::Camera::FirstPersonCamera::SetRotateFollowing ( bool  rotate_following)

◆ SetTilt()

void tram::Ext::Camera::FirstPersonCamera::SetTilt ( float  tilt)

◆ Update()

void tram::Ext::Camera::FirstPersonCamera::Update ( )
virtual

Member Data Documentation

◆ bob

float tram::Ext::Camera::FirstPersonCamera::bob = 0.0f
protected

◆ bob_callback

void(* tram::Ext::Camera::FirstPersonCamera::bob_callback) (FirstPersonCamera *) = nullptr
protected

◆ bob_speed

float tram::Ext::Camera::FirstPersonCamera::bob_speed = 0.1f
protected

◆ bobbing_distance

float tram::Ext::Camera::FirstPersonCamera::bobbing_distance = 0.2f
protected

◆ bobbing_tilt

float tram::Ext::Camera::FirstPersonCamera::bobbing_tilt = 0.0f
protected

◆ bobbing_tilt_goal

float tram::Ext::Camera::FirstPersonCamera::bobbing_tilt_goal = 0.0f
protected

◆ bobbing_weight

float tram::Ext::Camera::FirstPersonCamera::bobbing_weight = 0.0f
protected

◆ bobbing_weight_goal

float tram::Ext::Camera::FirstPersonCamera::bobbing_weight_goal = 0.0f
protected

◆ callback_count

int tram::Ext::Camera::FirstPersonCamera::callback_count = 0
protected

◆ following_interpolation

float tram::Ext::Camera::FirstPersonCamera::following_interpolation = 1.0f
protected

◆ following_offset

vec3 tram::Ext::Camera::FirstPersonCamera::following_offset = vec3 (0.0f, 0.0f, 0.0f)
protected

◆ mouselook

bool tram::Ext::Camera::FirstPersonCamera::mouselook = false
protected

◆ pitch

float tram::Ext::Camera::FirstPersonCamera::pitch = 0.0f
protected

◆ rotate_following

bool tram::Ext::Camera::FirstPersonCamera::rotate_following = false
protected

◆ tilt

float tram::Ext::Camera::FirstPersonCamera::tilt = 0.0f
protected

◆ tilt_goal

float tram::Ext::Camera::FirstPersonCamera::tilt_goal = 0.0f
protected

◆ tilt_last

float tram::Ext::Camera::FirstPersonCamera::tilt_last = 0.0f
protected

◆ yaw

float tram::Ext::Camera::FirstPersonCamera::yaw = 0.0f
protected

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