Changeset 2707 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 05/24/08 22:40:42 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2701 r2707 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: pá 23. V 15:20:40 20083 # Generated by qmake (2.00a) (Qt 4.1.2) on: so 24. V 22:09:30 2008 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 2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \65 Makefile: preprocessor.pro C:/Qt/4.1.2/mkspecs/win32-msvc.net\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
r2703 r2707 25 25 #include "GlobalLinesRenderer.h" 26 26 #include "ObjectsParser.h" 27 #include "SepPlanesBox3.h" 27 28 28 29 … … 1658 1659 /** Object has moved - must dynamically update all affected PVSs */ 1659 1660 void 1660 Preprocessor::ObjectMoved(SceneGraphLeaf * object)1661 Preprocessor::ObjectMoved(SceneGraphLeaf *leaf) 1661 1662 { 1662 1663 // first invalidate all PVS from which this object is visible 1663 1664 ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end(); 1664 1665 AxisAlignedBox3 box = object->GetBox(); 1666 1667 ObjectContainer objects; 1668 1669 if (0) 1670 { 1671 // simplified computation taking only the objects intersecting the box 1672 KdNode::NewMail(); 1673 1674 // first mail all kDObjects which are intersected by the object 1675 preprocessor->mKdTree->CollectKdObjects(box, objects); 1676 1677 } 1678 else 1679 { 1680 ViewCellContainer viewCells; 1681 mViewCellsManager->ComputeBoxIntersections(box, viewCells); 1682 1683 // add object to all viewcells that intersect the bounding box 1684 ObjectPvs pvs; 1685 1686 ViewCellContainer::const_iterator it = viewCells.begin(), it_end = viewCells.end(); 1687 1688 for (int i = 0; it != it_end; ++ it, ++ i) 1689 { 1690 //cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 1691 pvs.MergeInPlace((*it)->GetPvs()); 1692 } 1693 1694 ObjectPvsIterator pit = pvs.GetIterator(); 1695 while (pit.HasMoreEntries()) 1696 { 1697 PvsData pvsData; 1698 Intersectable *object = pit.Next(pvsData); 1699 objects.push_back(object); 1700 } 1701 } 1702 1703 int pvsCounter = 0; 1704 1705 // now search for pvss which contained any mailed node 1706 for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit) 1707 { 1708 ObjectPvs &pvs = (*vit)->GetPvs(); 1709 1710 for (int i=0; i < objects.size(); i++) 1711 { 1712 vector<PvsEntry<Intersectable *,PvsData> >::iterator v; 1665 1666 AxisAlignedBox3 box = leaf->GetBox(); 1667 Intersectable *inter = leaf->GetIntersectable(); 1668 int removedEntries = 0; 1669 1670 // now search for pvss which contained any mailed node 1671 for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit) { 1672 ObjectPvs &pvs = (*vit)->GetPvs(); 1673 if (Overlap(box, (*vit)->GetBox())) { 1674 pvs.Clear(); 1675 removedEntries += pvs.GetSize(); 1676 } else { 1677 CSeparatingAxisTester shadowVolume; 1678 1679 // cout<<(*vit)->GetBox()<<" "<<box<<endl; 1680 shadowVolume.Init((*vit)->GetBox(), box); 1681 1682 int j = 0; 1683 for (int i=0; i < pvs.mEntries.size(); i++) { 1684 Intersectable *o = pvs.mEntries[i].mObject; 1713 1685 1714 if (pvs.Find(objects[i], v)) { 1715 // clear the pvs 1716 pvs.Clear(); 1717 pvsCounter++; 1718 break; 1719 } 1720 } 1721 } 1722 1723 cout<<"Number of affected objects "<<objects.size()<<endl; 1724 cout<<"Cleared "<<pvsCounter<<" PVSs ("<<mViewCellsManager->GetViewCells().size()/ 1725 (float)pvsCounter*100.0f<<"%) "<<endl; 1726 1686 if (!shadowVolume.TestIsInsideShaft(o->GetBox())) { 1687 if (j != i) 1688 pvs.mEntries[j] = pvs.mEntries[i]; 1689 j++; 1690 } else { 1691 removedEntries++; 1692 } 1693 } 1694 pvs.mLastSorted = 0; 1695 if (j==0) 1696 pvs.mEntries.clear(); 1697 else { 1698 pvs.mEntries.resize(j); 1699 pvs.SimpleSort(); 1700 } 1701 } 1702 } 1703 1704 cerr<<"Number of removed pvs entries = "<<removedEntries<<endl; 1705 // cout<<"Cleared "<<pvsCounter<<" PVSs ("<<mViewCellsManager->GetViewCells().size()/ 1706 // (float)pvsCounter*100.0f<<"%) "<<endl; 1707 1727 1708 } 1728 1709 … … 1745 1726 cout<<"done."<<endl; 1746 1727 1747 c out<<"Updating affected PVSs..."<<endl;1728 cerr<<"Updating affected PVSs..."<<endl; 1748 1729 preprocessor->ObjectMoved(l); 1749 c out<<"done."<<endl;1730 cerr<<"done."<<endl; 1750 1731 } 1751 1732 -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2636 r2707 442 442 } 443 443 444 template <typename T, typename S> 445 void VerbosePvs<T, S>::Remove(typename vector<PvsEntry<T, S> >::iterator &it) 446 { 447 448 mEntries.erase(it); 449 -- mLastSorted; // wrong if sample was in tail!! 450 // $$JB decrement only if the sample found 451 -- mSamples; 452 453 } 444 454 445 455 template <typename T, typename S> -
GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
r2696 r2707 4 4 #include "common.h" 5 5 #include "Containers.h" 6 6 #include <vector> 7 7 8 8 namespace GtpVisibilityPreprocessor { … … 145 145 } 146 146 147 147 148 inline T Next() { return (*(mItCurrent ++)).mObject; } 148 149 149 150 private: 151 152 typename vector<PvsEntry<T, S> >::const_iterator mItCurrent; 153 typename vector<PvsEntry<T, S> >::const_iterator mItEnd; 150 inline T Current(S &pdf) { 151 pdf = (*mItCurrent).mData; 152 return (*(mItCurrent)).mObject; 153 } 154 155 //private: 156 157 typename vector<PvsEntry<T, S> >::const_iterator mItCurrent; 158 typename vector<PvsEntry<T, S> >::const_iterator mItEnd; 154 159 }; 155 160 … … 261 266 @param visibleSamples number of references to be removed 262 267 */ 263 bool RemoveSample(T sample, const float pdf); 268 bool RemoveSample(T sample, const float pdf); 269 270 void Remove(typename vector<PvsEntry<T, S> >::iterator &it); 264 271 265 272 /** Compute continuous PVS difference … … 334 341 VerbosePvsStats mStats; 335 342 336 protected:343 //protected: 337 344 338 345 /** Merge pvs 1 from begin iterator to end iterator with -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2706 r2707 333 333 char filename[256]; 334 334 //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 335 sprintf _s(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount);335 sprintf(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 336 336 QImage im = toImage(); 337 337 string str = mSnapPrefix + filename; … … 367 367 368 368 im = toImage(); 369 sprintf _s(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount);369 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 370 370 str = mSnapPrefix + filename; 371 371 qstr = str.c_str(); … … 1043 1043 break; 1044 1044 1045 if (sscanf _s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) {1045 if (sscanf(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 1046 1046 text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 1047 1047 text = QInputDialog::getText(this, … … 1053 1053 if (!ok) 1054 1054 break; 1055 if (sscanf _s(text.toAscii(), "%f %f %f", &mViewDirection.x,1055 if (sscanf(text.toAscii(), "%f %f %f", &mViewDirection.x, 1056 1056 &mViewDirection.y, &mViewDirection.z) == 3) { 1057 1057 updateGL(); … … 2194 2194 #endif 2195 2195 2196 #if 02196 #if 1 2197 2197 QGroupBox *groupBox4 = CreateTrafoPanel(hbox); 2198 2198 vh->addWidget(groupBox4, 0, 0); -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2706 r2707 27 27 #include "RayCaster.h" 28 28 #include "ViewCellsManager.h" 29 #include "SepPlanesBox3.h" 29 30 30 31 … … 169 170 Debug.open("debug.log"); 170 171 172 173 TestSepAxis(); 174 171 175 Environment::GetSingleton()->Parse(argc, argv, USE_EXE_PATH); 172 176 MeshKdTree::ParseEnvironment(); -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r2701 r2707 125 125 Intersectable.cpp TraversalTree.cpp ObjectPvs.cpp ObjectsParser.cpp \ 126 126 FilterBasedDistribution.cpp DifferenceSampling.cpp HavranRayCaster.cpp \ 127 HavranDynRayCaster.cpp OcclusionQuery.cpp RandomViewCellsHandler.cpp 127 HavranDynRayCaster.cpp OcclusionQuery.cpp RandomViewCellsHandler.cpp \ 128 SepPlanesBox3.cpp 128 129 129 130
Note: See TracChangeset
for help on using the changeset viewer.