Changeset 576 for trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
- Timestamp:
- 01/25/06 14:35:01 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
r572 r576 44 44 mViewDirection = Vector3(0,0,1); 45 45 // timerId = startTimer(10); 46 // debug coords for atlanta 47 mViewPoint = Vector3(3473, 6.778, -1699); 48 mViewDirection = Vector3(-0.2432, 0, 0.97); 49 46 50 mFrame = 0; 47 51 mWireFrame = false; 48 52 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 53 mSnapErrorFrames = false; 54 mSnapPrefix = ""; 49 55 50 56 } … … 177 183 glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC) 178 184 wglGetProcAddress("glGetOcclusionQueryuivNV"); 179 } 180 185 186 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 187 188 } 189 190 void 191 GlRendererWidget::RenderInfo() 192 { 193 QString s; 194 s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)", 195 mFrame, 196 mViewPoint.x, 197 mViewPoint.y, 198 mViewPoint.z, 199 mViewDirection.x, 200 mViewDirection.y, 201 mViewDirection.z 202 203 ); 204 renderText(0,20,s); 205 } 181 206 182 207 … … 245 270 KdTree *tree): 246 271 QGLPixelBuffer(QSize(w, h)), GlRenderer(sceneGraph, viewcells, tree) { 247 248 272 249 273 environment->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); … … 256 280 257 281 float 258 GlRenderer ::GetPixelError()282 GlRendererBuffer::GetPixelError() 259 283 { 260 284 float pErrorPixels = -1.0f; … … 262 286 glReadBuffer(GL_BACK); 263 287 264 mUseFalseColors = true; 265 288 // mUseFalseColors = true; 289 290 mUseFalseColors = false; 266 291 267 292 static int query = -1; … … 311 336 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 312 337 338 glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); 339 313 340 // Render PVS 314 341 std::map<Intersectable *, … … 320 347 RenderIntersectable(object); 321 348 } 349 350 // glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 351 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 352 mUseFalseColors = true; 322 353 323 354 glBeginOcclusionQueryNV(query); … … 337 368 338 369 pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 370 if (mSnapErrorFrames && pErrorPixels > 0.01) { 371 372 char filename[256]; 373 sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 374 QImage im = toImage(); 375 im.save(mSnapPrefix + filename, "PNG"); 376 if (1) { //0 && mFrame == 1543) { 377 int x,y; 378 int lastIndex = -1; 379 for (y=0; y < im.height(); y++) 380 for (x=0; x < im.width(); x++) { 381 QRgb p = im.pixel(x,y); 382 int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 383 if (qGreen(p) != 255 && index!=0) { 384 if (index != lastIndex) { 385 Debug<<"ei="<<index<<" "; 386 lastIndex = index; 387 } 388 } 389 } 390 } 391 392 393 mUseFalseColors = false; 394 glPushAttrib(GL_CURRENT_BIT); 395 glColor3f(0,1,0); 396 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 397 SetupCamera(); 398 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 399 400 // Render PVS 401 std::map<Intersectable *, 402 PvsData<Intersectable *>, 403 LtSample<Intersectable *> >::const_iterator it = viewcell->GetPvs().mEntries.begin(); 404 405 for (; it != viewcell->GetPvs().mEntries.end(); ++ it) { 406 Intersectable *object = (*it).first; 407 RenderIntersectable(object); 408 } 409 410 im = toImage(); 411 sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 412 im.save(mSnapPrefix + filename, "PNG"); 413 glPopAttrib(); 414 } 415 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 339 416 } 340 417 … … 400 477 diff.setPixel(x, y, qRgba(255,128,128,255)); 401 478 errorPixels++; 479 402 480 } 403 481 pErrorPixels = ((float)errorPixels)/(im1.height()*im1.width()); … … 506 584 for (int i=0; i < mPvsStatFrames; i++) { 507 585 float err; 586 // set frame id for saving the error buffer 587 mFrame = i; 508 588 RandomViewPoint(); 589 590 // atlanta problematic frames: 325 525 691 1543 591 #if 0 592 if (mFrame != 325 && 593 mFrame != 525 && 594 mFrame != 691 && 595 mFrame != 1543) 596 mPvsErrorBuffer[i] = -1; 597 else { 598 Debug<<"frame ="<<mFrame<<" vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 599 } 600 #endif 509 601 if (mPvsErrorBuffer[i] > 0.0f) { 510 602 mPvsErrorBuffer[i] = GetPixelError(); … … 592 684 GlRendererWidget::paintGL() 593 685 { 594 595 596 686 RenderErrors(); 687 RenderInfo(); 688 mFrame++; 597 689 } 598 690
Note: See TracChangeset
for help on using the changeset viewer.