- Timestamp:
- 12/19/05 13:07:21 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp
r469 r471 884 884 KdLeaf *leaf = (KdLeaf *)node; 885 885 // kdtree used as view cell container => create view cell 886 leaf->mViewCell = new KdViewCell(); 887 vc.push_back(leaf->mViewCell); 886 KdViewCell *viewCell = new KdViewCell(); 887 leaf->mViewCell = viewCell; 888 // push back pointer to this leaf 889 viewCell->mLeaves.push_back(leaf); 890 vc.push_back(viewCell); 888 891 } else { 889 892 KdInterior *interior = (KdInterior *)node; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
r470 r471 24 24 public: 25 25 ViewCell(); 26 26 27 27 /** Constructor taking a mesh representing the shape of the viewcell. 28 28 */ … … 32 32 */ 33 33 virtual ~ViewCell() {} 34 /** Returns Pvs. 34 /** Returns Pvs. 35 35 */ 36 36 const ObjectPvs &GetPvs() const; … … 38 38 39 39 int Type() const; 40 40 41 41 /** Adds a passing ray to the passing ray container. 42 42 */ 43 void AddPassingRay(const Ray &ray, const int contributions); 43 void AddPassingRay(const Ray &ray, const int contributions); 44 44 45 45 /** Returns volume of the view cell. … … 51 51 void SetVolume(float size); 52 52 53 /// Ray set description of the rays passing through this node. 53 /// Ray set description of the rays passing through this node. 54 54 PassingRaySet mPassingRays; 55 55 … … 73 73 public: 74 74 HierarchyViewCell<T>(): mLeaves(0) {} 75 HierarchyViewCell<T>(Mesh *mesh): 75 HierarchyViewCell<T>(Mesh *mesh): 76 76 ViewCell(mesh), mLeaves(0) {} 77 77 … … 87 87 /** Statistics for a view cell partition. 88 88 */ 89 89 90 class ViewCellsStatistics: public StatisticsBase 90 91 { … … 96 97 /// size of the PVS 97 98 int pvs; 98 99 99 100 /// largest PVS of all view cells 100 101 int maxPvs; … … 109 110 int leaves; 110 111 111 /// largest number of leaves covered by one view cell 112 /// largest number of leaves covered by one view cell 112 113 int maxLeaves; 113 114 114 115 // Constructor 115 ViewCellsStatistics() 116 ViewCellsStatistics() 116 117 { 117 118 Reset(); … … 120 121 double AvgLeaves() const {return (double)leaves / (double)viewCells;}; 121 122 double AvgPvs() const {return (double)pvs / (double)viewCells;}; 122 123 void Reset() 123 124 void Reset() 124 125 { 125 viewCells = 0; 126 pvs = 0; 126 viewCells = 0; 127 pvs = 0; 127 128 maxPvs = 0; 128 129 … … 135 136 void Print(ostream &app) const; 136 137 137 friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat) 138 friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat) 138 139 { 139 140 stat.Print(s); 140 141 return s; 141 } 142 } 142 143 }; 143 144 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r470 r471 396 396 397 397 398 float BspViewCellsManager::GetProbability(ViewCell *viewCell) const 399 { 400 PolygonContainer geom; 401 402 // compute view cell area 403 mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(viewCell), geom); 404 405 const float area = Polygon3::GetArea(geom); 406 const float viewspaceArea = GetTotalArea();// mBspTree->GetBoundingBox().SurfaceArea(); 407 408 CLEAR_CONTAINER(geom); 409 410 return area / viewspaceArea; 398 float BspViewCellsManager::GetProbability(ViewCell *viewCell) 399 { 400 // compute view cell area as subsititute for probability 401 return GetArea(viewCell) / mBspTree->GetBoundingBox().SurfaceArea(); 402 //return GetArea(viewCell) / GetTotalArea(); 411 403 } 412 404 … … 898 890 } 899 891 900 float KdViewCellsManager::GetProbability(ViewCell *viewCell) const901 { 902 KdViewCell *vc = dynamic_cast<KdViewCell *>(viewCell);903 904 AxisAlignedBox3 box = mKdTree->GetBox(vc->mLeaves[0]); 905 906 return box.SurfaceArea();892 float KdViewCellsManager::GetProbability(ViewCell *viewCell) 893 { 894 // compute view cell area as subsititute for probability 895 AxisAlignedBox3 box = mKdTree->GetBox(mKdTree->GetRoot()); 896 897 return GetArea(viewCell) / box.SurfaceArea(); 898 //return GetArea(viewCell) / GetTotalArea(); 907 899 } 908 900 … … 1161 1153 } 1162 1154 1163 float VspKdViewCellsManager::GetProbability(ViewCell *viewCell) const 1164 { 1165 /* AxisAlignedBox3 box = mKdTree->GetBox(*it); 1166 1155 float VspKdViewCellsManager::GetProbability(ViewCell *viewCell) 1156 { 1167 1157 // volume or area substitutes for view point probability 1168 if (0) 1169 return box.GetVolume(); 1170 else 1171 return box.SurfaceArea(); 1172 */ 1173 return dynamic_cast<VspKdViewCell *>(viewCell)->GetVolume(); 1158 AxisAlignedBox3 box = mVspKdTree->GetBBox(mVspKdTree->GetRoot()); 1159 1160 return GetArea(viewCell) / box.SurfaceArea(); 1161 //return GetArea(viewCell) / GetTotalArea(); 1174 1162 } 1175 1163 … … 1389 1377 } 1390 1378 1391 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) const 1392 { 1393 PolygonContainer geom; 1394 1395 // compute view cell area 1396 mVspBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(viewCell), geom); 1397 1398 const float area = Polygon3::GetArea(geom); 1399 const float accArea = mVspBspTree->GetBoundingBox().SurfaceArea(); 1400 1401 CLEAR_CONTAINER(geom); 1402 1403 return area / accArea; 1379 float VspBspViewCellsManager::GetProbability(ViewCell *viewCell) 1380 { 1381 return GetArea(viewCell) / mVspBspTree->GetBoundingBox().SurfaceArea(); 1382 //return GetArea(viewCell) / GetTotalArea(); 1404 1383 } 1405 1384 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r470 r471 172 172 /** Returns probability that view point lies in one view cell. 173 173 */ 174 virtual float GetProbability(ViewCell *viewCell) const= 0;174 virtual float GetProbability(ViewCell *viewCell) = 0; 175 175 176 176 /** Returns render cost of a single view cell given the render cost of an object. … … 261 261 ViewCellContainer &viewcells); 262 262 263 float GetProbability(ViewCell *viewCell) const;263 float GetProbability(ViewCell *viewCell); 264 264 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 265 265 … … 327 327 virtual void PrintStatistics(ostream &s) const; 328 328 329 float GetProbability(ViewCell *viewCell) const;329 float GetProbability(ViewCell *viewCell); 330 330 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 331 331 … … 377 377 ViewCellContainer &viewcells); 378 378 379 float GetProbability(ViewCell *viewCell) const;379 float GetProbability(ViewCell *viewCell); 380 380 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 381 381 … … 421 421 ViewCellContainer &viewcells); 422 422 423 float GetProbability(ViewCell *viewCell) const;423 float GetProbability(ViewCell *viewCell); 424 424 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 425 425 -
trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp
r470 r471 2163 2163 2164 2164 //Debug << mMinViewCells << " " << mMaxCostRatio << endl; 2165 2165 2166 // use priority queue to merge leaves 2166 2167 while (!mergeQueue.empty() &&
Note: See TracChangeset
for help on using the changeset viewer.