Tramway SDK
camera.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_EXTENSIONS_CAMERA_CAMERA_H
5#define TRAM_SDK_EXTENSIONS_CAMERA_CAMERA_H
6
7#include <framework/math.h>
8#include <framework/core.h>
9#include <framework/event.h>
10
11namespace tram::Ext::Camera {
12
13class Camera {
14public:
15 void SetActive();
16 void SetFollowing(Entity*);
18
19 inline void SetPosition(vec3 position) { this->position = position; }
20 inline void SetRotation(quat rotation) { this->rotation = rotation; }
21
22 inline vec3 GetPosition() { return position; }
23 inline quat GetRotation() { return rotation; }
24
25 void SetViewTransform();
27
28 void SetFollowingLookat(quat new_lookat);
29
30 void SetLayerMask(uint32_t layer_mask) { this->layer_mask = layer_mask; }
31
32 virtual void Update() = 0;
33 virtual ~Camera();
34protected:
35 vec3 position = {0.0f, 0.0f, 0.0f};
36 quat rotation = {1.0f, 0.0f, 0.0f, 0.0f};
37
39
40 uint32_t layer_mask = 1 + 2;
41
43 quat following_lookat = {1.0f, 0.0f, 0.0f, 0.0f};
44};
45
46void Init();
47void Update();
48
49}
50
51#endif // TRAM_SDK_EXTENSIONS_CAMERA_CAMERA_H
Definition: entity.h:20
Definition: camera.h:13
void SetFollowingLookat(quat new_lookat)
Definition: camera.cpp:81
vec3 position
Definition: camera.h:35
void SetRotation(quat rotation)
Definition: camera.h:20
virtual ~Camera()
Definition: camera.cpp:43
void SetViewTransform()
Definition: camera.cpp:47
quat rotation
Definition: camera.h:36
void SetPosition(vec3 position)
Definition: camera.h:19
uint32_t layer_mask
Definition: camera.h:40
void SetFollowing(Entity *)
Definition: camera.cpp:65
quat following_lookat
Definition: camera.h:43
void SetLayerMask(uint32_t layer_mask)
Definition: camera.h:30
id_t GetFollowing()
Definition: camera.cpp:77
listener_t following_listener
Definition: camera.h:38
quat GetRotation()
Definition: camera.h:23
id_t following
Definition: camera.h:42
void SetActive()
Definition: camera.cpp:61
virtual void Update()=0
Definition: camera.cpp:39
void SetListenerTransform()
Definition: camera.cpp:56
vec3 GetPosition()
Definition: camera.h:22
Definition: camera.cpp:13
void Update()
Definition: camera.cpp:34
void Init()
Definition: camera.cpp:23
uint32_t id_t
Definition: core.h:11
glm::vec3 vec3
Definition: math.h:12
glm::quat quat
Definition: math.h:13
uint32_t listener_t
Definition: event.h:17