Ignore:
Timestamp:
01/18/07 11:44:46 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.cpp

    r1980 r1990  
    99#include "SamplingStrategy.h" 
    1010 
    11  
    1211// the devil library 
    1312#include <IL/il.h> 
     
    1514#include <IL/ilut.h> 
    1615 
     16#ifdef USE_CG 
     17 
    1718#include <Cg/cg.h> 
    1819#include <Cg/cgGL.h> 
    1920 
    20 //#include <QtOpenGL> 
    2121 
    2222namespace GtpVisibilityPreprocessor { 
     
    659659         
    660660        const float leftDist = -0.5f * mWidth + mWidth * ((float)x + 0.5f) / mTexWidth; 
    661         //const float leftDist = 0.5f * mWidth - mWidth * ((float)x + 0.5f) / mTexWidth; 
    662          
    663         const float upDist = -0.5f * mWidth + mWidth * ((float)y + 0.5f) / mTexHeight; 
    664         //const float upDist = 0.5f * mWidth - mWidth * ((float)y + 0.5f) / mTexHeight; 
     661        const float upDist   = -0.5f * mWidth + mWidth * ((float)y + 0.5f) / mTexHeight; 
    665662 
    666663        hitPoint = mViewPoint +  
     
    693690 
    694691 
    695 void GlobalLinesRenderer::ComputeBoundingQuad(float &xMin,  
    696                                                                                           float &yMin,  
    697                                                                                           float &xMax, 
    698                                                                                           float &yMax) 
     692void GlobalLinesRenderer::ComputeBoundingQuad(int &xMin,  
     693                                                                                          int &yMin,  
     694                                                                                          int &xMax, 
     695                                                                                          int &yMax) 
    699696{ 
    700697        const AxisAlignedBox3 bbox = mPreprocessor->mKdTree->GetBox(); 
     
    704701        m.Invert(); 
    705702 
    706         Vector3 eye(m.x[0][0], m.x[0][1], m.x[0][2]); 
    707         Vector3 up(m.x[1][0], m.x[1][1], m.x[1][2]); 
    708         Vector3 left(m.x[2][0], m.x[2][1], m.x[2][2]); 
     703        Vector3 eye(m.x[0][0], m.x[1][0], m.x[2][0]); 
     704        Vector3 up(m.x[0][0], m.x[1][1], m.x[2][1]); 
     705        Vector3 left(m.x[0][2], m.x[1][2], m.x[2][2]); 
    709706 
    710707        Vector3 boxMin(1e20f); 
    711708        Vector3 boxMax(-1e20f); 
    712709         
    713 /*      for (int i = 0; i < 6; ++ i) 
    714         { 
    715                 Vector3 pt; 
     710        for (int i = 0; i < 8; ++ i) 
     711        { 
     712        Vector3 vtx; 
     713 
     714                bbox.GetVertex(i, vtx); 
     715 
     716                Vector3 pt = vtx.x * eye + vtx.y * up + vtx.z * left; 
     717 
    716718                // TODO 
    717                 if (boxMin.x < pt[i].x) 
    718                         boxMin.x = pt[i].x; 
     719                if (boxMin.x > pt.x) 
     720                        boxMin.x = pt.x; 
    719721                 
    720                 if (boxMin.y < pt[i].y) 
    721                         boxMin.y = pt[i].y; 
    722  
    723                 if (boxMin.z < pt[i].z) 
    724                         boxMin.z = pt[i].z; 
    725         } 
    726 */ 
    727         xMin = boxMin.x; 
    728         yMin = boxMin.y; 
    729  
    730         xMax = boxMax.x; 
    731         yMax = boxMax.y; 
     722                if (boxMin.y > pt.y) 
     723                        boxMin.y = pt.y; 
     724 
     725                if (boxMin.z > pt.z) 
     726                        boxMin.z = pt.z; 
     727 
     728                if (boxMax.x < pt.x) 
     729                        boxMax.x = pt.x; 
     730                 
     731                if (boxMax.y < pt.y) 
     732                        boxMax.y = pt.y; 
     733 
     734                if (boxMax.z < pt.z) 
     735                        boxMax.z = pt.z; 
     736        } 
     737 
     738        cout << "xmin: " << boxMin.x << " ymin " << boxMin.y << " xmax: " << boxMax.x << " ymax: " << boxMax.y << endl; 
     739 
     740        xMin = (int)(-0.5f * mWidth + mWidth * (boxMin.x + 0.5f) / mTexWidth); 
     741        yMin = (int)(-0.5f * mWidth + mWidth * (boxMin.y + 0.5f) / mTexHeight); 
     742        xMax = (int)(-0.5f * mWidth + mWidth * (boxMax.x + 0.5f) / mTexWidth); 
     743        yMax = (int)(-0.5f * mWidth + mWidth * (boxMax.y + 0.5f) / mTexHeight); 
    732744} 
    733745 
     
    757769                } 
    758770        } 
     771 
     772        int xMin, yMin, xMax, yMax; 
     773        ComputeBoundingQuad(xMin, yMin, xMax, yMax); 
     774         
     775        cout << "xmin2: " << xMin << " ymin " << yMin << " xmax: " << xMax << " ymax: " << yMax << endl; 
    759776 
    760777        ///////////////// 
     
    10811098} 
    10821099 
    1083  
    1084 } 
     1100} 
     1101 
     1102#endif 
Note: See TracChangeset for help on using the changeset viewer.