OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
World.cpp
Go to the documentation of this file.
1 
8 #include "global.h"
9 #include "World.h"
10 
12  destroy();
13 }
14 
16  mRooms.clear();
17  mSprites.clear();
18  mSpriteSequences.clear();
19  mEntities.clear();
20  mModels.clear();
21  mStaticMeshes.clear();
22  mMeshes.clear();
23 }
24 
25 void World::addRoom(Room* room) {
26  mRooms.emplace_back(std::unique_ptr<Room>(room));
27 }
28 
29 unsigned long World::sizeRoom() {
30  return mRooms.size();
31 }
32 
33 Room& World::getRoom(unsigned long index) {
34  assertLessThan(index, mRooms.size());
35  return *mRooms.at(index);
36 }
37 
38 void World::addSprite(Sprite* sprite) {
39  mSprites.emplace_back(std::unique_ptr<Sprite>(sprite));
40 }
41 
42 unsigned long World::sizeSprite() {
43  return mSprites.size();
44 }
45 
46 Sprite& World::getSprite(unsigned long index) {
47  assertLessThan(index, mSprites.size());
48  return *mSprites.at(index);
49 }
50 
52  mSpriteSequences.emplace_back(std::unique_ptr<SpriteSequence>(sprite));
53 }
54 
55 unsigned long World::sizeSpriteSequence() {
56  return mSpriteSequences.size();
57 }
58 
60  assertLessThan(index, mSpriteSequences.size());
61  return *mSpriteSequences.at(index);
62 }
63 
64 void World::addEntity(Entity* entity) {
65  mEntities.emplace_back(std::unique_ptr<Entity>(entity));
66 }
67 
68 unsigned long World::sizeEntity() {
69  return mEntities.size();
70 }
71 
72 Entity& World::getEntity(unsigned long index) {
73  assertLessThan(index, mEntities.size());
74  return *mEntities.at(index);
75 }
76 
78  mModels.emplace_back(std::unique_ptr<SkeletalModel>(model));
79 }
80 
81 unsigned long World::sizeSkeletalModel() {
82  return mModels.size();
83 }
84 
85 SkeletalModel& World::getSkeletalModel(unsigned long index) {
86  assertLessThan(index, mModels.size());
87  return *mModels.at(index);
88 }
89 
91  mStaticMeshes.emplace_back(std::unique_ptr<StaticMesh>(model));
92 }
93 
94 unsigned long World::sizeStaticMesh() {
95  return mStaticMeshes.size();
96 }
97 
98 StaticMesh& World::getStaticMesh(unsigned long index) {
99  assertLessThan(index, mStaticMeshes.size());
100  return *mStaticMeshes.at(index);
101 }
102 
103 void World::addMesh(Mesh* mesh) {
104  mMeshes.emplace_back(mesh);
105 }
106 
107 unsigned long World::sizeMesh() {
108  return mMeshes.size();
109 }
110 
111 Mesh& World::getMesh(unsigned long index) {
112  assertLessThan(index, mMeshes.size());
113  return *mMeshes.at(index);
114 }
115 
void addSkeletalModel(SkeletalModel *model)
Definition: World.cpp:77
~World()
Deconstructs an object of World.
Definition: World.cpp:11
Definition: Mesh.h:35
std::vector< std::unique_ptr< SpriteSequence > > mSpriteSequences
Definition: World.h:69
StaticMesh & getStaticMesh(unsigned long index)
Definition: World.cpp:98
Room & getRoom(unsigned long index)
Definition: World.cpp:33
unsigned long sizeMesh()
Definition: World.cpp:107
void addRoom(Room *room)
Definition: World.cpp:25
std::vector< std::unique_ptr< Mesh > > mMeshes
Definition: World.h:73
World Model.
unsigned long sizeStaticMesh()
Definition: World.cpp:94
void destroy()
Clears all data in world.
Definition: World.cpp:15
Included everywhere.
unsigned long sizeEntity()
Definition: World.cpp:68
std::vector< std::unique_ptr< SkeletalModel > > mModels
Definition: World.h:71
unsigned long sizeSpriteSequence()
Definition: World.cpp:55
void addMesh(Mesh *mesh)
Definition: World.cpp:103
Entity & getEntity(unsigned long index)
Definition: World.cpp:72
std::vector< std::unique_ptr< Entity > > mEntities
Definition: World.h:70
Definition: Sprite.h:13
SpriteSequence & getSpriteSequence(unsigned long index)
Definition: World.cpp:59
Definition: Entity.h:11
std::vector< std::unique_ptr< StaticMesh > > mStaticMeshes
Definition: World.h:72
void addSprite(Sprite *sprite)
Definition: World.cpp:38
Sprite & getSprite(unsigned long index)
Definition: World.cpp:46
SkeletalModel & getSkeletalModel(unsigned long index)
Definition: World.cpp:85
void addSpriteSequence(SpriteSequence *sprite)
Definition: World.cpp:51
std::vector< std::unique_ptr< Sprite > > mSprites
Definition: World.h:68
unsigned long sizeSkeletalModel()
Definition: World.cpp:81
Definition: Room.h:22
void addEntity(Entity *entity)
Definition: World.cpp:64
#define assertLessThan(x, y)
Definition: global.h:146
unsigned long sizeSprite()
Definition: World.cpp:42
unsigned long sizeRoom()
Definition: World.cpp:29
Mesh & getMesh(unsigned long index)
Definition: World.cpp:111
std::vector< std::unique_ptr< Room > > mRooms
Definition: World.h:67
void addStaticMesh(StaticMesh *model)
Definition: World.cpp:90