- Timestamp:
- 02/19/07 09:16:59 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/histogram.cpp
r2090 r2127 14 14 using namespace VMI; 15 15 16 void VMI::printHistogram( GLuint histoGram[][4]) {16 void VMI::printHistogram(int histoGram[][4]) { 17 17 int i; 18 18 … … 23 23 } 24 24 25 void VMI::plotHistogram( GLuint histoGram[][4]) {25 void VMI::plotHistogram(int histoGram[][4]) { 26 26 int i; 27 GLuint iLargest = 0; // Largest histogram value27 int iLargest = 0; // Largest histogram value 28 28 GLfloat maxHeight = height / 2.0f; 29 29 … … 72 72 } 73 73 74 GLuint **VMI::initHistogram(GLuint numTriangles, GLuint numCameras) {75 GLuint i;76 GLuint **histogram;77 78 histogram = ( GLuint **)malloc(sizeof(GLuint *) * numCameras);74 int **VMI::initHistogram(int numTriangles, int numCameras) { 75 int i; 76 int **histogram; 77 78 histogram = (int **)malloc(sizeof(int *) * numCameras); 79 79 80 80 if (histogram == NULL) { … … 84 84 85 85 for (i=0; i<numCameras; i++) 86 histogram[i] = ( GLuint *)malloc(sizeof(GLuint) * (numTriangles + 1)); // + 1 because the last is the numPixels of the background86 histogram[i] = (int *)malloc(sizeof(int) * (numTriangles + 1)); // + 1 because the last is the numPixels of the background 87 87 88 88 // Fill the histogram buffer with 0 89 89 for (i=0; i<numCameras; i++) 90 memset(histogram[i], 0, sizeof( GLuint) * (numTriangles + 1));90 memset(histogram[i], 0, sizeof(int) * (numTriangles + 1)); 91 91 92 92 return histogram; 93 93 } 94 94 95 void VMI::deleteHistogram( GLuint **histogram, GLuint numCameras) {96 GLuint i;95 void VMI::deleteHistogram(int **histogram, int numCameras) { 96 int i; 97 97 98 98 for (i=0;i<numCameras;i++) … … 102 102 } 103 103 104 void VMI::printFullHistogram( GLuint **histogram, GLuint numCameras, GLuint numTriangles) {105 GLuint i, j;104 void VMI::printFullHistogram(int **histogram, int numCameras, int numTriangles) { 105 int i, j; 106 106 107 107 printf("\n"); … … 116 116 } 117 117 118 void VMI::getSubHistogram( GLuint subHistoGram[][4]) {118 void VMI::getSubHistogram(int subHistoGram[][4]) { 119 119 //printf("Computing histogram...\n"); 120 120 // Define the histogram … … 137 137 } 138 138 139 void VMI::copySubHistogram(Color *colors, GLuint *histogram, GLuint begin, GLuint end, GLuint subHistoGram[][4]) {140 GLuint i;139 void VMI::copySubHistogram(Color *colors, int *histogram, int begin, int end, int subHistoGram[][4]) { 140 int i; 141 141 GLubyte r, g, b, a; 142 GLuint h = 0;142 int h = 0; 143 143 144 144 for (i=begin; i<end; i++) { … … 165 165 } 166 166 167 void VMI::getSWHistogram( GLuint *histogram, GLubyte *pixels) {167 void VMI::getSWHistogram(int *histogram, GLubyte *pixels) { 168 168 GLubyte r, g, b, a; 169 GLuint i, t, p, numPixels = width * height;169 int i, t, p, numPixels = width * height; 170 170 171 171 glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); … … 188 188 189 189 void VMI::getBoundingBox(Change *c, GLfloat min[3], GLfloat max[3]) { 190 GLuint i, j, t, v;190 int i, j, t, v; 191 191 GLfloat maxx = 0.0f, minx = 0.0f, 192 192 maxy = 0.0f, miny = 0.0f, … … 194 194 195 195 /* get the max/mins */ 196 for (i=0; i< (GLuint)c->numMod; i++) {196 for (i=0; i<c->numMod; i++) { 197 197 t = c->modified[i].id; 198 198 … … 217 217 } 218 218 219 for (i=0; i< (GLuint)c->numDel; i++) {219 for (i=0; i<c->numDel; i++) { 220 220 t = c->deleted[i].id; 221 221 … … 322 322 } 323 323 324 void VMI::getSWHistogramWin( GLuint *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c) {324 void VMI::getSWHistogramWin(int *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c) { 325 325 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)); 328 328 GLint minw[2], maxw[2], ox, oy, h, w; 329 329 … … 369 369 } 370 370 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; 373 373 374 374 histogram[t + 1] = histoAux[t + 1]; … … 379 379 } 380 380 381 void VMI::getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, GLuint *histogram) {382 GLuint i, v1, v2, v3;381 void VMI::getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, int *histogram) { 382 int i, v1, v2, v3; 383 383 GLint area, totalArea = 0; 384 384 … … 432 432 } 433 433 434 void VMI::resetSWHistogram( GLuint *histogram, GLuint numTriangles) {434 void VMI::resetSWHistogram(int *histogram, int numTriangles) { 435 435 436 436 // 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.