Changeset 268 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
- Timestamp:
- 09/14/05 18:32:40 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r267 r268 33 33 const int FACTOR_LEAST_SPLITS = 1; 34 34 35 int counter = 0; 36 bool BspTree::displayDebug = false; 35 37 /****************************************************************/ 36 38 /* class BspNode implementation */ 37 39 /****************************************************************/ 38 40 39 BspNode::BspNode(): mParent(NULL), mPolygons(NULL) 41 BspNode::BspNode(): mParent(NULL), mPolygons(NULL),mViewCellIdx(0) 40 42 {} 41 43 42 BspNode::BspNode(BspInterior *parent): mParent(parent), mPolygons(NULL) 44 BspNode::BspNode(BspInterior *parent): mParent(parent), mPolygons(NULL),mViewCellIdx(0) 43 45 {} 44 46 … … 147 149 int &splits, bool storePolys) 148 150 { 149 #ifdef _Debug 151 //#ifdef _Debug 152 if (BspTree::displayDebug) 150 153 Debug << "Splitting polygons of node " << this << " with plane " << mPlane << endl; 151 #endif154 //#endif 152 155 bool inside = false; 153 156 … … 157 160 polys->pop_back(); 158 161 162 if (BspTree::displayDebug) Debug << "New polygon with plane: " << poly->GetSupportingPlane() << "\n"; 163 159 164 // test if split is neccessary 160 165 int classification = poly->ClassifyPlane(mPlane); … … 162 167 Polygon3 *front_piece = NULL; 163 168 Polygon3 *back_piece = NULL; 164 169 165 170 switch (classification) 166 171 { … … 170 175 // same surface normal 171 176 inside = (DotProd(mPlane.mNormal, poly->GetSupportingPlane().mNormal) > 0); 172 173 //Debug << "coincident" << endl;177 if (BspTree::displayDebug) 178 Debug << "coincident" << endl; 174 179 // discard polygons or saves them in node 175 180 ProcessPolygon(poly, storePolys); 176 181 break; 177 case Polygon3::FRONT_SIDE: 178 //Debug << "front" << endl;182 case Polygon3::FRONT_SIDE: if (BspTree::displayDebug) 183 Debug << "front" << endl; 179 184 frontPolys->push_back(poly); 180 185 break; 181 186 case Polygon3::BACK_SIDE: 182 inside = true; 183 //Debug << "back" << endl;187 inside = true; if (BspTree::displayDebug) 188 Debug << "back" << endl; 184 189 backPolys->push_back(poly); 185 190 break; 186 191 case Polygon3::SPLIT: 187 inside = true; 188 //Debug << "split " << poly << endl; 192 inside = true; 189 193 190 194 front_piece = new Polygon3(); … … 197 201 backPolys->push_back(back_piece); 198 202 199 #ifdef _DEBUG200 Debug << "split " << *poly << endl << *front_piece << endl << *back_piece << endl;201 #endif203 //#ifdef _DEBUG 204 if (BspTree::displayDebug)Debug << "split " << *poly << endl << *front_piece << endl << *back_piece << endl; 205 //#endif 202 206 // save or discard polygons 203 207 ProcessPolygon(poly, storePolys); … … 258 262 mRoot(NULL), 259 263 mIsIncremential(false), 260 mStorePolys( false)264 mStorePolys(true) 261 265 { 262 266 Randomize(); // initialise random generator for heuristics … … 440 444 Polygon3 *poly = new Polygon3((*fi), mesh); 441 445 polys.push_back(poly); 446 if (displayDebug) 447 Debug << *poly << endl; 442 448 polysNum ++; 443 449 } … … 531 537 532 538 long startTime = GetTime(); 533 534 intcounter = 0;539 displayDebug = true; 540 counter = 0; 535 541 Debug << "**** Starting view cell insertion ****" << endl; 536 542 for (it = viewCells.begin(); it != viewCells.end(); ++ it) 537 543 { 538 Debug << "** inserting view cell " << counter ++ << " **" << endl; 539 InsertViewCell(*it); 544 if ((counter == 12) || (counter == 14)) 545 {Debug << "** inserting view cell " << counter << " **" << endl; 546 InsertViewCell(*it);} 547 counter ++; 540 548 } 541 549 … … 609 617 { 610 618 //#ifdef _DEBUG 611 Debug << "subdivision terminated at depth " << tData.mDepth << ", #polys: " << (int)tData.mPolygons->size() << endl; 619 if (displayDebug) 620 Debug << "subdivision terminated at depth " << tData.mDepth << ", #polys: " << (int)tData.mPolygons->size() << endl; 612 621 //#endif 613 622 … … 620 629 621 630 if (leaf->GetViewCell()) 622 Debug << "ERROR: leaf already has view cell" << endl; 623 631 Debug << "ERROR: leaf already has view cell " << leaf->mViewCellIdx << endl; 632 633 leaf->mViewCellIdx = counter; 624 634 Debug << "insert view cell" << endl; 625 635 leaf->SetViewCell(viewCell);
Note: See TracChangeset
for help on using the changeset viewer.