Changeset 2547


Ignore:
Timestamp:
08/22/07 14:27:41 (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

    r2544 r2547  
    16901690        //-- load the view cells assigning the found objects to the pvss 
    16911691 
    1692         if (!strstr(filename.c_str(), ".bn")) 
    1693         { 
    1694                 LogManager::getSingleton().logMessage("*** loading xml view cells ***"); 
    1695  
    1696                 mViewCellsManager = GtpVisibilityPreprocessor::ViewCellsManager:: 
    1697                         LoadViewCells(filename, mObjects, finalizeViewCells, &bconverter); 
    1698         } 
    1699         else 
    1700         { 
    1701                 LogManager::getSingleton().logMessage("*** loading binary view cells ***"); 
    1702                 mViewCellsManager = 
    1703                         LoadViewCellsBinary(filename, mObjects, finalizeViewCells, &bconverter); 
    1704         } 
     1692        mViewCellsManager = GtpVisibilityPreprocessor::ViewCellsManager:: 
     1693                LoadViewCells(filename, mObjects, finalizeViewCells, &bconverter); 
     1694         
    17051695 
    17061696        if (mViewCellsManager) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2544 r2547  
    10211021        if (!Debug.is_open()) Debug.open("debug.log"); 
    10221022 
    1023         // give just an empty container as parameter: 
    1024         // this loading function is used in the engine, thus it 
    1025         // does not need to load the entities the preprocessor works on 
    1026         ObjectContainer preprocessorObjects; 
    1027  
    1028         return LoadViewCells(filename,  
    1029                                                  pvsObjects, 
    1030                                                  preprocessorObjects, 
    1031                                                  finalizeViewCells, 
    1032                                                  bconverter); 
    1033 } 
    1034  
     1023 
     1024        if (strstr(filename.c_str(), ".bn")) 
     1025        { 
     1026                Debug << "binary view cells format detected" << endl; 
     1027 
     1028                return LoadViewCellsBinary(filename,  
     1029                                               pvsObjects, 
     1030                                                                   finalizeViewCells, 
     1031                                                                   bconverter); 
     1032        } 
     1033        else 
     1034        { 
     1035                Debug << "xml view cells format detected" << endl; 
     1036 
     1037                // give just an empty container as parameter: 
     1038                // this loading function is used in the engine, thus it 
     1039                // does not need to load the entities the preprocessor works on 
     1040                ObjectContainer preprocessorObjects; 
     1041 
     1042                return LoadViewCells(filename,  
     1043                                         pvsObjects, 
     1044                                                         preprocessorObjects, 
     1045                                                         finalizeViewCells, 
     1046                                                         bconverter); 
     1047        } 
     1048} 
    10351049 
    10361050void ViewCellsManager::LoadIndexedBoundingBoxesBinary(IN_STREAM &stream, IndexedBoundingBoxContainer &iboxes) 
     
    71107124 
    71117125 
    7112  
    7113 ViewCellsManager *LoadViewCellsBinary(const string &filename,  
    7114                                                                           ObjectContainer &pvsObjects, 
    7115                                                                           bool finalizeViewCells, 
    7116                                                                           BoundingBoxConverter *bconverter)                                                                                               
    7117 { 
    7118         if (!Debug.is_open()) Debug.open("debug.log"); 
    7119  
     7126ViewCellsManager *ViewCellsManager::LoadViewCellsBinary(const string &filename,  
     7127                                                                                                                ObjectContainer &pvsObjects, 
     7128                                                                                                                bool finalizeViewCells, 
     7129                                                                                                                BoundingBoxConverter *bconverter)                                                                                                 
     7130{ 
    71207131        IN_STREAM stream(filename.c_str()); 
    71217132 
     
    71427153        } 
    71437154 
    7144         // sort objects by id 
    7145         //sort(pvsObjects.begin(), pvsObjects.end(), ilt); 
    7146  
    71477155 
    71487156        ObjectContainer pvsLookup; 
     
    71887196 
    71897197        Debug << "loading the view space partition tree" << endl; 
    7190         VspTree *vspTree = new VspTree(); 
    7191  
    7192         vspTree->mBoundingBox = viewSpaceBox; 
     7198        VspTree *vspTree = new VspTree(viewSpaceBox); 
    71937199 
    71947200        if (!vspTree->ImportBinary(stream)) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r2543 r2547  
    715715        */ 
    716716        virtual void ExportStats(const string &mergeStats); 
    717  
    718         friend ViewCellsManager *LoadViewCellsBinary(const string &filename,  
     717        /** Loads view cells in binary mode. 
     718        */ 
     719        static ViewCellsManager *LoadViewCellsBinary(const string &filename,  
    719720                                                                                                 ObjectContainer &pvsObjects, 
    720721                                                                                                 bool finalizeViewCells, 
     
    722723        /** This helper function loads the bounding boxes for a binary solution. 
    723724        */ 
    724         static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream, IndexedBoundingBoxContainer &iboxes); 
     725        static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream,  
     726                                                       IndexedBoundingBoxContainer &iboxes); 
    725727 
    726728 
     
    12701272        /** Fast view cell loader in binary mode. 
    12711273        */ 
    1272         friend ViewCellsManager *LoadViewCellsBinary(const string &filename,  
    1273                                                                                                  ObjectContainer &pvsObjects, 
    1274                                                                                                  bool finalizeViewCells, 
    1275                                                                                                  BoundingBoxConverter *bconverter); 
     1274        friend ViewCellsManager *ViewCellsManager:: 
     1275                LoadViewCellsBinary(const std::string &filename,  
     1276                                    ObjectContainer &pvsObjects, 
     1277                                                        bool finalizeViewCells, 
     1278                                                        BoundingBoxConverter *bconverter); 
     1279 
    12761280 
    12771281        /** Print statistics about the view cells compression. 
     
    12821286        //////////////////// 
    12831287 
    1284         /// if we should compress the objects after view cell evaluation: this makes 
    1285         /// only sense for testing purpose 
     1288        /// if we the objects are compressed after evaluation  
     1289        /// this makes only sense for testing purpose 
    12861290        bool mCompressObjects; 
    1287         /// pointer to the hierarchy manager responsible for view space / object space subdivision. 
     1291        /// hierarchy manager managing view space / object subdivision. 
    12881292        HierarchyManager *mHierarchyManager; 
    12891293}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2546 r2547  
    387387mOutOfBoundsCell(NULL), 
    388388mStoreRays(false), 
    389 //mStoreRays(true), 
    390389mTimeStamp(1), 
    391390mHierarchyManager(NULL) 
    392391{ 
    393392        mLocalSubdivisionCandidates = new vector<SortableEntry>; 
    394  
    395         bool randomize = false; 
    396         Environment::GetSingleton()->GetBoolValue("VspTree.Construction.randomize", randomize); 
    397         if (randomize) 
    398                 Randomize(); // initialise random generator for heuristics 
     393        ParseEnvironment(); 
     394} 
     395 
     396 
     397VspTree::VspTree(const AxisAlignedBox3 &bbox): 
     398mRoot(NULL), 
     399mOutOfBoundsCell(NULL), 
     400mStoreRays(false), 
     401mTimeStamp(1), 
     402mHierarchyManager(NULL), 
     403mBoundingBox(bbox) 
     404{ 
     405        mLocalSubdivisionCandidates = new vector<SortableEntry>; 
     406        ParseEnvironment(); 
     407} 
     408 
     409 
     410 
     411void VspTree::ParseEnvironment() 
     412{ 
     413        // initialise random generator for heuristics 
     414        bool randomize; 
     415    Environment::GetSingleton()->GetBoolValue("VspTree.Construction.randomize", randomize); 
     416        if (randomize) Randomize();  
    399417 
    400418        char subdivisionStatsLog[100]; 
    401419        Environment::GetSingleton()->GetStringValue("VspTree.subdivisionStats", subdivisionStatsLog); 
    402420        mSubdivisionStats.open(subdivisionStatsLog); 
     421 
    403422 
    404423        ///////////// 
     
    410429        Environment::GetSingleton()->GetFloatValue("VspTree.Termination.minProbability", mTermMinProbability); 
    411430        Environment::GetSingleton()->GetFloatValue("VspTree.Termination.maxRayContribution", mTermMaxRayContribution); 
    412          
     431 
    413432        Environment::GetSingleton()->GetIntValue("VspTree.Termination.missTolerance", mTermMissTolerance); 
    414433        Environment::GetSingleton()->GetIntValue("VspTree.Termination.maxViewCells", mMaxViewCells); 
     
    432451 
    433452        Environment::GetSingleton()->GetFloatValue("VspTree.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 
    434          
     453 
    435454        // if only the driving axis is used for axis aligned split 
    436455        Environment::GetSingleton()->GetBoolValue("VspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 
     
    439458 
    440459        //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 
    441         //mMemoryConst = 50;//(float)(sizeof(VspViewCell)); 
    442460        //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(ObjectPvs)); 
    443  
    444         mMemoryConst = 16;//(float)sizeof(ObjectPvs); 
    445          
     461        //mMemoryConst = (float)sizeof(ObjectPvs); 
     462 
     463        // hack 
     464        mMemoryConst = 16; 
     465 
    446466 
    447467        ////////////// 
     
    450470        Debug << "******* VSP options ********" << endl; 
    451471 
    452     Debug << "max depth: " << mTermMaxDepth << endl; 
     472        Debug << "max depth: " << mTermMaxDepth << endl; 
    453473        Debug << "min PVS: " << mTermMinPvs << endl; 
    454474        Debug << "min probabiliy: " << mTermMinProbability << endl; 
     
    458478        Debug << "miss tolerance: " << mTermMissTolerance << endl; 
    459479        Debug << "max view cells: " << mMaxViewCells << endl; 
     480 
    460481        Debug << "randomize: " << randomize << endl; 
    461  
    462482        Debug << "min global cost ratio: " << mTermMinGlobalCostRatio << endl; 
    463483        Debug << "global cost miss tolerance: " << mTermGlobalCostMissTolerance << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r2544 r2547  
    550550        */  
    551551        VspTree(); 
     552        /** Constructor just setting the bounds of the tree. 
     553        */  
     554        VspTree(const AxisAlignedBox3 &bbox); 
    552555        /** Default destructor. 
    553556        */ 
     
    706709                } 
    707710        }; 
    708  
     711        /** Parse the environment settings. 
     712        */ 
     713        void ParseEnvironment(); 
    709714        /** faster evaluation of split plane cost for kd axis aligned cells. 
    710715        */ 
     
    754759        */ 
    755760        void EvaluateLeafStats(const VspTraversalData &data); 
    756  
    757761        /** Subdivides node using a best split priority queue. 
    758762            @param tQueue the best split priority queue 
     
    804808        */ 
    805809        float EvalPvsCost(const RayInfoContainer &rays) const; 
    806  
     810        /** Helper function for split cost evaluation. 
     811        */ 
    807812        int EvalPvsEntriesIncr(VspSubdivisionCandidate &splitCandidate, 
    808813                                                   const SplitData &sData) const; 
     
    10841089 
    10851090#endif 
    1086  
    1087  
    1088         friend ViewCellsManager *LoadViewCellsBinary(const std::string &filename,  
    1089                                                                                      ObjectContainer &pvsObjects, 
    1090                                                                                                  bool finalizeViewCells, 
    1091                                                                                                  BoundingBoxConverter *bconverter); 
     1091         
    10921092 
    10931093protected: 
Note: See TracChangeset for help on using the changeset viewer.