Changeset 2696 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 05/23/08 05:19:59 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2695 r2696 132 132 mViewPoint = Vector3(1189.54, 220.087, -462.869); 133 133 mViewDirection = Vector3(-0.996972, -0, -0.0776569); 134 135 mViewPoint = Vector3(1199.53, 257.677, -457.145); 136 mViewDirection = Vector3(-0.71206, -0, -0.702108); 134 137 } 135 138 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2695 r2696 1212 1212 void GvsPreprocessor::ComputeViewCell() 1213 1213 { 1214 if (mCurrentViewCell->GetId() != 499) return;1214 //if (mCurrentViewCell->GetId() != 499) return; 1215 1215 1216 1216 // clean up -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2695 r2696 254 254 { 255 255 Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 256 //tri.mVertices[0] *= 10; tri.mVertices[1] *= 10; tri.mVertices[2] *= 10; 256 257 257 258 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); -
GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
r2582 r2696 304 304 const double LOG2E = 1.442695040f; 305 305 306 const float logN = log((float) Max(1, n))/LOG2E;307 const float logS = log((float) Max(1, mLastSorted))/LOG2E;308 const float logD = log((float) Max(1, dirtySize))/LOG2E;306 const float logN = (float)log((float) Max(1, n))/LOG2E; 307 const float logS = (float)log((float) Max(1, mLastSorted))/LOG2E; 308 const float logD = (float)log((float) Max(1, dirtySize))/LOG2E; 309 309 310 310 if (8*(n + 2*dirtySize*logD) < -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2695 r2696 290 290 291 291 // some error happened 292 if ( 1)//pixelCount > pixelThres)292 if (pixelCount > pixelThres) 293 293 { 294 294 cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize … … 313 313 im.save(qstr, "PNG"); 314 314 315 #if 1 316 /////////// 317 //-- output computed pvs 318 319 //mUseFalseColors = false; 320 mUseFalseColors = true; 321 glPushAttrib(GL_CURRENT_BIT); 322 glColor3f(0, 1, 0); 323 324 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 325 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 326 327 KdNode::NewMail2(); 328 Intersectable::NewMail(); 329 330 ++ mCurrentFrame; 331 332 // render pvs once 333 //RenderPvs(pvs); 334 RenderTrianglePvs(); 335 336 glFlush(); 337 338 mUseFalseColors = false; 339 340 im = toImage(); 341 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 342 str = mSnapPrefix + filename; 343 qstr = str.c_str(); 344 im.save(qstr, "PNG"); 345 346 glPopAttrib(); 347 #endif 315 if (0) 316 { 317 /////////// 318 //-- output computed pvs 319 320 //mUseFalseColors = false; 321 mUseFalseColors = true; 322 glPushAttrib(GL_CURRENT_BIT); 323 glColor3f(0, 1, 0); 324 325 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 326 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 327 328 KdNode::NewMail2(); 329 Intersectable::NewMail(); 330 331 ++ mCurrentFrame; 332 333 // render pvs once 334 //RenderPvs(pvs); 335 RenderTrianglePvs(); 336 337 glFlush(); 338 339 mUseFalseColors = false; 340 341 im = toImage(); 342 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 343 str = mSnapPrefix + filename; 344 qstr = str.c_str(); 345 im.save(qstr, "PNG"); 346 347 glPopAttrib(); 348 } 348 349 } 349 350 } … … 2602 2603 } 2603 2604 2604 /* 2605 2606 int ExampleRenderThread::faceAtPosition(const QPoint &pos) 2605 2606 int QtGlRendererWidget::FindDynamicObject(const Vector3 &pos) 2607 2607 { 2608 2608 // we need to lock the rendering context 2609 glw.lockGLContext(); 2609 //glw.lockGLContext(); 2610 2610 2611 // this is the same as in every OpenGL picking example 2611 const int MaxSize = 512; 2612 const int maxSize = 512; 2613 2612 2614 // see below for an explanation on the buffer content 2613 GLuint buffer[ MaxSize];2615 GLuint buffer[maxSize]; 2614 2616 GLint viewport[4]; 2617 2615 2618 glGetIntegerv(GL_VIEWPORT, viewport); 2616 glSelectBuffer(MaxSize, buffer); 2619 glSelectBuffer(maxSize, buffer); 2620 2617 2621 // enter select mode 2618 2622 glRenderMode(GL_SELECT); 2619 2623 glInitNames(); 2620 2624 glPushName(0); 2625 2621 2626 glMatrixMode(GL_PROJECTION); 2622 2627 glPushMatrix(); 2623 2628 glLoadIdentity(); 2624 gluPickMatrix((GLdouble)pos.x(), 215 (GLdouble)(viewport[3] - pos.y()), 216 5.0, 5.0, viewport); 2625 GLfloat x = (GLfloat)viewport_size.width() / viewport_size.height(); 2629 gluPickMatrix((GLdouble)pos.x, (GLdouble)(viewport[3] - pos.y), 5.0f, 5.0f, viewport); 2630 2631 GLfloat x = (GLfloat)width() / height(); 2626 2632 glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0); 2627 draw(); 2633 2634 glLoadName(1); 2635 2636 _RenderDynamicObject(mPendingDynamicObject); 2637 2628 2638 glMatrixMode(GL_PROJECTION); 2629 2639 glPopMatrix(); 2640 2630 2641 // finally release the rendering context again 2631 2642 if (!glRenderMode(GL_RENDER)) 2632 2643 { 2633 glw.unlockGLContext();2644 //glw.unlockGLContext(); 2634 2645 return -1; 2635 2646 } 2636 2647 2637 glw.unlockGLContext();2648 //glw.unlockGLContext(); 2638 2649 2639 2650 // Each hit takes 4 items in the buffer. … … 2649 2660 return buffer[3]; 2650 2661 } 2651 */ 2652 } 2662 2663 void processHits (GLint hits, GLuint buffer[]) 2664 { 2665 unsigned int i, j; 2666 GLuint names, *ptr; 2667 2668 cout << "hits = %d" << endl;; 2669 ptr = (GLuint *) buffer; 2670 2671 for (i = 0; i < hits; i++) 2672 { 2673 /* for each hit */ 2674 names = *ptr; 2675 2676 printf (" number of names for hit = %d\n", names); ptr++; 2677 printf(" z1 is %g;", (float) *ptr/0x7fffffff); ptr++; 2678 printf(" z2 is %g\n", (float) *ptr/0x7fffffff); ptr++; 2679 printf (" the name is "); 2680 2681 for (j = 0; j < names; j++) { /* for each name */ 2682 printf ("%d ", *ptr); ptr++; 2683 } 2684 printf ("\n"); 2685 } 2686 } 2687 2688 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2695 r2696 80 80 void RenderTrianglePvs(); 81 81 82 82 83 public: 83 84 … … 248 249 249 250 #if DYNAMIC_OBJECTS_HACK 250 251 251 252 SceneGraphLeaf *mPendingDynamicObject; 252 253 253 DynamicObjectsContainer mDynamicObjects; 254 254 255 #endif 255 256 … … 324 325 325 326 void WriteViewCellInfos(); 326 327 327 /** Unproject x/y screen coordinates. 328 328 */ 329 329 Vector3 Unproject(int x, int y); 330 330 331 int FindDynamicObject(const Vector3 &pos); 332 331 333 332 334 public slots: -
GTP/trunk/Lib/Vis/Preprocessing/src/RandomViewCellsHandler.cpp
r2695 r2696 139 139 AxisAlignedBox3 bbox = mViewCellsManager->GetViewSpaceBox(); 140 140 141 cout << "old view space box: " << bbox << endl;142 143 141 string buf; 144 142 … … 164 162 sscanf(buf.c_str(), "p %f %f %f %f %f %f", &pt.x, &pt.y, &pt.z, &dir.x, &dir.y, &dir.z); 165 163 166 if (1) 167 { 168 // include new point into view space box 169 if (!bbox.IsInside(pt)) 170 bbox.Include(pt); 171 } 172 else 173 { 174 // other variant: clamp to box 175 bbox.ClampToBox(pt); 176 } 177 164 // other variant: clamp to box 165 bbox.ClampToBox(pt); 166 178 167 SimpleRay ray(pt, dir, 0, 1); 179 168 … … 194 183 } 195 184 } 196 197 // set updated view space box containing all view points198 mViewCellsManager->SetViewSpaceBox(bbox);199 200 cout << "new view space box: " << mViewCellsManager->GetViewSpaceBox() << endl;201 185 202 186 return true; -
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2695 r2696 822 822 823 823 // get point on view cell surface 824 if ( 1)824 if (0) 825 825 { 826 826 //mViewCell->GetRandomEdgePoint(origin, normal); … … 829 829 // move a little bit back to avoid piercing through walls 830 830 // that bound the view cell 831 if ( 1) origin -= 0.01f * normal;831 if (0) origin -= 0.01f * normal; 832 832 } 833 833 else -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2695 r2696 2277 2277 2278 2278 2279 void VspOspViewCellsManager::SetViewSpaceBox(const AxisAlignedBox3 &box)2280 {2281 mViewSpaceBox = box;2282 mHierarchyManager->mVspTree->mBoundingBox = box;2283 2284 cout << "vsp bounding box: " << box << endl;2285 // hack: create clip plane relative to new view space box2286 CreateClipPlane();2287 // the total area of the view space has changed2288 mTotalAreaValid = false;2289 }2290 2291 2292 2279 void ViewCellsManager::CreateClipPlane() 2293 2280 { -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2695 r2696 1248 1248 const ObjectContainer &objects); 1249 1249 1250 /** Sets a view space boundary. 1251 */ 1252 virtual void SetViewSpaceBox(const AxisAlignedBox3 &box); 1250 1253 1251 1254 1252 #if TEST_PACKETS -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r2695 r2696 354 354 friend class ViewCellsParseHandlers; 355 355 friend class HierarchyManager; 356 friend class VspOspViewCellsManager;356 //friend class VspOspViewCellsManager; 357 357 358 358 public:
Note: See TracChangeset
for help on using the changeset viewer.