Tramway SDK
worldcell.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_FRAMEWORK_WORLDCELL_H
5#define TRAM_SDK_FRAMEWORK_WORLDCELL_H
6
7#include <vector>
8
9#include <framework/uid.h>
10#include <framework/math.h>
11
12namespace tram {
13
14class Entity;
15class Transition;
16class Loader;
17
18class WorldCell {
19public:
20 WorldCell (name_t name) { this->name = name; }
21
22 bool IsLoaded() { return loaded; }
23 bool IsInterior() { return interior; }
25 bool IsDebugDraw() { return debug_draw; }
26
27 name_t GetName() { return name; }
28
29 void SetInterior (bool interior) { this->interior = interior; }
30 void SetInteriorLights (bool interior_lights) { this->interior_lighting = interior_lights; }
31 void SetDebugDraw (bool debug_draw) { this->debug_draw = debug_draw; }
32
33 void Load();
34 void Unload();
35
36 void LoadFromDisk();
37
38 void AddEntity(Entity* entity);
39 void RemoveEntity(Entity* entity);
40
41 size_t GetEntityCount() { return entities.size(); }
42
43 void AddTransitionInto (Transition* transition) { transitions_into.push_back(transition); }
44 void AddTransitionFrom (Transition* transition) { transitions_from.push_back(transition); }
45
47
48 inline const std::vector<Entity*>& GetEntities() { return entities; }
49
50 bool IsInside(vec3 point);
51
52 static WorldCell* Find (vec3 point);
53 static WorldCell* Find (name_t name);
54 static WorldCell* Make (name_t name);
55
56protected:
58 bool interior = false;
59 bool interior_lighting = false;
60 bool loaded = false;
61 bool debug_draw = false;
62 std::vector<Entity*> entities;
63 std::vector<Transition*> transitions_into;
64 std::vector<Transition*> transitions_from;
65 friend class Loader;
66};
67
68}
69
70#endif // TRAM_SDK_FRAMEWORK_WORLDCELL_H
Definition: entity.h:20
Definition: loader.h:11
Definition: transition.h:16
Definition: worldcell.h:18
void AddEntity(Entity *entity)
Definition: worldcell.cpp:104
bool interior
Definition: worldcell.h:58
void RemoveEntity(Entity *entity)
Definition: worldcell.cpp:118
std::vector< Entity * > entities
Definition: worldcell.h:62
void AddTransitionInto(Transition *transition)
Definition: worldcell.h:43
void SetInteriorLights(bool interior_lights)
Definition: worldcell.h:30
bool IsInterior()
Definition: worldcell.h:23
void Load()
Definition: worldcell.cpp:57
void SetDebugDraw(bool debug_draw)
Definition: worldcell.h:31
bool IsInside(vec3 point)
Definition: worldcell.cpp:96
void LoadFromDisk()
Definition: worldcell.cpp:122
bool interior_lighting
Definition: worldcell.h:59
std::vector< Transition * > transitions_from
Definition: worldcell.h:64
bool loaded
Definition: worldcell.h:60
size_t GetEntityCount()
Definition: worldcell.h:41
bool IsDebugDraw()
Definition: worldcell.h:25
const std::vector< Entity * > & GetEntities()
Definition: worldcell.h:48
void AddTransitionFrom(Transition *transition)
Definition: worldcell.h:44
name_t name
Definition: worldcell.h:57
void SetInterior(bool interior)
Definition: worldcell.h:29
WorldCell(name_t name)
Definition: worldcell.h:20
static WorldCell * Find(vec3 point)
Definition: worldcell.cpp:44
static WorldCell * Make(name_t name)
Definition: worldcell.cpp:33
name_t GetName()
Definition: worldcell.h:27
bool debug_draw
Definition: worldcell.h:61
void Unload()
Definition: worldcell.cpp:71
WorldCell * FindTransition(vec3 point)
Definition: worldcell.cpp:88
std::vector< Transition * > transitions_into
Definition: worldcell.h:63
bool HasInteriorLighting()
Definition: worldcell.h:24
bool IsLoaded()
Definition: worldcell.h:22
Definition: api.h:9
glm::vec3 vec3
Definition: math.h:12
Definition: uid.h:11