Changeset 2187


Ignore:
Timestamp:
03/05/07 11:07:44 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
18 edited

Legend:

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

    r2124 r2187  
    384384                                                                                BvhTraversalData &backData) 
    385385{  
     386        mNodeTimer.Entry(); 
    386387        const BvhTraversalData &tData = sc.mParentData; 
    387388        BvhLeaf *leaf = tData.mNode; 
     
    480481        } 
    481482         
     483        mNodeTimer.Exit(); 
     484 
    482485        // return the new interior node 
    483486        return node; 
     
    489492                                                                const bool globalCriteriaMet) 
    490493{ 
     494        mSubdivTimer.Entry(); 
     495 
    491496        BvhSubdivisionCandidate *sc =  
    492497                static_cast<BvhSubdivisionCandidate *>(splitCandidate); 
     
    505510                // create new interior node and two leaf node 
    506511                currentNode = SubdivideNode(*sc, tFrontData, tBackData); 
    507          
     512 
    508513                // decrease the weighted average cost of the subdivisoin 
    509514                mTotalCost -= sc->GetRenderCostDecrease(); 
     
    524529                EvalSubdivisionCandidate(*frontCandidate); 
    525530                EvalSubdivisionCandidate(*backCandidate); 
    526          
     531 
    527532                // cross reference 
    528533                tFrontData.mNode->SetSubdivisionCandidate(frontCandidate);  
     
    550555        } 
    551556         
     557        mSubdivTimer.Exit(); 
     558 
    552559        return currentNode; 
    553560} 
     
    608615                                                                                   bool computeSplitPlane) 
    609616{ 
     617        mEvalTimer.Entry(); 
    610618        if (computeSplitPlane) 
    611619        { 
     
    697705        // compute global decrease in render cost 
    698706        splitCandidate.SetPriority(priority); 
     707        mEvalTimer.Exit(); 
    699708} 
    700709 
     
    15491558                                                                                 bool useVisibilityBasedHeuristics) 
    15501559{ 
     1560        mSplitTimer.Entry(); 
     1561 
    15511562        if (mIsInitialSubdivision) 
    15521563        { 
     
    16531664        backObjects = nBackObjects[bestAxis]; 
    16541665 
     1666        mSplitTimer.Exit(); 
     1667 
    16551668        //cout << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
    16561669        return nCostRatio[bestAxis]; 
     
    23122325                                                                                                const ObjectContainer &objects) 
    23132326{ 
     2327        mSortTimer.Entry(); 
     2328 
     2329        const bool doSort = true; 
     2330 
    23142331        // we sort the objects as a preprocess so they don't have 
    23152332        // to be sorted for each split 
     
    23202337                CreateLocalSubdivisionCandidates(objects,  
    23212338                                                                             &sortedObjects,  
    2322                                                                                  true,  
     2339                                                                                 doSort,  
    23232340                                                                                 i); 
    23242341                 
     
    23422359 
    23432360        *(tData.mSortedObjects[3]) = objects; 
    2344         //stable_sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 
    2345         sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 
     2361         
     2362        stable_sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 
     2363        //sort(tData.mSortedObjects[3]->begin(), tData.mSortedObjects[3]->end(), smallerSize); 
     2364 
     2365        mSortTimer.Exit(); 
    23462366} 
    23472367 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r2176 r2187  
    1414#include "IntersectableWrapper.h" 
    1515#include "HierarchyManager.h" 
     16#include "PerfTimer.h" 
    1617 
    1718 
     
    495496                float GetPriority() const 
    496497                { 
    497                         return (float)-mParentData.mDepth; 
    498                         //return mPriority; 
     498                        //return (float)-mParentData.mDepth; 
     499                        return mPriority; 
    499500                } 
    500501 
     
    656657        void Compress(); 
    657658        void CreateUniqueObjectIds(); 
     659 
     660        PerfTimer mSortTimer; 
     661        PerfTimer mNodeTimer; 
     662        PerfTimer mSubdivTimer; 
     663        PerfTimer mEvalTimer; 
     664        PerfTimer mSplitTimer; 
    658665 
    659666protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2161 r2187  
    11631163void GvsPreprocessor::DeterminePvsObjects(VssRayContainer &rays) 
    11641164{ 
     1165        // store triangle directly 
    11651166        mViewCellsManager->DeterminePvsObjects(rays, true); 
    11661167} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r2170 r2187  
    409409 
    410410 
     411void HierarchyManager::PrintTimings(const bool lastSplitWasOsp) 
     412{ 
     413        double sortTime, evalTime, nodeTime, splitTime, subdTime; 
     414 
     415        sortTime = mBvHierarchy->mSortTimer.TotalTime(); 
     416        evalTime = mBvHierarchy->mEvalTimer.TotalTime(); 
     417        nodeTime = mBvHierarchy->mNodeTimer.TotalTime(); 
     418        splitTime = mBvHierarchy->mSplitTimer.TotalTime(); 
     419        subdTime = mBvHierarchy->mSubdivTimer.TotalTime(); 
     420 
     421        cout << "bvh times" 
     422                 << " sort : " << sortTime 
     423                 << " eval : " << evalTime 
     424                 << " node : " << nodeTime 
     425                 << " split: " << splitTime 
     426                 << " subd : " << subdTime << endl; 
     427 
     428        Debug << "bvh times" 
     429                << " sort : " << sortTime 
     430                 << " eval : " << evalTime 
     431                 << " node : " << nodeTime 
     432                 << " split: " << splitTime 
     433                 << " subd : " << subdTime << endl; 
     434 
     435        sortTime = mVspTree->mSortTimer.TotalTime(); 
     436        evalTime = mVspTree->mEvalTimer.TotalTime(); 
     437        nodeTime = mVspTree->mNodeTimer.TotalTime(); 
     438        splitTime = mVspTree->mSplitTimer.TotalTime(); 
     439        subdTime = mVspTree->mSubdivTimer.TotalTime(); 
     440 
     441        cout << "vsp times" 
     442                 << " sort : " << sortTime 
     443                 << " eval : " << evalTime 
     444                 << " node : " << nodeTime 
     445                 << " split: " << splitTime 
     446                 << " subd : " << subdTime << endl; 
     447 
     448        Debug << "vsp times" 
     449                << " sort : " << sortTime 
     450                 << " eval : " << evalTime 
     451                 << " node : " << nodeTime 
     452                 << " split: " << splitTime 
     453                 << " subd : " << subdTime << endl; 
     454        cout << endl; 
     455        Debug << endl; 
     456} 
     457 
     458 
    411459void HierarchyManager::ConstructInterleavedWithGradient(const VssRayContainer &sampleRays, 
    412460                                                                                                                const ObjectContainer &objects, 
     
    518566                //if (!lastSplitWasOsp) 
    519567                { 
     568                        ///////////////// 
     569                        // subdivide object space with respect to the objects 
     570 
    520571                        lastSplitWasOsp = true; 
    521572                        cout << "osp" << endl; 
     
    545596                else 
    546597                { 
     598                        ///////////////// 
     599                        // subdivide view space with respect to the objects 
     600 
    547601                        lastSplitWasOsp = false; 
    548602                        cout << "vsp" << endl; 
    549                          
    550                         ///////////////// 
    551                         // subdivide view space with respect to the objects 
    552603 
    553604                        // dirtied object space candidates 
     
    574625                                 << (int)dirtyOspList.size() << " dirtied candidates" << endl; 
    575626                } 
     627 
     628                PrintTimings(lastSplitWasOsp); 
    576629        } 
    577630 
     
    18451898                //cout << "priority: " << nodeWrapper->GetMergeCost() << endl; 
    18461899                // save the view cells if it is a leaf or if enough view cells have already been traversed 
    1847                 // because of the priority queue, this will be the optimal set of v 
     1900                // because of the priority queue, this will be the optimal set of view cells 
    18481901                if (nodeWrapper->IsLeaf() ||  
    18491902                        ((viewCells.size() + bvhNodes.size() + tqueue.size() + 1) >= maxSplits) || 
     
    18871940 
    18881941                if (obj->Type() != Intersectable::BVH_INTERSECTABLE) 
    1889                         cout << "error " << obj->Type() << endl; 
     1942                { 
     1943                        cout << "error: wrong object type detected: " << obj->Type() << endl; 
     1944                        exit(0); 
     1945                } 
    18901946 
    18911947                BvhNode *intersect = static_cast<BvhNode *>(obj); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r2176 r2187  
    323323protected: 
    324324 
     325        void PrintTimings(const bool osp); 
     326 
    325327        /** Returns true if the global termination criteria were met. 
    326328        */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r2105 r2187  
    115115                                                                const bool pruneInvalidRays) 
    116116{ 
    117   CastRays16(rays, 0, vssRays, sbox, castDoubleRay, pruneInvalidRays); 
     117        CastRays16(rays, 0, vssRays, sbox, castDoubleRay, pruneInvalidRays); 
    118118} 
    119119 
     
    322322  } 
    323323 
    324   for (; offset < rays.size(); offset++) 
     324  for (; offset < (int)rays.size(); offset++) 
    325325        CastRay(rays[offset], vssRays, sbox, castDoubleRay, pruneInvalidRays); 
    326326 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2183 r2187  
    3232namespace GtpVisibilityPreprocessor { 
    3333 
    34   const static bool ADDITIONAL_GEOMETRY_HACK = false; 
    35  
    36   Preprocessor *preprocessor = NULL; 
    37    
    38 // HACK: Artificially modify scene to watch rendercost changes 
    39 static void AddGeometry(SceneGraph *scene) 
    40 { 
    41         scene->GetRoot()->UpdateBox(); 
    42  
    43         AxisAlignedBox3 sceneBox = scene->GetBox(); 
    44  
    45         int n = 200; 
    46  
    47         if (0) 
    48         { 
    49                 // form grid of boxes 
    50                 for (int i = 0; i < n; ++ i) 
    51                 { 
    52                         for (int j = 0; j < n; ++ j) 
    53                         { 
    54                                 const Vector3 scale2((float)j * 0.8f / n + 0.1f,  0.05f, (float)i * 0.8f  / (float)n + 0.1f); 
    55  
    56                                 const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    57  
    58                                 const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
    59                                 AxisAlignedBox3 box(pt2, pt2 + boxSize); 
    60                                 Mesh *mesh = CreateMeshFromBox(box); 
    61  
    62                                 mesh->Preprocess(); 
    63  
    64                                 MeshInstance *mi = new MeshInstance(mesh); 
    65                                 scene->GetRoot()->mGeometry.push_back(mi); 
    66                         } 
    67                 } 
    68  
    69                 for (int i = 0; i < n; ++ i) 
    70                 { 
    71                         for (int j = 0; j < n; ++ j) 
    72                         { 
    73                                 const Vector3 scale2(0.15f, (float)j * 0.8f / n + 0.1f, (float)i * 0.8f  / (float)n + 0.1f); 
    74  
    75                                 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    76  
    77                                 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 
    78                                 AxisAlignedBox3 box(pt2, pt2 + boxSize); 
    79                                 Mesh *mesh = CreateMeshFromBox(box); 
    80  
    81                                 mesh->Preprocess(); 
    82  
    83                                 MeshInstance *mi = new MeshInstance(mesh); 
    84                                 scene->GetRoot()->mGeometry.push_back(mi); 
    85                         } 
    86                 } 
    87  
    88                 for (int i = 0; i < n; ++ i) 
    89                 { 
    90                         const Vector3 scale2(2, 0.2f, (float)i * 0.8f  / (float)n + 0.1f); 
    91  
    92                         Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    93                         Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 
    94  
    95                         AxisAlignedBox3 box(pt2 + 0.1f, pt2 + boxSize); 
    96                         Mesh *mesh = CreateMeshFromBox(box); 
    97  
    98                         mesh->Preprocess(); 
    99  
    100                         MeshInstance *mi = new MeshInstance(mesh); 
    101                         scene->GetRoot()->mGeometry.push_back(mi); 
    102                 } 
    103  
    104                 scene->GetRoot()->UpdateBox(); 
    105         } 
    106  
    107         if (1) 
    108         { 
    109                 // plane separating view space regions 
    110                 const Vector3 scale(1.0f, 0.0, 0); 
    111  
    112                 Vector3 pt = sceneBox.Min() + scale * (sceneBox.Max() - sceneBox.Min()); 
    113  
    114                 Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 
    115                 Mesh *planeMesh = new Mesh(); 
    116  
    117                 Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 
    118                 IncludePolyInMesh(*poly, *planeMesh); 
    119  
    120                 planeMesh->Preprocess(); 
    121  
    122                 MeshInstance *planeMi = new MeshInstance(planeMesh); 
    123                 scene->GetRoot()->mGeometry.push_back(planeMi); 
    124         }        
    125 } 
    126  
     34 
     35Preprocessor *preprocessor = NULL; 
     36   
    12737 
    12838Preprocessor::Preprocessor(): 
     
    599509        if (result)  
    600510        {  
    601           // HACK  
    602                 if (ADDITIONAL_GEOMETRY_HACK) 
    603                         AddGeometry(mSceneGraph); 
    604511 
    605512                mSceneGraph->AssignObjectIds(); 
     
    12281135        Environment::GetSingleton()->GetBoolValue("ViewCells.loadFromFile", loadViewCells); 
    12291136 
    1230         int reserveRays; 
     1137        int reserveRays;         
     1138        int constructionSamples; 
    12311139 
    12321140        if (!loadViewCells) 
    12331141        { 
    1234                 cout << "setting ray pool size to view cell construction ize" << endl; 
     1142                cout << "hack: setting ray pool size to view cell construction or evaluation size" << endl; 
     1143 
     1144                constructionSamples = 1000000; 
    12351145 
    12361146                char buf[100]; 
    12371147                Environment::GetSingleton()->GetStringValue("ViewCells.type", buf);      
    1238                  
     1148 
    12391149                if (strcmp(buf, "vspBspTree") == 0) 
    12401150                { 
    1241                         Environment::GetSingleton()->GetIntValue("VspBspTree.Construction.samples", reserveRays); 
    1242                         reserveRays *= 2; 
     1151                        Environment::GetSingleton()->GetIntValue("VspBspTree.Construction.samples", constructionSamples); 
     1152                         
    12431153                } 
    12441154                else if (strcmp(buf, "vspOspTree") == 0) 
    12451155                { 
    1246                         Environment::GetSingleton()->GetIntValue("Hierarchy.Construction.samples", reserveRays); 
    1247                         reserveRays *= 2;                        
    1248                 } 
     1156                        Environment::GetSingleton()->GetIntValue("Hierarchy.Construction.samples", constructionSamples);                 
     1157                } 
     1158 
     1159                int evalSamplesPerPass; 
     1160 
     1161                Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", evalSamplesPerPass); 
     1162 
     1163                reserveRays = max(constructionSamples, evalSamplesPerPass); 
     1164                reserveRays *= 2; 
    12491165        } 
    12501166        else 
    12511167        { 
    1252                 cout << "setting ray pool size to samples per pass" << endl; 
    1253          
     1168                cout << "setting ray pool size to samples per pass" << endl;        
    12541169                reserveRays = mSamplesPerPass * 2; 
    12551170        } 
     
    12741189        const long t1 = GetTime(); 
    12751190         
    1276         if ((int)rays.size() > 10000) { 
     1191        if (1 && (rays.size() > 10000)) 
     1192        { 
    12771193         
    12781194                mRayCaster->SortRays(rays); 
     
    12981214 
    12991215        if (mUseHwGlobalLines)  
     1216        { 
    13001217          CastRaysWithHwGlobalLines( 
    13011218                                                                rays, 
     
    13041221                                                                pruneInvalidRays 
    13051222                                                                ); 
     1223        } 
    13061224        else 
     1225        { 
    13071226          mRayCaster->CastRays( 
    13081227                                                 rays,                           
     
    13111230                                                 castDoubleRays, 
    13121231                                                 pruneInvalidRays); 
    1313    
    1314         if ((int)rays.size() > 10000)  
     1232        } 
     1233 
     1234        if (rays.size() > 10000)  
    13151235        { 
    13161236                cout << endl; 
     
    13281248} 
    13291249 
    1330  
    13311250   
    13321251void 
    13331252Preprocessor::CastRaysWithHwGlobalLines( 
    13341253                                                                                SimpleRayContainer &rays, 
    1335                                                                           VssRayContainer &vssRays, 
    1336                                                                           const bool castDoubleRays, 
    1337                                                                           const bool pruneInvalidRays 
    1338                                                                           ) 
     1254                                                                                VssRayContainer &vssRays, 
     1255                                                                                const bool castDoubleRays, 
     1256                                                                                const bool pruneInvalidRays) 
    13391257{ 
    13401258  SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
     
    13521270                } 
    13531271#endif 
    1354           rayBucket.push_back(ray); 
    1355            
    1356           // 16 rays gathered => do ray casting 
    1357           if ((int)rayBucket.size() >= 16) 
    1358                 { 
    1359                   mRayCaster->CastRays16( 
    1360                                                                  rayBucket,                              
    1361                                                                  vssRays, 
    1362                                                                  mViewCellsManager->GetViewSpaceBox(), 
    1363                                                                  castDoubleRays, 
    1364                                                                  pruneInvalidRays); 
    1365                    
    1366                   rayBucket.clear(); 
    1367                 } 
    1368          
    1369                 if ((int)rays.size() > 100000 && i % 100000 == 0) 
     1272                rayBucket.push_back(ray); 
     1273 
     1274                // 16 rays gathered => do ray casting 
     1275                if (rayBucket.size() >= 16) 
     1276                { 
     1277                        mRayCaster->CastRays16( 
     1278                                rayBucket,                               
     1279                                vssRays, 
     1280                                mViewCellsManager->GetViewSpaceBox(), 
     1281                                castDoubleRays, 
     1282                                pruneInvalidRays); 
     1283 
     1284                        rayBucket.clear(); 
     1285                } 
     1286 
     1287                if (rays.size() > 100000 && i % 100000 == 0) 
    13701288                        cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
    13711289        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2183 r2187  
    5757 
    5858        /** Load the input scene.  
    59         @param filename file to load 
    60         @return true on success 
     59                @param filename file to load 
     60                @return true on success 
    6161        */ 
    6262        virtual bool LoadScene(const string filename); 
    6363 
    6464        /** Export all preprocessed data in a XML format understandable by the 
    65         PreprocessingInterface of the GtpVisibilityPreprocessor Module.  
    66         The file can be compressed depending on the environement settings. 
    67         @return true on successful export 
     65                PreprocessingInterface of the GtpVisibilityPreprocessor Module.  
     66                The file can be compressed depending on the environement settings. 
     67                @return true on successful export 
    6868        */ 
    6969        virtual bool ExportPreprocessedData(const string filename); 
    7070 
    7171        /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction 
    72         is driven by the environment settings, which also sais which of the three types of 
    73         entities should be used to drive the heuristical construction (only occluders by default) 
     72                is driven by the environment settings, which also sais which of the three types of 
     73                entities should be used to drive the heuristical construction (only occluders by default) 
    7474        */ 
    7575        virtual bool BuildKdTree(); 
    7676 
    7777        /** Compute visibility method. This method has to be reimplemented by the actual 
    78         Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, 
    79         GlobalSamplingpreprocessor) 
     78                Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, 
     79                GlobalSamplingpreprocessor) 
    8080        */ 
    8181        virtual bool ComputeVisibility() = 0; 
    8282 
    8383        /** Post Process the computed visibility. By default applys the visibility filter 
    84         (if specified in the environment and export the preprocessed data */ 
     84                (if specified in the environment and export the preprocessed data  
     85                */ 
    8586        virtual bool PostProcessVisibility(); 
    8687 
    8788        /** View cells are either loaded or prepared for generation, according to the chosen environment 
    88         object. Important evironment options are, e.g, the view cell type. 
    89         Should be done after scene loading (i.e., some options are based on scene type). 
     89                object. Important evironment options are, e.g, the view cell type. 
     90                Should be done after scene loading (i.e., some options are based on scene type). 
    9091        */ 
    9192        bool PrepareViewCells(); 
     
    111112        @returns true if samples were loaded successfully 
    112113        */ 
    113         bool LoadSamples(VssRayContainer &samples, 
    114                 ObjectContainer &objects) const; 
     114        bool LoadSamples(VssRayContainer &samples, ObjectContainer &objects) const; 
    115115 
    116116        /** Exports samples to file. 
    117         @returns true if samples were written successfully 
     117                @returns true if samples were written successfully 
    118118        */ 
    119119        bool ExportSamples(const VssRayContainer &samples) const; 
     
    158158                                                        ); 
    159159 
    160         /** Compute pixel error of the current PVS solution by sampling given number of viewpoints . 
     160        /** Compute pixel error of the current PVS solution by sampling given number of viewpoints. 
    161161        */ 
    162162        virtual void ComputeRenderError(); 
     
    223223        bool mUseGlRenderer; 
    224224        bool mUseGlDebugger; 
    225   bool mUseHwGlobalLines; 
     225         
     226        bool mUseHwGlobalLines; 
    226227        bool mLoadViewCells; 
    227228 
     
    261262        RayCaster *mRayCaster; 
    262263 
     264 
    263265protected: 
    264266 
     
    288290        vector<FaceParentInfo> mFaceParents; 
    289291 
    290  
    291    
    292292        /// if box around view space should be used 
    293293        bool mUseViewSpaceBox; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2176 r2187  
    267267                                Name="VCCLCompilerTool" 
    268268                                Optimization="3" 
     269                                GlobalOptimizations="TRUE" 
    269270                                InlineFunctionExpansion="0" 
    270                                 FavorSizeOrSpeed="0" 
    271                                 OptimizeForProcessor="3" 
     271                                EnableIntrinsicFunctions="TRUE" 
     272                                FavorSizeOrSpeed="1" 
     273                                OmitFramePointers="TRUE" 
     274                                EnableFiberSafeOptimizations="TRUE" 
     275                                OptimizeForProcessor="0" 
    272276                                OptimizeForWindowsApplication="TRUE" 
    273                                 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;" 
     277                                AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;Timer" 
    274278                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;NO_QT" 
     279                                StringPooling="TRUE" 
    275280                                ExceptionHandling="TRUE" 
    276281                                RuntimeLibrary="2" 
     282                                EnableEnhancedInstructionSet="2" 
    277283                                DisableLanguageExtensions="FALSE" 
    278284                                ForceConformanceInForLoopScope="FALSE" 
    279                                 RuntimeTypeInfo="TRUE" 
     285                                RuntimeTypeInfo="FALSE" 
    280286                                UsePrecompiledHeader="0" 
    281287                                BrowseInformation="1" 
     
    11601166                        </File> 
    11611167                        <File 
     1168                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
     1169                        </File> 
     1170                        <File 
    11621171                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    1163                         </File> 
    1164                         <File 
    1165                                 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    11661172                        </File> 
    11671173                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r2105 r2187  
    238238   
    239239                                         
     240VssRay *RayCaster::RequestRay(const Vector3 &origin,  
     241                                                          const Vector3 &termination,  
     242                                                          Intersectable *originObject,  
     243                                                          Intersectable *terminationObject,  
     244                                                          const int pass,  
     245                                                          const float pdf) 
     246{ 
     247 #if DEBUG_RAYCAST 
     248        Debug<<"PR2a"<<flush; 
     249#endif 
     250         
     251        // old method: always allocate 
     252        if (1) return new VssRay(origin, termination, originObject, terminationObject, pass, pdf); 
     253 
     254        VssRay *vssRay = mVssRayPool.Alloc(); 
     255 
     256#if DEBUG_RAYCAST 
     257        Debug<<"PR2b"<<flush; 
     258#endif 
     259         
     260        *vssRay = VssRay(origin, termination, originObject, terminationObject, pass, pdf); 
     261 
     262#if DEBUG_RAYCAST 
     263        Debug<<"PR2c"<<flush; 
     264#endif 
     265 
     266        return vssRay; 
     267} 
     268 
    240269 
    241270int 
     
    306335 
    307336          if (!pruneInvalidRays || hitA.mObject) { 
    308 #if DEBUG_RAYCAST 
    309                 Debug<<"PR2a"<<flush; 
    310 #endif 
    311                  
    312                 VssRay *vssRay = mVssRayPool.Alloc(); 
    313  
    314 #if DEBUG_RAYCAST 
    315                 Debug<<"PR2b"<<flush; 
    316 #endif 
    317                 *vssRay = VssRay( 
    318                                                  !castDoubleRay ? simpleRay.mOrigin : clipB, 
     337 
     338                  VssRay *vssRay =  
     339                          RequestRay(!castDoubleRay ? simpleRay.mOrigin : clipB, 
    319340                                                 hitA.mPoint, 
    320341                                                 hitB.mObject, 
     
    323344                                                 1.0f //simpleRay.mPdf 
    324345                                                 ); 
    325 #if DEBUG_RAYCAST 
    326                 Debug<<"PR2c"<<flush; 
    327 #endif 
    328                  
     346 
    329347                if (validA) 
    330348                  vssRay->mFlags |= VssRay::Valid; 
     
    344362        if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
    345363        { 
    346                 VssRay *vssRay = mVssRayPool.Alloc(); 
    347  
    348                 *vssRay = VssRay( 
    349                         clipA, 
    350                         hitB.mPoint, 
    351                         hitA.mObject, 
    352                         hitB.mObject, 
    353                         mPreprocessor.mPass, 
    354                         1.0f //simpleRay.mPdf 
    355                         ); 
     364                VssRay *vssRay = RequestRay( 
     365                                                                        clipA, 
     366                                                                        hitB.mPoint, 
     367                                                                        hitA.mObject, 
     368                                                                        hitB.mObject, 
     369                                                                        mPreprocessor.mPass, 
     370                                                                        1.0f //simpleRay.mPdf 
     371                                                                        ); 
    356372 
    357373                if (validB) 
     
    381397                                        const bool pruneInvalidRays ) 
    382398{ 
    383   SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
    384    
    385   for (rit = rays.begin(); rit != rit_end; ++ rit) { 
    386         CastRay( 
     399        SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
     400 
     401        for (rit = rays.begin(); rit != rit_end; ++ rit) { 
     402                CastRay( 
    387403                        *rit,                            
    388404                        vssRays, 
     
    390406                        castDoubleRay, 
    391407                        pruneInvalidRays); 
    392   } 
    393    
    394 } 
    395  
    396 } 
     408        } 
     409} 
     410 
     411 
     412} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r2176 r2187  
    108108  }; 
    109109 
    110    
    111110  VssRayPool mVssRayPool; 
    112111 
     
    121120 
    122121protected: 
     122 
     123        VssRay *RequestRay(const Vector3 &origin,  
     124                                           const Vector3 &termination,  
     125                                           Intersectable *originObject,  
     126                                           Intersectable *terminationObject,  
     127                                           const int pass,  
     128                                           const float pdf); 
     129 
    123130  void _SortRays(SimpleRayContainer &rays, 
    124131                                 const int l, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2116 r2187  
    5252        // terminate the whole method? 
    5353        for (; i < number; i++)  
    54           { 
     54        { 
    5555                int j = 0; 
    5656                bool sampleGenerated = false; 
    57                  
     57 
    5858                for (j = 0; !sampleGenerated && (j < maxTries); ++ j) 
    59                   { 
     59                { 
    6060                        sampleGenerated = GenerateSample(ray); 
    61                          
     61 
    6262                        if (sampleGenerated) 
    63                           {              
     63                        {                
    6464                                ++ samples; 
    6565                                rays.push_back(ray); 
    66                           } 
    67                   } 
    68           } 
    69  
    70  
    71          
     66                        } 
     67                } 
     68        } 
    7269 
    7370        return samples; 
     
    313310        return true; 
    314311} 
    315  
    316  
    317 #if 0 
    318 bool ObjectsInteriorDistribution::GenerateSample(SimpleRay &ray) 
    319 { 
    320         Vector3 origin, direction;  
    321  
    322         // get random object 
    323         const int i = RandomValue(0, mPreprocessor.mObjects.size() - 1); 
    324  
    325         const Intersectable *obj = mPreprocessor.mObjects[i]; 
    326  
    327         // note: if we load the polygons as meshes,  
    328         // asymtotically every second sample is lost! 
    329         origin = obj->GetBox().GetRandomPoint(); 
    330  
    331         // uniformly distributed direction 
    332         direction = UniformRandomVector(); 
    333  
    334         const float c = Magnitude(direction); 
    335  
    336         if (c <= Limits::Small)  
    337                 return false; 
    338  
    339         const float pdf = 1.0f; 
    340  
    341         direction *= 1.0f / c; 
    342         ray = SimpleRay(origin, direction, pdf); 
    343  
    344         return true; 
    345 } 
    346  
    347 #endif 
    348312 
    349313 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r2176 r2187  
    256256                                GlobalOptimizations="TRUE" 
    257257                                InlineFunctionExpansion="2" 
    258                                 FavorSizeOrSpeed="1" 
     258                                EnableIntrinsicFunctions="TRUE" 
     259                                FavorSizeOrSpeed="1" 
     260                                OmitFramePointers="TRUE" 
    259261                                EnableFiberSafeOptimizations="TRUE" 
    260                                 OptimizeForProcessor="3" 
     262                                OptimizeForProcessor="0" 
    261263                                OptimizeForWindowsApplication="TRUE" 
    262264                                AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;" 
    263265                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;NO_QT" 
    264                                 RuntimeLibrary="2" 
    265                                 RuntimeTypeInfo="TRUE" 
     266                                StringPooling="TRUE" 
     267                                MinimalRebuild="FALSE" 
     268                                RuntimeLibrary="2" 
     269                                EnableEnhancedInstructionSet="2" 
     270                                RuntimeTypeInfo="FALSE" 
    266271                                UsePrecompiledHeader="0" 
    267272                                WarningLevel="3" 
     
    275280                                OutputFile="../bin/release/Preprocessor.exe" 
    276281                                LinkIncremental="1" 
    277                                 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release" 
    278                                 GenerateDebugInformation="FALSE" 
    279                                 SubSystem="1" 
    280                                 OptimizeReferences="2" 
    281                                 EnableCOMDATFolding="2" 
     282                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release" 
     283                                GenerateDebugInformation="FALSE" 
     284                                SubSystem="1" 
     285                                LargeAddressAware="0" 
     286                                OptimizeReferences="2" 
     287                                EnableCOMDATFolding="2" 
     288                                OptimizeForWindows98="1" 
    282289                                TargetMachine="1" 
    283290                                FixedBaseAddress="1"/> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2176 r2187  
    969969        if (mShowVisualization) 
    970970        { 
    971                 if (0) 
    972                 { 
    973                         mStrategies.clear(); 
    974                         mStrategies.push_back(SamplingStrategy::VIEWCELL_BORDER_BASED_DISTRIBUTION); 
    975                 } 
    976  
    977971                /////////////// 
    978972                //-- visualization rays, e.g., to show some samples in the scene 
     
    27122706        if (!useHitObjects)  
    27132707        { 
     2708                // store higher order object (e.g., bvh node) instead of object itself 
    27142709                VssRayContainer::const_iterator it, it_end = rays.end(); 
    27152710         
     
    27172712                { 
    27182713                        VssRay *vssRay = *it; 
     2714 
    27192715                        // set only the termination object 
    2720                         vssRay->mTerminationObject = GetIntersectable( 
    2721                                 *vssRay, 
    2722                                 true); 
     2716                        vssRay->mTerminationObject = GetIntersectable(*vssRay, true); 
    27232717                } 
    27242718        } 
     
    27712765        ray.mRelativePvsContribution = 0.0f; 
    27722766 
    2773         mSamplesStat.mRays++; 
     2767        ++ mSamplesStat.mRays; 
    27742768         
    27752769        if (!ray.mTerminationObject) 
     
    27962790        static VssRay *lastVssRay = NULL; 
    27972791         
     2792        // check if last ray was not same ray with reverse direction 
    27982793        if (lastVssRay == NULL || 
    27992794                !(ray.mOrigin == lastVssRay->mTermination) || 
     
    28192814          ray.mViewCells = viewCells; 
    28202815#else 
    2821           cerr<<"Vss store viewcells not supported."<<endl; 
     2816          cerr << "Vss store viewcells not supported." << endl; 
    28222817          exit(1); 
    28232818#endif 
     
    28502845        mSamplesStat.mPvsContributions += ray.mPvsContribution; 
    28512846        if (ray.mPvsContribution) 
    2852           mSamplesStat.mContributingRays++; 
     2847                ++ mSamplesStat.mContributingRays; 
    28532848         
    28542849#if AVG_RAY_CONTRIBUTIONS 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r2176 r2187  
    668668                                                        const bool globalCriteriaMet) 
    669669{ 
     670        mSubdivTimer.Entry(); 
     671 
    670672        // todo remove dynamic cast 
    671673        VspSubdivisionCandidate *sc =  
     
    686688                const int maxCostMisses = sc->GetMaxCostMisses(); 
    687689 
    688                 newNode = SubdivideNode(*sc, 
    689                                                                 tFrontData,  
    690                                                                 tBackData); 
    691          
     690                newNode = SubdivideNode(*sc, tFrontData, tBackData); 
     691 
    692692                // how often was max cost ratio missed in this branch? 
    693693                tFrontData.mMaxCostMisses = maxCostMisses; 
     
    766766        } 
    767767 
     768        mSubdivTimer.Exit(); 
     769 
    768770        return newNode; 
    769771} 
     
    773775                                                                           bool computeSplitPlane) 
    774776{ 
     777        mEvalTimer.Entry(); 
     778 
    775779        if (computeSplitPlane) 
    776780        { 
     
    825829 
    826830        splitCandidate.SetPriority(priority); 
     831 
     832        mEvalTimer.Exit(); 
    827833} 
    828834 
     
    887893                                                                        VspTraversalData &backData) 
    888894{ 
     895        mNodeTimer.Entry(); 
     896         
    889897        VspLeaf *leaf = static_cast<VspLeaf *>(sc.mParentData.mNode); 
    890898 
     
    9931001        AddViewCellReferences(backLeaf->GetViewCell()); 
    9941002#endif 
     1003 
     1004        mNodeTimer.Exit(); 
    9951005 
    9961006        return interior; 
     
    10231033 
    10241034                if (entry)  
    1025                 {cout<<"a"; 
     1035                { 
    10261036                        madeContrib =  
    10271037                                vc->GetPvs().AddSample(entry, ray->mPdf); 
     
    10521062 
    10531063void VspTree::SortSubdivisionCandidates(const RayInfoContainer &rays, 
    1054                                                                   const int axis,  
    1055                                                                   float minBand,  
    1056                                                                   float maxBand) 
    1057 { 
     1064                                                                                const int axis,  
     1065                                                                                float minBand,  
     1066                                                                                float maxBand) 
     1067{ 
     1068        mSortTimer.Entry(); 
     1069 
    10581070        mLocalSubdivisionCandidates->clear(); 
    10591071 
     
    11021114        stable_sort(mLocalSubdivisionCandidates->begin(), mLocalSubdivisionCandidates->end()); 
    11031115        //sort(mLocalSubdivisionCandidates->begin(), mLocalSubdivisionCandidates->end()); 
     1116 
     1117        mSortTimer.Exit(); 
    11041118} 
    11051119 
     
    14081422                                                                float &pBack) 
    14091423{ 
     1424        mSplitTimer.Entry(); 
     1425 
    14101426        float nPosition[3]; 
    14111427        float nCostRatio[3]; 
     
    15021518        pFront = nProbFront[bestAxis]; 
    15031519        pBack = nProbBack[bestAxis]; 
     1520 
     1521        mSplitTimer.Exit(); 
    15041522 
    15051523        return nCostRatio[bestAxis]; 
     
    31913209                { 
    31923210                        BvhLeaf *leaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj); 
    3193                         UpdateContributionsToPvs(leaf, cf, frontPvs, backPvs, totalPvs); 
     3211                        UpdateContributionsToPvs(leaf, cf, frontPvs, backPvs, totalPvs, false); 
    31943212                        break; 
    31953213                } 
     
    32423260        int pvs = 0; 
    32433261 
    3244         switch(mHierarchyManager->GetObjectSpaceSubdivisionType()) 
     3262        switch (mHierarchyManager->GetObjectSpaceSubdivisionType()) 
    32453263        { 
    32463264        case HierarchyManager::NO_OBJ_SUBDIV: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r2176 r2187  
    1212#include "SubdivisionCandidate.h" 
    1313#include "HierarchyManager.h" 
     14#include "PerfTimer.h" 
    1415 
    1516 
     
    535536                float GetPriority() const 
    536537                { 
    537                         return (float)-mParentData.mDepth; 
    538                         //return mPriority; 
     538                        return mPriority; 
    539539                } 
    540540 
     
    723723        VspNode *SubdivideAndCopy(SplitQueue &tQueue, SubdivisionCandidate *splitCandidate); 
    724724 
     725        PerfTimer mSortTimer; 
     726        PerfTimer mSplitTimer; 
     727        PerfTimer mNodeTimer; 
     728        PerfTimer mSubdivTimer; 
     729        PerfTimer mEvalTimer; 
    725730 
    726731protected: 
     
    985990                float &backPvs, 
    986991                float &totalPvsm, 
    987                 const bool countEntries = false) const; 
     992                const bool countEntries) const; 
    988993 
    989994        /** Evaluates the contribution for kd leaves. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp

    r2116 r2187  
    623623void VssPreprocessor::DeterminePvsObjects(VssRayContainer &rays) 
    624624{ 
    625         //Preprocessor::DeterminePvsObjects(rays); 
    626         mViewCellsManager->DeterminePvsObjects(rays, true); 
    627 } 
    628  
    629  
    630 } 
     625        // store higher order object 
     626        mViewCellsManager->DeterminePvsObjects(rays, false); 
     627} 
     628 
     629 
     630} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.cpp

    r2176 r2187  
    158158TimeDiff(long time1, long time2) // in ms 
    159159{ 
    160   const Real clk=1.0e-3f; // ticks per second 
     160  //const Real clk=1.0e-3f; // ticks per second 
    161161  // $$ tmp store time in ms 
    162   //const Real clk=1.0f; // ticks per second 
     162  const Real clk=1.0f; // ticks per second 
    163163  long t=time2-time1; 
    164164   
Note: See TracChangeset for help on using the changeset viewer.