- Timestamp:
- 01/10/07 02:10:23 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1944 r1960 251 251 252 252 void 253 GlRenderer::SetupFalseColor(const int id)253 GlRenderer::SetupFalseColor(const unsigned int id) 254 254 { 255 255 // swap bits of the color … … 258 258 259 259 260 int GlRenderer::GetId(int r, int g, int b) const 260 unsigned int GlRenderer::GetId(const unsigned char r, 261 const unsigned char g, 262 const unsigned char b) const 261 263 { 262 264 return r + (g << 8) + (b << 16); 263 265 } 266 264 267 265 268 void … … 269 272 glColor3fv(&(m->mDiffuseColor.r)); 270 273 } 274 271 275 272 276 void -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
r1949 r1960 106 106 virtual void RandomViewPoint(); 107 107 108 void SetupFalseColor(const int id);108 void SetupFalseColor(const unsigned int id); 109 109 void RenderIntersectable(Intersectable *); 110 110 void RenderViewCell(ViewCell *vc); … … 152 152 virtual int GetHeight() const { return 0; } 153 153 154 int GetId(int r, int g, int b) const; 154 unsigned int GetId(const unsigned char r, 155 const unsigned char g, 156 const unsigned char b) const; 155 157 156 158 inline const bool GetSnapErrorFrames() { return mSnapErrorFrames; } -
GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.cpp
r1958 r1960 5 5 #include "Preprocessor.h" 6 6 #include "GlRenderer.h" 7 #include "Exporter.h" 8 7 9 // the devil library 8 10 #include <IL/il.h> … … 27 29 GlobalLinesRenderer *globalLinesRenderer = NULL; 28 30 29 static int texWidth = 256; 30 static int texHeight = 256; 31 31 static int texWidth = 128; 32 static int texHeight = 128; 33 34 static bool isDepth = true; 32 35 33 36 static void InitDevIl() … … 89 92 90 93 91 void SetFrustum(int sizeX, int sizeY, float nearPlane, float farPlane) 94 void SetFrustum(const int sizeX, const int sizeY, 95 const float nearPlane, const float farPlane) 92 96 { 93 97 glMatrixMode(GL_PROJECTION); 94 98 glLoadIdentity(); 95 99 96 glOrtho(-sizeX / 2, sizeX / 2,97 -sizeY / 2, sizeY / 2,100 glOrtho(-sizeX * 0.5, sizeX * 0.5, 101 -sizeY * 0.5, sizeY * 0.5, 98 102 nearPlane, farPlane); 99 103 … … 107 111 //globalLinesRenderer->DrawGeometry(); 108 112 //globalLinesRenderer->CastGlobalLines(Beam(), 0); 109 globalLinesRenderer->DisplayBuffer( );113 globalLinesRenderer->DisplayBuffer(isDepth); 110 114 PrintGLerror("display"); 111 115 … … 132 136 133 137 cout << "max depth: " << globalLinesRenderer->mMaxDepth << endl; 138 CLEAR_CONTAINER(rays); 134 139 return; 135 140 } … … 142 147 143 148 globalLinesRenderer->ApplyDepthPeeling(rays, Beam(), 0); 149 CLEAR_CONTAINER(rays); 144 150 return; 145 151 } … … 148 154 //globalLinesRenderer->ApplyDepthPeeling(Beam(), 0); 149 155 globalLinesRenderer->ExportDepthBuffer(); 156 150 157 return; 151 158 } 152 159 case '4': 153 160 { 161 //globalLinesRenderer->ApplyDepthPeeling(Beam(), 0); 162 globalLinesRenderer->ExportItemBuffer(); 163 164 return; 165 } 166 case '8': 167 { 168 isDepth = !isDepth; 169 return; 170 } 171 case '9': 172 { 154 173 VssRayContainer rays; 155 156 174 globalLinesRenderer->ApplyDepthPeeling(rays, Beam(), 0); 175 VssRayContainer outRays; 176 VssRayContainer::const_iterator vit, vit_end = rays.end(); 177 178 const float p = 8.0f / (float)rays.size(); 179 180 for (vit = rays.begin(); vit != vit_end; ++ vit) 181 { 182 if (Random(1.0f) < p) 183 { 184 outRays.push_back(*vit); 185 } 186 } 187 188 globalLinesRenderer->Visualize(rays); 189 CLEAR_CONTAINER(rays); 190 return; 191 } 192 case '0': 193 { 194 VssRayContainer rays; 195 globalLinesRenderer->ApplyDepthPeeling(rays, Beam(), 0); 196 CLEAR_CONTAINER(rays); 157 197 return; 158 198 } … … 185 225 186 226 187 void GlobalLinesRenderer::DisplayBuffer() 188 { 189 //mNewTexture->Bind(); 190 mNewTexture->BindDepth(); 227 void GlobalLinesRenderer::DisplayBuffer(const bool isDepth) 228 { 229 if (!isDepth) 230 mNewTexture->Bind(); 231 else 232 mNewTexture->BindDepth(); 191 233 mNewTexture->EnableTextureTarget(); 192 234 … … 262 304 for (oit = mPreprocessor->mObjects.begin(); oit != oit_end; ++ oit) 263 305 { 306 cout << (*oit)->GetId() << " "; 264 307 RenderObject(*oit); 265 308 } … … 297 340 InitDevIl(); 298 341 299 342 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); 300 343 glutInitWindowPosition(50, 50); 301 344 glutInitWindowSize(512, 512); … … 321 364 // initialise the receiving buffers 322 365 mNewDepthBuffer = new float[texWidth * texHeight]; 366 mNewItemBuffer = new unsigned char[texWidth * texHeight * 4]; 367 323 368 mOldDepthBuffer = new float[texWidth * texHeight]; 324 369 mOldItemBuffer = new unsigned char[texWidth * texHeight * 4]; 370 325 371 for (int i = 0; i < texWidth * texHeight; ++ i) 326 372 { 327 373 mNewDepthBuffer[i] = 1; 328 374 mOldDepthBuffer[i] = 1; 329 } 330 331 mNewItemBuffer = new int[texWidth * texHeight *4]; 332 mOldItemBuffer = new int[texWidth * texHeight *4]; 333 334 for (int i = 0; i < texWidth * texHeight * 4; ++ i) 335 { 336 mNewItemBuffer[i] = 0; 337 mOldItemBuffer[i] = 0; 375 376 mNewItemBuffer[i * 4] = 255; 377 mNewItemBuffer[i * 4 + 1] = 255; 378 mNewItemBuffer[i * 4 + 2] = 255; 379 mNewItemBuffer[i * 4 + 3] = 255; 380 381 mOldItemBuffer[i * 4] = 255; 382 mOldItemBuffer[i * 4 + 1] = 255; 383 mOldItemBuffer[i * 4 + 2] = 255; 384 mOldItemBuffer[i * 4 + 3] = 255; 338 385 } 339 386 340 387 AxisAlignedBox3 bbox = globalLinesRenderer->mPreprocessor->mKdTree->GetBox(); 341 388 342 mViewPoint = bbox.Center();389 Vector3 midPoint = bbox.Center(); 343 390 344 391 const float sceneSize = Magnitude(bbox.Diagonal()); 345 Vector3 viewPoint = mViewPoint + Vector3(0.5 * sceneSize, 0, 0);346 347 cout << "mid point: " << m ViewPoint << endl;348 cout << "view point: " << viewPoint << endl;392 mViewPoint = midPoint + Vector3(0.5 * sceneSize, 0, 0); 393 394 cout << "mid point: " << midPoint << endl; 395 cout << "view point: " << mViewPoint << endl; 349 396 cout << "scene: " << bbox << endl; 350 397 351 mEyeVec = Normalize(viewPoint - mViewPoint); 398 mNear = 1; 399 mFar = sceneSize; 400 mWidth = sceneSize; 401 402 mEyeVec = Normalize(midPoint - mViewPoint); 352 403 mEyeVec.RightHandedBase(mUpVec, mLeftVec); 353 404 354 /*gluLookAt( viewPoint.x, viewPoint.y, viewPoint.z,405 /*gluLookAt(mViewPoint.x, mViewPoint.y, mViewPoint.z, 355 406 midPoint.x, midPoint.y, midPoint.z, 356 407 0, 1, 0); … … 422 473 //Reshape(texWidth, texHeight); 423 474 glViewport(0, 0, texWidth, texHeight); 424 SetFrustum( sceneSize, sceneSize, 1, sceneSize);475 SetFrustum(mWidth, mWidth, mNear, mFar); 425 476 426 477 // for item buffer: white means no color … … 430 481 glFrontFace(GL_CCW); 431 482 glCullFace(GL_BACK); 432 glEnable(GL_CULL_FACE); 483 484 glDisable(GL_CULL_FACE); 485 //glEnable(GL_CULL_FACE); 486 433 487 glShadeModel(GL_FLAT); 434 488 glEnable(GL_DEPTH_TEST); … … 436 490 glMatrixMode(GL_MODELVIEW); 437 491 glLoadIdentity(); 438 gluLookAt( viewPoint.x, viewPoint.y, viewPoint.z,439 m ViewPoint.x, mViewPoint.y, mViewPoint.z,492 gluLookAt(mViewPoint.x, mViewPoint.y, mViewPoint.z, 493 midPoint.x, midPoint.y, midPoint.z, 440 494 0, 1, 0); 441 495 442 //SetFrustum(sceneSize, sceneSize, 1, sceneSize);443 496 } 444 497 mNewTexture->EndCapture(); … … 452 505 //Reshape(texWidth, texHeight); 453 506 glViewport(0, 0, texWidth, texHeight); 454 SetFrustum( sceneSize, sceneSize, 1, sceneSize);507 SetFrustum(mWidth, mWidth, mNear, mFar); 455 508 456 509 glMatrixMode(GL_MODELVIEW); … … 459 512 glFrontFace(GL_CCW); 460 513 glCullFace(GL_BACK); 461 glEnable(GL_CULL_FACE); 514 515 glDisable(GL_CULL_FACE); 516 //glEnable(GL_CULL_FACE); 517 462 518 glShadeModel(GL_FLAT); 463 519 glEnable(GL_DEPTH_TEST); 464 520 465 gluLookAt( viewPoint.x, viewPoint.y, viewPoint.z,466 m ViewPoint.x, mViewPoint.y, mViewPoint.z,521 gluLookAt(mViewPoint.x, mViewPoint.y, mViewPoint.z, 522 midPoint.x, midPoint.y, midPoint.z, 467 523 0, 1, 0); 468 524 … … 475 531 476 532 477 Intersectable *GetObject(const int index) 478 { 479 return NULL; 480 } 481 482 483 void GlobalLinesRenderer::ProcessDepthBuffer(VssRayContainer &vssRays) 533 Intersectable *GlobalLinesRenderer::ExtractSamplePoint(float *depthBuffer, 534 unsigned char *itemBuffer, 535 const int x, 536 const int y, 537 Vector3 &hitPoint, 538 const bool isFrontBuffer) const 539 { 540 const int depthIndex = x + texWidth * y; 541 const int itemIndex = 4 * depthIndex; 542 543 const float depth = depthBuffer[depthIndex]; 544 const float eyeDist = mNear + (mFar - mNear) * depth; 545 546 const float leftDist = 0.5f * mWidth - mWidth * ((float)x + 0.5f) / texWidth; 547 //const float upDist = 0.5f * mWidth - (float)mWidth * ((float)y + 0.5f) / texHeight; 548 const float upDist = -0.5f * mWidth + mWidth * ((float)y + 0.5f) / texHeight; 549 550 hitPoint = mViewPoint + 551 eyeDist * mEyeVec + 552 leftDist * mUpVec + 553 upDist * mLeftVec; 554 555 unsigned char r = itemBuffer[itemIndex]; 556 unsigned char g = itemBuffer[itemIndex + 1]; 557 unsigned char b = itemBuffer[itemIndex + 2]; 558 559 // 3 times 255 means no valid object 560 if ((r == 255) && (g == 255) && (b == 255)) 561 return NULL; 562 563 const int id = mRenderer->GetId(r, g, b); 564 //cout << "r: " << (int)r << "g: " << (int)g << " b: " << (int)b << " id: " << id << "|"; 565 Intersectable *intersect = mPreprocessor->GetObjectById(id); 566 567 const Vector3 dir = isFrontBuffer ? mEyeVec : -mEyeVec; 568 // HACK: assume triangle intersectable 569 const Vector3 norm = intersect->GetNormal(0); 570 571 //if (DotProd(dir, norm) >= -Limits::Small) 572 return intersect; 573 } 574 575 576 void GlobalLinesRenderer::ProcessDepthBuffer(VssRayContainer &vssRays, 577 const bool oldBufferInitialised) 484 578 { 485 579 GrabDepthBuffer(mNewDepthBuffer, mNewTexture); 486 GrabDepthBuffer(mOldDepthBuffer, mOldTexture);487 488 580 GrabItemBuffer(mNewItemBuffer, mNewTexture); 489 GrabItemBuffer(mOldItemBuffer, mOldTexture); 581 582 if (oldBufferInitialised) 583 { 584 GrabDepthBuffer(mOldDepthBuffer, mOldTexture); 585 GrabItemBuffer(mOldItemBuffer, mOldTexture); 586 } 587 else 588 { 589 for (int i = 0; i < texWidth * texHeight; ++ i) 590 { 591 mOldDepthBuffer[i] = 0; 592 593 mOldItemBuffer[i * 4] = 255; 594 mOldItemBuffer[i * 4 + 1] = 255; 595 mOldItemBuffer[i * 4 + 2] = 255; 596 mOldItemBuffer[i * 4 + 3] = 255; 597 } 598 } 599 600 cout << "vp: " << "eye: " << mEyeVec << " left: " << mLeftVec << " up: " << mUpVec << endl; 490 601 491 602 for (int y = 0; y < texHeight; ++ y) … … 493 604 for (int x = 0; x < texWidth; ++ x) 494 605 { 495 const int index = x + texWidth * y; 496 const float newDepth = mNewDepthBuffer[index]; 497 const float oldDepth = mOldDepthBuffer[index]; 498 499 float newDummy1 = mNear + (mFar - mNear) * newDepth; 500 float oldDummy1 = mNear + (mFar - mNear) * oldDepth; 501 502 float newDummy2 = x - texWidth / 2; 503 float newDummy3 = y - texHeight / 2; 504 505 float oldDummy2 = newDummy2; 506 float oldDummy3 = newDummy3; 507 508 const Vector3 newPt = mViewPoint + newDepth * mEyeVec + newDummy1 * mLeftVec + newDummy2 * mUpVec; 509 const Vector3 oldPt = mViewPoint + oldDepth * mEyeVec + oldDummy1 * mLeftVec + oldDummy2 * mUpVec; 510 511 //cout << "viewpoint: " << mViewPoint << " new: " << newPt << " old: " << newPt << endl; 512 513 int r = mNewItemBuffer[index]; 514 int g = mNewItemBuffer[index + 1]; 515 int b = mNewItemBuffer[index + 2]; 516 517 Intersectable *termObj1 = NULL; 518 Intersectable *termObj2 = NULL; 519 520 // 3 times 255 means no valid object 521 if (!((r == 255) && (g == 255) && (b == 255))) 606 Vector3 newPt, oldPt; 607 608 Intersectable *termObj1 = ExtractSamplePoint(mNewDepthBuffer, 609 mNewItemBuffer, 610 x, 611 y, 612 newPt, 613 true); 614 615 Intersectable *termObj2 = ExtractSamplePoint(mOldDepthBuffer, 616 mOldItemBuffer, 617 x, 618 y, 619 oldPt, 620 false); 621 622 // create rays in both directions 623 if (termObj1) 522 624 { 523 const int id = mRenderer->GetId(r, g, b); 524 cout << id << " "; 525 //termObj1 = mPreprocessor->GetObjectById(id); 625 vssRays.push_back(new VssRay(oldPt, newPt, NULL, termObj1)); 626 //cout << "new pt: " << newPt << endl; 526 627 } 527 628 528 /*r = mOldItemBuffer[index]; 529 g = mOldItemBuffer[index + 1]; 530 b = mOldItemBuffer[index + 2]; 531 532 if (!((r == 255) && (g == 255) && (b == 255))) 533 Intersectable *termObj2 = mPreprocessor->GetObjectById(mRenderer->GetId(r, g, b)); 534 */ 535 // create rays in both directions 536 //vssRays.push_back(new VssRay(oldPt, newPt, NULL, termObj1)); 537 //vssRays.push_back(new VssRay(newPt, oldPt, NULL, termObj2)); 629 //if (termObj2) 630 //{ 631 // vssRays.push_back(new VssRay(oldPt, newPt, NULL, termObj2)); 632 // cout << "old pt: " << oldPt << endl; 633 //} 538 634 } 539 635 } … … 544 640 { 545 641 glutMainLoop(); 642 } 643 644 645 void SetupFalseColor(const unsigned int id, 646 unsigned char &r, 647 unsigned char &g, 648 unsigned char &b 649 ) 650 { 651 // swap bits of the color 652 r = id & 255; 653 g = (id >> 8) & 255; 654 b = (id >> 16) & 255; 655 } 656 657 658 void GlobalLinesRenderer::Visualize(const VssRayContainer &vssRays) 659 { 660 Exporter *exporter = Exporter::GetExporter("globalLines.wrl"); 661 662 if (!exporter) 663 return; 664 665 exporter->SetWireframe(); 666 //exporter->ExportGeometry(preprocessor->mObjects); 667 exporter->SetFilled(); 668 669 VssRayContainer::const_iterator vit, vit_end = vssRays.end(); 670 671 for (vit = vssRays.begin(); vit != vit_end; ++ vit) 672 { 673 VssRay *ray = *vit; 674 Intersectable *obj = (*vit)->mTerminationObject; 675 exporter->ExportIntersectable(obj); 676 677 unsigned char r, g, b; 678 SetupFalseColor(obj->GetId(), r, g, b); 679 int id = mRenderer->GetId(r, g, b); 680 681 if (id != obj->GetId()) 682 cout << "error!" << endl; 683 else cout <<"x"; 684 } 685 686 exporter->ExportRays(vssRays); 687 688 delete exporter; 546 689 } 547 690 … … 560 703 561 704 562 void GlobalLinesRenderer::GrabItemBuffer( int*data, RenderTexture *rt)705 void GlobalLinesRenderer::GrabItemBuffer(unsigned char *data, RenderTexture *rt) 563 706 { 564 707 rt->Bind(); … … 567 710 568 711 const int texFormat = GL_RGBA; 569 glGetTexImage(mNewTexture->GetTextureTarget(), 0, texFormat, GL_ FLOAT, data);712 glGetTexImage(mNewTexture->GetTextureTarget(), 0, texFormat, GL_UNSIGNED_BYTE, data); 570 713 571 714 mNewTexture->DisableTextureTarget(); … … 579 722 cout << "depth: " << mNewTexture->GetDepthBits() << endl; 580 723 581 const boolcomponents = 1;//mNewTexture->GetDepthBits() / 8;724 const int components = 1;//mNewTexture->GetDepthBits() / 8; 582 725 583 726 float *data = new float[texWidth * texHeight * components]; … … 609 752 } 610 753 611 612 754 /* 613 755 void GlobalLinesRenderer::ExportItemBuffer() 614 756 { 615 mNewTexture->Bind Depth();757 mNewTexture->Bind(); 616 758 mNewTexture->EnableTextureTarget(); 617 759 cout << "depth: " << mNewTexture->GetDepthBits() << endl; 618 760 619 const bool components = 1;//mNewTexture->GetDepthBits() / 8; 620 621 float *data = new float[texWidth * texHeight * components]; 622 //const int texFormat = WGL_TEXTURE_DEPTH_COMPONENT_NV; 623 const int texFormat = GL_DEPTH_COMPONENT; 624 //const int texFormat = GL_RGBA; 761 const int components = 4;//mNewTexture->GetDepthBits() / 8; 762 763 float *data = new float[texWidth * texHeight * components*8]; 764 const int texFormat = GL_RGBA; 625 765 glGetTexImage(mNewTexture->GetTextureTarget(), 0, texFormat, GL_FLOAT, data); 626 766 627 string filename(" depth.tga");767 string filename("items.tga"); 628 768 ilRegisterType(IL_FLOAT); 629 769 … … 631 771 const int bpp = components; 632 772 633 ilTexImage(texWidth, texHeight, depth, bpp, IL_LUMINANCE, IL_FLOAT, data); 773 cout << "saving items to file " << endl; 774 775 ilTexImage(16, 16, depth, bpp, IL_RGBA, IL_FLOAT, data); 634 776 ilSaveImage((char *const)filename.c_str()); 635 777 … … 641 783 } 642 784 */ 785 void GlobalLinesRenderer::ExportItemBuffer() 786 { 787 mNewTexture->Bind(); 788 mNewTexture->EnableTextureTarget(); 789 cout << "depth: " << mNewTexture->GetDepthBits() << endl; 790 791 const int components = 4;//mNewTexture->GetDepthBits() / 8; 792 793 unsigned char *data = new unsigned char [texWidth * texHeight * components]; 794 //const int texFormat = WGL_TEXTURE_DEPTH_COMPONENT_NV; 795 const int texFormat = GL_RGBA; 796 glGetTexImage(mNewTexture->GetTextureTarget(), 0, texFormat, GL_UNSIGNED_BYTE, data); 797 798 string filename("items.jpg"); 799 ilRegisterType(IL_UNSIGNED_BYTE); 800 801 const int depth = 1; 802 const int bpp = components; 803 804 ilTexImage(texWidth, texHeight, depth, bpp, IL_RGBA, IL_UNSIGNED_BYTE, data); 805 ilSaveImage((char *const)filename.c_str()); 806 807 cout << "finished" << endl; 808 delete data; 809 cout << "data deleted" << endl; 810 mNewTexture->DisableTextureTarget(); 811 PrintGLerror("grab texture"); 812 } 643 813 644 814 … … 659 829 660 830 // process the buffers for the first layer 661 ProcessDepthBuffer(rays );831 ProcessDepthBuffer(rays, false); 662 832 663 833 for(int i = 0; i < mMaxDepth; ++ i) … … 685 855 cgGLDisableTextureParameter(sTextureParam); 686 856 cgGLDisableProfile(sCgFragmentProfile); 687 688 // process the buffers for following layer689 ProcessDepthBuffer(rays);690 691 857 } 692 858 mNewTexture->EndCapture(); 859 860 // process the buffers for following layer 861 ProcessDepthBuffer(rays, true); 693 862 } 694 863 -
GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.h
r1958 r1960 48 48 */ 49 49 void DrawGeometry(); 50 void Run(); 51 void GrabDepthBuffer(float *data, RenderTexture *rt); 52 void GrabItemBuffer(int *data, RenderTexture *rt); 53 void ApplyDepthPeeling(VssRayContainer &rays, Beam &beam, const int samples); 54 void ExportDepthBuffer(); 55 void ProcessDepthBuffer(VssRayContainer &vssRays); 56 void DisplayBuffer(); 50 void Run(); 51 void GrabDepthBuffer(float *data, RenderTexture *rt); 52 void GrabItemBuffer(unsigned char *data, RenderTexture *rt); 53 void ApplyDepthPeeling(VssRayContainer &rays, Beam &beam, const int samples); 54 void ExportDepthBuffer(); 55 void ExportItemBuffer(); 56 void ProcessDepthBuffer(VssRayContainer &vssRays, const bool oldBufferInitialised); 57 void DisplayBuffer(const bool isDepth); 58 59 Intersectable *ExtractSamplePoint(float *depthBuffer, 60 unsigned char *itemBuffer, 61 const int x, 62 const int y, 63 Vector3 &hitPoint, 64 const bool isFrontBuffer) const; 65 66 void Visualize(const VssRayContainer &vssRays); 57 67 58 68 int mMaxDepth; … … 62 72 float mFar; 63 73 float mNear; 74 float mWidth; 64 75 65 76 Vector3 mViewPoint; … … 67 78 float *mNewDepthBuffer; 68 79 float *mOldDepthBuffer; 69 int *mNewItemBuffer; 70 int *mOldItemBuffer; 71 RenderTexture *mNewTexture; 80 unsigned char *mNewItemBuffer; 81 unsigned char *mOldItemBuffer; 82 83 RenderTexture *mNewTexture; 72 84 RenderTexture *mOldTexture; 73 85 -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r1952 r1960 13 13 14 14 15 IntelRayCaster::IntelRayCaster(const Preprocessor &preprocessor, const string externKdTree): 15 IntelRayCaster::IntelRayCaster(const Preprocessor &preprocessor, 16 const string externKdTree): 16 17 RayCaster(preprocessor) 17 18 { … … 74 75 Vector3 dir = -simpleRay.mDirection; 75 76 hittriangle = mlrtaIntersectAS( 76 &simpleRay.mOrigin.x,77 &dir.x,78 normal,79 dist);77 &simpleRay.mOrigin.x, 78 &dir.x, 79 normal, 80 dist); 80 81 81 82 Intersectable *intersect = mPreprocessor.GetParentObject(hittriangle); -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1958 r1960 1297 1297 Intersectable *Preprocessor::GetObjectById(const int id) 1298 1298 { 1299 #if 01299 #if 1 1300 1300 // create a dummy mesh instance to be able to use stl 1301 1301 MeshInstance object(NULL); … … 1315 1315 } 1316 1316 #else 1317 return mObjects[id ];1317 return mObjects[id - 1]; 1318 1318 #endif 1319 1319 } -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r1715 r1960 124 124 { 125 125 const Vector3 a = (*ri)->GetOrigin(); 126 const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 126 const Vector3 b = (*ri)->mTerminationObject ? 127 (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 127 128 128 129 #if GTP_DEBUG … … 130 131 if (!a.CheckValidity()) 131 132 { 132 cout << "error a" <<endl;133 cout << "error a" << endl; 133 134 isnan = true; 134 135 } … … 136 137 if (!b.CheckValidity()) 137 138 { 138 cout << "error b" <<endl;139 cout << "error b" << endl; 139 140 isnan = true; 140 141 }
Note: See TracChangeset
for help on using the changeset viewer.