Changeset 1561


Ignore:
Timestamp:
10/03/06 17:31:07 (18 years ago)
Author:
gumbau
Message:

Added F1 key functionality

Location:
GTP/trunk/App/Demos/Geom
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Geom/Demo_LodStrips/main.cpp

    r1555 r1561  
    4141OverlayElement* mInfo; 
    4242OverlayElement* mInfo2; 
     43OverlayElement* mHelp; 
     44 
     45char HelpString[]="(F1) Help\n" 
     46                        "This demo shows an example of the LODStrips model in action. The models in the scene\n" 
     47                        "are associated to a LodStrips object that manage their level of detail.\n" 
     48                        "The level of detail of the objects depend on the distance to the camera. When the\n" 
     49                        "camera goes away from them, the level of detail decreases, and when the camera gets\n" 
     50                        "closer to them the level of detail increases to restore the original geometry of the\n" 
     51                        "model.\n" 
     52                        "The current level of detail can be seen in real-time in the top-left corner of the screen.\n" 
     53                        "The level of detail begins to decrease at a certain distance of the crowd, and stops\n" 
     54                        "decreasing when the objects reach the their minimum LOD. This 'lodding' distance is\n" 
     55                        "customizable from the source code of the demo."; 
     56 
     57char NoHelpString[]="(F1) Help\n"; 
     58 
    4359 
    4460class CustomIndexData : public Geometry::IndexData 
     
    161177                        mCamera->setDetailLevel(SDL_WIREFRAME);*/ 
    162178 
     179                static bool newpush = true; 
     180                if (!mInputDevice->isKeyDown(Ogre::KC_F1)) 
     181                        newpush = true; 
     182 
     183                static bool showing_help = false; 
     184                if (mInputDevice->isKeyDown(Ogre::KC_F1) && newpush) 
     185                { 
     186                        newpush = false; 
     187                        if (showing_help = !showing_help) 
     188                mHelp->setCaption(HelpString); 
     189                        else 
     190                mHelp->setCaption(NoHelpString); 
     191                } 
    163192 
    164193                if(mInputDevice->isKeyDown(Ogre::KC_LEFT)) 
     
    204233                return true; 
    205234    } 
     235 
    206236}; 
    207237 
     
    251281                groundEntity->setCastShadows(false);        
    252282 
    253  
    254 /*        pEnt = mSceneMgr->createEntity( "PoolFloor", "PoolFloor.mesh" ); 
    255         myRootNode->attachObject(pEnt); 
    256                 myRootNode->scale(6.0,6.0,6.0);*/ 
    257  
    258283                std::string model_file=model_name; 
    259284                model_file.append(".mesh"); 
     
    269294        node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); 
    270295        node->attachObject( entity ); 
     296                node->setVisible(false); 
    271297 
    272298                std::string lod_file="../../media/GT/"; 
     
    306332        mInfo = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_1"); 
    307333                mInfo2 = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_2"); 
     334                mHelp = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Help"); 
     335                mHelp->setCaption(NoHelpString); 
    308336            pOver->show(); 
    309337 
  • GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg

    r1540 r1561  
    1 Render System   OpenGL Rendering Subsystem 
    2 Colour Depth    32 
    3 Display Frequency       60 
    4 FSAA    0 
     1Render System   Direct3D9 Rendering SubSystem 
     2Anti aliasing   None 
     3Floating-point mode     Fastest 
    54Full Screen     Yes 
     5Rendering Device        NVIDIA GeForce 6800 Series GPU 
    66VSync   No 
    7 Video Mode      1024 x 768 
     7Video Mode      800 x 600 @ 32-bit colour 
  • GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp

    r1540 r1561  
    1919// Distance values 
    2020#define dist_min 300 
    21 #define dist_max 700 
     21#define dist_max 900 
    2222 
    2323// Model name 
     
    4141OverlayElement* mInfo; 
    4242OverlayElement* mInfo2; 
     43OverlayElement* mHelp; 
     44 
     45char HelpString[]="(F1) Help\n" 
     46                        "This demo shows an example of the LodTree model in action. The trees in the scene\n" 
     47                        "are associated to a LodTree object that manage their level of detail of both the\n" 
     48                        "trunk and the leaves. The level of detail of the objects depend on the distance to\n" 
     49                        "the camera. When the camera goes away from them, the level of detail decreases, and\n" 
     50                        "when the camera gets closer to them the level of detail increases to restore the\n" 
     51                        "original geometry of the model.\n" 
     52                        "The current level of detail can be seen in real-time in the top-left corner of the screen.\n" 
     53                        "The level of detail begins to decrease at a certain distance of the forest, and stops\n" 
     54                        "decreasing when the objects reach the their minimum LOD. This 'lodding' distance is\n" 
     55                        "customizable from the source code of the demo."; 
     56 
     57char NoHelpString[]="(F1) Help\n"; 
    4358 
    4459 
     
    107122 
    108123                static float lodfactorBefore = -1.0f; 
    109                 if (fabsf(lodfactorBefore-lodfactor)>0.05f) 
     124                if (fabsf(lodfactorBefore-lodfactor)>0.1f) 
    110125                { 
    111126                        myTrees->GoToLod(lodfactor); 
     
    141156                if(mInputDevice->isKeyDown(Ogre::KC_RIGHT)) 
    142157                  mCamera->yaw(-mRotScale); 
     158 
     159                static bool newpush = true; 
     160                if (!mInputDevice->isKeyDown(Ogre::KC_F1)) 
     161                        newpush = true; 
     162 
     163                static bool showing_help = false; 
     164                if (mInputDevice->isKeyDown(Ogre::KC_F1) && newpush) 
     165                { 
     166                        newpush = false; 
     167                        if (showing_help = !showing_help) 
     168                mHelp->setCaption(HelpString); 
     169                        else 
     170                mHelp->setCaption(NoHelpString); 
     171                } 
     172 
    143173 
    144174                if(mInputDevice->isKeyDown(Ogre::KC_ESCAPE)) 
     
    230260        // Set ambient light 
    231261        mSceneMgr->setAmbientLight(ColourValue(0.4, 0.4, 0.4)); 
     262                theCam->setNearClipDistance(0.1f); 
    232263 
    233264        // Create a directional light 
     
    260291 
    261292                //Models 
    262         entity = mSceneMgr->createEntity(model_name, "../../../OgreStuff/media/GT/ML12m.mesh"); 
     293        entity = mSceneMgr->createEntity(model_name, "../../../OgreStuff/media/GT/ML11.mesh"); 
    263294 
    264295                ogreMesh = entity->getMesh().getPointer(); 
     
    266297                // load LOD info from the object 
    267298                meshloader=new Geometry::GeoMeshLoader; 
    268                 Geometry::Mesh *themesh = meshloader->load("../../../OgreStuff/media/GT/ML12m.mesh"); 
     299                Geometry::Mesh *themesh = meshloader->load("../../../OgreStuff/media/GT/ML11.mesh"); 
    269300 
    270301                if (!meshloader->GetLodStripsData()) 
     
    284315                        bool istrunk = myTrees->GetLeavesSubMesh()!=submesh; 
    285316                        if (istrunk) 
    286                                 entity->getSubEntity(submesh)->setMaterialName("Examples/Populifolia/trunk"); 
     317                                entity->getSubEntity(submesh)->setMaterialName("Examples/ML11/trunk"); 
    287318                        else 
    288                                 entity->getSubEntity(submesh)->setMaterialName("Examples/Populifolia/leaf"); 
     319                                entity->getSubEntity(submesh)->setMaterialName("Examples/ML11/leaf"); 
    289320                } 
    290321 
    291322                forest_center=Ogre::Vector3(150.0f,0.0f,0.0f); 
    292                 for (int i=1; i<8; i++) // 20 
    293                         for (int j=1; j<8; j++) // 20 
     323                for (int i=1; i<5; i++) // 20 
     324                        for (int j=1; j<5; j++) // 20 
    294325                        { 
    295326                                char newTreeName[16]=""; 
     
    301332                                auxnode->rotate(Ogre::Vector3(0,0,1),Ogre::Degree(rand()%360)); 
    302333                                auxnode->rotate(Ogre::Vector3(1,0,0),Ogre::Radian(-3.14159f*0.5f),Ogre::Node::TS_WORLD); 
    303                                 float randomsepx = (float)((rand()%18)-9); 
    304                                 float randomsepy = (float)((rand()%12)-6); 
    305                                 auxnode->translate(i*30.0f+randomsepx,0.0f,-j*30.0f-randomsepx); 
     334                                float randomsepx = (float)((rand()%38)-19); 
     335                                float randomsepy = (float)((rand()%32)-12); 
     336                                auxnode->translate(i*80.0f+randomsepx,0.0f,-j*80.0f-randomsepx); 
    306337                                auxent->setNormaliseNormals(true); 
    307338                        } 
     
    315346        mInfo = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_1"); 
    316347                mInfo2 = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Info_2"); 
     348                mHelp = OverlayManager::getSingleton().getOverlayElement("Demo_LodStrips/Help"); 
     349                mHelp->setCaption(NoHelpString); 
    317350            pOver->show(); 
    318351 
  • GTP/trunk/App/Demos/Geom/OgreStuff/media/materials/scripts/Example.material

    r1542 r1561  
    778778                pass 
    779779                { 
    780                         cull_hardware anticlockwise 
     780                        cull_hardware clockwise 
    781781                        texture_unit 
    782782                        { 
     
    787787} 
    788788 
     789material Examples/ML11/leaf 
     790{ 
     791    technique 
     792    { 
     793        pass 
     794        { 
     795                alpha_rejection greater 150  
     796                scene_blend alpha_blend 
     797              cull_hardware none 
     798            cull_software none           
     799            texture_unit 
     800            { 
     801                    filtering linear linear none  
     802                texture ML11lef.tga 
     803            } 
     804        } 
     805    } 
     806} 
     807 
     808material Examples/ML11/trunk 
     809{ 
     810        technique 
     811        { 
     812                pass 
     813                { 
     814                        cull_hardware clockwise 
     815                        texture_unit 
     816                        { 
     817                                texture ML11brk.tif 
     818                        } 
     819                } 
     820        } 
     821} 
     822 
    789823material Examples/Rockwall 
    790824{ 
  • GTP/trunk/App/Demos/Geom/OgreStuff/media/materials/scripts/RZR-002.material

    r1092 r1561  
    1414        } 
    1515} 
     16 
     17 
     18material RockTerrain 
     19{ 
     20        technique 
     21        { 
     22                pass 
     23                { 
     24 
     25                        texture_unit 
     26                        { 
     27                                texture terr_rock-dirt.jpg 
     28                        } 
     29                } 
     30        } 
     31} 
  • GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Demo_LodStrips.overlay

    r1092 r1561  
    4848                        colour_bottom 0.3 0.5 0.3 
    4949                } 
     50                element TextArea(Demo_LodStrips/Help) 
     51                { 
     52                        metrics_mode pixels 
     53                        left 5 
     54                        top 50 
     55                        width 90 
     56                        height 50 
     57                        font_name TrebuchetMSBold 
     58                        char_height 16 
     59                        colour_top 0.5 0.7 0.5 
     60                        colour_bottom 0.3 0.5 0.3 
     61                } 
    5062        } 
    5163} 
Note: See TracChangeset for help on using the changeset viewer.