00001 #ifndef _RR_MAINAPPLICATION_H_ 00002 #define _RR_MAINAPPLICATION_H_ 00003 00004 #include <vrs/sharedobj.h> 00005 00006 #include "vrsode/TriangleData.h" 00007 00011 namespace VRS 00012 { 00013 class BehaviorCallback; 00014 class GlutCanvas; 00015 class SceneThing; 00016 class LookAt; 00017 class Perspective; 00018 } // namespace VRS 00019 00023 namespace vrsode 00024 { 00025 class CarSimple; 00026 } // namespace vrsode 00027 00028 00032 namespace random_racer 00033 { 00034 00035 class LoaderGlue; 00036 class ReloadPlane; 00037 class TerrainGenerator; 00038 class TerrainLoader; 00039 class ThirdPersonCameraHelper; 00040 class CenterScreenDisplay; 00041 class Presenter; 00042 00046 class MainApplication : public VRS::SharedObj 00047 { 00048 /* 00049 Scene Graph: 00050 canvas 00051 |_ scene -- contains the real scene 00052 | |_ light 00053 | |_ cam -- with m_perspective and m_lookAt 00054 | |_ background -- with cubetexture 00055 | | 00056 | |_ geometryRoot 00057 | |_ car... 00058 | | |_... 00059 | | |_... 00060 | | 00061 | |_ terrain 00062 | |_... 00063 | 00064 |_ consoleThing -- with own cam, etc. holds the console 00065 */ 00066 00067 VRS::SO<VRS::GlutCanvas> m_canvas; 00068 VRS::SO<VRS::SceneThing> m_scene, m_geometryRoot, m_skyBoxThing; 00069 VRS::SO<VRS::LookAt> m_lookAt; 00070 VRS::SO<VRS::Perspective> m_perspective; 00071 VRS::SO<VRS::Fog> m_fog; 00072 VRS::SO<VRS::BehaviorCallback> m_keyCallBack; 00073 VRS::SO<Car> m_car[2]; 00074 unsigned int m_activeCar; 00075 double m_oldFov; 00076 double m_targetFov; 00077 double m_lastFov; 00078 00079 VRS::SO<ThirdPersonCameraHelper> m_camHelper; 00080 00081 VRS::SO<TerrainGenerator> m_odeGenerator, m_vrsGenerator; 00082 VRS::SO<VRSTerrainLoader> m_vrsLoader; 00083 VRS::SO<ODETerrainLoader> m_odeLoader; 00084 VRS::SO<LoaderGlue> m_odeGlue, m_vrsGlue; 00085 VRS::SO<ReloadPlane> m_planes[8]; 00086 00087 VRS::SO<ControlPointGenerator> m_generator; 00088 00089 VRS::SO<ItemDistributor> m_itemDistributor; 00090 00091 bool m_isFullscreen; 00092 00093 static const double c_defaultFov; 00094 static const unsigned int c_canvasWidth, c_canvasHeight; 00095 00096 VRS::SO<vrsode::TriangleData> m_triangleData; 00097 00098 VRS::SO<ControlPointContainer> m_container; 00099 00100 VRS::SO<CenterScreenDisplay> m_centerScreen; 00101 00102 VRS::SO<Presenter> m_presenter; 00103 00107 static MainApplication* s_daMainApp; 00108 00112 void keyEvent(); 00113 00118 void fovCommand(const std::string& newFov); 00119 00124 void carResetCommand(); 00125 00130 void carPositionCommand(); 00131 00135 void camUpCommand(const std::string& newUpDouble); 00136 00141 void camCorrectCommand(const std::string& newDouble); 00142 00146 void camBackCommand(const std::string& newBackDouble); 00147 00151 void camStaticCommand(const std::string& newStaticBool); 00152 00156 void camResetCommand(); 00157 00161 void camFogCommand(const std::string& fogToggle); 00162 00166 void camDelayCommand(const std::string& newIntDelay); 00167 00171 void versionCommand(); 00172 00176 void fullscreenCommand(); 00177 00181 void autoexecCommand(); 00182 00186 void phyDebugCommand(const std::string& newDebugBool); 00187 00191 void terDebugPlanesCommand(const std::string& which); 00192 00196 void terDebugPhyCommand(const std::string& newBool); 00197 00201 void phyPerformanceAdjustCommand(const std::string& newBool); 00202 00206 void phyStepTimeCommand(const std::string& newDouble); 00207 00211 void phyStepSizeCommand(const std::string& newBool); 00212 00216 void phyChangeTerrainCommand(); 00217 00221 void collectCoinsCommand(const std::string& newBool); 00222 00226 void preStartCommand(const std::string& temp); 00227 00232 void registerCommands(); 00233 00234 public: 00239 MainApplication(); 00240 00244 virtual ~MainApplication(); 00245 00252 static void updatePhysics(int args); 00253 00257 static void everyFrame(int args); 00258 00263 void quitCommand(); 00264 00270 static void cleanUpAtExit(); 00271 00275 static void signalHandler(int sig); 00276 }; 00277 00278 } // namespace random_racer 00279 00280 00281 #endif // _RR_MAINAPPLICATION_H_
1.5.1