Line | |
---|
1 | #ifndef __ResourceManager_H__
|
---|
2 | #define __ResourceManager_H__
|
---|
3 |
|
---|
4 |
|
---|
5 | #include <string>
|
---|
6 | #include <iostream>
|
---|
7 | #include <fstream>
|
---|
8 | #include <map>
|
---|
9 |
|
---|
10 | #include "common.h"
|
---|
11 |
|
---|
12 | class igzstream;
|
---|
13 |
|
---|
14 |
|
---|
15 | namespace CHCDemoEngine
|
---|
16 | {
|
---|
17 |
|
---|
18 | class SceneEntity;
|
---|
19 | class Material;
|
---|
20 | class Geometry;
|
---|
21 | class Texture;
|
---|
22 | class Matrix4x4;
|
---|
23 |
|
---|
24 | /** Loads a scene and also handles the cleanup
|
---|
25 | */
|
---|
26 | class ResourceManager
|
---|
27 | {
|
---|
28 | public:
|
---|
29 |
|
---|
30 | ~ResourceManager();
|
---|
31 | /** Loads a model
|
---|
32 | */
|
---|
33 | bool Load(const std::string &filename, SceneEntityContainer &geometry);
|
---|
34 |
|
---|
35 | protected:
|
---|
36 |
|
---|
37 | void LoadTextures(igzstream &str);
|
---|
38 | void LoadShapes(igzstream &str);
|
---|
39 | void LoadSceneEntities(igzstream &str, SceneEntityContainer &entities);
|
---|
40 |
|
---|
41 | SceneEntity *LoadSceneEntity(igzstream &str);
|
---|
42 | Material *LoadMaterial(igzstream &str);
|
---|
43 | Geometry *LoadGeometry(igzstream &str);
|
---|
44 |
|
---|
45 | std::map<int, Texture *> mTextureTable;
|
---|
46 | std::map<int, Material *> mMaterialTable;
|
---|
47 | std::map<int, Geometry *> mGeometryTable;
|
---|
48 |
|
---|
49 | // these are kept to be able to delete these resources afterwards
|
---|
50 | std::vector<Texture *> mTextures;
|
---|
51 | std::vector<Material *> mMaterials;
|
---|
52 | std::vector<Geometry *> mGeometry;
|
---|
53 | std::vector<SceneEntity *> mSceneEntities;
|
---|
54 | std::vector<Matrix4x4 *> mTrafos;
|
---|
55 | };
|
---|
56 |
|
---|
57 | }
|
---|
58 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.