Ignore:
Timestamp:
07/06/05 02:36:16 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r155 r156  
    99#include <OgreEntity.h> 
    1010#include <OgreSubEntity.h> 
     11 
    1112 
    1213namespace Ogre { 
     
    3132mSkipTransparents(false), 
    3233mSavedShadowTechnique(SHADOWTYPE_NONE), 
    33 mRenderOnlyBoundingBoxes(false) 
     34mRenderHierarchyNodes(false) 
     35//mRenderHierarchyNodes(true) 
    3436{ 
    3537        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
     
    147149        //Pass *usedPass = ((mRenderDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass);  
    148150         
    149         // set depth fill pass only if depth write enabled 
     151        // set depth fill pass if we currently do not make an aabb occlusion query 
    150152        Pass *usedPass = (mRenderDepthPass && !mHierarchyInterface->IsBoundingBoxQuery() ?  
    151153                                          mDepthPass : pass); 
     
    208210void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    209211{ 
     212        // clear list of solid boxes (used for item buffer hierarchy node rendering) 
     213        /*for (int i=0; i<(int)mSolidBoxes.size(); ++i) 
     214                delete mSolidBoxes[i]; 
     215 
     216        mSolidBoxes.clear();*/ 
     217 
    210218        //-- show visible scene nodes and octree bounding boxes from last frame 
    211219        if (mShowVisualization) 
     
    213221                PrepareVisualization(cam); 
    214222        } 
    215         else if (mRenderOnlyBoundingBoxes) 
    216         { 
     223        else if (mRenderHierarchyNodes) 
     224        { 
     225                AxisAlignedBox aab; 
     226                 
     227 
     228                // get rendered hierarchy nodes from last frame 
     229                GtpVisibility::HierarchyNodeList *nodeList = mHierarchyInterface->GetRenderedNodes(); 
     230                GtpVisibility::HierarchyNodeList::iterator nodeIt, nodeIt_end = nodeList->end(); 
     231 
     232                for (nodeIt = nodeList->begin(); nodeIt != nodeIt_end; ++nodeIt)                 
     233                { 
     234                        SolidBoundingBox *solidBox = new SolidBoundingBox(); 
     235                        solidBox->SetupBoundingBox(aab); 
     236 
     237                        Octree *octree = static_cast<Octree *>(*nodeIt); 
     238                        solidBox->setId(octree->getId()); 
     239                        mSolidBoxes.push_back(solidBox); 
     240 
     241                        aab = octree->_getWorldAABB(); 
     242                        std::stringstream d; d << "bounding box with id: " << octree->getId() << ", " << aab << "\n"; 
     243                        LogManager::getSingleton().logMessage(d.str()); 
     244 
     245                        getRenderQueue()->addRenderable(solidBox);       
     246                } 
    217247        } 
    218248        else  
     
    233263        //TerrainSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
    234264         
     265        // -- delete lists stored for visualization 
    235266        mVisible.clear(); 
    236267        mBoxes.clear(); 
    237  
    238268} 
    239269//----------------------------------------------------------------------- 
     
    246276    // e.g., visualization, shadow pass 
    247277 
    248         if (mShowVisualization || mRenderOnlyBoundingBoxes || 
    249            (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE && mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 
     278        if (mShowVisualization || mRenderHierarchyNodes || 
     279           (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE &&  
     280            mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 
    250281        {        
    251282                IlluminationRenderStage savedStage = mIlluminationStage;  
    252283         
    253                 if (mShowVisualization)  
    254                         // disable illumination stage because we want no shadows in visualization 
     284                if (mShowVisualization || mRenderHierarchyNodes)  
     285                        // disable illumination stage because we want no shadows 
    255286                        mIlluminationStage = IRS_NONE; 
    256287 
     
    416447                mUseItemBuffer = (*static_cast<const bool *>(val)); 
    417448                return true; 
     449        } 
     450        if (key == "RenderHierarchyNodes") 
     451        { 
     452                mRenderHierarchyNodes = (*static_cast<const bool *>(val)); 
    418453        } 
    419454        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
     
    503538        } 
    504539 
    505         //--- item buffer 
     540        // --- item buffer 
     541 
    506542    // Iterate through priorities 
    507543    RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     
    604640 
    605641        Pass *usedPass = setPass(mItemBufferPass);  
    606          
    607         /*if (rend->getId() > 0) 
    608         { 
    609                 std::stringstream d; d << "item buffer id: " << rend->getId() << ", col: " << col[0] << 
    610                         " " << col[1] << " " << col[2] << " " << col[3]; 
    611                 LogManager::getSingleton().logMessage(d.str()); 
    612         }*/ 
     642 
    613643 
    614644        // Render a single object, this will set up auto params if required 
Note: See TracChangeset for help on using the changeset viewer.