[1092] | 1 | /* ==========================================================================
|
---|
| 2 | * (C) 2006 Universitat Jaume I
|
---|
| 3 | * ==========================================================================
|
---|
| 4 | * PROYECT: GAME TOOLS
|
---|
| 5 | * ==========================================================================*/
|
---|
| 6 | /** CONTENT:
|
---|
| 7 | *
|
---|
| 8 | *
|
---|
| 9 | * @file main.cpp
|
---|
| 10 | /** COMMENTS:
|
---|
| 11 | * Model must be in "media/models" folder.
|
---|
| 12 | * Lod file must be in "media/GT" folder.
|
---|
| 13 | /*===========================================================================*/
|
---|
| 14 | #include "ExampleApplication.h"
|
---|
| 15 | #include "GeoLodStripsLibrary.h"
|
---|
| 16 | #include "GeoMeshLoader.h"
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | // Distance values
|
---|
[1536] | 20 | #define dist_min 1100
|
---|
[1555] | 21 | #define dist_max 2500
|
---|
[1092] | 22 |
|
---|
| 23 | // Model name
|
---|
| 24 | #define model_name "dwarf2"
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | //Global variables
|
---|
[1775] | 28 |
|
---|
[1092] | 29 | Entity* entity;
|
---|
| 30 | Geometry::LodStripsLibrary* myStrips;
|
---|
| 31 | Ogre::Mesh *ogreMesh=NULL;
|
---|
| 32 | Geometry::GeoMeshLoader *meshloader=NULL;
|
---|
| 33 | SceneNode* node;
|
---|
| 34 |
|
---|
| 35 | MaterialPtr *mat;
|
---|
| 36 |
|
---|
| 37 | ColourValue color=ColourValue::Red;
|
---|
| 38 |
|
---|
| 39 | Camera* theCam;
|
---|
| 40 | Entity* pPlaneEnt;
|
---|
| 41 |
|
---|
| 42 | OverlayElement* mInfo;
|
---|
| 43 | OverlayElement* mInfo2;
|
---|
[1561] | 44 | OverlayElement* mHelp;
|
---|
[1775] | 45 | OverlayElement* mLOD;
|
---|
| 46 | OverlayElement* mShad;
|
---|
| 47 | SceneManager* SceneMgrAux;
|
---|
[1092] | 48 |
|
---|
[1775] | 49 | char LODStringAuto[]="(F3) LOD Mode: AUTOMATIC";
|
---|
| 50 | char LODStringManu[]="(F3) LOD Mode: MANUAL";
|
---|
| 51 | char ShadON[] ="(F2) Shadows ON";
|
---|
| 52 | char ShadOFF[] ="(F2) Shadows OFF";
|
---|
| 53 |
|
---|
| 54 | char HelpString[]="(F1) Quit Help\n"
|
---|
[1561] | 55 | "This demo shows an example of the LODStrips model in action. The models in the scene\n"
|
---|
| 56 | "are associated to a LodStrips object that manage their level of detail.\n"
|
---|
| 57 | "The level of detail of the objects depend on the distance to the camera. When the\n"
|
---|
| 58 | "camera goes away from them, the level of detail decreases, and when the camera gets\n"
|
---|
| 59 | "closer to them the level of detail increases to restore the original geometry of the\n"
|
---|
| 60 | "model.\n"
|
---|
[1775] | 61 | "The current level of detail can be seen in real-time in the bottom-left corner of the screen.\n"
|
---|
[1561] | 62 | "The level of detail begins to decrease at a certain distance of the crowd, and stops\n"
|
---|
| 63 | "decreasing when the objects reach the their minimum LOD. This 'lodding' distance is\n"
|
---|
[1775] | 64 | "customizable from the source code of the demo.\n\n"
|
---|
| 65 | "(F3) LOD Mode ( AUTOMATIC vs MANUAL )\n"
|
---|
| 66 | " MANUAL MODE: Use (+) and (-) keys to change de LOD\n";
|
---|
[1561] | 67 |
|
---|
[1775] | 68 | char NoHelpString[]="\n\n\n\n\n\n\n\n\n\n\n\n\n(F1) Help\n";
|
---|
[1561] | 69 |
|
---|
[1775] | 70 | int num_ogres = 90;
|
---|
[1561] | 71 |
|
---|
[1775] | 72 |
|
---|
[1529] | 73 | class CustomIndexData : public Geometry::IndexData
|
---|
[1092] | 74 | {
|
---|
[1529] | 75 | private:
|
---|
| 76 | Ogre::Mesh *targetMesh;
|
---|
| 77 | Ogre::HardwareIndexBufferSharedPtr ibuf;
|
---|
[1092] | 78 | Ogre::RenderOperation mRenderOp;
|
---|
[1529] | 79 | unsigned long* pIdx;
|
---|
| 80 | public:
|
---|
| 81 | CustomIndexData(Ogre::Mesh *ogremesh):Geometry::IndexData(){
|
---|
| 82 | targetMesh=ogremesh;
|
---|
| 83 | pIdx=NULL;
|
---|
| 84 | }
|
---|
| 85 | virtual ~CustomIndexData(void){}
|
---|
[1092] | 86 |
|
---|
[1529] | 87 | virtual void Begin(unsigned int submeshid, unsigned int indexcount){
|
---|
| 88 | targetMesh->getSubMesh(submeshid)->_getRenderOperation(mRenderOp,0);
|
---|
[1306] | 89 | ibuf = mRenderOp.indexData->indexBuffer;
|
---|
[1529] | 90 | mRenderOp.indexData->indexCount = indexcount;
|
---|
| 91 | pIdx = static_cast<unsigned long*>(ibuf->lock(Ogre::HardwareBuffer::HBL_NORMAL));
|
---|
| 92 | }
|
---|
| 93 | virtual void SetIndex(unsigned int i, unsigned int index){
|
---|
| 94 | pIdx[i] = index; //lodStripsLib->dataRetrievalInterface->GetIndex(k+offset);
|
---|
| 95 | }
|
---|
| 96 | virtual void End(){
|
---|
| 97 | ibuf->unlock();
|
---|
| 98 | }
|
---|
| 99 | virtual void BorrowIndexData(const Geometry::IndexData *){}
|
---|
| 100 | };
|
---|
[1092] | 101 |
|
---|
| 102 | class FresnelFrameListener : public ExampleFrameListener
|
---|
| 103 | {
|
---|
[1775] | 104 | float miButtonTimer;
|
---|
[1092] | 105 |
|
---|
| 106 | public:
|
---|
| 107 |
|
---|
| 108 | FresnelFrameListener(RenderWindow* win, Camera* cam)
|
---|
| 109 | : ExampleFrameListener(win, cam, false, false)
|
---|
| 110 | {
|
---|
[1775] | 111 | miButtonTimer=0;
|
---|
[1092] | 112 | }
|
---|
| 113 |
|
---|
| 114 | bool frameStarted(const FrameEvent& evt)
|
---|
| 115 | {
|
---|
| 116 | Vector3 dist;
|
---|
[1775] | 117 | int distance=0,inc2=0;
|
---|
| 118 | static int modo=0;
|
---|
| 119 | static int shadows=1;
|
---|
[1092] | 120 |
|
---|
[1775] | 121 | float tiempo = evt.timeSinceLastFrame;
|
---|
| 122 | miButtonTimer -= tiempo;
|
---|
| 123 |
|
---|
| 124 | if (shadows == 0)
|
---|
| 125 | {
|
---|
| 126 | SceneMgrAux->setShadowTechnique(SHADOWTYPE_NONE);
|
---|
| 127 | }
|
---|
| 128 | else
|
---|
| 129 | {
|
---|
| 130 | SceneMgrAux->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 |
|
---|
[1092] | 134 | // Move upto 80 units/second
|
---|
| 135 | Real MoveFactor = 180.0 * evt.timeSinceLastFrame;
|
---|
| 136 |
|
---|
| 137 | // Copy the current state of the input devices
|
---|
| 138 | mInputDevice->capture();
|
---|
| 139 |
|
---|
| 140 | // If this is the first frame, pick a speed
|
---|
| 141 | if (evt.timeSinceLastFrame == 0)
|
---|
| 142 | {
|
---|
| 143 | mMoveScale = 1;
|
---|
| 144 | mRotScale = 0.1;
|
---|
| 145 | }
|
---|
| 146 | // Otherwise scale movement units by time passed since last frame
|
---|
| 147 | else
|
---|
| 148 | {
|
---|
| 149 | // Move about 100 units per second,
|
---|
| 150 | mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;
|
---|
| 151 | // Take about 10 seconds for full rotation
|
---|
| 152 | mRotScale = mRotateSpeed * evt.timeSinceLastFrame;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | mRotX = 0;
|
---|
| 156 | mRotY = 0;
|
---|
| 157 | mTranslateVector = Vector3::ZERO;
|
---|
| 158 |
|
---|
| 159 | //LOD selection
|
---|
[1775] | 160 | static float lodfactor=0;
|
---|
| 161 | static float lodfactorBefore = -1.0f;
|
---|
| 162 |
|
---|
[1092] | 163 | dist = node->getPosition() - mCamera->getPosition();
|
---|
| 164 | distance =dist.length();
|
---|
| 165 |
|
---|
[1775] | 166 | if ( modo == 0 ) //Automatic LOD
|
---|
| 167 | {
|
---|
| 168 | int difdist = dist_max - dist_min;
|
---|
| 169 |
|
---|
| 170 | int i=0;
|
---|
[1092] | 171 |
|
---|
[1775] | 172 | lodfactor = (float)(distance - dist_min) / (float)(dist_max - dist_min);
|
---|
| 173 | lodfactor = 1.0f - lodfactor;
|
---|
| 174 | }
|
---|
| 175 | else
|
---|
| 176 | {
|
---|
| 177 | // lodfactor = lodfactorBefore;
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 |
|
---|
| 181 | if (( mInputDevice->isKeyDown(Ogre::KC_ADD) ) && (modo == 1))
|
---|
| 182 | lodfactor += 0.001f;
|
---|
| 183 | if (( mInputDevice->isKeyDown(Ogre::KC_SUBTRACT) ) && (modo == 1))
|
---|
| 184 | lodfactor -= 0.001f;
|
---|
| 185 |
|
---|
[1114] | 186 | if (lodfactor<0.0f)
|
---|
| 187 | lodfactor=0.0f;
|
---|
| 188 | if (lodfactor>1.0f)
|
---|
| 189 | lodfactor=1.0f;
|
---|
| 190 |
|
---|
[2165] | 191 | if (fabsf(lodfactorBefore-lodfactor)>0.03f ||
|
---|
[1114] | 192 | (lodfactorBefore>0.0f && lodfactor==0.0f) ||
|
---|
| 193 | (lodfactorBefore<1.0f && lodfactor==1.0f))
|
---|
[1092] | 194 | {
|
---|
| 195 | myStrips->GoToLod(lodfactor);
|
---|
[1114] | 196 | lodfactorBefore=lodfactor;
|
---|
[1092] | 197 | }
|
---|
[2165] | 198 |
|
---|
[1775] | 199 | if ( mInputDevice->isKeyDown(Ogre::KC_F3) && ( miButtonTimer <= 0 ) )
|
---|
| 200 | {
|
---|
| 201 | miButtonTimer = 0.5;
|
---|
| 202 |
|
---|
| 203 | if (modo == 0)
|
---|
| 204 | {
|
---|
| 205 | modo=1;
|
---|
| 206 | mLOD->setCaption(LODStringManu);
|
---|
| 207 | }
|
---|
| 208 | else
|
---|
| 209 | {
|
---|
| 210 | modo=0;
|
---|
| 211 | mLOD->setCaption(LODStringAuto);
|
---|
| 212 | }
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | if ( mInputDevice->isKeyDown(Ogre::KC_F2) && ( miButtonTimer <= 0 ) )
|
---|
| 216 | {
|
---|
| 217 | miButtonTimer = 0.5;
|
---|
| 218 |
|
---|
| 219 | if (shadows == 0)
|
---|
| 220 | {
|
---|
| 221 | shadows = 1;
|
---|
| 222 | mShad->setCaption(ShadON);
|
---|
| 223 | }
|
---|
| 224 | else
|
---|
| 225 | {
|
---|
| 226 | shadows = 0;
|
---|
| 227 | mShad->setCaption(ShadOFF);
|
---|
| 228 | }
|
---|
| 229 | }
|
---|
| 230 |
|
---|
[1092] | 231 | // Move the node
|
---|
[1537] | 232 | if(mInputDevice->isKeyDown(Ogre::KC_UP) ||
|
---|
| 233 | mInputDevice->isKeyDown(Ogre::KC_W) ||
|
---|
| 234 | mInputDevice->isKeyDown(Ogre::KC_NUMPAD5))
|
---|
[1092] | 235 | mTranslateVector.z = -mMoveScale;
|
---|
| 236 |
|
---|
[1537] | 237 | if(mInputDevice->isKeyDown(Ogre::KC_DOWN) ||
|
---|
| 238 | mInputDevice->isKeyDown(Ogre::KC_S) ||
|
---|
| 239 | mInputDevice->isKeyDown(Ogre::KC_NUMPAD2))
|
---|
[1092] | 240 | mTranslateVector.z = mMoveScale;
|
---|
| 241 |
|
---|
[1537] | 242 | if (mInputDevice->isKeyDown(Ogre::KC_A) ||
|
---|
| 243 | mInputDevice->isKeyDown(Ogre::KC_NUMPAD1))
|
---|
| 244 | mTranslateVector.x = -mMoveScale;
|
---|
| 245 |
|
---|
| 246 | if (mInputDevice->isKeyDown(Ogre::KC_D) ||
|
---|
| 247 | mInputDevice->isKeyDown(Ogre::KC_NUMPAD3))
|
---|
| 248 | mTranslateVector.x = mMoveScale;
|
---|
| 249 |
|
---|
[1555] | 250 | /* if (mInputDevice->isKeyDown(Ogre::KC_K))
|
---|
| 251 | mCamera->setDetailLevel(SDL_WIREFRAME);*/
|
---|
[1537] | 252 |
|
---|
[1561] | 253 | static bool newpush = true;
|
---|
| 254 | if (!mInputDevice->isKeyDown(Ogre::KC_F1))
|
---|
| 255 | newpush = true;
|
---|
[1555] | 256 |
|
---|
[1561] | 257 | static bool showing_help = false;
|
---|
| 258 | if (mInputDevice->isKeyDown(Ogre::KC_F1) && newpush)
|
---|
| 259 | {
|
---|
| 260 | newpush = false;
|
---|
| 261 | if (showing_help = !showing_help)
|
---|
| 262 | mHelp->setCaption(HelpString);
|
---|
| 263 | else
|
---|
| 264 | mHelp->setCaption(NoHelpString);
|
---|
| 265 | }
|
---|
| 266 |
|
---|
[1092] | 267 | if(mInputDevice->isKeyDown(Ogre::KC_LEFT))
|
---|
| 268 | mCamera->yaw(mRotScale);
|
---|
| 269 |
|
---|
| 270 | if(mInputDevice->isKeyDown(Ogre::KC_RIGHT))
|
---|
| 271 | mCamera->yaw(-mRotScale);
|
---|
| 272 |
|
---|
| 273 | if(mInputDevice->isKeyDown(Ogre::KC_ESCAPE))
|
---|
| 274 | {
|
---|
| 275 | delete myStrips;
|
---|
| 276 | delete [] mat;
|
---|
| 277 | return false;
|
---|
| 278 | }
|
---|
| 279 |
|
---|
| 280 | if( mInputDevice->getMouseButton( 1 ) )
|
---|
| 281 | {
|
---|
| 282 | mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13;
|
---|
| 283 | mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13;
|
---|
| 284 | }
|
---|
| 285 | else
|
---|
| 286 | {
|
---|
| 287 | mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
|
---|
| 288 | mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
|
---|
| 289 | }
|
---|
| 290 |
|
---|
[1775] | 291 | SceneMgrAux->setShadowFarDistance(distance + 200);
|
---|
[1092] | 292 |
|
---|
| 293 | char cadena[256];
|
---|
[1775] | 294 | const RenderTarget::FrameStats& stats = mWindow->getStatistics();
|
---|
[1092] | 295 |
|
---|
[1781] | 296 | sprintf(cadena,"\nDistance: %d\nLOD factor: %f\nTriangle Count: %d\n"
|
---|
| 297 | , distance, lodfactor,stats.triangleCount);
|
---|
[1092] | 298 | mInfo->setCaption(cadena);
|
---|
[1775] | 299 | sprintf(cadena,"Current FPS: %f\n",stats.lastFPS);
|
---|
| 300 | mInfo2->setCaption(cadena);
|
---|
[1092] | 301 |
|
---|
| 302 | mCamera->yaw(mRotX);
|
---|
| 303 | mCamera->pitch(mRotY);
|
---|
| 304 | mCamera->moveRelative(mTranslateVector);
|
---|
| 305 |
|
---|
| 306 | return true;
|
---|
| 307 | }
|
---|
[1561] | 308 |
|
---|
[1092] | 309 | };
|
---|
| 310 |
|
---|
[1536] | 311 | class LodStripsApplication : public ExampleApplication
|
---|
[1092] | 312 | {
|
---|
| 313 | protected:
|
---|
| 314 | public:
|
---|
[1536] | 315 | LodStripsApplication() {}
|
---|
| 316 | ~LodStripsApplication() {}
|
---|
[1092] | 317 |
|
---|
| 318 | protected:
|
---|
| 319 |
|
---|
| 320 | // Just override the mandatory create scene method
|
---|
| 321 | void createScene(void)
|
---|
| 322 | {
|
---|
[1775] | 323 | SceneMgrAux = mSceneMgr;
|
---|
| 324 | mSceneMgr->setAmbientLight(ColourValue(0.2, 0.2, 0.2));
|
---|
| 325 | mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_MODULATIVE);
|
---|
| 326 | mSceneMgr->setShadowTextureSettings(2048,1);
|
---|
| 327 | mSceneMgr->setShadowFarDistance(1024);
|
---|
| 328 | mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5));
|
---|
[1092] | 329 |
|
---|
| 330 | mat = new MaterialPtr[1];
|
---|
| 331 |
|
---|
[1775] | 332 | theCam = mCamera;
|
---|
| 333 | theCam->setPosition(-35,50,dist_min-600.0f);
|
---|
[1092] | 334 | // Set ambient light
|
---|
| 335 |
|
---|
[1536] | 336 | // Create a directional light
|
---|
[1092] | 337 | Light* l = mSceneMgr->createLight("MainLight");
|
---|
| 338 | l->setType(Light::LT_DIRECTIONAL);
|
---|
[1775] | 339 | l->setDirection(-0.5,-1.0,-1.0);
|
---|
| 340 | l->setCastShadows(true);
|
---|
| 341 |
|
---|
[1092] | 342 | mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox");
|
---|
| 343 |
|
---|
| 344 | // My node to which all objects will be attached
|
---|
| 345 | SceneNode* myRootNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
|
---|
| 346 |
|
---|
[1555] | 347 | // Define a floor plane mesh
|
---|
| 348 | Plane plane( Vector3::UNIT_Y, 0 );
|
---|
[1092] | 349 |
|
---|
[1555] | 350 | MeshManager::getSingleton().createPlane("ground",
|
---|
| 351 | ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
|
---|
[1775] | 352 | 20000,10000,6,6,true,1,250,250,Vector3::UNIT_Z);
|
---|
[1555] | 353 |
|
---|
| 354 | Entity* groundEntity = mSceneMgr->createEntity( "GroundEntity", "ground" );
|
---|
| 355 | mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
|
---|
| 356 |
|
---|
[1775] | 357 | groundEntity->setMaterialName("SnowTerrain");
|
---|
| 358 | groundEntity->setCastShadows(false);
|
---|
[1555] | 359 |
|
---|
[1092] | 360 | std::string model_file=model_name;
|
---|
| 361 | model_file.append(".mesh");
|
---|
| 362 |
|
---|
| 363 | //Models
|
---|
[2165] | 364 | entity = mSceneMgr->createEntity(model_name, "../../../OgreStuff/media/GT/ogrolod.mesh");
|
---|
[1092] | 365 | ogreMesh = entity->getMesh().getPointer();
|
---|
| 366 |
|
---|
| 367 | // load LOD info from the object
|
---|
| 368 | meshloader=new Geometry::GeoMeshLoader;
|
---|
[2165] | 369 | Geometry::Mesh *themesh = meshloader->load("../../../OgreStuff/media/GT/ogrolod.mesh");
|
---|
[1092] | 370 |
|
---|
| 371 | node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
|
---|
| 372 | node->attachObject( entity );
|
---|
[1775] | 373 | node->setVisible(false);
|
---|
[1092] | 374 |
|
---|
| 375 | std::string lod_file="../../media/GT/";
|
---|
| 376 | lod_file.append(model_name);
|
---|
| 377 | lod_file.append(".lod");
|
---|
| 378 |
|
---|
[2165] | 379 | if (!meshloader->GetLodStripsData())
|
---|
[1113] | 380 | OGRE_EXCEPT(1, "The loaded mesh does not contain any LOD info","LOD Demo");
|
---|
[1092] | 381 |
|
---|
[1529] | 382 | myStrips = new Geometry::LodStripsLibrary( meshloader->GetLodStripsData(),
|
---|
| 383 | themesh,
|
---|
| 384 | new CustomIndexData(ogreMesh) );
|
---|
[2165] | 385 |
|
---|
[1306] | 386 | entity->setNormaliseNormals(true);
|
---|
[1128] | 387 | entity->setMaterialName("LODStripsDemo/Ogro");
|
---|
[1092] | 388 |
|
---|
[1775] | 389 |
|
---|
| 390 | num_ogres=0;
|
---|
| 391 |
|
---|
| 392 | for (int i=-4; i<4; i++) // 7
|
---|
| 393 | for (int j=0; j<8; j++) // 4
|
---|
[1104] | 394 | {
|
---|
| 395 | char newObjName[16]="";
|
---|
| 396 | sprintf(newObjName,"arbol_%d_%d",i,j);
|
---|
| 397 | Ogre::SceneNode * auxnode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
|
---|
[1128] | 398 | Ogre::Entity *auxen = entity->clone(newObjName);
|
---|
| 399 | auxnode->attachObject(auxen);
|
---|
| 400 | auxnode->rotate(Ogre::Vector3(0,1,0),Ogre::Degree(180.0f),Ogre::Node::TS_WORLD);
|
---|
| 401 | auxnode->scale(30.0f,30.0f,30.0f);
|
---|
[1104] | 402 | float randomsepx = (float)((rand()%18)-9);
|
---|
| 403 | float randomsepy = (float)((rand()%12)-6);
|
---|
[1775] | 404 | auxnode->translate(i*70.0f+randomsepx,-0.3f,-j*70.0f-randomsepx);
|
---|
[1128] | 405 | auxen->setNormaliseNormals(true);
|
---|
[1775] | 406 | auxen->setCastShadows(true);
|
---|
| 407 |
|
---|
| 408 | num_ogres++;
|
---|
[1104] | 409 | }
|
---|
| 410 |
|
---|
[1113] | 411 | node->translate(0,0,-500.0f);
|
---|
[1104] | 412 |
|
---|
[1092] | 413 | // show overlay
|
---|
| 414 | Overlay* pOver = OverlayManager::getSingleton().getByName("Demo_LodStrips/Overlay");
|
---|
| 415 | mInfo = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_1");
|
---|
| 416 | mInfo2 = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_2");
|
---|
[1561] | 417 | mHelp = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Help");
|
---|
[1775] | 418 | mLOD = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/ModoLOD");
|
---|
| 419 | mShad = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Shadows");
|
---|
[1561] | 420 | mHelp->setCaption(NoHelpString);
|
---|
[1775] | 421 | mLOD->setCaption(LODStringAuto);
|
---|
| 422 | mShad->setCaption(ShadON);
|
---|
| 423 | pOver->show();
|
---|
| 424 | //mWindow->getStatistics();
|
---|
[1092] | 425 |
|
---|
| 426 | }
|
---|
| 427 |
|
---|
| 428 | void createFrameListener(void)
|
---|
| 429 | {
|
---|
| 430 | mFrameListener= new FresnelFrameListener(mWindow, mCamera);
|
---|
[1775] | 431 | mFrameListener->showDebugOverlay(false);
|
---|
[1092] | 432 | mRoot->addFrameListener(mFrameListener);
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | };
|
---|
| 436 |
|
---|
| 437 |
|
---|
| 438 |
|
---|
| 439 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
---|
| 440 | #define WIN32_LEAN_AND_MEAN
|
---|
| 441 | #include "windows.h"
|
---|
| 442 | #endif
|
---|
| 443 |
|
---|
| 444 | #ifdef __cplusplus
|
---|
| 445 | extern "C" {
|
---|
| 446 | #endif
|
---|
| 447 |
|
---|
| 448 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
---|
| 449 | INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
|
---|
| 450 | #else
|
---|
| 451 | int main(int argc, char **argv)
|
---|
| 452 | #endif
|
---|
| 453 | {
|
---|
| 454 | // Create application object
|
---|
[1536] | 455 | LodStripsApplication app;
|
---|
[1092] | 456 |
|
---|
| 457 | try {
|
---|
| 458 | app.go();
|
---|
| 459 | } catch( Exception& e ) {
|
---|
| 460 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
---|
| 461 | MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
---|
| 462 | #else
|
---|
| 463 | std::cerr << "An exception has occured: " << e.getFullDescription();
|
---|
| 464 | #endif
|
---|
| 465 | }
|
---|
| 466 |
|
---|
| 467 |
|
---|
| 468 | return 0;
|
---|
| 469 | }
|
---|
| 470 |
|
---|
| 471 | #ifdef __cplusplus
|
---|
| 472 | }
|
---|
| 473 | #endif
|
---|