Ignore:
Timestamp:
Mar 6, 2012 10:51:13 AM (12 years ago)
Author:
ldelgass
Message:

Fix brace nesting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/ParticleSystem.cpp

    r2806 r2807  
    3535//#define TEST
    3636// TEST
    37 extern void* LoadFlowDx(const char* fname, int& width, int& height, int&depth,
    38                         float& min, float& max, float& nonzero_min,
    39                         float& axisScaleX, float& axisScaleY, float& axisScaleZ);
    40 extern void* LoadFlowRaw(const char* fname, int width, int height, int depth,
    41                          float& min, float& max, float& nonzero_min,
    42                          float& axisScaleX, float& axisScaleY, float& axisScaleZ,
    43                          int skipByte, bool bigEndian);
    44 extern void* LoadProcessedFlowRaw(const char* fname, int width, int height, int depth,
    45                                   float min, float max,
    46                                   float& axisScaleX, float& axisScaleY, float& axisScaleZ, int skipByte);
    47 extern void LoadProcessedFlowRaw(const char* fname, int width, int height, int depth,
    48                                  float* data);
     37extern void*
     38LoadFlowDx(const char* fname, int& width, int& height, int&depth,
     39           float& min, float& max, float& nonzero_min,
     40           float& axisScaleX, float& axisScaleY, float& axisScaleZ);
     41
     42extern void*
     43LoadFlowRaw(const char* fname, int width, int height, int depth,
     44            float& min, float& max, float& nonzero_min,
     45            float& axisScaleX, float& axisScaleY, float& axisScaleZ,
     46            int skipByte, bool bigEndian);
     47
     48extern void*
     49LoadProcessedFlowRaw(const char* fname, int width, int height, int depth,
     50                     float min, float max,
     51                     float& axisScaleX, float& axisScaleY, float& axisScaleZ,
     52                     int skipByte);
     53
     54extern void
     55LoadProcessedFlowRaw(const char* fname, int width, int height, int depth,
     56                     float* data);
    4957
    5058inline float randomRange(float rangeMin, float rangeMax)
     
    6977}
    7078
    71 void* ParticleSystem::dataLoadMain(void* data)
     79void* ParticleSystem::dataLoadMain(void *data)
    7280{
    7381    ParticleSystem* particleSystem = (ParticleSystem*) data;
    7482    CircularFifo<float*, 10>& queue = particleSystem->_queue;
    75        
     83
    7684    // TBD..
    7785    //float min = particleSystem->_time_series_vel_mag_min;
     
    8593    float flowHeight = particleSystem->_flowHeight;
    8694    float flowDepth = particleSystem->_flowDepth;
    87        
     95
    8896    const char* fileNameFormat = particleSystem->_fileNameFormat.c_str();
    8997    char buff[256];
     
    108116                ++curIndex;
    109117            }
    110         }
     118        }
     119    }
    111120
    112121    return 0;
     
    130139    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    131140
    132 
    133141    float *img = new float[DIM*DIM];
    134142
     
    139147        for (int x = 0; x < DIM; x++) {
    140148            // Clamping the edges to zero allows Nvidia's blend optimizations to do their thing.
    141             if (x==0 || x==DIM-1 || y==0 || y==DIM-1) {
     149            if (x == 0 || x == DIM-1 || y == 0 || y == DIM-1) {
    142150                img[y*DIM+x] = 0;
    143151            } else {
     
    176184                               bool timeVaryingData,
    177185                               int flowFileStartIndex, int flowFileEndIndex) :
    178   _width(width), _height(height)
     186    _width(width),
     187    _height(height)
    179188{
    180189    ////////////////////////////////
     
    243252    int index = fileName.rfind('.');
    244253    std::string ext = fileName.substr(index + 1, fileName.size() - (index + 1));
    245     float* data = 0;
    246 
     254    float *data = 0;
    247255
    248256    if (this->isTimeVaryingField()) {
     
    270278        } else if (ext == "data") {
    271279            data = (float*) LoadFlowRaw(fileName.c_str(), _flowWidth, _flowHeight, _flowDepth, min, max, nonzero_min, axisScaleX, axisScaleY, axisScaleZ, 0, true);
     280#endif
    272281        }
    273 #endif 
    274282        //_criticalPoints = find_critical_points((vrVector4f*) data, _flowWidth,  _flowHeight,  _flowDepth);
    275283        //algorithm_test((vrVector4f*) data,  _flowWidth,  _flowHeight,  _flowDepth);
     
    339347#ifdef notdef
    340348    // TBD..
    341       std::string path = vrFilePath::getInstance()->getPath("arrows_red_bg.bmp");
    342       AUX_RGBImageRec *pTextureImage = auxDIBImageLoad(path.c_str());
    343       unsigned char* pixels = new unsigned char [pTextureImage->sizeX * pTextureImage->sizeY * sizeof(unsigned char) * 4];
    344       unsigned char* srcPixels = pTextureImage->data;
    345       unsigned char* dstPixels = pixels;
    346       for (int i = 0; i < pTextureImage->sizeX * pTextureImage->sizeY; ++i) {
    347           *dstPixels = *srcPixels; ++srcPixels;
    348           *(dstPixels + 1) = *srcPixels; ++srcPixels;
    349           *(dstPixels + 2) = *srcPixels; ++srcPixels;
    350 
    351           if ((*dstPixels > 127) && (*(dstPixels + 1) < 127) && (*(dstPixels + 2) < 127)) {
    352               *(dstPixels + 3) = 0;
    353           } else {
    354               *(dstPixels + 3) = 255;
    355           }
    356 
    357           dstPixels += 4;
    358       }
    359 
    360       _arrows->setPixels(CF_RGBA, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pixels);
     349    std::string path = vrFilePath::getInstance()->getPath("arrows_red_bg.bmp");
     350    AUX_RGBImageRec *pTextureImage = auxDIBImageLoad(path.c_str());
     351    unsigned char* pixels = new unsigned char [pTextureImage->sizeX * pTextureImage->sizeY * sizeof(unsigned char) * 4];
     352    unsigned char* srcPixels = pTextureImage->data;
     353    unsigned char* dstPixels = pixels;
     354    for (int i = 0; i < pTextureImage->sizeX * pTextureImage->sizeY; ++i) {
     355        *dstPixels = *srcPixels; ++srcPixels;
     356        *(dstPixels + 1) = *srcPixels; ++srcPixels;
     357        *(dstPixels + 2) = *srcPixels; ++srcPixels;
     358
     359        if ((*dstPixels > 127) && (*(dstPixels + 1) < 127) && (*(dstPixels + 2) < 127)) {
     360            *(dstPixels + 3) = 0;
     361        } else {
     362            *(dstPixels + 3) = 255;
     363        }
     364
     365        dstPixels += 4;
     366    }
     367
     368    _arrows->setPixels(CF_RGBA, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pixels);
    361369#endif
    362370
     
    460468{
    461469    CGerror lastError = cgGetError();
    462     if(lastError) {
     470    if (lastError) {
    463471        const char *listing = cgGetLastListing(_context);
    464472        ERROR("\n---------------------------------------------------\n");
     
    623631        pinfo[i] = _particles[i];
    624632    }
    625        
     633
    626634    glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
    627635
     
    977985    glDisable(GL_BLEND);
    978986    glDisable(GL_DEPTH_TEST);
    979        
     987
    980988    //glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, psys_fbo[_destPosIndex]);
    981989    //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     
    10551063    if (this->isTimeVaryingField()) {
    10561064        static float oldTime = vrGetTimeStamp();
     1065#ifdef WANT_TRACE
    10571066        static int index = 0;
     1067#endif
    10581068        float time = vrGetTimeStamp();
    10591069        if ((time - oldTime) > 2.0) {
     
    10611071                float* data = 0;
    10621072                if (_queue.top(data)) {
     1073#ifdef WANT_TRACE
    10631074                    float t = clock() /(float) CLOCKS_PER_SEC;
    10641075                    _vectorFields[0]->updatePixels(data);
    10651076                    float ti = clock() / (float) CLOCKS_PER_SEC;
    10661077                    TRACE("pixels %f\n",ti - t);
     1078#endif
    10671079                    _queue.pop();
    10681080                    oldTime = time;
     
    12771289
    12781290    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    1279        
     1291
    12801292    // INIT NEW END
    12811293    /////////////////////////////
     
    13471359
    13481360            //if (i >= _maxUsedIndex)
    1349             //  while (!_usedIndices[_maxUsedIndex])
    1350             //          _maxUsedIndex--;
     1361            //    while (!_usedIndices[_maxUsedIndex])
     1362            //        _maxUsedIndex--;
    13511363        }
    13521364    }
     
    15311543{
    15321544    if (count > 1) {
    1533         mergeSort(count >> 1); 
     1545        mergeSort(count >> 1);
    15341546        merge(count, 1);
    15351547    }
     
    16461658        //glColorPointer(4, GL_FLOAT, 0, 0);
    16471659
    1648         ::glDrawElements(GL_LINES, _particleCount * 2 * (_currentStreamlineIndex - 1), GL_UNSIGNED_INT, _indexBuffer);
     1660        ::glDrawElements(GL_LINES, _particleCount * 2 * (_currentStreamlineIndex - 1),
     1661                         GL_UNSIGNED_INT, _indexBuffer);
    16491662        glDisableClientState(GL_VERTEX_ARRAY);
    16501663        glPopMatrix();
     
    17321745            cgGLDisableProfile(CG_PROFILE_FP40);
    17331746
    1734 
    17351747            glDepthMask(GL_TRUE);
    17361748
     
    17731785#endif
    17741786        } else {
    1775                 if (_drawBBoxEnabled) drawUnitBox();
    1776 
    1777                 glColor3f(1, 1, 1);
    1778                 glEnableClientState(GL_VERTEX_ARRAY);
    1779                 //glEnableClientState(GL_COLOR_ARRAY);
    1780                 glPointSize(10);
    1781                 _vertices->SetPointer(0);
    1782                 //glBindBufferARB(GL_ARRAY_BUFFER, _colorBufferID);
    1783                 //glColorPointer(4, GL_FLOAT, 0, 0);
    1784                 //glBindBufferARB(GL_ARRAY_BUFFER, 0);
    1785                 glDrawArrays(GL_POINTS, 0, _particleMaxCount);
    1786 
    1787                 glPointSize(1);
    1788                 _vertices->SetPointer(0);
    1789                 //glBindBufferARB(GL_ARRAY_BUFFER, _colorBufferID);
    1790                 //glColorPointer(4, GL_FLOAT, 0, 0);
    1791                 //glBindBufferARB(GL_ARRAY_BUFFER, 0);
    1792                 glDrawArrays(GL_POINTS, 0, _particleMaxCount);
    1793 
    1794                 glDisableClientState(GL_VERTEX_ARRAY);
     1787            if (_drawBBoxEnabled) drawUnitBox();
     1788
     1789            glColor3f(1, 1, 1);
     1790            glEnableClientState(GL_VERTEX_ARRAY);
     1791            //glEnableClientState(GL_COLOR_ARRAY);
     1792            glPointSize(10);
     1793            _vertices->SetPointer(0);
     1794            //glBindBufferARB(GL_ARRAY_BUFFER, _colorBufferID);
     1795            //glColorPointer(4, GL_FLOAT, 0, 0);
     1796            //glBindBufferARB(GL_ARRAY_BUFFER, 0);
     1797            glDrawArrays(GL_POINTS, 0, _particleMaxCount);
     1798
     1799            glPointSize(1);
     1800            _vertices->SetPointer(0);
     1801            //glBindBufferARB(GL_ARRAY_BUFFER, _colorBufferID);
     1802            //glColorPointer(4, GL_FLOAT, 0, 0);
     1803            //glBindBufferARB(GL_ARRAY_BUFFER, 0);
     1804            glDrawArrays(GL_POINTS, 0, _particleMaxCount);
     1805
     1806            glDisableClientState(GL_VERTEX_ARRAY);
    17951807        }
    17961808
     
    18021814            glBegin(GL_POINTS);
    18031815            for (iter = _criticalPoints->begin(); iter != _criticalPoints->end(); ++iter) {
    1804                 glVertex3f((*iter).x, (*iter).y, (*iter).z);           
     1816                glVertex3f((*iter).x, (*iter).y, (*iter).z);
    18051817            }
    18061818            glEnd();
Note: See TracChangeset for help on using the changeset viewer.