Changeset 2615 for GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Timestamp:
- 01/19/08 05:28:24 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2614 r2615 88 88 KdTree *tree): 89 89 QGLPixelBuffer(QSize(w, h)), 90 //QGLWidget(NULL, w, h),91 90 GlRendererBuffer(sceneGraph, viewcells, tree) 92 91 { … … 380 379 glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 381 380 glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 382 381 #if DYNAMIC_OBJECTS_HACK 383 382 // handle dynamic objects 384 383 DynamicObjectsContainer::const_iterator dit, dit_end = mDynamicObjects.end(); 385 384 385 386 386 for (dit = mDynamicObjects.begin(); dit != dit_end; ++ dit) 387 387 { 388 #if USE_TRANSFORMED_MESH_INSTANCE_HACK 388 389 //cerr << "here45\n****"<<endl; 389 390 RenderIntersectable(*dit); 390 } 391 #else 392 RenderDynamicObject(*dit); 393 #endif 394 } 395 #endif 391 396 } 392 397 … … 400 405 401 406 mPvsSize = mPvsCache.mPvs.GetSize(); 402 407 #if DYNAMIC_OBJECTS_HACK 403 408 mDynamicObjects.clear(); 404 409 #endif 405 410 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 406 411 … … 416 421 } 417 422 break; 423 #if DYNAMIC_OBJECTS_HACK 424 #if USE_TRANSFORMED_MESH_INSTANCE_HACK 425 418 426 case Intersectable::TRANSFORMED_MESH_INSTANCE: 419 427 mDynamicObjects.push_back(static_cast<TransformedMeshInstance *>(obj)); 420 428 break; 429 430 #else 431 case Intersectable::SCENEGRAPHLEAF_INTERSECTABLE: 432 mDynamicObjects.push_back(static_cast<SceneGraphLeafIntersectable *>(obj)->GetItem()); 433 break; 434 #endif 435 #endif 421 436 default: 422 437 cerr << "PreparePvs: type " << Intersectable::GetTypeName(obj) << " not handled yet" << endl; … … 513 528 //mPvsCache.mPvs = pvs; 514 529 //mMutex.unlock(); 530 cout << "pvs size: " << mPvsCache.mPvs.GetSize() << endl; 515 531 } 516 532 else … … 667 683 mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY / 2.0; 668 684 } 685 #if DYNAMIC_OBJECTS_HACK 669 686 else if (e->modifiers() & Qt::AltModifier) 670 687 { … … 673 690 Matrix4x4 tm; 674 691 TransformedMeshInstance *tmi; 692 #if USE_TRANSFORMED_MESH_INSTANCE_HACK 675 693 676 694 switch (mTrafoType) … … 703 721 704 722 tmi->ApplyWorldTransform(tm); 723 #endif 705 724 updateGL(); 706 725 } 707 726 } 727 #endif 708 728 else 709 729 { … … 1001 1021 connect(mControlWidget, SIGNAL(SetScale(bool)), this, SLOT(SetScale(bool))); 1002 1022 1003 // setting the size here 1004 resize(800, 600); 1023 setWindowTitle("PVS Visualization"); 1024 1025 // setting the main window size here 1026 //resize(800, 600); 1027 //resize(640, 480); 1028 //resize(512, 384); 1029 //resize(512, 320); 1030 resize(640, 400); 1031 1005 1032 mControlWidget->show(); 1006 1033 } … … 1309 1336 while (pit.HasMoreEntries()) 1310 1337 { 1338 KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 1339 1311 1340 if (mShowDistanceWeightedPvs) 1312 1341 { 1313 KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());1314 1342 const AxisAlignedBox3 box = kdObj->GetBox(); 1315 1343 … … 1319 1347 else if (mShowDistanceWeightedTriangles) 1320 1348 { 1321 KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());1322 1349 const AxisAlignedBox3 box = kdObj->GetBox(); 1323 1350 … … 1327 1354 else //if (mShowWeightedTriangles) 1328 1355 { 1329 KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next());1330 1356 renderCost += kdObj->ComputeNumTriangles(); 1331 1357 } … … 1436 1462 1437 1463 ComputeMaxValues(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 1438 1464 // matt: temp hack 1465 //maxRcCost = 200.0f; 1466 //cout << "maxRcCost: " << maxRcCost << endl; 1439 1467 int i; 1440 1468 … … 1488 1516 else // using specialised colors 1489 1517 { 1490 1491 1492 1518 if (!mShowComparison) 1493 1519 AssignImportanceByRelativeValue(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); … … 1557 1583 importance = rcCost / maxRcCost; 1558 1584 } 1559 1585 if (importance > 1.0f) importance = 1.0f; 1560 1586 // c = RgbColor(importance, 1.0f - importance, 0.0f); 1561 1587 c = RainbowColorMapping(importance); … … 1658 1684 connect(rb5, SIGNAL(toggled(bool)), SIGNAL(SetShowWeightedCost(bool))); 1659 1685 1660 QGroupBox *groupBox = new QGroupBox(" Visualization options");1686 QGroupBox *groupBox = new QGroupBox("PVS Visualization"); 1661 1687 1662 1688 QVBoxLayout *vbox2 = new QVBoxLayout; … … 1771 1797 1772 1798 1773 QGroupBox *groupBox = new QGroupBox("Ray visualization options");1799 QGroupBox *groupBox = new QGroupBox("Ray visualization"); 1774 1800 QVBoxLayout *vbox2 = new QVBoxLayout; 1775 1801 … … 1816 1842 QVBoxLayout *vl = new QVBoxLayout; 1817 1843 setLayout(vl); 1818 1819 QWidget *vbox = new QGroupBox("ViewCells", this); 1820 layout()->addWidget(vbox); 1821 1822 vl = new QVBoxLayout; 1823 vbox->setLayout(vl); 1844 1845 //QWidget *vbox; 1846 1847 //vbox = new QGroupBox("Render Controls", this); 1848 //layout()->addWidget(vbox); 1849 //vl = new QVBoxLayout; 1850 //vbox->setLayout(vl); 1824 1851 1825 1852 QLabel *label; … … 1830 1857 1831 1858 label = new QLabel("Granularity"); 1832 vbox->layout()->addWidget(label); 1859 //vbox->layout()->addWidget(label); 1860 vl->addWidget(label); 1833 1861 1834 1862 slider = new QSlider(Qt::Horizontal, vbox); … … 1844 1872 1845 1873 label = new QLabel("Transfer function"); 1846 v box->layout()->addWidget(label);1874 vl->addWidget(label); 1847 1875 1848 1876 slider = new QSlider(Qt::Horizontal, vbox); … … 1859 1887 1860 1888 button = new QPushButton("Update all PVSs", vbox); 1861 v box->layout()->addWidget(button);1889 vl->addWidget(button); 1862 1890 connect(button, SIGNAL(clicked()), SLOT(UpdateAllPvs())); 1863 1891 … … 1865 1893 1866 1894 label = new QLabel("Filter size"); 1867 v box->layout()->addWidget(label);1895 vl->addWidget(label); 1868 1896 1869 1897 slider = new QSlider(Qt::Horizontal, vbox); 1870 v box->layout()->addWidget(slider);1898 vl->addWidget(slider); 1871 1899 slider->show(); 1872 1900 slider->setRange(1, 100); … … 1879 1907 1880 1908 1881 ////////////////////////////////////////// 1882 1883 label = new QLabel("Spatial Filter size"); 1884 vbox->layout()->addWidget(label); 1885 1886 slider = new QSlider(Qt::Horizontal, vbox); 1887 vbox->layout()->addWidget(slider); 1888 slider->show(); 1889 slider->setRange(1, 100); 1890 slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 1891 slider->setValue(10); 1892 1893 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetSpatialFilterSize(int))); 1894 1895 1909 1896 1910 /////////////////////////////////// 1897 1911 1898 1912 1899 QWidget *hbox = new QWidget( vbox);1913 QWidget *hbox = new QWidget();//vbox); 1900 1914 vl->addWidget(hbox); 1901 1915 QHBoxLayout *hlayout = new QHBoxLayout; … … 1906 1920 cb->setChecked(false); 1907 1921 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowViewCells(bool))); 1908 1922 1923 cb = new QCheckBox("Render errors", hbox); 1924 hlayout->layout()->addWidget(cb); 1925 cb->setChecked(false); 1926 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 1927 1928 #if REMOVE_TEMPORARY 1909 1929 cb = new QCheckBox("Render cost curve", hbox); 1910 1930 hlayout->addWidget(cb); 1911 1931 cb->setChecked(false); 1912 1932 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRenderCost(bool))); 1913 1933 #endif 1914 1934 cb = new QCheckBox("Show rays", hbox); 1915 1935 hlayout->addWidget(cb); 1916 1936 cb->setChecked(false); 1917 1937 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 1918 1938 #if REMOVE_TEMPORARY 1919 1939 cb = new QCheckBox("Show Comparison", hbox); 1920 1940 hlayout->addWidget(cb); 1921 1941 cb->setChecked(false); 1922 1942 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowComparison(bool))); 1923 1943 #endif 1924 1944 1925 1945 ////////////////// … … 1934 1954 QGroupBox *groupBox = CreateVisualizationPanel(hbox); 1935 1955 vh->addWidget(groupBox, 0, 0); 1936 1956 #if REMOVE_TEMPORARY 1937 1957 QGroupBox *groupBox2 = CreateRenderCostPanel(hbox); 1938 1958 vh->addWidget(groupBox2, 0, 0); 1939 1959 #endif 1940 1960 QGroupBox *groupBox3 = CreateRayVisualizationPanel(hbox); 1941 1961 vh->addWidget(groupBox3, 0, 0); … … 1948 1968 1949 1969 /*cb = new QRadiobox("Top View", vbox); 1950 v box->layout()->addWidget(cb);1970 vl->addWidget(cb); 1951 1971 cb->setChecked(false); 1952 1972 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetTopView(bool))); 1953 1973 */ 1954 1974 1955 vbox->resize(800,150); 1975 //vbox->resize(800,150); 1976 QWidget *vbox; 1956 1977 1957 1978 vbox = new QGroupBox("Rendering", this); … … 2022 2043 2023 2044 /////////////////////////////////////////// 2024 2045 #if REMOVE_TEMPORARY 2025 2046 cb = new QCheckBox("Transparency", vbox); 2026 2047 vbox->layout()->addWidget(cb); … … 2038 2059 slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 2039 2060 slider->setValue(0); 2040 2061 #endif 2041 2062 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetTransparency(int))); 2042 2063 … … 2048 2069 cb->setChecked(false); 2049 2070 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetCutScene(bool))); 2050 #endif 2071 2051 2072 cb = new QCheckBox("Render boxes", vbox); 2052 2073 vbox->layout()->addWidget(cb); … … 2058 2079 cb->setChecked(false); 2059 2080 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderVisibilityEstimates(bool))); 2060 2061 2062 cb = new QCheckBox("Render errors", vbox); 2063 vbox->layout()->addWidget(cb); 2064 cb->setChecked(false); 2065 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderErrors(bool))); 2081 #endif 2066 2082 2067 2083 bool tmp; … … 2081 2097 cb->setChecked(tmp); 2082 2098 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetUseSpatialFilter(bool))); 2083 2099 #if REMOVE_TEMPORARY 2084 2100 cb = new QCheckBox("Render filter", vbox); 2085 2101 vbox->layout()->addWidget(cb); … … 2113 2129 vbox->layout()->addWidget(button); 2114 2130 connect(button, SIGNAL(clicked()), SIGNAL(LoadObject())); 2115 2131 #endif 2116 2132 /*cb = new QCheckBox("Stats", vbox); 2117 2133 vbox->layout()->addWidget(cb); … … 2142 2158 //connect(button, SIGNAL(clicked(void)), SLOT(StoreStatistics(void))); 2143 2159 //mHidingCost = 0.1f; 2160 ////////////////////////////////////////// 2161 2162 label = new QLabel("Spatial Filter size"); 2163 vbox->layout()->addWidget(label); 2164 2165 slider = new QSlider(Qt::Horizontal, vbox); 2166 vbox->layout()->addWidget(slider); 2167 slider->show(); 2168 slider->setRange(1, 100); 2169 slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 2170 slider->setValue(10); 2171 2172 connect(slider, SIGNAL(valueChanged(int)), SIGNAL(SetSpatialFilterSize(int))); 2173 2144 2174 2145 2175 setWindowTitle("Preprocessor Control Widget"); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2614 r2615 232 232 233 233 bool mUseRandomColorPerPvsObject; 234 234 #if DYNAMIC_OBJECTS_HACK 235 235 DynamicObjectsContainer mDynamicObjects; 236 236 #endif 237 237 QtGlRendererWidget(SceneGraph *sceneGraph, 238 238 ViewCellsManager *viewcells, -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2614 r2615 31 31 mModelMatrix = IdentityMatrix(); 32 32 33 //setWindowTitle("PVS visualization"); 34 setWindowTitle("Global View Cell Visualization"); 35 33 36 trackball(manipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f); 34 37 //connect(renderer, SIGNAL(PvsUpdated()), this, SLOT(updateGL())); … … 46 49 QSize QtGlViewer::sizeHint() const 47 50 { 48 return QSize(640, 480); 51 // set viewer size here 52 return QSize(512, 320); 53 54 //return QSize(512, 384); 55 //return QSize(640, 480); 49 56 } 50 57 … … 228 235 { 229 236 switch (e->key()) { 237 case Qt::Key_V: 238 mRenderer->mRenderViewCells = !mRenderer->mRenderViewCells; 239 updateGL(); 240 break; 241 230 242 case Qt::Key_W: 231 243 mWireframe = !mWireframe; 232 244 updateGL(); 245 break; 246 233 247 default: 234 248 e->ignore();
Note: See TracChangeset
for help on using the changeset viewer.