Changeset 2172


Ignore:
Timestamp:
02/28/07 15:33:04 (17 years ago)
Author:
bittner
Message:

merge

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

Legend:

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

    r2124 r2172  
    765765#ifdef GTP_INTERNAL 
    766766  int rayCaster; 
    767   Environment::GetSingleton()->GetIntValue("Mutation.radiusTermination", 
     767  Environment::GetSingleton()->GetIntValue("Preprocessor.rayCastMethod", 
    768768                                                                                   rayCaster); 
    769769  useEnhancedFeatures = (rayCaster == 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2164 r2172  
    2222#include "InternalRayCaster.h" 
    2323#include "GlobalLinesRenderer.h" 
    24 #include "ObjectsParser.h" 
    2524 
    2625 
     
    266265 
    267266 
    268 bool Preprocessor::LoadBinaryObj(const string &filename, 
     267bool Preprocessor::LoadBinaryObj(const string filename, 
    269268                                                                 SceneGraphNode *root, 
    270269                                                                 vector<FaceParentInfo> *parents) 
     
    278277        cout << "binary obj dump available, loading " << filename.c_str() << endl; 
    279278         
     279        // table for vertices 
     280        VertexContainer vertices;  
     281         
     282        if (parents) 
     283                cout << "using face parents" << endl; 
     284        else 
     285                cout << "not using face parents" << endl; 
     286 
    280287        // read in triangle size 
    281288        int numTriangles; 
     
    302309                root->mGeometry.push_back(obj); 
    303310                 
    304                 if ((i ++) % 500000 == 499999) 
     311                i ++; 
     312         
     313                if (i % 500000 == 499999) 
    305314                         cout<<"\r"<<i<<"/"<<numTriangles<<"\r"; 
    306315        } 
     
    479488        const int files = SplitFilenames(filename, filenames); 
    480489        cout << "number of input files: " << files << endl; 
    481  
    482490        bool result = false; 
    483491        bool isObj = false; 
     
    534542                 
    535543                                result = parser->ParseFile(filename,  
    536                                                                                    mSceneGraph->GetRoot(), 
    537                                                                                    mLoadMeshes, 
    538                                                                                    fi); 
    539  
     544                                                                   mSceneGraph->GetRoot(), 
     545                                                                   mLoadMeshes, 
     546                                                                   fi); 
     547                                                 
    540548                                cout << "loaded " << (int)mSceneGraph->GetRoot()->mGeometry.size() << " entities" << endl; 
    541  
    542549                                // only works for triangles 
    543550                                if (result && !mLoadMeshes) 
    544551                                { 
    545552                                        cout << "exporting binary obj to " << bnFile << "... " << endl; 
    546  
    547553                                        ExportBinaryObj(bnFile, mSceneGraph->GetRoot()); 
    548                                  
    549554                                        cout << "finished" << endl; 
    550555                                } 
    551556 
    552557                                delete parser; 
     558                        } 
     559                        else if (0) 
     560                        { 
     561                                ExportBinaryObj("../data/test.bn", mSceneGraph->GetRoot()); 
    553562                        } 
    554563                } 
     
    729738        char buf[100]; 
    730739 
    731     if (mLoadViewCells) 
     740        if (mLoadViewCells) 
    732741        {        
    733                  
    734 #ifdef USE_BIT_PVS 
    735                 // HACK: for kd pvs, set pvs size to maximal number of kd nodes 
    736                 vector<KdLeaf *> leaves; 
    737                 preprocessor->mKdTree->CollectLeaves(leaves); 
    738  
    739                 ObjectPvs::SetPvsSize((int)leaves.size()); 
    740 #endif 
    741  
    742         Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
    743                 cout << "loading objects from " << buf << endl; 
    744  
    745                 // load objects which will be used as pvs entries 
    746                 ObjectContainer pvsObjects; 
    747                 if (0) LoadObjects(buf, pvsObjects, mObjects); 
    748  
    749                 const bool finalizeViewCells = true; 
    750                 cout << "loading view cells from " << buf << endl; 
    751  
    752                 mViewCellsManager = ViewCellsManager::LoadViewCells(buf,  
    753                                                                                                                         pvsObjects, 
    754                                                                                                                         mObjects,  
    755                                                                                                                         finalizeViewCells,  
    756                                                                                                                         NULL); 
     742                Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
     743                cout << "loading view cells from " << buf << endl<<flush; 
     744 
     745                mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true, NULL); 
    757746 
    758747                cout << "view cells loaded." << endl<<flush; 
     
    12731262        const long t1 = GetTime(); 
    12741263         
    1275         if ((int)rays.size() > 10000) { 
     1264        if (0 && (int)rays.size() > 10000) { 
    12761265         
    12771266                mRayCaster->SortRays(rays); 
     
    13671356         
    13681357                if ((int)rays.size() > 100000 && i % 100000 == 0) 
     1358                        //cout << "here2 " << vssRays.size()<<endl; 
    13691359                        cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
    13701360        } 
     
    16421632 
    16431633 
    1644 bool Preprocessor::LoadObjects(const string &filename, 
    1645                                                            ObjectContainer &pvsObjects,  
    1646                                                            const ObjectContainer &preprocessorObjects) 
    1647 { 
    1648         ObjectsParser parser; 
    1649  
    1650         const bool success = parser.ParseObjects(filename,  
    1651                                                                                          pvsObjects,  
    1652                                                                                          preprocessorObjects); 
    1653  
    1654         if (!success) 
    1655         { 
    1656                 Debug << "Error: loading objects failed!" << endl; 
    1657         } 
    1658  
    1659         // hack: no bvh object could be found => take preprocessor objects 
    1660         if (pvsObjects.empty()) 
    1661         { 
    1662                 Debug << "no objects" << endl; 
    1663                 pvsObjects = preprocessorObjects; 
    1664         } 
    1665  
    1666         return success; 
    1667 } 
    1668  
    1669  
    1670 } 
     1634} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp

    r2116 r2172  
    11#include "VssRay.h" 
    22#include "AxisAlignedBox3.h" 
    3 #include "Ray.h" 
    4  
     3#include "SamplingStrategy.h" 
    54 
    65namespace GtpVisibilityPreprocessor { 
     
    340339VssRayContainer::SelectRays(const int number, 
    341340                                                        VssRayContainer &selected, 
    342                                                         const bool copy) const 
     341                                                        const bool copy 
     342                                                        ) const 
    343343{ 
    344344  float p = number/(float)size(); 
     
    346346   
    347347  for (; it != end(); it++) 
    348         if (Random(1.0f) < p) { 
     348        // temporarily only take mutation rays! 
     349        if ((*it)->mDistribution == SamplingStrategy::MUTATION_BASED_DISTRIBUTION && Random(1.0f) < p) { 
    349350          if (!copy) 
    350351                selected.push_back(*it); 
Note: See TracChangeset for help on using the changeset viewer.