Changeset 1757 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 11/15/06 14:56:00 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1749 r1757 2424 2424 2425 2425 2426 void BvHierarchy::CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects) 2426 void BvHierarchy::CollectObjects(const AxisAlignedBox3 &box, 2427 ObjectContainer &objects) 2427 2428 { 2428 2429 stack<BvhNode *> nodeStack; … … 2430 2431 nodeStack.push(mRoot); 2431 2432 2432 while (!nodeStack.empty()) 2433 { 2434 BvhNode *node = nodeStack.top(); 2433 while (!nodeStack.empty()) { 2434 BvhNode *node = nodeStack.top(); 2435 2436 nodeStack.pop(); 2437 2438 if (node->IsLeaf()) { 2439 BvhLeaf *leaf = (BvhLeaf *)node; 2440 if (Overlap(box, leaf->GetBoundingBox())) { 2441 Intersectable *object = GetOrCreateBvhIntersectable(leaf); 2442 if (!object->Mailed()) { 2443 object->Mail(); 2444 objects.push_back(object); 2445 } 2446 } 2447 } 2448 else { 2449 BvhInterior *interior = (BvhInterior *)node; 2435 2450 2436 nodeStack.pop(); 2451 if (Overlap(box, interior->GetBoundingBox())) 2452 nodeStack.push(interior->GetFront()); 2437 2453 2438 if (node->IsLeaf()) 2439 { 2440 BvhLeaf *leaf = (BvhLeaf *)node; 2441 if (Overlap(box, leaf->GetBoundingBox())) { 2442 Intersectable *object = GetOrCreateBvhIntersectable(leaf); 2443 if (!object->Mailed()) { 2444 object->Mail(); 2445 objects.push_back(object); 2446 } 2447 } 2448 } 2449 else 2450 { 2451 BvhInterior *interior = (BvhInterior *)node; 2452 2453 if (Overlap(box, interior->GetBoundingBox())) 2454 nodeStack.push(interior->GetFront()); 2455 2456 if (Overlap(box, interior->GetBoundingBox())) 2457 nodeStack.push(interior->GetBack()); 2458 } 2459 } 2460 } 2461 2462 } 2454 if (Overlap(box, interior->GetBoundingBox())) 2455 nodeStack.push(interior->GetBack()); 2456 } 2457 } 2458 } 2459 2460 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1756 r1757 1732 1732 RegisterOption("Preprocessor.useGlRenderer", 1733 1733 optBool, 1734 "preprocessor_use_gl_renderer =",1734 "preprocessor_use_gl_renderer", 1735 1735 "false"); 1736 1736 1737 1737 RegisterOption("Preprocessor.useGlDebugger", 1738 1738 optBool, 1739 "preprocessor_use_gl_debugger =",1739 "preprocessor_use_gl_debugger", 1740 1740 "false"); 1741 1741 … … 2625 2625 strcpy(filename, "default.env"); 2626 2626 } 2627 2627 2628 2628 2629 if (useExePath) { -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r1533 r1757 6 6 #include "ArchModeler2MLRT.hxx" 7 7 8 #define DEBUG_RAYCAST 0 8 #define DEBUG_RAYCAST 0 9 9 10 10 … … 131 131 132 132 for (i=0; i < num; i++) { 133 mlrtaStoreRayAS16(&rays[index + i].mOrigin.x, 134 &rays[index + i].mDirection.x, 135 i); 136 } 133 mlrtaStoreRayAS16(&rays[index + i].mOrigin.x, 134 &rays[index + i].mDirection.x, 135 i); 136 } 137 138 #if DEBUG_RAYCAST 139 Debug<<"TA\n"<<flush; 140 #endif 137 141 138 142 mlrtaTraverseGroupAS16(&min.x, 139 &max.x,140 forward_hit_triangles,141 forward_dist);142 143 &max.x, 144 forward_hit_triangles, 145 forward_dist); 146 143 147 if (castDoubleRay) 144 {148 { 145 149 for (i=0; i < num; i++) 146 {150 { 147 151 Vector3 dir = -rays[index + i].mDirection; 148 152 mlrtaStoreRayAS16(&rays[index+i].mOrigin.x, 149 &dir.x, 150 i); 151 } 153 &dir.x, 154 i); 155 } 156 157 #if DEBUG_RAYCAST 158 Debug<<"TB\n"<<flush; 159 #endif 152 160 153 161 mlrtaTraverseGroupAS16(&min.x, 154 &max.x, 155 backward_hit_triangles, 156 backward_dist); 157 } 162 &max.x, 163 backward_hit_triangles, 164 backward_dist); 165 } 166 167 #if DEBUG_RAYCAST 168 Debug<<"BBB\n"<<flush; 169 #endif 158 170 159 171 for (i=0; i < num; i++) 160 {172 { 161 173 Intersection hitA(rays[i].mOrigin), hitB(rays[i].mOrigin); 174 175 #if DEBUG_RAYCAST 176 Debug<<"FH\n"<<flush; 177 #endif 162 178 163 179 if (forward_hit_triangles[i] != -1 ) { 164 165 166 167 168 169 170 171 180 if (forward_hit_triangles[i] >= mPreprocessor.mFaceParents.size()) 181 cerr<<"Warning: triangle index out of range! "<<forward_hit_triangles[i]<<endl; 182 else { 183 hitA.mObject = mPreprocessor.mFaceParents[forward_hit_triangles[i]].mObject; 184 // Get the normal of that face 185 hitA.mNormal = hitA.mObject->GetNormal(mPreprocessor.mFaceParents[forward_hit_triangles[i]].mFaceIndex); 186 //-rays[index+i].mDirection; // $$ temporary 187 hitA.mPoint = rays[index+i].Extrap(forward_dist[i]); 172 188 } 189 } 190 #if DEBUG_RAYCAST 191 Debug<<"BH\n"<<flush; 192 #endif 193 194 if (castDoubleRay && (backward_hit_triangles[i] != -1)) { 195 if (backward_hit_triangles[i] >= mPreprocessor.mFaceParents.size()) 196 cerr<<"Warning: triangle index out of range! "<<backward_hit_triangles[i]<<endl; 197 else { 198 hitB.mObject = mPreprocessor.mFaceParents[backward_hit_triangles[i]].mObject; 199 hitB.mNormal = hitB.mObject->GetNormal(mPreprocessor.mFaceParents[backward_hit_triangles[i]].mFaceIndex); 200 201 // normalB = rays[index+i].mDirection; // $$ temporary 202 hitB.mPoint = rays[index+i].Extrap(-backward_dist[i]); 173 203 } 174 175 if (castDoubleRay && (backward_hit_triangles[i] != -1)) { 176 if (backward_hit_triangles[i] >= mPreprocessor.mFaceParents.size()) 177 cerr<<"Warning: triangle index out of range! "<<backward_hit_triangles[i]<<endl; 178 else { 179 hitB.mObject = mPreprocessor.mFaceParents[backward_hit_triangles[i]].mObject; 180 hitB.mNormal = hitB.mObject->GetNormal(mPreprocessor.mFaceParents[forward_hit_triangles[i]].mFaceIndex); 181 182 // normalB = rays[index+i].mDirection; // $$ temporary 183 hitB.mPoint = rays[index+i].Extrap(-backward_dist[i]); 184 } 185 } 186 187 ProcessRay( 188 rays[index + i], 189 hitA, 190 hitB, 191 vssRays, 192 sbox, 193 castDoubleRay, 194 pruneInvalidRays 195 ); 196 } 197 204 } 205 206 #if DEBUG_RAYCAST 207 Debug<<"PR\n"<<flush; 208 #endif 209 210 ProcessRay( 211 rays[index + i], 212 hitA, 213 hitB, 214 vssRays, 215 sbox, 216 castDoubleRay, 217 pruneInvalidRays 218 ); 219 } 220 198 221 #if DEBUG_RAYCAST 199 222 Debug<<"C16F\n"<<flush; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1743 r1757 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: po 13. XI 15:12:57 20063 # Generated by qmake (2.00a) (Qt 4.1.2) on: Tue Nov 14 23:59:07 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app … … 63 63 $(MAKE) -f $(MAKEFILE).Debug uninstall 64 64 65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc .net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \ 66 66 C:\Qt\4.1.2\mkspecs\features\qt_config.prf \ 67 67 C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \ -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1749 r1757 1059 1059 ) 1060 1060 { 1061 1061 const long t1 = GetTime(); 1062 1062 1063 1063 for (int i = 0; i < (int)rays.size();) -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1751 r1757 159 159 public: 160 160 161 Pvs(): mSamples(0), mEntries() {}161 Pvs(): mSamples(0), mEntries(), mLastSorted(0) {} 162 162 163 163 /** creates pvs and initializes it with the given entries. … … 205 205 */ 206 206 float AddSample(T sample, const float pdf); 207 207 208 /** Adds sample to PVS without checking for presence of the sample 209 pvs remians unsorted! 210 */ 211 void AddSampleDirty(T sample, const float pdf); 212 213 /** Sort pvs entries - this should always be called after a 214 sequence of AddSampleDirty calls */ 215 void Sort(); 216 208 217 /** Adds sample to PVS. Assumes that the pvs is sorted 209 218 @returns contribution of sample (0 or 1) … … 271 280 /// Number of samples used to create the PVS 272 281 int mSamples; 282 283 /// Last sorted entry in the pvs (important for find and merge 284 int mLastSorted; 285 273 286 }; 274 287 … … 279 292 mEntries.reserve(samples.size()); 280 293 mEntries = samples; 281 } 282 294 mLastSorted = 0; 295 } 296 297 template <typename T, typename S> 298 void Pvs<T, S>::Sort() 299 { 300 std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin(); 301 it.inc(mLastSorted); 302 sort(it, mEntries.end()); 303 mLastSorted = mEntries.size() - 1; 304 } 283 305 284 306 /** … … 500 522 501 523 template <typename T, typename S> 524 void Pvs<T, S>::AddSampleDirty(T sample, const float pdf) 525 { 526 ++ mSamples; 527 mEntries.push_back(PvsEntry<T, S>(sample, pdf)); 528 } 529 530 531 template <typename T, typename S> 502 532 typename vector< PvsEntry<T, S> >::iterator Pvs<T, S>::AddSample2(T sample, const float pdf) 503 533 { -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1743 r1757 15 15 #include "QtPreprocessorThread.h" 16 16 17 17 #define USE_CG 1 18 19 #ifdef USE_CG 18 20 #include <Cg/cg.h> 19 21 #include <Cg/cgGL.h> 22 #endif 20 23 21 24 #include <QVBoxLayout> … … 48 51 } 49 52 50 53 #if USE_CG 51 54 static void handleCgError() 52 55 { … … 54 57 exit(1); 55 58 } 59 #endif 56 60 57 61 void … … 150 154 QtGlRendererBuffer::~QtGlRendererBuffer() 151 155 { 152 if (sCgFragmentProgram) 156 #if USE_CG 157 if (sCgFragmentProgram) 153 158 cgDestroyProgram(sCgFragmentProgram); 154 159 if (sCgContext) 155 160 cgDestroyContext(sCgContext); 161 #endif 156 162 } 157 163 … … 604 610 glEnable(GL_TEXTURE_2D); 605 611 612 #if USE_CG 606 613 // bind pixel shader implementing the front depth buffer functionality 607 614 cgGLBindProgram(sCgFragmentProgram); 608 615 cgGLEnableProfile(sCgFragmentProfile); 609 616 #endif 610 617 611 618 // 5. render all objects inside the beam … … 752 759 glEnable(GL_CULL_FACE); 753 760 glDisable(GL_STENCIL_TEST); 761 #if USE_CG 754 762 cgGLDisableProfile(sCgFragmentProfile); 763 #endif 755 764 glDisable(GL_TEXTURE_2D); 756 765 … … 822 831 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 823 832 833 #if USE_CG 824 834 // cg initialization 825 835 cgSetErrorCallback(handleCgError); … … 840 850 } 841 851 842 843 852 sCgFragmentProgram = cgCreateProgramFromFile(sCgContext, 844 853 CG_SOURCE, "../src/dual_depth.cg", … … 855 864 Debug << "---- PROGRAM BEGIN ----\n" << 856 865 cgGetProgramString(sCgFragmentProgram, CG_COMPILED_PROGRAM) << "---- PROGRAM END ----\n"; 866 867 #endif 857 868 858 869 #endif … … 1570 1581 } 1571 1582 1572 for (int i=0; pow(10 , i) < maxCost; i+=1) {1583 for (int i=0; pow(10.0f, i) < maxCost; i+=1) { 1573 1584 float y = i*scaley; 1574 1585 // QString s; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h
r1743 r1757 174 174 struct PvsCache { 175 175 PvsCache():mViewCell(NULL) {} 176 Reset() { mViewCell = NULL; mPvs.Clear(); }176 void Reset() { mViewCell = NULL; mPvs.Clear(); } 177 177 ViewCell *mViewCell; 178 178 ObjectPvs mPvs; -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
r1584 r1757 88 88 89 89 #if DEBUG_RAYCAST 90 Debug<<"PR ";90 Debug<<"PRA"<<flush; 91 91 #endif 92 92 … … 101 101 const bool validA = 102 102 ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 103 104 #if DEBUG_RAYCAST 105 Debug<<"PR1"<<flush; 106 #endif 103 107 104 108 if (!validA && pruneInvalidRays) … … 116 120 117 121 const bool validSample = !pruneInvalidRays || (hitA.mObject != hitB.mObject); 118 122 123 #if DEBUG_RAYCAST 124 Debug<<"PR2"<<flush; 125 #endif 126 119 127 if (validSample) 120 128 { … … 134 142 //cout << "vssray 1: " << *vssRay << " " << vssRay->mTermination - vssRay->mOrigin << endl; 135 143 } 136 144 145 #if DEBUG_RAYCAST 146 Debug<<"PR3"<<flush; 147 #endif 148 137 149 if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 138 150 { … … 151 163 } 152 164 } 153 165 166 #if DEBUG_RAYCAST 167 Debug<<"PR4"<<flush; 168 #endif 169 154 170 return hits; 155 171 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
r1715 r1757 2272 2272 float density = 1.0f; 2273 2273 float p = 1.0f/density; //(box.GetVolume()*dirBox.GetVolume())/i; 2274 for (i =startIndex; i < rays.size(); i++) {2274 for (int i=startIndex; i < rays.size(); i++) { 2275 2275 rays[i].mPdf = p; 2276 2276 } … … 2461 2461 2462 2462 float p = 1.0f/density; //(box.GetVolume()*dirBox.GetVolume())/i; 2463 for (i =startIndex; i < rays.size(); i++) {2463 for (int i=startIndex; i < rays.size(); i++) { 2464 2464 rays[i].mPdf = p; 2465 2465 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
r1749 r1757 126 126 127 127 for (int j=0; j < vssRays.size(); j++) { 128 Intersectable *obj = mViewCellsManager->GetIntersectable(*(vssRays[j]), true); 128 Intersectable *obj = mViewCellsManager->GetIntersectable(*(vssRays[j]), 129 true); 129 130 if (obj) { 130 131 // if ray not outside of view space … … 148 149 } 149 150 151 #if 0 150 152 Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 151 153 mViewCellsManager->SetValidity(0, intersectables/2); 152 154 Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 153 155 #endif 156 154 157 // mVssRays.PrintStatistics(mStats); 155 158 mStats << -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1756 r1757 1835 1835 stat.avgPvs += pvsCost; 1836 1836 1837 if (0) { 1837 const bool evaluateFilter = true; 1838 1839 if (evaluateFilter) { 1838 1840 ObjectPvs filteredPvs = viewcell->GetPvs(); 1839 1841 ApplyFilter2(viewcell, false, 1.0f, filteredPvs); … … 1841 1843 stat.avgFilteredPvs += filteredCost; 1842 1844 stat.avgFilterContribution += filteredCost - pvsCost; 1845 } else { 1846 stat.avgFilteredPvs += pvsCost; 1847 stat.avgFilterContribution += 0; 1843 1848 } 1844 1849 … … 2594 2599 AxisAlignedBox3 vbox = GetViewCellBox(viewCell); 2595 2600 Vector3 center = vbox.Center(); 2596 // first determine the average size of the filter2597 2598 pvs = viewCell->GetPvs();2601 2602 // COpy the PVS 2603 ObjectPvs basePvs = viewCell->GetPvs(); 2599 2604 Intersectable::NewMail(); 2600 2601 ObjectPvsIterator pit = pvs.GetIterator();2605 2606 ObjectPvsIterator pit = basePvs.GetIterator(); 2602 2607 2603 2608 // first mark all object from this pvs 2604 while (pit.HasMoreEntries()) 2605 { 2606 ObjectPvsEntry entry = pit.Next(); 2607 2608 Intersectable *object = entry.mObject; 2609 object->Mail(); 2609 while (pit.HasMoreEntries()) { 2610 ObjectPvsEntry entry = pit.Next(); 2611 2612 Intersectable *object = entry.mObject; 2613 object->Mail(); 2610 2614 } 2611 2615 2612 ObjectPvs nPvs; 2616 2613 2617 int pvsSize = 0; 2614 2618 int nPvsSize = 0; 2615 2619 float samples = (float)pvs.GetSamples(); 2616 cout<<"Samples = "<<samples<<endl; 2617 cout<<"pvs size = "<<pvs.GetSize() <<endl; 2620 2621 // cout<<"#s"<<samples<<endl; 2622 // cout<<"pvs size = "<<pvs.GetSize() <<endl; 2618 2623 // cout<<"Filter size = "<<filterSize<<endl; 2619 2624 // cout<<"vbox = "<<vbox<<endl; … … 2621 2626 2622 2627 2628 // Minimal number of local samples to take into account 2629 // the local sampling density. 2630 // The size of the filter is a minimum of the conservative 2631 // local sampling density estimate (#rays intersecting teh viewcell and 2632 // the object) 2633 // and gobal estimate for the view cell 2634 // (total #rays intersecting the viewcell) 2623 2635 #define MIN_LOCAL_SAMPLES 5 2624 2636 2625 // compute the average filter radius2626 2637 float globalC = 2.0f*filterSize/sqrt(samples); 2627 2628 float sumRadius = 0.0f;2629 2630 ObjectPvsIterator pit2 = pvs.GetIterator();2631 2632 // first mark all object from this pvs2633 for (; pit2.HasMoreEntries(); pvsSize++) {2634 ObjectPvsEntry entry = pit2.Next();2635 Intersectable *object = entry.mObject;2636 // compute filter size based on the distance and the numebr of samples2637 AxisAlignedBox3 box = object->GetBox();2638 2639 float distance = Distance(center, box.Center());2640 float globalRadius = distance*globalC;2641 2642 int objectSamples = (int)entry.mData.mSumPdf;2643 float localRadius = MAX_FLOAT;2644 2645 if (objectSamples > MIN_LOCAL_SAMPLES)2646 localRadius = 0.5f*Magnitude(box.Diagonal())/sqrt((float)objectSamples);2647 2648 // now compute the filter size2649 float radius = Min(localRadius, globalRadius);2650 2651 sumRadius +=radius;2652 }2653 2654 float avgRadius = sumRadius/pvsSize;2655 2638 float viewCellRadius = 0.5f*Magnitude(vbox.Diagonal()); 2656 cout<<"radius ratio = "<<avgRadius/viewCellRadius<<endl;2657 2639 2658 2640 // now compute the filter box around the current viewCell 2659 2641 2660 2642 if (useViewSpaceFilter) { 2661 2643 // float radius = Max(viewCellRadius/100.0f, avgRadius - viewCellRadius); … … 2666 2648 ComputeBoxIntersections(vbox, viewCells); 2667 2649 2668 // cout<<"box="<<box<<endl; 2669 ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end(); 2670 2671 int i; 2650 ViewCellContainer::const_iterator it = viewCells.begin(), 2651 it_end = viewCells.end(); 2652 int i = 0; 2672 2653 for (i=0; it != it_end; ++ it, ++ i) 2673 2654 if ((*it) != viewCell) { 2674 2655 //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 2675 pvs.MergeInPlace((*it)->GetPvs());2656 basePvs.MergeInPlace((*it)->GetPvs()); 2676 2657 } 2677 2658 2678 2659 // update samples and globalC 2679 2660 samples = (float)pvs.GetSamples(); 2680 2661 globalC = 2.0f*filterSize/sqrt(samples); 2681 cout<<"neighboring viewcells = "<<i-1<<endl;2682 cout<<"Samples' = "<<samples<<endl;2662 // cout<<"neighboring viewcells = "<<i-1<<endl; 2663 // cout<<"Samples' = "<<samples<<endl; 2683 2664 } 2684 2665 2685 pit = pvs.GetIterator(); 2686 2687 // first mark all object from this pvs 2666 pit = basePvs.GetIterator(); 2667 2668 ObjectContainer objects; 2669 2688 2670 while (pit.HasMoreEntries()) 2689 2671 { 2690 ObjectPvsEntry entry = pit.Next(); 2691 2692 Intersectable *object = entry.mObject; 2693 // compute filter size based on the distance and the numebr of samples 2694 AxisAlignedBox3 box = object->GetBox(); 2695 2696 float distance = Distance(center, box.Center()); 2697 float globalRadius = distance*globalC; 2698 2699 int objectSamples = (int)entry.mData.mSumPdf; 2700 float localRadius = MAX_FLOAT; 2701 if (objectSamples > MIN_LOCAL_SAMPLES) 2702 localRadius = filterSize*0.5f*Magnitude(box.Diagonal())/sqrt((float)objectSamples); 2703 2704 // cout<<"lr="<<localRadius<<" gr="<<globalRadius<<endl; 2705 2706 // now compute the filter size 2707 float radius = Min(localRadius, globalRadius); 2708 2709 // cout<<"box = "<<box<<endl; 2710 // cout<<"distance = "<<distance<<endl; 2711 // cout<<"radiues = "<<radius<<endl; 2712 2713 box.Enlarge(Vector3(radius)); 2714 2715 2716 ObjectContainer objects; 2717 // $$ warning collect objects takes only unmailed ones! 2718 CollectObjects(box, objects); 2719 // cout<<"collected objects="<<objects.size()<<endl; 2720 ObjectContainer::const_iterator noi = objects.begin(); 2721 for (; noi != objects.end(); ++ noi) { 2722 Intersectable *o = *noi; 2723 // $$ JB warning: pdfs are not correct at this point! 2724 nPvs.AddSample(o, Limits::Small); 2725 nPvsSize ++; 2726 } 2672 ObjectPvsEntry entry = pit.Next(); 2673 2674 Intersectable *object = entry.mObject; 2675 // compute filter size based on the distance and the numebr of samples 2676 AxisAlignedBox3 box = object->GetBox(); 2677 2678 float distance = Distance(center, box.Center()); 2679 float globalRadius = distance*globalC; 2680 2681 int objectSamples = (int)entry.mData.mSumPdf; 2682 float localRadius = MAX_FLOAT; 2683 if (objectSamples > MIN_LOCAL_SAMPLES) 2684 localRadius = filterSize*0.5f*Magnitude(box.Diagonal())/ 2685 sqrt((float)objectSamples); 2686 2687 // cout<<"lr="<<localRadius<<" gr="<<globalRadius<<endl; 2688 2689 // now compute the filter size 2690 float radius = Min(localRadius, globalRadius); 2691 2692 // cout<<"box = "<<box<<endl; 2693 // cout<<"distance = "<<distance<<endl; 2694 // cout<<"radiues = "<<radius<<endl; 2695 2696 box.Enlarge(Vector3(radius)); 2697 2698 objects.clear(); 2699 // $$ warning collect objects takes only unmailed ones! 2700 CollectObjects(box, objects); 2701 // cout<<"collected objects="<<objects.size()<<endl; 2702 ObjectContainer::const_iterator noi = objects.begin(); 2703 for (; noi != objects.end(); ++ noi) { 2704 Intersectable *o = *noi; 2705 // $$ JB warning: pdfs are not correct at this point! 2706 pvs.AddSampleDirty(o, Limits::Small); 2707 } 2727 2708 } 2728 cout<<"nPvs size = "<<nPvsSize<<endl; 2729 2730 pvs.MergeInPlace(nPvs); 2709 2710 // cout<<"nPvs size = "<<pvs.GetSize()<<endl; 2711 2712 // copy the base pvs to the new pvs 2713 pit = basePvs.GetIterator(); 2714 while (pit.HasMoreEntries()) { 2715 ObjectPvsEntry entry = pit.Next(); 2716 pvs.AddSampleDirty(entry.mObject, entry.mData.mSumPdf); 2717 } 2731 2718 2732 2719 Intersectable::NewMail(); … … 3908 3895 exporter->ExportKdTree(*mKdTree); 3909 3896 3910 for (i = 0; i < pvsOut; i++)3897 for (int i = 0; i < pvsOut; i++) 3911 3898 exporter->ExportRays(rays[i], RgbColor(1, 0, 0)); 3912 3899 … … 3918 3905 { 3919 3906 Intersectable *object = objects[k]; 3920 char str[64]; sprintf(str, "viewcell%04d.wrl", i);3907 char str[64]; sprintf(str, "viewcell%04d.wrl", k); 3921 3908 3922 3909 Exporter *exporter = Exporter::GetExporter(str); -
GTP/trunk/Lib/Vis/Preprocessing/src/common.h
r1717 r1757 54 54 #else // __WATCOMC__ 55 55 #define M_PI 3.14159265358979323846 56 #define MAXFLOAT 3.40282347e+3 8F56 #define MAXFLOAT 3.40282347e+37F 57 57 #endif // __WATCOMC__ 58 58 -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1743 r1757 75 75 76 76 SamplingPreprocessor { 77 totalSamples 10000000078 samplesPerPass 100000077 totalSamples 50000000 78 samplesPerPass 3000000 79 79 } 80 80 … … 82 82 samplesPerPass 1000 83 83 initialSamples 2000000 84 vssSamples 10000000084 vssSamples 50000000 85 85 # vssSamples 1000000 86 86 vssSamplesPerPass 3000000 … … 289 289 # filename ../data/vienna/vsposp-seq-viewCells.xml.gz 290 290 291 filename ../data/vienna/vienna_cropped-gradient- 2-viewcells.xml.gz291 filename ../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 292 292 293 293 # filename ../data/vienna/vienna_cropped-2-sequential-30000-viewcells.xml.gz -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r1715 r1757 1 CONFIG -= qt debug2 CONFIG += console warn_off thread releasemlrt qt1 CONFIG += qt release 2 CONFIG += console warn_off thread mlrt qt 3 3 4 4 TEMPLATE = app 5 6 5 7 6 TARGET = preprocessor … … 20 19 21 20 CONFIG(qt) { 22 win32:INCLUDEPATH += " d:/Programs/NVIDIA Corporation/Cg/include"21 win32:INCLUDEPATH += "c:/Program Files/NVIDIA Corporation/Cg/include" 23 22 } 24 23 … … 32 31 33 32 CONFIG(qt) { 34 win32:LIBPATH += "d:/Programs/NVIDIA Corporation/Cg/lib" 35 CONFIG(debug) { 36 LIBPATH += QtRenderer/debug 37 } 38 39 CONFIG(release) { 40 LIBPATH += QtRenderer/release 41 } 33 win32:LIBPATH += "c:/Program Files/NVIDIA Corporation/Cg/lib" 42 34 } 43 35 … … 47 39 48 40 49 # RELEASE CONFIG50 #CONFIG += windows warn_on thread release51 41 52 42 # DEPENDPATH = ../../include … … 88 78 CONFIG(qt) { 89 79 win32:LIBS += cg.lib cgGL.lib 90 #LIBS += QtRenderer.lib91 80 DEFINES += USE_QT 92 81 } … … 116 105 OspTree.cpp HierarchyManager.cpp ObjParser.cpp \ 117 106 BvHierarchy.cpp \ 118 BoostPreprocessorThread.cppInternalRayCaster.cpp IntelRayCaster.cpp \107 InternalRayCaster.cpp IntelRayCaster.cpp \ 119 108 RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp \ 120 109 Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp 121 110 122 111 112 SOURCES += BoostPreprocessorThread.cpp 123 113 124 114 CONFIG(qt) { 125 115 HEADERS += QtPreprocessorThread.h QtGlRenderer.h 126 116 SOURCES += OcclusionQuery.cpp QtPreprocessorThread.cpp QtGlRenderer.cpp 117 } else { 118 SOURCES += BoostPreprocessorThread.cpp 127 119 } 128 120 -
GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
r1756 r1757 2 2 3 3 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ "4 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer-" 5 5 6 6 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d" … … 27 27 28 28 SCENE=../data/vienna/vienna_cropped.obj 29 VIEWCELLS=../data/vienna/vienna_cropped-gradient- 2-viewcells.xml.gz29 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 30 30 31 31 PREFIX=../work/plots/osp-rss … … 37 37 #mv stats.log $PREFIX-i-combined-b3.log 38 38 39 # 40 # 41 # 39 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 40 #-rss_use_importance+ -rss_update_subdivision+ -rss_split=regular \ 41 #-view_cells_filter_max_size=1 42 42 43 # 43 #mv stats.log $PREFIX-i-combined-update-ccb3.log 44 44 45 45 # $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ … … 54 54 55 55 56 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \57 #-rss_use_importance+ -rss_update_subdivision+ -rss_split=hybrid -hybrid_depth=10 \58 #-view_cells_filter_max_size=159 #mv stats.log $PREFIX-i-combined-update-ccb12.log56 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 57 -rss_use_importance+ -rss_update_subdivision+ -rss_split=hybrid -hybrid_depth=10 \ 58 -view_cells_filter_max_size=1 59 mv stats.log $PREFIX-i-combined-update-ccb12.log 60 60 61 61 62 62 63 # #######64 # #######65 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \66 #-rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ \67 #-view_cells_filter_max_size=168 #mv stats.log $PREFIX-r-directional-based-b3.log63 ####### 64 ####### 65 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 66 -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ \ 67 -view_cells_filter_max_size=1 68 mv stats.log $PREFIX-r-directional-based-b3.log 69 69 70 70 71 #$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \72 #-rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling- \73 #-view_cells_filter_max_size=174 #mv stats.log $PREFIX-r-spatial-based-bb3.log71 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 72 -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling- \ 73 -view_cells_filter_max_size=1 74 mv stats.log $PREFIX-r-spatial-based-bb3.log 75 75 76 76 77 77 78 #$COMMAND -scene_filename=$SCENE -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+79 #mv stats.log $PREFIX-r-direction-based-b3.log78 $COMMAND -scene_filename=$SCENE -rss_use_importance- -rss_object_based_sampling- -rss_directional_sampling+ 79 mv stats.log $PREFIX-r-direction-based-b3.log 80 80 81 81
Note: See TracChangeset
for help on using the changeset viewer.