Changeset 1585 for GTP/trunk/Lib
- Timestamp:
- 10/09/06 15:10:29 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1581 r1585 12 12 #include "Triangle3.h" 13 13 #include "IntersectableWrapper.h" 14 #include "BvHierarchy.h" 14 15 15 16 //#include <Cg/cg.h> … … 126 127 RenderTriangle(dynamic_cast<TriangleIntersectable *>(object)); 127 128 break; 129 case Intersectable::BVH_INTERSECTABLE: { 130 131 BvhNode *node = (dynamic_cast<BvhIntersectable *>(object))->GetItem(); 132 // RenderBvhNode(node); 133 RenderBox(node->GetBoundingBox()); 134 break; 135 } 136 128 137 default: 129 138 cerr<<"Rendering this object not yet implemented\n"; … … 564 573 565 574 566 } 575 void 576 GlRenderer::RenderBox(const AxisAlignedBox3 &box) 577 { 578 579 glBegin(GL_LINE_LOOP); 580 glVertex3d(box.Min().x, box.Max().y, box.Min().z ); 581 glVertex3d(box.Max().x, box.Max().y, box.Min().z ); 582 glVertex3d(box.Max().x, box.Min().y, box.Min().z ); 583 glVertex3d(box.Min().x, box.Min().y, box.Min().z ); 584 glEnd(); 585 586 glBegin(GL_LINE_LOOP); 587 glVertex3d(box.Min().x, box.Min().y, box.Max().z ); 588 glVertex3d(box.Max().x, box.Min().y, box.Max().z ); 589 glVertex3d(box.Max().x, box.Max().y, box.Max().z ); 590 glVertex3d(box.Min().x, box.Max().y, box.Max().z ); 591 glEnd(); 592 593 glBegin(GL_LINE_LOOP); 594 glVertex3d(box.Max().x, box.Min().y, box.Min().z ); 595 glVertex3d(box.Max().x, box.Min().y, box.Max().z ); 596 glVertex3d(box.Max().x, box.Max().y, box.Max().z ); 597 glVertex3d(box.Max().x, box.Max().y, box.Min().z ); 598 glEnd(); 599 600 glBegin(GL_LINE_LOOP); 601 glVertex3d(box.Min().x, box.Min().y, box.Min().z ); 602 glVertex3d(box.Min().x, box.Min().y, box.Max().z ); 603 glVertex3d(box.Min().x, box.Max().y, box.Max().z ); 604 glVertex3d(box.Min().x, box.Max().y, box.Min().z ); 605 glEnd(); 606 607 glBegin(GL_LINE_LOOP); 608 glVertex3d(box.Min().x, box.Min().y, box.Min().z ); 609 glVertex3d(box.Max().x, box.Min().y, box.Min().z ); 610 glVertex3d(box.Max().x, box.Min().y, box.Max().z ); 611 glVertex3d(box.Min().x, box.Min().y, box.Max().z ); 612 glEnd(); 613 614 glBegin(GL_LINE_LOOP); 615 glVertex3d(box.Min().x, box.Max().y, box.Min().z ); 616 glVertex3d(box.Max().x, box.Max().y, box.Min().z ); 617 glVertex3d(box.Max().x, box.Max().y, box.Max().z ); 618 glVertex3d(box.Min().x, box.Max().y, box.Max().z ); 619 620 glEnd(); 621 622 } 623 624 void 625 GlRenderer::RenderBvhNode(BvhNode *node) 626 { 627 if (node->IsLeaf()) { 628 BvhLeaf *leaf = (BvhLeaf *) node; 629 for (int i=0; i < mObjects.size(); i++) 630 RenderIntersectable(mObjects[i]); 631 } else { 632 BvhInterior *in = (BvhInterior *)node; 633 RenderBvhNode(in->GetBack()); 634 RenderBvhNode(in->GetFront()); 635 } 636 637 } 638 639 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1581 r1585 25 25 class TransformedMeshInstance; 26 26 class TriangleIntersectable; 27 27 class BvhNode; 28 28 29 struct VssRayContainer; 29 30 … … 107 108 RenderTriangle(TriangleIntersectable *object); 108 109 110 void 111 RenderBox(const AxisAlignedBox3 &box); 112 113 void 114 RenderBvhNode(BvhNode *node); 115 109 116 bool 110 117 RenderScene(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1581 r1585 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: so 7. X 21:56:3020063 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 8. X 23:47:35 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1584 r1585 426 426 Environment::GetSingleton()->GetBoolValue("ViewCells.loadFromFile", mLoadViewCells); 427 427 char buf[100]; 428 428 429 429 if (mLoadViewCells) 430 430 { … … 902 902 } 903 903 if (i % 10000 == 0) 904 cout<< ".";904 cout<<i<<"/"<<rays.size()<<"\r"; 905 905 } 906 906 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1584 r1585 942 942 glMatrixMode(GL_PROJECTION); 943 943 glLoadIdentity(); 944 gluPerspective(angle, ww/(float)hh, 1.0f, 40.0f);944 gluPerspective(angle, ww/(float)hh, 0.1f, 1000.0f); 945 945 glMatrixMode(GL_MODELVIEW); 946 946 } … … 1219 1219 } 1220 1220 1221 RenderInfo();1222 1221 } 1223 1222 … … 1250 1249 if (mShowRenderCost) 1251 1250 RenderRenderCost(); 1251 1252 RenderInfo(); 1252 1253 } 1253 1254 mFrame++; … … 1421 1422 for (int i=0; i < costFunction.size(); i++) { 1422 1423 // cout<<i<<":"<<costFunction[i]<<" "; 1424 // update cost function to an absolute value based on the total geometry count 1425 costFunction[i]*=mSceneGraph->GetRoot()->mGeometry.size(); 1423 1426 if (costFunction[i] > maxCost) 1424 1427 maxCost = costFunction[i]; … … 1433 1436 if (currentPos < costFunction.size()) 1434 1437 currentCost = costFunction[currentPos]; 1435 #if 01438 #if 1 1436 1439 cout<<"costFunction.size()="<<costFunction.size()<<endl; 1437 1440 cout<<"CP="<<currentPos<<endl; … … 1440 1443 #endif 1441 1444 if (costFunction.size()) { 1445 float scaley = 1.0f/log10(maxCost); 1446 float scalex = 1.0f/(float)costFunction.size(); 1447 1442 1448 glDisable(GL_DEPTH_TEST); 1443 1449 // init ortographic projection 1444 1450 glMatrixMode(GL_PROJECTION); 1445 1446 1451 1447 1452 glPushMatrix(); 1448 1453 … … 1460 1465 1461 1466 for (int i=0; i < costFunction.size(); i++) { 1462 float x = i /(float)costFunction.size();1463 float y = costFunction[i]/(maxCost*0.5f);1467 float x = i*scalex; 1468 float y = log10(costFunction[i])*scaley; 1464 1469 glVertex3f(x,y,0.0f); 1465 1470 } … … 1468 1473 glColor3f(1.0f,0,0); 1469 1474 glBegin(GL_LINES); 1470 float x = currentPos /(float)costFunction.size();1475 float x = currentPos*scalex; 1471 1476 glVertex3f(x,0.0,0.0f); 1472 1477 glVertex3f(x,1.0f,0.0f); … … 1483 1488 1484 1489 glBegin(GL_LINES); 1485 for (int i=0; i < 50000 && i < costFunction.size(); i+=10000) {1486 float x = i /(float)costFunction.size();1490 for (int i=0; i < costFunction.size(); i += 1000) { 1491 float x = i*scalex; 1487 1492 glVertex3f(x,0.0,0.0f); 1488 1493 glVertex3f(x,1.0f,0.0f); 1489 1494 } 1490 1495 1491 for (int i=0; i < maxCost; i+=100) { 1492 float y = i/(maxCost*0.5f); 1493 glVertex3f(0,y,0.0f); 1494 glVertex3f(1,y,0.0f); 1496 for (int i=0; pow(10, i) < maxCost; i+=1) { 1497 float y = i*scaley; 1498 // QString s; 1499 // s.sprintf("%d", (int)pow(10,i)); 1500 // renderText(width()/2+5, y*height(), s); 1501 glVertex3f(0.0f, y, 0.0f); 1502 glVertex3f(1.0f, y, 0.0f); 1495 1503 } 1496 1504 … … 1513 1521 QtGlRendererWidget::RenderInfo() 1514 1522 { 1523 1524 // $$JB temporal hack for two windows separation 1525 if (1) { 1526 1527 // model view 1528 glPushMatrix(); 1529 glLoadIdentity(); 1530 1531 // init ortographic projection 1532 glMatrixMode(GL_PROJECTION); 1533 glPushMatrix(); 1534 1535 glLoadIdentity(); 1536 gluOrtho2D(0, 1.0f, 0, 1.0f); 1537 1538 float w = 0.01f; 1539 float h = 1.0f; 1540 float px = 0.0f; 1541 float py = 0.0f; 1542 1543 glColor3f(0.8f, 0.8f, 0.8f); 1544 glBegin(GL_QUADS); 1545 1546 glVertex3f(px+w, py, 0); 1547 glVertex3f(px+w, py+h + w, 0); 1548 glVertex3f(px, py+h, 0); 1549 glVertex3f(px, py, 0); 1550 glEnd(); 1551 1552 // projection 1553 glPopMatrix(); 1554 1555 glMatrixMode(GL_MODELVIEW); 1556 // model view 1557 glPopMatrix(); 1558 } 1559 1560 1515 1561 QString s; 1516 1562 int vc = 0; … … 1521 1567 filter = mViewCellsManager->GetMaxFilterSize(); 1522 1568 1523 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f) viewcells:%04d filter:%04d pvs:%04d error:%5.5f\%", 1569 glColor3f(1.0f,1.0f,1.0f); 1570 1571 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)", 1524 1572 mFrame, 1525 1573 mViewPoint.x, … … 1528 1576 mViewDirection.x, 1529 1577 mViewDirection.y, 1530 mViewDirection.z, 1578 mViewDirection.z 1579 ); 1580 1581 renderText(20,20,s); 1582 1583 s.sprintf("viewcells:%04d filter:%04d pvs:%04d error:%5.5f\%", 1531 1584 vc, 1532 1533 1585 filter, 1534 1586 mPvsSize, 1535 mRenderError*100.0f 1536 ); 1537 1538 glColor3f(0.0f,0.0f,0.0f); 1539 renderText(0,20,s); 1587 mRenderError*100.0f); 1588 1589 1590 renderText(20,40,s); 1591 1592 1593 1540 1594 1541 1595 } -
GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
r1583 r1585 427 427 428 428 if (mUseImportanceSampling) { 429 GenerateRays(mInitialSamples/ 3, SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays);430 GenerateRays(mInitialSamples/3, SamplingStrategy::OBJECT_BASED_DISTRIBUTION, rays);431 GenerateRays(mInitialSamples/ 3, SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays);429 GenerateRays(mInitialSamples/2, SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION, rays); 430 // GenerateRays(mInitialSamples/3, SamplingStrategy::OBJECT_BASED_DISTRIBUTION, rays); 431 GenerateRays(mInitialSamples/2, SamplingStrategy::DIRECTION_BASED_DISTRIBUTION, rays); 432 432 // GenerateRays(mInitialSamples/4, OBJECT_DIRECTION_BASED_DISTRIBUTION, rays); 433 433 } else { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1570 r1585 2163 2163 ViewCellsTree::GetCostFunction(vector<float> &costFunction) 2164 2164 { 2165 2166 2167 2168 2169 { 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2165 TraversalQueue tqueue; 2166 tqueue.push(mRoot); 2167 2168 while (!tqueue.empty()) 2169 { 2170 ViewCell *vc = tqueue.top(); 2171 tqueue.pop(); 2172 // save the view cells if it is a leaf or if enough view cells have already been traversed 2173 // because of the priority queue, this will be the optimal set of v 2174 if (!vc->IsLeaf()) { 2175 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 2176 costFunction.push_back(interior->GetMergeCost()); 2177 2178 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 2179 2180 for (it = interior->mChildren.begin(); it != it_end; ++ it) { 2181 tqueue.push(*it); 2182 } 2183 2184 } 2185 2185 } 2186 2186 } -
GTP/trunk/Lib/Vis/Preprocessing/src/default.env
r1584 r1585 6 6 Scene { 7 7 8 # filename ../data/City4M/City4M.obj9 #filename ../data/CityModel/CityModel.obj8 # filename ../data/City4M/City4M.obj 9 filename ../data/CityModel/CityModel.obj 10 10 # filename ../data/GrandCanyon/grandcanyon1_RotXmin90.obj 11 11 # filename ../data/glasgow/glasgow1.x3d … … 14 14 # filename ../data/vienna/vienna-buildings.x3d 15 15 # filename ../data/vienna/city1500_flat_1.x3d 16 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 17 #;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 16 filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 17 18 # ../data/vienna/vienna-plane.x3d; 18 19 # filename ../data/vienna/viewcells-25-sel.x3d 19 20 #filename ../data/atlanta/atlanta2.x3d … … 53 54 visibilityFilterWidth 0.01 54 55 visibilityFile visibility.xml 55 loadMeshes true56 loadMeshes false 56 57 loadKdTree false 57 58 exportKdTree false … … 59 60 60 61 ObjParser { 61 meshGrouping 162 meshGrouping 2 62 63 } 63 64 … … 144 145 minCost 0.95 145 146 maxDepth 30 146 maxCostRatio 1.0147 maxCostRatio 0.98 147 148 ct_div_ci 0.5 148 149 maxNodes 100000 149 #200000150 150 #500000 151 151 } … … 194 194 #type vspKdTree 195 195 #type bspTree 196 type vspBspTree 196 # type vspBspTree 197 type vspOspTree 197 198 #type sceneDependent 198 199 … … 277 278 # filename ../data/vienna/vienna-viewcells-5000.xml 278 279 # filename ../data/vienna/vienna-viewcells-1000.xml.zip 279 280 filename ../data/vienna/vsposp-seq-viewCells.xml.gz 280 281 281 282 # filename ../data/PowerPlant/power_plant_viewcells1.xml … … 339 340 missTolerance 6 340 341 globalCostMissTolerance 4 341 #minGlobalCostRatio 0.0000001342 minGlobalCostRatio 0.0001343 # $$ MAX342 minGlobalCostRatio 0.0000001 343 # minGlobalCostRatio 0.0001 344 # $$MAXVIEWCELLS 344 345 maxViewCells 5000 345 346
Note: See TracChangeset
for help on using the changeset viewer.