Changeset 1843


Ignore:
Timestamp:
12/04/06 22:34:15 (18 years ago)
Author:
mattausch
Message:

warning! changed pvs output because of paper hack

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp

    r1842 r1843  
    4545        return obj1->GetBox().SurfaceArea() < obj2->GetBox().SurfaceArea(); 
    4646} 
     47 
     48 
    4749 
    4850/***************************************************************/ 
     
    20262028                 
    20272029                //-- export objects 
    2028                 ExportObjects(leaf, stream); 
     2030                // tmp matt 
     2031                if (0) ExportObjects(leaf, stream); 
    20292032                 
    20302033                stream << "\" />" << endl; 
     
    25382541 
    25392542 
     2543void BvHierarchy::CreateUniqueObjectIds() 
     2544{ 
     2545        stack<BvhNode *> nodeStack; 
     2546        nodeStack.push(mRoot); 
     2547 
     2548        int currentId = 0; 
     2549        while (!nodeStack.empty())  
     2550        { 
     2551                BvhNode *node = nodeStack.top(); 
     2552                nodeStack.pop(); 
     2553 
     2554                node->SetId(currentId ++); 
     2555 
     2556                if (!node->IsLeaf())  
     2557                { 
     2558                        BvhInterior *interior = (BvhInterior *)node; 
     2559 
     2560                        nodeStack.push(interior->GetFront()); 
     2561                        nodeStack.push(interior->GetBack()); 
     2562                } 
     2563        } 
     2564} 
     2565 
     2566 
    25402567void BvHierarchy::ApplyInitialSubdivision(SubdivisionCandidate *firstCandidate, 
    25412568                                                                                  vector<SubdivisionCandidate *> &candidateContainer) 
     
    26192646        const float areaLarge = largeObj->GetBox().SurfaceArea(); 
    26202647 
    2621         return areaLarge / (areaLarge - areaSmall + Limits::Small); 
     2648        return areaSmall / (areaLarge - areaSmall + Limits::Small); 
    26222649} 
    26232650 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1789 r1843  
    627627        float GetRenderCostIncrementially(BvhNode *node) const; 
    628628 
     629        void CreateUniqueObjectIds(); 
    629630 
    630631protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1825 r1843  
    26172617        RegisterOption("Hierarchy.Construction.maxRepairs", 
    26182618                                        optInt, 
    2619                                         "hierarchy_construction_maxRepairs=", 
     2619                                        "hierarchy_construction_max_repairs=", 
    26202620                                        "1000"); 
    26212621 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1764 r1843  
    149149 
    150150                SetFilled(); 
     151                // hack 
     152                if (1 || (leaf->mObjects.size() < 50000)) 
    151153                ExportGeometry(leaf->mObjects, true, box); 
    152154        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1842 r1843  
    23522352} 
    23532353 
    2354 } 
     2354 
     2355void HierarchyManager::CreateUniqueObjectIds() 
     2356{ 
     2357        mBvHierarchy->CreateUniqueObjectIds(); 
     2358} 
     2359 
     2360 
     2361 
     2362} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1830 r1843  
    292292        void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 
    293293 
     294        void CreateUniqueObjectIds(); 
     295 
     296 
    294297        float mInitialRenderCost; 
    295298 
     
    530533        float EvalFullMem() const; 
    531534 
     535 
     536 
    532537protected: 
    533538 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1842 r1843  
    23922392 
    23932393                // hack: just output full pvs 
    2394                 if (obj->Type() == Intersectable::BVH_INTERSECTABLE) 
     2394                if (0 && (obj->Type() == Intersectable::BVH_INTERSECTABLE)) 
    23952395                { 
    23962396                        ObjectContainer objects;  
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1842 r1843  
    562562        disposeRays(postProcessSamples, outRays); 
    563563 
    564                  
    565         // write view cells to disc 
    566         if (mExportViewCells) 
    567         { 
    568                 char filename[100]; 
    569                 Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename); 
    570                 ExportViewCells(filename, mExportPvs, mPreprocessor->mObjects); 
    571         } 
    572564 
    573565        //////////////// 
     
    610602        // recalculate view cells 
    611603        EvaluateViewCellsStats(); 
     604 
     605        if (1) CompressViewCells(); 
     606 
     607        // write view cells to disc 
     608        if (mExportViewCells) 
     609        { 
     610                char filename[100]; 
     611                Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename); 
     612                ExportViewCells(filename, mExportPvs, mPreprocessor->mObjects); 
     613        } 
    612614 
    613615        return numSamples; 
     
    16261628{ 
    16271629        return viewCell->GetVolume(); 
     1630} 
     1631 
     1632 
     1633void ViewCellsManager::CompressViewCells() 
     1634{ 
     1635        //////////// 
     1636        //-- compression 
     1637 
     1638        if (ViewCellsTreeConstructed() && mCompressViewCells) 
     1639        { 
     1640                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     1641                 
     1642                cout << "number of entries before compress: " << pvsEntries << endl; 
     1643                Debug << "number of entries before compress: " << pvsEntries << endl; 
     1644 
     1645                mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 
     1646 
     1647                pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     1648                 
     1649                Debug << "number of entries after compress: " << pvsEntries << endl; 
     1650                cout << "number of entries after compress: " << pvsEntries << endl; 
     1651        } 
    16281652} 
    16291653 
     
    45824606         
    45834607 
    4584         //////////// 
    4585         //-- compression 
    4586  
    4587         if (ViewCellsTreeConstructed() && mCompressViewCells) 
    4588         { 
    4589                 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    4590                  
    4591                 cout << "number of entries before compress: " << pvsEntries << endl; 
    4592                 Debug << "number of entries before compress: " << pvsEntries << endl; 
    4593  
    4594                 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 
    4595  
    4596                 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    4597                  
    4598                 Debug << "number of entries after compress: " << pvsEntries << endl; 
    4599                 cout << "number of entries after compress: " << pvsEntries << endl; 
    4600         } 
    4601  
     4608        if (0) CompressViewCells(); 
     4609         
    46024610        // collapse sibling leaves that share the same view cell 
    46034611        if (0) mVspBspTree->CollapseTree(); 
     
    55005508         
    55015509 
     5510        mHierarchyManager->CreateUniqueObjectIds(); 
     5511 
    55025512        /////////// 
    55035513        //-- compression 
    55045514 
    5505         if (ViewCellsTreeConstructed() && mCompressViewCells) 
    5506         { 
    5507                 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    5508                  
    5509                 cout << "number of entries before compress: " << pvsEntries << endl; 
    5510                 Debug << "number of entries before compress: " << pvsEntries << endl; 
    5511  
    5512                 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 
    5513  
    5514                 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
    5515                  
    5516                 Debug << "number of entries after compress: " << pvsEntries << endl; 
    5517                 cout << "number of entries after compress: " << pvsEntries << endl; 
    5518         } 
     5515        if (0) CompressViewCells(); 
    55195516 
    55205517        ///////////// 
     
    59245921        stream << "<VisibilitySolution>" << endl; 
    59255922 
    5926         if (exportPvs)  
     5923        // §§ tmp matt: for storage cost 
     5924        if (0 && exportPvs)  
    59275925        { 
    59285926        /////////////// 
     
    62276225                evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    62286226                evalStrats.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 
    6229  
    6230                 Debug << "casting volume strategies" << endl; 
    6231                 cout << "casting volume strategies" << endl; 
    62326227        } 
    62336228        else 
     
    62386233                //evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    62396234                //evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    6240  
    6241                 Debug << "casting surface strategies" << endl; 
    6242                 cout << "casting surface strategies" << endl; 
    62436235        } 
    62446236         
     
    62476239                Debug << evalStrats[i] << " "; 
    62486240        Debug << endl; 
     6241 
     6242        cout << "casting eval strategies: "; 
     6243        for (int i = 0; i < (int)evalStrats.size(); ++ i) 
     6244                cout << evalStrats[i] << " "; 
     6245        cout << endl; 
    62496246 
    62506247        while (castSamples < numSamples) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1824 r1843  
    467467                                                                  const ViewCellContainer &viewCells) const; 
    468468 
    469  
     469        void CompressViewCells(); 
    470470        ///////////////////////////// 
    471471        // static members 
Note: See TracChangeset for help on using the changeset viewer.