Changeset 158 for trunk/VUT/Ogre/src


Ignore:
Timestamp:
07/06/05 11:04:25 (19 years ago)
Author:
mattausch
Message:

removed node visibility for item buffer

Location:
trunk/VUT/Ogre/src
Files:
6 edited

Legend:

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

    r155 r158  
    1212} 
    1313//----------------------------------------------------------------------- 
    14 void BspHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 
     14void BspHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 
    1515{ 
    1616} 
  • trunk/VUT/Ogre/src/OgreItemBufferQueryManager.cpp

    r156 r158  
    7777        } 
    7878 
    79         delete [] buf; 
    80  
    81         // ---- render visible nodes and collect node visibility 
    82         bool renderBoxes = true; 
    83         sm->setOption("RenderHierarchyNodes", &renderBoxes); 
    84  
    85  
    86         // --- render item buffer for visible nodes only 
    87         pfHierarchyInterface->GetSceneManager()->_renderScene(pCam, mViewport, false); 
    88  
    89  
    90         // get frame buffer for node visibility 
    91         buf = mViewport->getTarget()->getBufferContents(dimx, dimy); 
    92  
    93          
    94         // loop through frame buffer & collect visible pixels 
    95         for (int idx = 0; idx < dimy * dimx * 3; idx += 3) 
    96         { 
    97                 // -- decode color code to receive id 
    98                 int id = buf[idx] << 16; 
    99                 id += buf[idx + 1] << 8; 
    100                 id += buf[idx + 2]; 
    101  
    102                 // if valid id <= add visibility (id values start at 1 
    103                 if ((id > 0) && (id < (int)visibleNodes->size())) 
    104                 { 
    105                         ((*visibleNodes)[id]).AddVisibility(1, 1); 
    106                 } 
    107         } 
     79        //-- reset options 
    10880 
    10981        // don't need item buffer anymore 
    11082        useItemBuffer = false; 
    111         //sm->setOption("UseItemBuffer", &useItemBuffer); 
    112  
    113         renderBoxes = false; 
    114         //sm->setOption("RenderHierarchyNodes", &renderBoxes); 
    115  
     83        sm->setOption("UseItemBuffer", &useItemBuffer); 
    11684        // reset initialised - flag 
    11785        mWasInitialised = false; 
    118  
    11986        // reset old overlay status 
    12087        mViewport->setOverlaysEnabled(overlayEnabled); 
    121          
     88        // reset background color 
    12289        mViewport->setBackgroundColour(bg); 
    12390 
     91        // delete array storing the frame buffer 
    12492        delete [] buf; 
    12593} 
     
    146114                visibleGeometry->push_back(GtpVisibility::MeshInfo(it.getNext(), 0, 0)); 
    147115        } 
    148  
    149         // -- initialise hierarchy interface for simple node traversal 
    150         mHierarchyInterface->InitTraversal(false); 
    151  
    152         GtpVisibility::HierarchyNode *node = NULL; 
    153          
    154         int i = 1; 
    155  
    156         while (node = mHierarchyInterface->GetNextNode()) 
    157         { 
    158                 mHierarchyInterface->SetNodeId(node, i++); 
    159                 visibleNodes->push_back(GtpVisibility::NodeInfo(node, 0, 0)); 
    160         } 
    161116} 
    162117 
  • trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp

    r155 r158  
    1010//----------------------------------------------------------------------- 
    1111OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys):  
    12 SceneNodeHierarchyInterface(sm, rsys), mCurrentOctreePosition(0) 
     12SceneNodeHierarchyInterface(sm, rsys) 
    1313{ 
    1414} 
    1515//----------------------------------------------------------------------- 
    16 void OctreeHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 
     16void OctreeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 
    1717{ 
    1818        ++ mNumTraversedNodes; 
     
    168168        } 
    169169} 
    170 //----------------------------------------------------------------------- 
    171 void OctreeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id) 
    172 { 
    173         static_cast<Octree *>(node)->setId(id); 
    174 } 
    175 //----------------------------------------------------------------------- 
    176 int OctreeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node) 
    177 { 
    178         return static_cast<Octree *>(node)->getId(); 
    179 } 
    180 //----------------------------------------------------------------------- 
    181 GtpVisibility::HierarchyNode *OctreeHierarchyInterface::GetNextNode() 
    182 { 
    183         if (mTraversalStack->empty()) 
    184                 return NULL; 
    185          
    186         Octree *octree = static_cast<Octree *>(mTraversalStack->top()); 
    187         mTraversalStack->pop(); 
    188                  
    189         for(int i=0; i<8; ++i) 
    190         { 
    191                 Octree *nextChild =  
    192                         octree->mChildren[(i & 4) >> 2][(i & 2) >> 1][i & 1]; 
    193  
    194                 if (nextChild) 
    195                 { 
    196                         mTraversalStack->push(nextChild); 
    197                 } 
    198         } 
    199  
    200         return octree; 
    201 }  
    202                  
    203170} // namespace Ogre 
  • trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp

    r155 r158  
    130130} 
    131131//----------------------------------------------------------------------- 
    132 void PlatformHierarchyInterface::InitTraversal(Camera *cam, Camera *cullCam, int leavePassesInQueue) 
     132void PlatformHierarchyInterface::InitTraversal(Camera *cam, Camera *cullCam,  
     133                                                                                           int leavePassesInQueue) 
    133134{ 
    134135        GtpVisibility::HierarchyInterface::InitTraversal(); 
  • trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp

    r155 r158  
    1717} 
    1818//----------------------------------------------------------------------- 
    19 void SceneNodeHierarchyInterface::TraverseAndRenderNode(GtpVisibility::HierarchyNode *node) 
     19void SceneNodeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) 
    2020{ 
    2121        ++ mNumTraversedNodes; 
     
    157157    } 
    158158} 
    159 //----------------------------------------------------------------------- 
    160 void SceneNodeHierarchyInterface::SetNodeId(GtpVisibility::HierarchyNode *node, int id) 
    161 { 
    162         static_cast<SceneNode *>(node)->setId(id); 
    163 } 
    164 //----------------------------------------------------------------------- 
    165 int SceneNodeHierarchyInterface::GetNodeId(GtpVisibility::HierarchyNode *node) 
    166 { 
    167         return static_cast<SceneNode *>(node)->getId(); 
    168 } 
    169 //----------------------------------------------------------------------- 
    170 GtpVisibility::HierarchyNode *SceneNodeHierarchyInterface::GetNextNode() 
    171 { 
    172         if (mTraversalStack->empty()) 
    173                 return NULL; 
    174          
    175         SceneNode *node = static_cast<SceneNode *>(mTraversalStack->top()); 
    176         mTraversalStack->pop(); 
    177159 
    178         // internal node: add children to priority queue for further processing 
    179         Node::ChildNodeIterator it = node->getChildIterator(); 
    180                                  
    181         while (it.hasMoreElements())                     
    182         {  
    183                 mTraversalStack->push(it.getNext()); 
    184         } 
    185  
    186         return node; 
    187 }  
    188160} // namespace Ogre      
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r157 r158  
    3131mEnableDepthWrite(true), 
    3232mSkipTransparents(false), 
    33 mSavedShadowTechnique(SHADOWTYPE_NONE), 
    34 mRenderHierarchyNodes(false) 
    35 //mRenderHierarchyNodes(true) 
     33mSavedShadowTechnique(SHADOWTYPE_NONE) 
    3634{ 
    3735        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
     
    210208void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
    211209{ 
    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  
    218210        //-- show visible scene nodes and octree bounding boxes from last frame 
    219211        if (mShowVisualization) 
     
    221213                PrepareVisualization(cam); 
    222214        } 
    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                 } 
    247         } 
    248215        else  
    249216        {        
     
    273240        ColourValue savedAmbient = mAmbientLight; 
    274241 
    275         // --- apply standard rendering for some cases  
    276     // e.g., visualization, shadow pass 
    277  
    278         if (mShowVisualization || mRenderHierarchyNodes || 
     242        // --- apply standard rendering for some cases (e.g., visualization, shadow pass) 
     243 
     244        if (mShowVisualization || 
    279245           (mShadowTechnique == SHADOWTYPE_TEXTURE_MODULATIVE &&  
    280246            mIlluminationStage == IRS_RENDER_TO_TEXTURE)) 
     
    282248                IlluminationRenderStage savedStage = mIlluminationStage;  
    283249         
    284                 if (mShowVisualization || mRenderHierarchyNodes)  
    285                         // disable illumination stage because we want no shadows 
     250                if (mShowVisualization)  
     251                        // disable illumination stage to prevent rendering shadows 
    286252                        mIlluminationStage = IRS_NONE; 
    287253 
     
    448414                return true; 
    449415        } 
    450         if (key == "RenderHierarchyNodes") 
    451         { 
    452                 mRenderHierarchyNodes = (*static_cast<const bool *>(val)); 
    453         } 
     416         
    454417        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    455418                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
Note: See TracChangeset for help on using the changeset viewer.