1 | #ifndef _SCENECONTENTGENERATOR_H__
|
---|
2 | #define _SCENECONTENTGENERATOR_H__
|
---|
3 |
|
---|
4 | #include <OgrePrerequisites.h>
|
---|
5 | #include <OgreMath.h>
|
---|
6 | #include <Ogre.h>
|
---|
7 |
|
---|
8 | namespace Ogre {
|
---|
9 |
|
---|
10 | typedef std::vector<SceneNode *> SceneNodeList;
|
---|
11 | typedef std::vector<Entity *> EntityList;
|
---|
12 |
|
---|
13 | /** Class which fills a scene with content in a random fashion.
|
---|
14 | */
|
---|
15 | class __declspec(dllexport) SceneContentGenerator
|
---|
16 | {
|
---|
17 | public:
|
---|
18 | SceneContentGenerator(SceneManager *sm);
|
---|
19 | virtual ~SceneContentGenerator() {};
|
---|
20 | /** Generates scene object in a random fashion.
|
---|
21 | @param number of objects to generate
|
---|
22 | @param objName the name of the mesh to be generated
|
---|
23 | */
|
---|
24 | void GenerateScene(int numObjects, const String &objName);
|
---|
25 |
|
---|
26 | /** Generates a new object in the scene using ray scene queries |
---|
27 | and inserts it into thr scene hierarchy. |
---|
28 | @param position position where the object is created |
---|
29 | @param rotation rotation angle applied locally to object |
---|
30 | @objName the name of the object entity |
---|
31 | @returns scene object if it was successfully created, NULL otherwise |
---|
32 | @remark internally stores pointer to object |
---|
33 | */ |
---|
34 | virtual SceneNode *GenerateSceneObject(const Vector3 &position,
|
---|
35 | const Vector3 &rotation, const String &objName);
|
---|
36 |
|
---|
37 | /** Minimum angle for the random orientation.
|
---|
38 | */
|
---|
39 | void SetMinAngle(Vector3 minAngle);
|
---|
40 |
|
---|
41 | /** Maximum angle for the random orientation.
|
---|
42 | */
|
---|
43 | void SetMaxAngle(Vector3 maxAngle);
|
---|
44 |
|
---|
45 | /** Minimum possible random position.
|
---|
46 | */
|
---|
47 | void SetMinPos(Vector3 minPos);
|
---|
48 | /** Maximum possible random position.
|
---|
49 | */
|
---|
50 | void SetMaxPos(Vector3 maxPos);
|
---|
51 | /** Scale factor applied to each generated object.
|
---|
52 | */
|
---|
53 | void SetScale(Vector3 scale);
|
---|
54 |
|
---|
55 | /** The number of created objects.
|
---|
56 | */
|
---|
57 | int GetObjectCount();
|
---|
58 |
|
---|
59 | /** Writes scene nodes to file.
|
---|
60 | */
|
---|
61 | bool WriteObjects(const std::string &filename);
|
---|
62 |
|
---|
63 | /** Loads scene nodes from file.
|
---|
64 | */
|
---|
65 | bool LoadObjects(const std::string &filename);
|
---|
66 |
|
---|
67 | /** Generates a scene object with the specified parameters
|
---|
68 | @param position the position of the scene object
|
---|
69 | @param orientation the orientation of the scene object
|
---|
70 | @param objName the mesh name of the scene object
|
---|
71 | @returns the created scene object
|
---|
72 | */
|
---|
73 | SceneNode *GenerateSceneObject(const Vector3 &position,
|
---|
74 | const Quaternion &orientation, const String &objName);
|
---|
75 |
|
---|
76 | /** Gets pointer to list of generated scene nodes.
|
---|
77 | */
|
---|
78 | SceneNodeList *GetGeneratedSceneNodes();
|
---|
79 |
|
---|
80 | /** Gets pointer to list of entities.
|
---|
81 | */
|
---|
82 | EntityList *GetGeneratedEntities();
|
---|
83 |
|
---|
84 | /** Removes generated object from scene graph.
|
---|
85 | */
|
---|
86 | void RemoveGeneratedObjects();
|
---|
87 |
|
---|
88 | protected:
|
---|
89 |
|
---|
90 | Vector3 mMinAngle;
|
---|
91 | Vector3 mMaxAngle;
|
---|
92 | Vector3 mMaxPos;
|
---|
93 | Vector3 mMinPos;
|
---|
94 | Vector3 mScale;
|
---|
95 |
|
---|
96 | SceneManager *mSceneMgr;
|
---|
97 |
|
---|
98 | SceneNodeList mSceneNodes;
|
---|
99 | EntityList mEntities;
|
---|
100 | };
|
---|
101 |
|
---|
102 | } // namespace Ogre
|
---|
103 |
|
---|
104 | #endif // SCENECONTENTGENERATOR_H_ |
---|