Ignore:
Timestamp:
02/19/07 09:16:59 (17 years ago)
Author:
gumbau
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/histogram.cpp

    r2090 r2127  
    1414using namespace VMI; 
    1515 
    16 void VMI::printHistogram(GLuint histoGram[][4]) { 
     16void VMI::printHistogram(int histoGram[][4]) { 
    1717    int i; 
    1818    
     
    2323} 
    2424 
    25 void VMI::plotHistogram(GLuint histoGram[][4]) { 
     25void VMI::plotHistogram(int histoGram[][4]) { 
    2626    int i; 
    27     GLuint iLargest = 0;  // Largest histogram value 
     27    int iLargest = 0;  // Largest histogram value 
    2828    GLfloat maxHeight = height / 2.0f; 
    2929         
     
    7272} 
    7373 
    74 GLuint **VMI::initHistogram(GLuint numTriangles, GLuint numCameras) { 
    75     GLuint i; 
    76     GLuint **histogram; 
    77  
    78     histogram = (GLuint **)malloc(sizeof(GLuint *) * numCameras); 
     74int **VMI::initHistogram(int numTriangles, int numCameras) { 
     75    int i; 
     76    int **histogram; 
     77 
     78    histogram = (int **)malloc(sizeof(int *) * numCameras); 
    7979 
    8080    if (histogram == NULL) { 
     
    8484 
    8585    for (i=0; i<numCameras; i++) 
    86     histogram[i] = (GLuint *)malloc(sizeof(GLuint) * (numTriangles + 1)); // + 1 because the last is the numPixels of the background 
     86    histogram[i] = (int *)malloc(sizeof(int) * (numTriangles + 1)); // + 1 because the last is the numPixels of the background 
    8787 
    8888    // Fill the histogram buffer with 0 
    8989    for (i=0; i<numCameras; i++) 
    90     memset(histogram[i], 0, sizeof(GLuint) * (numTriangles + 1)); 
     90    memset(histogram[i], 0, sizeof(int) * (numTriangles + 1)); 
    9191 
    9292    return histogram; 
    9393} 
    9494 
    95 void VMI::deleteHistogram(GLuint **histogram, GLuint numCameras) { 
    96     GLuint i; 
     95void VMI::deleteHistogram(int **histogram, int numCameras) { 
     96    int i; 
    9797     
    9898    for (i=0;i<numCameras;i++) 
     
    102102} 
    103103 
    104 void VMI::printFullHistogram(GLuint **histogram, GLuint numCameras, GLuint numTriangles) { 
    105     GLuint i, j; 
     104void VMI::printFullHistogram(int **histogram, int numCameras, int numTriangles) { 
     105    int i, j; 
    106106     
    107107    printf("\n"); 
     
    116116} 
    117117 
    118 void VMI::getSubHistogram(GLuint subHistoGram[][4]) { 
     118void VMI::getSubHistogram(int subHistoGram[][4]) { 
    119119    //printf("Computing histogram...\n"); 
    120120    // Define the histogram 
     
    137137} 
    138138 
    139 void VMI::copySubHistogram(Color *colors, GLuint *histogram, GLuint begin, GLuint end, GLuint subHistoGram[][4]) { 
    140     GLuint i; 
     139void VMI::copySubHistogram(Color *colors, int *histogram, int begin, int end, int subHistoGram[][4]) { 
     140    int i; 
    141141    GLubyte r, g, b, a; 
    142     GLuint h = 0; 
     142    int h = 0; 
    143143 
    144144    for (i=begin; i<end; i++) { 
     
    165165} 
    166166 
    167 void VMI::getSWHistogram(GLuint *histogram, GLubyte *pixels) { 
     167void VMI::getSWHistogram(int *histogram, GLubyte *pixels) { 
    168168    GLubyte r, g, b, a; 
    169     GLuint i, t, p, numPixels = width * height; 
     169    int i, t, p, numPixels = width * height; 
    170170 
    171171    glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); 
     
    188188 
    189189void VMI::getBoundingBox(Change *c, GLfloat min[3], GLfloat max[3]) { 
    190     GLuint  i, j, t, v; 
     190    int  i, j, t, v; 
    191191    GLfloat maxx = 0.0f, minx = 0.0f,  
    192192            maxy = 0.0f, miny = 0.0f, 
     
    194194     
    195195    /* get the max/mins */ 
    196     for (i=0; i<(GLuint)c->numMod; i++) { 
     196    for (i=0; i<c->numMod; i++) { 
    197197        t = c->modified[i].id; 
    198198         
     
    217217    } 
    218218 
    219     for (i=0; i<(GLuint)c->numDel; i++) { 
     219    for (i=0; i<c->numDel; i++) { 
    220220        t = c->deleted[i].id; 
    221221         
     
    322322} 
    323323 
    324 void VMI::getSWHistogramWin(GLuint *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c) { 
     324void VMI::getSWHistogramWin(int *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c) { 
    325325    GLubyte r, g, b, a; 
    326     GLuint i, t, p, numPixels, 
    327           *histoAux = (GLuint *)calloc(mesh->numTriangles + 1, sizeof(GLuint)); 
     326    int i, t, p, numPixels, 
     327          *histoAux = (int *)calloc(mesh->numTriangles + 1, sizeof(int)); 
    328328    GLint minw[2], maxw[2], ox, oy, h, w; 
    329329 
     
    369369    } 
    370370 
    371     for (i=0; i<(GLuint)c->numMod; i++) { 
    372         t = (GLuint)c->modified[i].id; 
     371    for (i=0; i<c->numMod; i++) { 
     372        t = c->modified[i].id; 
    373373 
    374374        histogram[t + 1] = histoAux[t + 1];  
     
    379379} 
    380380 
    381 void VMI::getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, GLuint *histogram) { 
    382     GLuint i, v1, v2, v3; 
     381void VMI::getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, int *histogram) { 
     382    int i, v1, v2, v3; 
    383383    GLint area, totalArea = 0; 
    384384 
     
    432432} 
    433433 
    434 void VMI::resetSWHistogram(GLuint *histogram, GLuint numTriangles) { 
     434void VMI::resetSWHistogram(int *histogram, int numTriangles) { 
    435435 
    436436    // Fill the histogram buffer with 0 
    437     memset(histogram, 0, sizeof(GLuint) * (numTriangles + 1)); 
    438 } 
     437    memset(histogram, 0, sizeof(int) * (numTriangles + 1)); 
     438} 
Note: See TracChangeset for help on using the changeset viewer.