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