Changeset 135 for trunk/VUT/Ogre


Ignore:
Timestamp:
06/16/05 18:13:33 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/Ogre
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/Ogre/include/OgreTerrainContentGenerator.h

    r130 r135  
    3232 
    3333        /**  
    34                 Generates objects and places it on the terrain 
     34                Generates objects and places it on the terrain. 
    3535        */ 
    3636        SceneNode *GenerateSceneObject(const Vector3 &position,  
    37                 const Vector3 &rotation, const String &objName, const bool clampToTerrain = true); 
     37                const Vector3 &rotation, const String &objName); 
     38        /**  
     39                Generates objects and optionally places it on the terrain. 
     40                @param clampToTerrain if true, scene object is clamped to the terrain 
     41        */ 
     42        SceneNode *GenerateSceneObject(const Vector3 &position,  
     43                const Vector3 &rotation, const String &objName, const bool clampToTerrain); 
    3844         
    3945        /** offset which is added to objects when put into the terrain */ 
  • trunk/VUT/Ogre/resources/VisibilityDemo.overlay

    r121 r135  
    240240} 
    241241 
     242 
    242243Example/Visibility/HelpOverlay 
    243244{ 
    244245        zorder 600 
    245246        // Stats block 
    246         container BorderPanel(Example/Visibility/HelpPanel) 
     247        container BorderPanel(Example/Visibility/Help/HelpPanel) 
    247248        { 
    248249                metrics_mode pixels 
     
    250251                vert_align top 
    251252                width 600 
    252                 height 315 
     253                height 300 
    253254                left 200 
    254255                top 200 
     
    276277                } 
    277278 
    278                 element TextArea(Example/Visibility/Help/Help) 
     279                element TextArea(Example/Visibility/Help/HelpOptions) 
    279280                { 
    280281                        metrics_mode pixels 
     
    293294                { 
    294295                        left 5 
    295                         top 40 
     296                        top 30 
    296297                        width 180 
    297298                        height 30 
     
    301302                { 
    302303                        left 5 
    303                         top 55 
     304                        top 45 
    304305                        width 180 
    305306                        height 30 
     
    309310                { 
    310311                        left 5 
    311                         top 85 
     312                        top 75 
    312313                        width 180 
    313314                        height 30 
     
    317318                { 
    318319                        left 5 
    319                         top 70 
     320                        top 60 
    320321                        width 180 
    321322                        height 30 
     
    325326                { 
    326327                        left 5 
    327                         top 115 
     328                        top 105 
    328329                        width 180 
    329330                        height 30 
     
    333334                { 
    334335                        left 5 
    335                         top 130 
     336                        top 120 
    336337                        width 180 
    337338                        height 30 
     
    342343                { 
    343344                        left 5 
    344                         top 160 
     345                        top 150 
    345346                        width 180 
    346347                        height 30 
     
    350351                { 
    351352                        left 5 
    352                         top 175 
     353                        top 165 
    353354                        width 175 
    354355                        height 30 
     
    358359                { 
    359360                        left 5 
    360                         top 190 
     361                        top 180 
    361362                        width 190 
    362363                        height 30 
     
    366367                { 
    367368                        left 5 
    368                         top 220 
     369                        top 210 
    369370                        width 180 
    370371                        height 30 
     
    374375                { 
    375376                        left 5 
    376                         top 235 
     377                        top 225 
    377378                        width 180 
    378379                        height 30 
     
    382383                { 
    383384                        left 5 
    384                         top 250 
     385                        top 240 
    385386                        width 180 
    386387                        height 30 
     
    390391                { 
    391392                        left 5 
    392                         top 265 
     393                        top 255 
    393394                        width 180 
    394395                        height 30 
     
    398399                { 
    399400                        left 5 
    400                         top 280 
     401                        top 270 
    401402                        width 180 
    402403                        height 30 
     
    405406        } 
    406407} 
     408 
     409Example/Visibility/QueryOverlay 
     410{ 
     411        zorder 650 
     412        // Stats block 
     413        container BorderPanel(Example/Visibility/Query/QueryPanel) 
     414        { 
     415                metrics_mode pixels 
     416                horz_align left 
     417                vert_align top 
     418                width 600 
     419                height 120 
     420                left 200 
     421                top 300 
     422                material Core/StatsBlockCenter 
     423                 
     424                border_size 1 1 1 1 
     425                border_material Core/StatsBlockBorder 
     426                border_topleft_uv     0.0000 1.0000 0.0039 0.9961 
     427                border_top_uv         0.0039 1.0000 0.9961 0.9961 
     428                border_topright_uv    0.9961 1.0000 1.0000 0.9961 
     429                border_left_uv        0.0000 0.9961 0.0039 0.0039 
     430                border_right_uv       0.9961 0.9961 1.0000 0.0039 
     431                border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000 
     432                border_bottom_uv      0.0039 0.0039 0.9961 0.0000 
     433                border_bottomright_uv 0.9961 0.0039 1.0000 0.0000 
     434 
     435                container Panel(Example/Visibility/Query/BreakPanel) 
     436                { 
     437                        metrics_mode pixels 
     438                        left 5  
     439                        top 22 
     440                        width 590 
     441                        height 1 
     442                        material Core/StatsBreak 
     443                } 
     444 
     445                element TextArea(Example/Visibility/Query/Headline) 
     446                { 
     447                        metrics_mode pixels 
     448                        left 5 
     449                        top 5 
     450                        width 90 
     451                        height 30 
     452                        font_name TrebuchetMSBold 
     453                        char_height 19 
     454                        caption Exact Visibility Query 
     455                        colour_top 1 1 0.7 
     456                        colour_bottom 1 1 0.7 
     457                } 
     458 
     459                element TextArea(Example/Visibility/Query/QueryType): Example/Visibility/Templates/BasicText 
     460                { 
     461                        left 5 
     462                        top 30 
     463                        width 90 
     464                        height 30 
     465                        caption Type 
     466                } 
     467                 
     468                 
     469                element TextArea(Example/Visibility/Query/QueryTypeInfo): Example/Visibility/Templates/BasicText 
     470                { 
     471                        left 180 
     472                        top 30 
     473                        width 90 
     474                        height 30 
     475                        caption : 
     476                } 
     477 
     478                element TextArea(Example/Visibility/Query/VisibleNodes): Example/Visibility/Templates/BasicText 
     479                { 
     480                        left 5 
     481                        top 45 
     482                        width 90 
     483                        height 30 
     484                        caption Visible nodes 
     485                } 
     486                element TextArea(Example/Visibility/Query/VisibleNodesInfo): Example/Visibility/Templates/BasicText 
     487                { 
     488                        left 180 
     489                        top 45 
     490                        width 90 
     491                        height 30 
     492                        caption : 
     493                } 
     494 
     495                element TextArea(Example/Visibility/Query/VisibleGeometry): Example/Visibility/Templates/BasicText 
     496                { 
     497                        left 5 
     498                        top 60 
     499                        width 90 
     500                        height 30 
     501                        caption Visible geometry 
     502                } 
     503                element TextArea(Example/Visibility/Query/VisibleGeometryInfo): Example/Visibility/Templates/BasicText 
     504                { 
     505                        left 180 
     506                        top 60 
     507                        width 90 
     508                        height 30 
     509                        caption : 
     510                } 
     511 
     512                element TextArea(Example/Visibility/Query/NodeVisibility): Example/Visibility/Templates/BasicText 
     513                { 
     514                        left 5 
     515                        top 75 
     516                        width 90 
     517                        height 30 
     518                        caption Avg. node visibility 
     519                } 
     520 
     521                element TextArea(Example/Visibility/Query/NodeVisibilityInfo): Example/Visibility/Templates/BasicText 
     522                { 
     523                        left 180 
     524                        top 75 
     525                        width 90 
     526                        height 30 
     527                        caption: 
     528                } 
     529 
     530                element TextArea(Example/Visibility/Query/GeometryVisibility): Example/Visibility/Templates/BasicText 
     531                { 
     532                        left 5 
     533                        top 90 
     534                        width 90 
     535                        height 30 
     536                        caption Avg. geometry visibility 
     537                } 
     538 
     539                element TextArea(Example/Visibility/Query/GeometryVisibilityInfo): Example/Visibility/Templates/BasicText 
     540                { 
     541                        left 180 
     542                        top 90 
     543                        width 90 
     544                        height 30 
     545                        caption: 
     546                } 
     547 
     548        } 
     549} 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r130 r135  
    137137        { 
    138138                mPreviousNode = node; 
    139                 static_cast<Octree *>(node)->_getCullBounds(&mBox); 
     139        //      static_cast<Octree *>(node)->_getCullBounds(&mBox); 
     140                mBox = static_cast<Octree *>(node)->_getWorldAABB(); 
    140141        } 
    141142 
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r133 r135  
    188188        else 
    189189        { 
    190                 // used by the scene manager, because bounding box rendering must be handled 
    191                 // differently 
     190                // this information is used e.g., by the scene graph, because the bounding box 
     191                // must be treated differently to the scene geometry during rendering 
    192192                mIsBoundingBoxQuery = true; 
    193193 
  • trunk/VUT/Ogre/src/OgrePlatformQueryManager.cpp

    r134 r135  
    2525                            bool relativeVisibility) 
    2626{ 
    27         if (relativeVisibility) 
    28                 LogManager::getSingleton().logMessage("relative"); 
    29         else 
    30                 LogManager::getSingleton().logMessage("absolute"); 
    31  
    3227        // we need access to the scene manager and the rendersystem 
    3328        PlatformHierarchyInterface *pfHierarchyInterface =  
     
    3934        Camera *pCam = const_cast<Camera *>(&camera);  
    4035 
     36        bool overlayEnabled = mViewport->getOverlaysEnabled(); 
     37        mViewport->setOverlaysEnabled(false); 
    4138        pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 
    4239 
     
    5350        GtpVisibility::GeometryList geometryList; 
    5451         
    55         GtpVisibility::HierarchyNodeList::const_iterator nodeIt, nodeIt_end = nodeList->end(); 
     52        GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 
    5653        // geometry list has still do be built 
    5754        GtpVisibility::GeometryList::iterator geometryIt, geometryIt_end; 
    5855 
     56        // to obtain the correct number of projected pixels, depth write must be disabled 
     57 
     58        bool enableDepthWrite = false; 
     59        // this option must be provided by the scene manager 
     60        pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 
     61 
     62        /* relative visiblity: 
     63                1) get visible pixels count of objects 
     64                2) clear frame buffer 
     65                3) get projected visible pixels count: 
     66                   test all objects again without depth write (set as option in scene manager) 
     67                4) calculate ratio between visible vs. projected pixels 
     68        */ 
    5969        // for relative visibility we need 2 rendering passes 
    6070        int n = relativeVisibility ? 2 : 1; 
     
    6373        { 
    6474                //-- queries for hierarchy nodes 
    65                 for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 
     75                for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt)                 
    6676                { 
    6777                        // TODO: DELETE QUERIES FROM PREVIOUS RENDER 
     
    6979                         
    7080                        // store geometry of the hierarchy node in a geometry list (only once!) 
    71                         if (i == n - 2) 
     81                        if (i == 0) 
    7282                        { 
    7383                                mHierarchyInterface->GetGeometry(*nodeIt, &geometryList, false); 
     
    8393                } 
    8494 
    85                 // --- relative visiblity 
    86                 /*  
    87                         1) get visible pixels count of objects 
    88                         2) clear frame buffer 
    89                         3) get projected visible pixels count: 
    90                            test all objects again without depth write (set as option in scene manager) 
    91                         4) calculate ratio between visible vs. projected pixels 
    92                 */ 
    93                 if (i == n - 2) // if relativeVisibility, between first and second loop 
    94                 { 
    95                         pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR | FBT_DEPTH); 
    96                 } 
    97  
    98                 // to obtain the correct number of projected pixels, depth write must be disabled 
    99                 bool enableDepthWrite = (i != n - 2); 
    100  
    101                 // this option must be provided by the scene manager 
    102                 pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 
     95         
     96                pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_DEPTH); 
    10397        } 
    10498 
     99        enableDepthWrite = true; 
     100        // this option must be provided by the scene manager 
     101        pfHierarchyInterface->GetSceneManager()->setOption("DepthWrite", &enableDepthWrite); 
     102         
     103        mViewport->setOverlaysEnabled(overlayEnabled); 
    105104 
    106105        //---- collect results 
    107         unsigned int visiblePixels; 
     106        unsigned int visiblePixels = 0; 
    108107 
    109108        GtpVisibility::QueryList::iterator visQueryIt, projQueryIt; 
     
    111110        visQueryIt = queryList[0].begin(); 
    112111        projQueryIt = queryList[1].begin(); 
     112 
    113113         
    114114        for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt) 
    115115        { 
    116116                (*visQueryIt)->GetQueryResult(visiblePixels, true); 
    117  
     117         
     118                 
    118119                float vis = (float)visiblePixels; 
    119120 
     
    121122                { 
    122123                        (*projQueryIt)->GetQueryResult(visiblePixels, true); 
    123                         std::stringstream d; d << "relativ " << visiblePixels; 
    124                         LogManager::getSingleton().logMessage(d.str()); 
    125  
     124         
    126125                        if (visiblePixels > 0) 
    127126                        {                                
     
    132131 
    133132                ++visQueryIt; 
    134  
     133                 
    135134                // leave nodes with visibilty 0 in queue:  
    136135                // happens if node is intersected by near plane 
     
    141140        geometryIt_end = geometryList.end(); 
    142141         
    143         /*for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 
     142        for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt) 
    144143        { 
    145                 (*absQueryIt)->GetQueryResult(visiblePixels, true); 
     144                (*visQueryIt)->GetQueryResult(visiblePixels, true); 
     145                 
    146146 
    147147                float vis = (float)visiblePixels; 
     
    150150                if (relativeVisibility) 
    151151                { 
    152                         (*relQueryIt)->GetQueryResult(visiblePixels, true); 
     152                        (*projQueryIt)->GetQueryResult(visiblePixels, true); 
    153153 
    154154                        if (visiblePixels) 
     
    156156                                vis /= (float) visiblePixels; 
    157157                        } 
    158                         ++relQueryIt; 
     158                        ++projQueryIt; 
    159159                } 
    160160 
    161                 ++absQueryIt; 
     161                ++visQueryIt; 
    162162 
    163163                // approximate depth ordering during rendering =>  
     
    167167                        visibleGeometry->push_back(GtpVisibility::MeshInfo(*geometryIt, vis)); 
    168168                } 
    169         }*/ 
     169        } 
    170170 
    171171} 
     
    176176                               bool relativeVisibility) 
    177177{ 
    178          visibleNodes->push_back(GtpVisibility::NodeInfo(mHierarchyInterface->GetSceneRoot(), 1.0f)); 
     178         
    179179} 
    180180//----------------------------------------------------------------------- 
  • trunk/VUT/Ogre/src/OgreTerrainContentGenerator.cpp

    r130 r135  
    7070                                         const Vector3 &rotation, const String& objName, const bool clampToTerrain) 
    7171{ 
     72         
     73        if (clampToTerrain) 
     74        { 
     75                return GenerateSceneObject(position, rotation, objName); 
     76        } 
     77        else 
     78        { 
     79                return SceneContentGenerator::GenerateSceneObject(position, rotation, objName); 
     80        } 
     81} 
     82//----------------------------------------------------------------------- 
     83SceneNode *TerrainContentGenerator::GenerateSceneObject(const Vector3 &position,  
     84                                         const Vector3 &rotation, const String& objName) 
     85{ 
    7286        Vector3 queryResult; 
    7387        // set y to max height so we are sure to be over terrain 
    7488        Vector3 pos(position.x, MAX_HEIGHT, position.z); 
    75  
    76         if (!clampToTerrain) 
    77         { 
    78                 return SceneContentGenerator::GenerateSceneObject(queryResult, rotation, objName); 
    79         } 
    8089 
    8190        if (mRayQueryExecutor->executeRayQuery(&queryResult, position, Vector3::NEGATIVE_UNIT_Y)) 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r134 r135  
    274274        TerrainSceneManager::_renderVisibleObjects(); 
    275275 
    276  
    277276#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    278277        _deleteRenderedQueueGroups(false); 
     
    300299        mVisibilityManager->ApplyVisibilityCulling(); 
    301300 
     301        // delete remaining renderables from queue (or all but transparents) 
     302#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     303        _deleteRenderedQueueGroups(mSkipTransparents); 
     304#endif 
    302305 
    303306        // for depth pass: add visible nodes found with the visibility culling 
     
    320323 
    321324        TerrainRenderable::setCurrentRenderLevelIndex(renderLevel); 
     325        getRenderQueue()->clear(); 
    322326        //WriteLog(); // write out stats 
    323327} 
Note: See TracChangeset for help on using the changeset viewer.