Changeset 1832 for GTP/trunk/Lib
- Timestamp:
- 11/30/06 16:17:35 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1824 r1832 154 154 inline void SetSnapPrefix(const string &pref) { mSnapPrefix = pref; } 155 155 156 public: 157 int mFrame; 158 bool mWireFrame; 159 156 160 protected: 157 161 … … 171 175 HaltonSequence halton; 172 176 173 int mFrame;174 bool mWireFrame;175 177 176 178 bool mDetectEmptyViewSpace; -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r1824 r1832 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: út 28. XI 19:46:0620063 # Generated by qmake (2.00a) (Qt 4.1.2) on: ?t 30. XI 15:32:50 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.cpp
r1824 r1832 27 27 28 28 29 #define CAMERA_VIEW_WIDTH 0.5f30 29 31 30 class ViewCellsManager; … … 305 304 { 306 305 if (!mTopView) { 307 int ww = w *CAMERA_VIEW_WIDTH;306 int ww = w; 308 307 int hh = h; 309 308 glViewport(0, 0, ww, hh); … … 313 312 glMatrixMode(GL_MODELVIEW); 314 313 } else { 315 int ww = w *CAMERA_VIEW_WIDTH;314 int ww = w; 316 315 int hh = h; 317 316 glViewport(0, 0, ww, hh); … … 323 322 } 324 323 325 void326 QtGlRendererWidget::SetupManipulatorProjection(const int w, const int h, const float angle)327 {328 int ww = w*(1.0f - CAMERA_VIEW_WIDTH);329 int hh = h;330 glViewport(w - ww, 0, ww, hh);331 glMatrixMode(GL_PROJECTION);332 glLoadIdentity();333 gluPerspective(angle, ww/(float)hh, 0.1f, 1000.0f);334 glMatrixMode(GL_MODELVIEW);335 }336 324 337 325 … … 380 368 #endif 381 369 } else 382 pvs = viewcell->GetPvs(); 370 pvs = viewcell->GetPvs(); 371 372 emit PvsUpdated(); 383 373 } 384 374 … … 584 574 int diffy = -(mousePoint.y - y); 585 575 586 if (x < width()*CAMERA_VIEW_WIDTH) { 587 if (e->modifiers() & Qt::ControlModifier) { 588 mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0; 589 mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0; 590 } else { 591 mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY); 592 float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY; 593 float angle = atan2(mViewDirection.x, mViewDirection.z); 594 mViewDirection.x = sin(angle+adiff); 595 mViewDirection.z = cos(angle+adiff); 596 } 576 if (e->modifiers() & Qt::ControlModifier) { 577 mViewPoint.y += (y-mousePoint.y)*MOVE_SENSITIVITY/2.0; 578 mViewPoint.x += (x-mousePoint.x)*MOVE_SENSITIVITY/2.0; 597 579 } else { 598 float W = width()*(1.0f-CAMERA_VIEW_WIDTH); 599 float H = height(); 600 int xx = x - width()*CAMERA_VIEW_WIDTH; 601 int mxx = mousePoint.x - width()*CAMERA_VIEW_WIDTH; 602 if (e->modifiers() & Qt::ControlModifier) { 603 mManipulatorScale = mManipulatorScale * (1.0 + (((float) (-diffy)) / H)); 604 } else { 605 float quat[4]; 606 trackball(quat, 607 (2.0 * mxx - W) / W, 608 (H - 2.0 * mousePoint.y) / H, 609 (2.0 * xx - W) / W, 610 (H - 2.0 * y) / H 611 ); 612 add_quats(quat, mManipulatorLastQuat, mManipulatorLastQuat); 613 } 580 mViewPoint += mViewDirection*((mousePoint.y - y)*MOVE_SENSITIVITY); 581 float adiff = TURN_ANGLE*(x - mousePoint.x)*-TURN_SENSITIVITY; 582 float angle = atan2(mViewDirection.x, mViewDirection.z); 583 mViewDirection.x = sin(angle+adiff); 584 mViewDirection.z = cos(angle+adiff); 614 585 } 615 586 … … 651 622 } 652 623 653 mFrame++; 654 655 if (1) { 656 // render into the right side of the window buffer 657 SetupManipulatorProjection(width(), height()); 658 SetupManipulator(); 659 660 661 if (mRenderViewCells) 662 RenderViewCells(); 663 664 RenderPvs(); 665 666 if (0) { 667 mWireFrame = true; 668 RenderScene(); 669 mWireFrame = false; 670 } 671 672 if (mShowRays) { 673 RssPreprocessor *p = (RssPreprocessor *)mViewCellsManager->GetPreprocessor(); 674 if (p->mRssTree) { 675 VssRayContainer rays; 676 p->mRssTree->CollectRays(rays, 10000); 677 RenderRays(rays); 678 } 679 } 680 681 if (mShowRenderCost) 682 RenderRenderCost(); 683 684 RenderInfo(); 685 } 624 RenderInfo(); 625 686 626 mFrame++; 687 627 … … 727 667 } 728 668 729 void730 QtGlRendererWidget::SetupManipulator()731 {732 float m[4][4];733 734 glLoadIdentity();735 gluLookAt(0.0, 0.0, 30.0, /* eye is at (0,0,30) */736 0.0, 0.0, 0.0, /* center is at (0,0,0) */737 0.0, 1.0, 0.); /* up is in positive Y direction */738 739 build_rotmatrix(m, mManipulatorLastQuat);740 glMultMatrixf(&m[0][0]);741 742 float scale = mManipulatorScale*20.0f/Magnitude(mSceneGraph->GetBox().Diagonal());743 glScalef(scale, scale, scale);744 745 Vector3 t = -mSceneGraph->GetBox().Center();746 glTranslatef(t.x, t.y, t.z);747 748 }749 669 750 670 void … … 797 717 mRenderVisibilityEstimates = false; 798 718 mTransferFunction = 0.2f; 799 mManipulatorScale = 1.0f; 800 trackball(mManipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f); 719 801 720 bool tmp; 802 721 … … 990 909 QtGlRendererWidget::RenderInfo() 991 910 { 992 993 // $$JB temporal hack for two windows separation 994 if (1) { 995 996 // model view 997 glPushMatrix(); 998 glLoadIdentity(); 999 1000 // init ortographic projection 1001 glMatrixMode(GL_PROJECTION); 1002 glPushMatrix(); 1003 1004 glLoadIdentity(); 1005 gluOrtho2D(0, 1.0f, 0, 1.0f); 1006 1007 float w = 0.01f; 1008 float h = 1.0f; 1009 float px = 0.0f; 1010 float py = 0.0f; 1011 1012 glColor3f(0.8f, 0.8f, 0.8f); 1013 glBegin(GL_QUADS); 1014 1015 glVertex3f(px+w, py, 0); 1016 glVertex3f(px+w, py+h + w, 0); 1017 glVertex3f(px, py+h, 0); 1018 glVertex3f(px, py, 0); 1019 glEnd(); 1020 1021 // projection 1022 glPopMatrix(); 1023 1024 glMatrixMode(GL_MODELVIEW); 1025 // model view 1026 glPopMatrix(); 1027 } 1028 1029 911 1030 912 QString s; 1031 913 int vc = 0; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer.h
r1824 r1832 147 147 float mTransferFunction; 148 148 149 float mManipulatorLastQuat[4];150 float mManipulatorScale;151 149 152 150 QtRendererControlWidget *mControlWidget; … … 169 167 170 168 virtual void SetupCamera(); 171 // setup a transformation for manipulator172 void173 SetupManipulator();174 169 175 170 void initializeGL() { … … 204 199 virtual void 205 200 SetupCameraProjection(const int w, const int h, const float angle = 70.0f); 206 207 virtual void208 SetupManipulatorProjection(const int w, const int h, const float angle = 70.0f);209 201 210 202 void … … 310 302 } 311 303 312 304 signals: 305 void PvsUpdated(); 313 306 }; 314 307 -
GTP/trunk/Lib/Vis/Preprocessing/src/Renderer.h
r860 r1832 26 26 void SetViewCellsManager(ViewCellsManager *vcm); 27 27 28 p rotected:28 public: 29 29 ViewCellsManager *mViewCellsManager; 30 30 SceneGraph *mSceneGraph; -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
r1829 r1832 2864 2864 2865 2865 // $$ 2866 //sumWeights = leaf->mTotalRays;2866 sumWeights = leaf->mTotalRays; 2867 2867 2868 2868 //$$ test 30.11. 2006 2869 2869 // normalize per volume of the cell not the number of rays! 2870 sumWeights = spatialArea*dirArea;2870 // sumWeights = spatialArea*dirArea; 2871 2871 2872 2872 if (sumWeights != 0.0f) { -
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h
r1715 r1832 446 446 447 447 void AddRay(const RayInfo &data) { 448 mValidPvs = false;448 mValidPvs = false; 449 449 rays.push_back(data); 450 mTotalRays++;451 data.mRay->Ref();450 mTotalRays++; 451 data.mRay->Ref(); 452 452 } 453 453 -
GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp
r1715 r1832 211 211 212 212 float cosTheta = 1.0f - 2*r1; 213 214 215 216 217 218 213 float sinTheta = sqrt(1 - sqr(cosTheta)); 214 float fi = 2.0f*M_PI*r2; 215 216 Vector3 dir(sinTheta*sin(fi), 217 cosTheta, 218 sinTheta*cos(fi)); 219 219 220 220 return dir; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1830 r1832 32 32 33 33 // $$JB HACK 34 #define USE_KD_PVS 0 34 #define USE_KD_PVS 1 35 35 36 #define KD_PVS_AREA (1e-5f) 36 37 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1785 r1832 40 40 #include "QtPreprocessorThread.h" 41 41 #include "QtGlRenderer.h" 42 #include "QtGlViewer.h" 42 43 #endif 43 44 … … 295 296 if (!rendererWidget) 296 297 { 297 298 298 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 299 299 QMessageBox::information(0, "OpenGL pbuffers", … … 303 303 } 304 304 305 306 305 rendererWidget = new QtGlRendererWidget(preprocessor->mSceneGraph, 307 308 309 310 ((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt);306 preprocessor->mViewCellsManager, 307 preprocessor->mKdTree); 308 309 //((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt); 311 310 rendererWidget->Show(); 312 guiSupported = true; 311 312 QtGlViewer *viewer = new QtGlViewer(NULL, 313 (QtGlRendererWidget *) 314 rendererWidget); 315 viewer->show(); 316 guiSupported = true; 313 317 } 314 318 … … 321 325 preprocessor->renderer = 322 326 new QtGlRendererBuffer(512, 512, 323 324 325 327 preprocessor->mSceneGraph, 328 preprocessor->mViewCellsManager, 329 preprocessor->mKdTree); 326 330 // preprocessor->Getrenderer->makeCurrent(); 327 331 } -
GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
r1757 r1832 85 85 # Input 86 86 HEADERS += Halton.h VssRay.h VssPreprocessor.h RssTree.h GlRenderer.h \ 87 PreprocessorThread.h Preprocessor.h Beam.h 87 PreprocessorThread.h Preprocessor.h Beam.h QtGlViewer.h 88 88 89 89 … … 107 107 InternalRayCaster.cpp IntelRayCaster.cpp \ 108 108 RayCaster.cpp PreprocessorFactory.cpp GvsPreprocessor.cpp \ 109 Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp 109 Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp QtGlViewer.cpp 110 110 111 111
Note: See TracChangeset
for help on using the changeset viewer.