Changeset 2283


Ignore:
Timestamp:
03/23/07 01:40:24 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2280 r2283  
    20252025                return; 
    20262026        } 
    2027 Ogre::LogManager::getSingleton().logMessage("here99"); 
     2027 
    20282028    Root::getSingleton()._setCurrentSceneManager(this); 
    20292029        mActiveQueuedRenderableVisitor->targetSceneMgr = this; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r2281 r2283  
    6262         
    6363        std::vector<Octree *> nodes; 
    64  
    65         //LogManager::getSingleton().logMessage("***"); 
     64        nodes.reserve(8); 
     65 
    6666        for (int i = 0; i < 8; ++ i) 
    6767        { 
     
    7070                int z = i & 1; 
    7171         
     72                //std::stringstream d; d << x << " " << y << " " << z; 
     73                //Ogre::LogManager::getSingleton().logMessage(d.str()); 
     74 
    7275                if ((child = octree->mChildren[x][y][z]) != NULL) 
    7376                { 
     
    7679        } 
    7780 
     81        //std::stringstream str; str << "nodes: " << nodes.size(); 
     82        //Ogre::LogManager::getSingleton().logMessage(str.str()); 
     83 
    7884        if (nodes.empty()) 
    7985                return NULL; 
    8086 
    81         int r = (int) (rand() * (float)nodes.size()); 
     87        int r = (int)(((float)rand() / RAND_MAX) * ((float)nodes.size() - 0.5f)); 
     88 
     89        //std::stringstream str2; 
     90        //str2 << "rand: " << r; 
     91        //Ogre::LogManager::getSingleton().logMessage(str2.str()); 
    8292 
    8393        return GetRandomLeaf(nodes[r]); 
     
    101111        if (!octree->mNodes.empty()) 
    102112        { 
     113                RenderNodeRecursive(node); 
     114        } 
     115 
     116/* 
    103117                // render everything from here 
    104118                if (octree->isOctreeFullyVisible()) 
     
    133147                        mDistanceQueue->push(nextChild); 
    134148        } 
     149        */ 
    135150} 
    136151//----------------------------------------------------------------------- 
     
    206221         
    207222        Octree *nextChild; 
    208         //LogManager::getSingleton().logMessage("***"); 
     223         
    209224        for (int i = 0; i < 8; ++ i) 
    210225        { 
     
    212227                int y = (i & 2) / 2; 
    213228                int z = i & 1; 
    214                 Ogre::LogManager::getSingleton().logMessage("y"); 
    215                 //std::stringstream d; d << "x " << x << " y " << y << " z " << z; 
    216                 //LogManager::getSingleton().logMessage(d.str()); 
    217  
    218                 if ((nextChild = octant->mChildren[x][y][z]) != NULL) 
     229                 
     230                        if ((nextChild = octant->mChildren[x][y][z]) != NULL) 
    219231                { 
    220232                        DetermineFullVisibility(nextChild); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp

    r2281 r2283  
    3333        ///////////// 
    3434        //-- PART 1: process finished occlusion queries 
    35          
     35        //mHierarchyInterface->TraverseNode2(mHierarchyInterface->GetHierarchyRoot()); 
     36        //return; 
     37 
    3638        while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 
    3739        { 
     
    108110                                        continue; 
    109111                                } 
    110                                 if (mHierarchyInterface->IsLeaf(node)) 
    111                                 { 
    112                                         if (mHierarchyInterface->IsNodeVisible(node)) 
    113                                                 CullingLogManager::GetSingleton()->LogMessage("u"); 
    114                                         else 
    115                                                 CullingLogManager::GetSingleton()->LogMessage("g"); 
    116                                 } 
    117                                  
     112                                                                 
    118113                                if (mHierarchyInterface->IsNodeFullyVisible(node)) 
    119114                                { 
    120                                         CullingLogManager::GetSingleton()->LogMessage("here8"); 
    121115                                        // node fully visible => test only random leaves 
    122116                                        for (int i = 0; i < mRandomCandidates; ++ i) 
    123117                                        { 
    124                                                 CullingLogManager::GetSingleton()->LogMessage("z"); 
    125118                                                HierarchyNode *randomLeaf = mHierarchyInterface->GetRandomLeaf(node); 
    126                                                 CullingLogManager::GetSingleton()->LogMessage("c"); 
     119                                                 
    127120                                                if (!randomLeaf) 
    128121                                                        continue; 
     
    136129                                                queryQueue.push(QueryPair(node,  
    137130                                                        mHierarchyInterface->IssueNodeOcclusionQuery(node))); 
    138                                                  
    139                                                         CullingLogManager::GetSingleton()->LogMessage("a"); 
    140                                                 mHierarchyInterface->TraverseNode2(node); 
    141                                                         CullingLogManager::GetSingleton()->LogMessage("b"); 
    142131                                        } 
     132 
     133                                        mHierarchyInterface->TraverseNode2(node); 
    143134 
    144135                                        continue; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r2233 r2283  
    17781778                { 
    17791779                        const int randIdx =  
    1780                                 (int)RandomValue(0, (Real)((int)data.mPolygons->size() - 1)); 
     1780                                (int)RandomValue(0, (Real)((float)data.mPolygons->size() - 0.5f)); 
    17811781                        Polygon3 *nextPoly = (*data.mPolygons)[randIdx]; 
    17821782 
     
    18141814                // swap candidate to the end to avoid testing same plane 
    18151815                std::swap((*data.mPolygons)[maxIdx], (*data.mPolygons)[candidateIdx]); 
    1816                 //Polygon3 *poly = (*data.mPolygons)[(int)RandomValue(0, (int)polys.size() - 1)]; 
    1817  
     1816         
    18181817                // evaluate current candidate 
    18191818                BspNodeGeometry fGeom, bGeom; 
     
    18951894Plane3 VspBspTree::ChooseCandidatePlane(const RayInfoContainer &rays) const 
    18961895{ 
    1897         const int candidateIdx = (int)RandomValue(0, (Real)((int)rays.size() - 1)); 
     1896        const int candidateIdx = (int)RandomValue(0, (Real)((float)rays.size() - 0.5f)); 
    18981897 
    18991898        const Vector3 minPt = rays[candidateIdx].ExtrapOrigin(); 
     
    21032102        { 
    21042103                const int testIdx = useRand ?  
    2105                         (int)RandomValue(0, (Real)((int)data.mRays->size() - 1)) : i; 
     2104                        (int)RandomValue(0, (Real)((float)data.mRays->size() - 0.5f)) : i; 
    21062105                RayInfo rayInf = (*data.mRays)[testIdx]; 
    21072106 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp

    r2199 r2283  
    283283                Intersectable *sourceObj = mObjects[5]; 
    284284 
    285                 const int index = (int)RandomValue(0, (Real)((int)leaves.size() - 1)); 
     285                const int index = (int)RandomValue(0, (Real)((float)leaves.size() - 0.5f)); 
    286286                VssTreeLeaf *leaf = leaves[index]; 
    287287 
Note: See TracChangeset for help on using the changeset viewer.