1 | #ifndef __KdTreeApp_H__
|
---|
2 | #define __KdTreeApp_H__
|
---|
3 |
|
---|
4 | #include <OgreRenderTargetListener.h>
|
---|
5 | #include <ExampleApplication.h>
|
---|
6 | #include <ivreader.h>
|
---|
7 | #include "TestKdTreeAppListener.h"
|
---|
8 |
|
---|
9 |
|
---|
10 | class KdTreeAppRenderTargetListener : public RenderTargetListener
|
---|
11 | {
|
---|
12 | public:
|
---|
13 | KdTreeAppRenderTargetListener(SceneManager *sceneMgr);
|
---|
14 |
|
---|
15 | protected:
|
---|
16 | void preViewportUpdate (const RenderTargetViewportEvent &evt);
|
---|
17 | void postRenderTargetUpdate (const RenderTargetEvent &evt);
|
---|
18 |
|
---|
19 | SceneManager *mSceneMgr;
|
---|
20 |
|
---|
21 | ShadowTechnique mSavedShadowTechnique;
|
---|
22 | ColourValue mSavedAmbientLight;
|
---|
23 | };
|
---|
24 |
|
---|
25 | class KdTreeApp : public ExampleApplication
|
---|
26 | {
|
---|
27 | public:
|
---|
28 |
|
---|
29 | KdTreeApp() { mFrameListener = 0; }
|
---|
30 |
|
---|
31 | ~KdTreeApp()
|
---|
32 | {
|
---|
33 | delete mRenderTargerListener;
|
---|
34 | delete mFrameListener;
|
---|
35 | }
|
---|
36 |
|
---|
37 | protected:
|
---|
38 | SceneNode *mCamNode;
|
---|
39 | SceneNode *mDeathNode;
|
---|
40 | Camera *mTopCam;
|
---|
41 | Camera *mFollowCam;
|
---|
42 | KdTreeAppListener *mFrameListener;
|
---|
43 | KdTreeAppRenderTargetListener *mRenderTargerListener;
|
---|
44 |
|
---|
45 | String mSceneFiles;
|
---|
46 | String mSelectedSceneManager;
|
---|
47 | Real mMoveSpeed;
|
---|
48 | Real mRotateSpeed;
|
---|
49 | Real mRotationRadius;
|
---|
50 | Real mRotationPeriod;
|
---|
51 | int mModelSpacing;
|
---|
52 | int mModelCount;
|
---|
53 | int mRandomCount;
|
---|
54 | Real mPlaneDim;
|
---|
55 | bool mShadowsEnabled;
|
---|
56 | int mSelectEntities;
|
---|
57 |
|
---|
58 | virtual void setupResources(void);
|
---|
59 |
|
---|
60 | virtual void createScene(void);
|
---|
61 |
|
---|
62 | virtual void createFrameListener(void);
|
---|
63 |
|
---|
64 | virtual void chooseSceneManager(void);
|
---|
65 |
|
---|
66 | virtual void createCamera(void);
|
---|
67 |
|
---|
68 | virtual void createViewports(void);
|
---|
69 |
|
---|
70 | /** Configures the application - returns false if the user chooses to abandon configuration. */
|
---|
71 | virtual bool configure(void);
|
---|
72 |
|
---|
73 | bool loadScene(const String& filename);
|
---|
74 | bool loadSceneIV(const String &filename, SceneNode *root, const int index);
|
---|
75 | private:
|
---|
76 | void createMaterials(void);
|
---|
77 | std::string cat(std::string name, int x, int z)
|
---|
78 | {
|
---|
79 | std::stringstream s;
|
---|
80 | s.fill('0');
|
---|
81 | s << name;
|
---|
82 | s.width(2);
|
---|
83 | s << x;
|
---|
84 | s.width(2);
|
---|
85 | s << z;
|
---|
86 | return s.str();
|
---|
87 | }
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif |
---|