Ignore:
Timestamp:
07/13/05 18:28:40 (19 years ago)
Author:
mattausch
Message:

did some code cleanup

Location:
trunk/VUT/work/TestCullingTerrain
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp

    r171 r173  
    1212#include "TestCullingTerrainApplication.h" 
    1313 
     14 
     15//-- captions for overlays 
     16String TerrainFrameListener::msAlgorithmCaptions[] =  
     17{ 
     18        "View Frustum Culling",  
     19        "Stop and Wait Culling",  
     20        "Coherent Hierarchical Culling" 
     21}; 
     22 
     23String TerrainFrameListener::msQueryTypeCaptions[] =  
     24{ 
     25        "from camera",  
     26        "from viewpoint" 
     27}; 
     28 
     29String TerrainFrameListener::msQueryRelativeVisCaptions[] =  
     30{ 
     31        "visible pixels",  
     32        "relative visibility" 
     33}; 
     34 
     35String TerrainFrameListener::msQueryMethodCaptions[] =  
     36{ 
     37        "occlusion queries",  
     38        "item buffer" 
     39}; 
     40 
     41Real TerrainFrameListener::msObjectTerrainOffsets[] =  
     42{ 
     43        0, 
     44        7, 
     45        0 
     46}; 
     47 
     48Real TerrainFrameListener::msObjectScales[] =  
     49{ 
     50        0.1, 
     51        0.6, 
     52        0.07 
     53}; 
     54 
     55String TerrainFrameListener::msObjectCaptions[] = 
     56{ 
     57        "robot", 
     58        "athene", 
     59        //"tree2", 
     60        //"HongKong_Tower", 
     61        "ninja" 
     62        //"ogrehead" 
     63}; 
     64 
    1465// output file for frame info 
    1566const char* frames_out_filename = "frame.out"; 
     
    1768const char* objects_out_filename = "objects.out"; 
    1869 
    19  
    20 // --- captions for overlays 
    21  
    22 String currentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =  
    23 { 
    24         "View Frustum Culling",  
    25         "Stop and Wait Culling",  
    26         "Coherent Hierarchical Culling" 
    27 }; 
    28  
    29 String queryTypeCaptions[] =  
    30 { 
    31         "from camera",  
    32         "from viewpoint" 
    33 }; 
    34  
    35 String queryRelativeVisCaptions[] =  
    36 { 
    37         "visible pixels",  
    38         "relative visibility" 
    39 }; 
    40  
    41 String queryMethodCaptions[] =  
    42 { 
    43         "occlusion queries",  
    44         "item buffer" 
    45 }; 
    46  
    47 Real currentObjectTerrainOffsets[] =  
    48 { 
    49         0, 
    50         7, 
    51         0 
    52 }; 
    53 Real currentObjectScales[] =  
    54 { 
    55         0.1, 
    56         0.1, 
    57         0.07 
    58 }; 
    5970 
    6071//----------------------------------------------------------------------- 
     
    210221                 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 
    211222                         mouseRay.getOrigin()/*queryResult*/, Vector3(val, 0, 0),  
    212                          mApplication->getCurrentObjectCaption(mCurrentObjectType)); 
     223                         msObjectCaptions[mCurrentObjectType]); 
    213224                 
    214225         mLMouseDown = true;  
     
    281292                 { 
    282293                         // apply offset so object is ON terrain 
    283                          queryResult.y += currentObjectTerrainOffsets[mCurrentObjectType]; 
     294                         queryResult.y += msObjectTerrainOffsets[mCurrentObjectType]; 
    284295                         mCurrentObject->setPosition(queryResult); 
    285296                 } 
     
    414425 
    415426        mQueryManager = new OcclusionQueriesQueryManager(sm->GetHierarchyInterface(), 
    416                         mWindow->getViewport(0), false, useItemBuffer); 
     427                        mWindow->getViewport(0), true, useItemBuffer); 
    417428        //mQueryManager = new PlatformQueryManager(sm->GetHierarchyInterface(), mWindow->getViewport(0), false); 
    418429         
     
    437448                 
    438449        std::stringstream d;  
    439         d << queryTypeCaptions[fromPoint ?  1 : 0].c_str() << " " 
    440           << queryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " " 
    441       << queryMethodCaptions[useItemBuffer ? 1 : 0].c_str(); 
     450        d << msQueryTypeCaptions[fromPoint ?  1 : 0].c_str() << " " 
     451          << msQueryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " " 
     452      << msQueryMethodCaptions[useItemBuffer ? 1 : 0].c_str(); 
    442453        LogManager::getSingleton().logMessage(d.str()); 
    443454 
     
    515526                 
    516527                sprintf(str, ": %s, %s, %s",  
    517                                 queryTypeCaptions[fromPoint ?  1 : 0].c_str(), 
    518                                 queryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str(), 
    519                                 queryMethodCaptions[useItemBuffer ? 1 : 0].c_str()); 
     528                                msQueryTypeCaptions[fromPoint ?  1 : 0].c_str(), 
     529                                msQueryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str(), 
     530                                msQueryMethodCaptions[useItemBuffer ? 1 : 0].c_str()); 
    520531 
    521532                mQueryTypeInfo->setCaption(str); 
     
    635646                //-- write out stats for recorded walkthrough 
    636647                std::stringstream d; 
    637                 d << "Algorithm: " << currentAlgorithmCaptions[mCurrentAlgorithm] << "\n" 
     648                d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 
    638649                  //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 
    639650                  << "avg. FPS: " << avgFps << "\n" 
     
    737748 
    738749        // parameters for new object 
    739         mTerrainContentGenerator->SetOffset(currentObjectTerrainOffsets[mCurrentObjectType]); 
    740         Real scale = currentObjectScales[mCurrentObjectType]; 
     750        mTerrainContentGenerator->SetOffset(msObjectTerrainOffsets[mCurrentObjectType]); 
     751        Real scale = msObjectScales[mCurrentObjectType]; 
    741752        mTerrainContentGenerator->SetScale(Vector3(scale, scale, scale)); 
    742753 
    743         mCurrentObjectTypeInfo->setCaption(": " +  
    744                 mApplication->getCurrentObjectCaption(mCurrentObjectType)); 
     754        mCurrentObjectTypeInfo->setCaption(": " + msObjectCaptions[mCurrentObjectType]); 
    745755} 
    746756//----------------------------------------------------------------------- 
    747757void TerrainFrameListener::setAlgorithm(int algorithm) 
    748758{ 
    749         mAlgorithmInfo->setCaption(": " + currentAlgorithmCaptions[mCurrentAlgorithm]); 
     759        mAlgorithmInfo->setCaption(": " + msAlgorithmCaptions[mCurrentAlgorithm]); 
    750760        mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 
    751761} 
     
    13701380         
    13711381        initOverlayElement(&mAlgorithmInfo, ext, "Algorithm", top, 
    1372                 ": " + currentAlgorithmCaptions[mCurrentAlgorithm]); top += vert_space; 
     1382                ": " + msAlgorithmCaptions[mCurrentAlgorithm]); top += vert_space; 
    13731383 
    13741384        initOverlayElement(&mThresholdInfo, ext, "Threshold", top, ": 0"); top += vert_space; 
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h

    r164 r173  
    1313#include "OgrePlatformQueryManager.h" 
    1414 
     15 
    1516class TestCullingTerrainApplication; 
    1617 
     
    1819using namespace Ogre; 
    1920 
    20 // z order index of visualizaion viewport 
    21 #define VIZ_VIEWPORT_Z_ORDER 10 
    2221 
    2322/** Frame listener specialised for terrains. 
     
    8483   //enum {NODEVIZ_NONE, NODEVIZ_RENDER_GEOMETRY, NODEVIZ_MODES_NUM}; 
    8584 
    86   void zoomVizCamera(int zoom); 
     85   void zoomVizCamera(int zoom); 
    8786         
    8887   void addFrameInfo(SceneNode *camNode, Real timeElapsed); 
     
    141140        void setObjectType(int objectType); 
    142141 
     142        static String msAlgorithmCaptions[]; 
     143        static String msQueryTypeCaptions[];  
     144        static String msQueryRelativeVisCaptions[]; 
     145        static String msQueryMethodCaptions[]; 
     146        static Real msObjectTerrainOffsets[];  
     147        static Real msObjectScales[]; 
     148        static String msObjectCaptions[]; 
     149 
    143150protected: 
    144151 
    145152        void initHelpOverlayElement(String name, int top); 
    146         void initOverlayElement(OverlayElement **elInfo, String ext, String name, int top, String caption); 
     153        void initOverlayElement(OverlayElement **elInfo, String ext, String name,  
     154                                                        int top, String caption); 
    147155 
    148156        //-- initialise overlays 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp

    r164 r173  
    1111//#include "OgreRefAppWorld.h" 
    1212#include "TestCullingTerrainApplication.h" 
    13  
     13#include "TerrainFrameListener.h" 
    1414 
    1515#define WIN32_LEAN_AND_MEAN 
    1616#include <windows.h> 
    1717 
    18 String currentObjectCaptions[] = 
    19 { 
    20         "robot", 
    21         "athene", 
    22         "ninja" 
    23         //"ogrehead" 
    24 }; 
    25  
    26 const float walk_duration = 10.0f; 
    27 const float wait_duration = 2.0f; 
    28 const float rotate_factor = 0.7f; 
    29 const float move_factor = 0.03; 
    30  
    31 /***************************************/ 
    32 /*      EntityState implementation     */ 
    33 /***************************************/ 
     18 
     19/**********************************************/ 
     20/*             EntityState implementation     */ 
     21/**********************************************/ 
     22 
     23 
    3424Vector3 EntityState::msMinPos = Vector3::ZERO; 
    3525Vector3 EntityState::msMaxPos = Vector3::ZERO; 
     
    250240        mSunLight->setCastShadows(true); 
    251241 
    252         // set light angle not too sharp, otherwise shadows textures will be broken 
     242        // set light angle not too small over the surface, otherwise shadows textures will be broken 
    253243        Vector3 dir(0.5, 1, 0.5); 
    254244        dir.normalise(); 
     
    288278        mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); */ 
    289279 
    290         mSceneMgr->setShadowTextureSettings(1024, 2); 
     280        // Use 512x512 texture in GL since we can't go higher than the window res 
     281        mSceneMgr->setShadowTextureSettings(512, 2); 
     282 
    291283        mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 
    292284    
     
    326318void  TestCullingTerrainApplication::generateScene(int num, int objectType) 
    327319{ 
    328         mTerrainContentGenerator->GenerateScene(num, currentObjectCaptions[objectType]); 
     320        Vector3 scale(TerrainFrameListener::msObjectScales[objectType],  
     321                                  TerrainFrameListener::msObjectScales[objectType], 
     322                                  TerrainFrameListener::msObjectScales[objectType]); 
     323 
     324        mTerrainContentGenerator->SetScale(scale); 
     325        mTerrainContentGenerator->SetOffset(TerrainFrameListener::msObjectTerrainOffsets[objectType]); 
     326        mTerrainContentGenerator->GenerateScene(num, TerrainFrameListener::msObjectCaptions[objectType]); 
    329327 
    330328        if (objectType != 0) // from our objects, only robot has animation phases 
     
    384382} 
    385383//----------------------------------------------------------------------- 
    386 String TestCullingTerrainApplication::getCurrentObjectCaption(int id) 
    387 { 
    388         return currentObjectCaptions[id]; 
    389 } 
    390 //----------------------------------------------------------------------- 
    391384void TestCullingTerrainApplication::chooseSceneManager() 
    392385{ 
  • trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h

    r164 r173  
    1111#include <OgreEntity.h> 
    1212 
     13// z order index of visualizaion viewport 
     14#define VIZ_VIEWPORT_Z_ORDER 10 
     15 
     16 
     17//-- constants for animation 
     18const float walk_duration = 10.0f; 
     19const float wait_duration = 2.0f; 
     20const float rotate_factor = 0.7f; 
     21const float move_factor = 0.03; 
     22 
     23 
     24/** Rendertarget listener which shows a visualization. 
     25*/ 
    1326class VisualizationRenderTargetListener: public RenderTargetListener 
    1427{ 
Note: See TracChangeset for help on using the changeset viewer.