[107] | 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 |
|
---|
[160] | 10 | typedef std::vector<SceneNode *> SceneNodeList;
|
---|
| 11 | typedef std::vector<Entity *> EntityList;
|
---|
| 12 |
|
---|
[107] | 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);
|
---|
[160] | 25 |
|
---|
[107] | 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 |
|
---|
[160] | 37 | /** Minimum angle for the random orientation.
|
---|
| 38 | */
|
---|
[107] | 39 | void SetMinAngle(Vector3 minAngle);
|
---|
[160] | 40 |
|
---|
| 41 | /** Maximum angle for the random orientation.
|
---|
| 42 | */
|
---|
[107] | 43 | void SetMaxAngle(Vector3 maxAngle);
|
---|
[160] | 44 |
|
---|
| 45 | /** Minimum possible random position.
|
---|
| 46 | */
|
---|
[107] | 47 | void SetMinPos(Vector3 minPos);
|
---|
[160] | 48 | /** Maximum possible random position.
|
---|
| 49 | */
|
---|
[107] | 50 | void SetMaxPos(Vector3 maxPos);
|
---|
[160] | 51 | /** Scale factor applied to each generated object.
|
---|
| 52 | */
|
---|
[107] | 53 | void SetScale(Vector3 scale);
|
---|
| 54 |
|
---|
[160] | 55 | /** The number of created objects.
|
---|
| 56 | */
|
---|
[107] | 57 | int GetObjectCount();
|
---|
| 58 |
|
---|
[160] | 59 | /** Writes scene nodes to file.
|
---|
| 60 | */
|
---|
[107] | 61 | bool WriteObjects(const std::string &filename);
|
---|
| 62 |
|
---|
[160] | 63 | /** Loads scene nodes from file.
|
---|
| 64 | */
|
---|
[107] | 65 | bool LoadObjects(const std::string &filename);
|
---|
[160] | 66 |
|
---|
[130] | 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 | */
|
---|
[107] | 73 | SceneNode *GenerateSceneObject(const Vector3 &position,
|
---|
| 74 | const Quaternion &orientation, const String &objName);
|
---|
| 75 |
|
---|
[160] | 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 |
|
---|
[107] | 88 | protected:
|
---|
| 89 |
|
---|
| 90 | Vector3 mMinAngle;
|
---|
| 91 | Vector3 mMaxAngle;
|
---|
| 92 | Vector3 mMaxPos;
|
---|
| 93 | Vector3 mMinPos;
|
---|
| 94 | Vector3 mScale;
|
---|
| 95 |
|
---|
| 96 | SceneManager *mSceneMgr;
|
---|
| 97 |
|
---|
[160] | 98 | SceneNodeList mSceneNodes;
|
---|
| 99 | EntityList mEntities;
|
---|
[107] | 100 | };
|
---|
| 101 |
|
---|
| 102 | } // namespace Ogre
|
---|
| 103 |
|
---|
| 104 | #endif // SCENECONTENTGENERATOR_H_ |
---|