Changeset 2818 for trunk


Ignore:
Timestamp:
Mar 7, 2012 8:46:09 AM (12 years ago)
Author:
ldelgass
Message:

Fix spelling of some identifiers, formatting fixes

Location:
trunk/packages/vizservers/nanovis
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/ParticleEmitter.h

    r2817 r2818  
    1717    float _minLifeTime;
    1818    float _maxLifeTime;
    19        
     19
    2020    // [0..1] * _maxPositionOffset;
    2121    vrVector3f _maxPositionOffset;
  • trunk/packages/vizservers/nanovis/ParticleSystem.cpp

    r2817 r2818  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
     2#include "nvconf.h"
    23
    34#include <time.h>
     
    67#include <pthread.h>
    78
     9#ifdef _WIN32
     10#include <GL/glaux.h>
     11#else
     12#ifdef HAVE_OPENCV_H
     13#include <opencv/cv.h>
     14#endif
     15#ifdef HAVE_OPENCV_HIGHGUI_H
     16#include <opencv/highgui.h>
     17#endif
     18#endif
     19
    820#include <vr3d/vr3d.h>
    921#include <vr3d/vrTexture3D.h>
     
    1628#include <vrmath/vrVector3f.h>
    1729#include <vrmath/vrVector4f.h>
    18 
    19 #ifdef _WIN32
    20 #include <GL/glaux.h>
    21 #else
    22 #ifdef notdef
    23 #include <opencv/cv.h>
    24 #include <opencv/highgui.h>
    25 #endif
    26 #endif
    2730
    2831#include "ParticleSystem.h"
     
    226229    _currentTime = 0;
    227230    _sortEnabled = false;
    228     _glypEnabled = false;
     231    _glyphEnabled = false;
    229232    _advectionEnabled = false;
    230233    _streamlineEnabled = false;
     
    347350    _arrows->setPixels(CF_RGB, DT_UBYTE, pTextureImage->width, pTextureImage->height, (void*) pTextureImage->imageData);
    348351#else
    349 
    350352#ifdef notdef
    351353    // TBD..
     
    928930        return _sortEnabled;
    929931        break;
    930     case PS_GLYPE :
    931         return _glypEnabled;
     932    case PS_GLYPH :
     933        return _glyphEnabled;
    932934        break;
    933935    case PS_DRAW_BBOX :
     
    948950        _sortEnabled = true;
    949951        break;
    950     case PS_GLYPE :
    951         _glypEnabled = true;
     952    case PS_GLYPH :
     953        _glyphEnabled = true;
    952954        break;
    953955    case PS_DRAW_BBOX :
     
    969971        _sortEnabled = false;
    970972        break;
    971     case PS_GLYPE :
    972         _glypEnabled = false;
     973    case PS_GLYPH :
     974        _glyphEnabled = false;
    973975        break;
    974976    case PS_DRAW_BBOX :
     
    16731675        glScalef(_scalex, _scaley, _scalez);
    16741676        glTranslatef(-0.5f, -0.5f, -0.5f);
    1675         if (_glypEnabled) {
     1677        if (_glyphEnabled) {
    16761678            if (_drawBBoxEnabled) drawUnitBox();
    16771679            glColor3f(1, 1, 1);
  • trunk/packages/vizservers/nanovis/ParticleSystem.h

    r2817 r2818  
    7070    enum EnableEnum {
    7171        PS_SORT = 1,
    72         PS_GLYPE = 2,
     72        PS_GLYPH = 2,
    7373        PS_DRAW_BBOX = 4,
    7474        PS_ADVECTION = 8,
     
    155155    color4 *_colorBuffer;
    156156    unsigned _colorBufferID;
    157 
    158157    //////////////////////////////////////////
    159158    vrTexture2D *_arrows;
     
    166165
    167166    bool _sortEnabled;
    168     bool _glypEnabled;
     167    bool _glyphEnabled;
    169168    bool _drawBBoxEnabled;
    170169    bool _advectionEnabled;
     
    268267    void createSortRenderTargets();
    269268    void createStreamlineRenderTargets();
    270 
    271269    void advectStreamlines();
    272270    void renderStreamlines();
  • trunk/packages/vizservers/nanovis/ParticleSystemFactory.cpp

    r2817 r2818  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
     2#include <stdio.h>
     3#include <string.h>
     4
     5#include <expat.h>
    26
    37#include <vrutil/vrFilePath.h>
     
    59#include "ParticleSystemFactory.h"
    610#include "ParticleSystem.h"
    7 
    8 #include <stdio.h>
    911#include "Trace.h"
    1012
    11 #include <expat.h>
    12 
    13 #include <string.h>
    14 
    1513#define BUFSIZE 4096
    1614
    1715void ParticleSystemFactory::text(void *data, const XML_Char *txt, int len)
    1816{
    19 } 
     17}
    2018
    2119void ParticleSystemFactory::startElement(void *userData, const char *elementName, const char **attrs)
     
    8583    int numOfUsedParticles = -1;
    8684    bool sortEnabled = false;
    87     bool glypEnabled = false;
     85    bool glyphEnabled = false;
    8886    bool bboxVisible = false;
    8987    bool advectionEnabled = false;
     
    114112            if (!strcmp(attrs[i + 1], "true"))
    115113                sortEnabled = true;
    116         } else if (!strcmp(attrs[i], "glyp-enabled")) {
    117             if (!strcmp(attrs[i + 1], "true"))
    118                 glypEnabled = true;
     114        } else if (!strcmp(attrs[i], "glyph-enabled")) {
     115            if (!strcmp(attrs[i + 1], "true"))
     116                glyphEnabled = true;
    119117        } else if (!strcmp(attrs[i], "bbox-draw-enabled")) {
    120118            if (!strcmp(attrs[i + 1], "true"))
     
    158156            dir = path.substr(0, index + 1);
    159157            path = dir + fileName;
    160 
    161             _newParticleSystem = new ParticleSystem(width, height, path.c_str(), fieldWidth, fieldHeight, fieldDepth, timeVaryingData, startIndex, endIndex);
     158               
     159            _newParticleSystem =
     160                new ParticleSystem(width, height, path.c_str(),
     161                                   fieldWidth, fieldHeight, fieldDepth,
     162                                   timeVaryingData, startIndex, endIndex);
    162163        } else {
    163             _newParticleSystem = new ParticleSystem(width, height, fileName.c_str(), fieldWidth, fieldHeight, fieldDepth, timeVaryingData, startIndex, endIndex);
     164            _newParticleSystem =
     165                new ParticleSystem(width, height, fileName.c_str(),
     166                                   fieldWidth, fieldHeight, fieldDepth,
     167                                   timeVaryingData, startIndex, endIndex);
    164168        }
    165169    } else {
    166170        std::string path = vrFilePath::getInstance()->getPath(fileName.c_str());
    167         _newParticleSystem = new ParticleSystem(width, height, path.c_str(), fieldWidth, fieldHeight, fieldDepth, timeVaryingData, startIndex, endIndex);
     171        _newParticleSystem =
     172            new ParticleSystem(width, height, path.c_str(),
     173                               fieldWidth, fieldHeight, fieldDepth,
     174                               timeVaryingData, startIndex, endIndex);
    168175    }
    169176
    170177    if (pointSize != -1.0f) _newParticleSystem->setDefaultPointSize(pointSize);
    171178    if (sortEnabled) _newParticleSystem->enable(ParticleSystem::PS_SORT);
    172     if (glypEnabled) _newParticleSystem->enable(ParticleSystem::PS_GLYPE);
     179    if (glyphEnabled) _newParticleSystem->enable(ParticleSystem::PS_GLYPH);
    173180    if (bboxVisible) _newParticleSystem->enable(ParticleSystem::PS_DRAW_BBOX);
    174181    if (advectionEnabled) _newParticleSystem->enable(ParticleSystem::PS_ADVECTION);
  • trunk/packages/vizservers/nanovis/ParticleSystemFactory.h

    r2817 r2818  
    1212{
    1313    ParticleSystem *_newParticleSystem;
    14 public :
     14public:
    1515    ParticleSystemFactory();
    1616    ~ParticleSystemFactory();
     
    1818    ParticleSystem *create(const std::string& fileName);
    1919
    20 private :
     20private:
    2121    void parseParticleSysInfo(const char **attrs);
    2222    void parseEmitterInfo(const char **attrs);
  • trunk/packages/vizservers/nanovis/RpDX.h

    r2798 r2818  
    1818#define RAPPTURE_DX_H
    1919
    20 // #include "rappture2.h"
    2120#include <dx/dx.h>
    2221#include <RpOutcome.h>
  • trunk/packages/vizservers/nanovis/Texture2D.h

    r2798 r2818  
    2020#include <GL/glew.h>
    2121
    22 class Texture2D{
    23        
     22class Texture2D
     23{
    2424public:
    2525  int width;
  • trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp

    r2798 r2818  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
     2#include "nvconf.h"
     3
    24#include <GL/glew.h>
    35#ifdef _WIN32
     
    57#endif
    68#include <GL/gl.h>
    7 #include "VelocityArrowsSlice.h"
    89#ifdef WIN32
    910#include <GL/glaux.h>
    1011#else
    11 //#include <opencv/cv.h>
    12 //#include <opencv/highgui.h>
    13 #endif
     12#ifdef HAVE_OPENCV_H
     13#include <opencv/cv.h>
     14#endif
     15#ifdef HAVE_OPENCV_HIGHGUI_H
     16#include <opencv/highgui.h>
     17#endif
     18#endif
     19
     20#include "VelocityArrowsSlice.h"
    1421
    1522#ifdef USE_NANOVIS_LIB
     
    2431{
    2532    _enabled = false;
    26         _context = cgCreateContext();
    27         _vectorFieldGraphicsID = 0;
    28         _vfXscale = _vfYscale = _vfZscale = 0;
    29         _slicePos = 0.5f;
    30         _vertexBufferGraphicsID = 0;
    31         axis(2);
    32         //_renderMode = GLYPHES;
    33         _renderMode = LINES;
    34        
    35         _tickCountForMinSizeAxis = 10;
    36 
    37         _queryVelocityFP =
    38 #ifdef USE_NANOVIS_LIB
    39             LoadCgSourceProgram(_context, "queryvelocity.cg", CG_PROFILE_FP30, "main");
    40 #else
    41             cgCreateProgramFromFile(_context, CG_SOURCE, "queryvelocity.cg",
    42                                                         CG_PROFILE_FP30, "main", NULL);
    43             cgGLLoadProgram(_queryVelocityFP);
    44 #endif
    45         _qvVectorFieldParam = cgGetNamedParameter(_queryVelocityFP, "vfield");
    46 
    47         _dirty = true;
    48         _dirtySamplingPosition = true;
    49         _dirtyRenderTarget = true;
    50         _maxVelocityScale.x = _maxVelocityScale.y = _maxVelocityScale.z = 1.0f;
    51 
    52         _renderTargetWidth = 128;
    53         _renderTargetHeight = 128;
    54         _velocities = new Vector3[_renderTargetWidth * _renderTargetHeight];
    55 
    56         ::glGenBuffers(1, &_vertexBufferGraphicsID);
    57         glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vertexBufferGraphicsID);
    58         glBufferDataARB(GL_ARRAY_BUFFER, _renderTargetWidth * _renderTargetHeight * 3 * sizeof(float),
    59                 0, GL_DYNAMIC_DRAW_ARB);
    60         glBindBufferARB(GL_ARRAY_BUFFER, 0);
    61         createRenderTarget();
    62         _pointCount = 0;
    63 
    64 /*
    65         _particleVP =
    66 #ifdef USE_NANOVIS_LIB
    67                 LoadCgSourceProgram(_context, "velocityslicevp.cg", CG_PROFILE_VP40, "vpmain");
    68 #else
    69                 cgCreateProgramFromFile(_context, CG_SOURCE, "velocityslicevp.cg",
    70                                                         CG_PROFILE_VP40, "vpmain", NULL);
    71                 cgGLLoadProgram(_particleVP);
    72 #endif
    73         _mvpParticleParam = cgGetNamedParameter(_particleVP, "mvp");
    74         _mvParticleParam = cgGetNamedParameter(_particleVP, "modelview");
    75         _mvTanHalfFOVParam = cgGetNamedParameter(_particleVP, "tanHalfFOV");
    76 
    77         // TBD..
    78         //_particleFP =
    79 #ifdef USE_NANOVIS_LIB
    80 //                LoadCgSourceProgram(_context, "velocityslicefp.cg", CG_PROFILE_FP40, "fpmain");
    81 #else
    82                 cgCreateProgramFromFile(_context, CG_SOURCE, "velocityslicefp.cg",
    83                                                         CG_PROFILE_FP40, "fpmain", NULL);
    84                 cgGLLoadProgram(_particleFP);
    85 #endif
    86         _vectorParticleParam = cgGetNamedParameter(_particleVP, "vfield");
    87 */
     33    _context = cgCreateContext();
     34    _vectorFieldGraphicsID = 0;
     35    _vfXscale = _vfYscale = _vfZscale = 0;
     36    _slicePos = 0.5f;
     37    _vertexBufferGraphicsID = 0;
     38    axis(2);
     39    //_renderMode = GLYPHS;
     40    _renderMode = LINES;
     41       
     42    _tickCountForMinSizeAxis = 10;
     43
     44    _queryVelocityFP =
     45#ifdef USE_NANOVIS_LIB
     46        LoadCgSourceProgram(_context, "queryvelocity.cg", CG_PROFILE_FP30, "main");
     47#else
     48        cgCreateProgramFromFile(_context, CG_SOURCE, "queryvelocity.cg",
     49                                CG_PROFILE_FP30, "main", NULL);
     50    cgGLLoadProgram(_queryVelocityFP);
     51#endif
     52    _qvVectorFieldParam = cgGetNamedParameter(_queryVelocityFP, "vfield");
     53
     54    _dirty = true;
     55    _dirtySamplingPosition = true;
     56    _dirtyRenderTarget = true;
     57    _maxVelocityScale.x = _maxVelocityScale.y = _maxVelocityScale.z = 1.0f;
     58
     59    _renderTargetWidth = 128;
     60    _renderTargetHeight = 128;
     61    _velocities = new Vector3[_renderTargetWidth * _renderTargetHeight];
     62
     63    ::glGenBuffers(1, &_vertexBufferGraphicsID);
     64    glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vertexBufferGraphicsID);
     65    glBufferDataARB(GL_ARRAY_BUFFER, _renderTargetWidth * _renderTargetHeight * 3 * sizeof(float),
     66                    0, GL_DYNAMIC_DRAW_ARB);
     67    glBindBufferARB(GL_ARRAY_BUFFER, 0);
     68    createRenderTarget();
     69    _pointCount = 0;
     70
     71    /*
     72      _particleVP =
     73#ifdef USE_NANOVIS_LIB
     74          LoadCgSourceProgram(_context, "velocityslicevp.cg", CG_PROFILE_VP40, "vpmain");
     75#else
     76          cgCreateProgramFromFile(_context, CG_SOURCE, "velocityslicevp.cg",
     77                                  CG_PROFILE_VP40, "vpmain", NULL);
     78      cgGLLoadProgram(_particleVP);
     79#endif
     80      _mvpParticleParam = cgGetNamedParameter(_particleVP, "mvp");
     81      _mvParticleParam = cgGetNamedParameter(_particleVP, "modelview");
     82      _mvTanHalfFOVParam = cgGetNamedParameter(_particleVP, "tanHalfFOV");
     83
     84      // TBD..
     85      _particleFP =
     86#ifdef USE_NANOVIS_LIB
     87          LoadCgSourceProgram(_context, "velocityslicefp.cg", CG_PROFILE_FP40, "fpmain");
     88#else
     89          cgCreateProgramFromFile(_context, CG_SOURCE, "velocityslicefp.cg",
     90                                  CG_PROFILE_FP40, "fpmain", NULL);
     91      cgGLLoadProgram(_particleFP);
     92#endif
     93      _vectorParticleParam = cgGetNamedParameter(_particleVP, "vfield");
     94    */
    8895
    8996#ifdef USE_NANOVIS_LIB
    9097
    9198#ifdef WIN32
    92         AUX_RGBImageRec *pTextureImage = auxDIBImageLoad("arrows.bmp");
    93         _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pTextureImage->data);
    94 
    95         _arrowsTex = new Texture2D(pTextureImage->sizeX, pTextureImage->sizeY, GL_FLOAT, GL_LINEAR, 3, (void*) pTextureImage->data);
    96 
    97         //delete pTextureImage;
     99    AUX_RGBImageRec *pTextureImage = auxDIBImageLoad("arrows.bmp");
     100    _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pTextureImage->data);
     101
     102    _arrowsTex = new Texture2D(pTextureImage->sizeX, pTextureImage->sizeY, GL_FLOAT, GL_LINEAR, 3, (void*) pTextureImage->data);
     103
     104    //delete pTextureImage;
    98105#else
    99106    /*
    100107      TRACE("test1\n");
    101         const char *path = R2FilePath::getInstance()->getPath("arrows_flip2.png");
    102         if (path) TRACE("test2 %s\n", path);
    103         else TRACE("tt\n");
    104         IplImage* pTextureImage = cvLoadImage(path);
    105         TRACE("test3\n");
    106         if (pTextureImage)
    107         {
    108             TRACE("file(%s) has been loaded\n", path);
    109             _arrowsTex = new Texture2D(pTextureImage->width, pTextureImage->height, GL_FLOAT, GL_LINEAR, 3, (float*) pTextureImage->imageData);
    110             TRACE("file(%s) has been loaded\n", path);
    111             //cvReleaseImage(&pTextureImage);
    112         }
    113         else
    114         {
    115             TRACE("not found\n");
    116         }
    117         if (path) delete [] path;
    118 */
    119 
    120 #endif
    121 
    122 #else
    123         _arrowsTex = new Texture2D();
    124         _arrowsTex->setWrapS(TW_MIRROR);
    125         _arrowsTex->setWrapT(TW_MIRROR);
     108      const char *path = R2FilePath::getInstance()->getPath("arrows_flip2.png");
     109      if (path) {
     110          TRACE("test2 %s\n", path);
     111      } else {
     112          TRACE("tt\n");
     113      }
     114      IplImage* pTextureImage = cvLoadImage(path);
     115      TRACE("test3\n");
     116      if (pTextureImage) {
     117          TRACE("file(%s) has been loaded\n", path);
     118          _arrowsTex = new Texture2D(pTextureImage->width, pTextureImage->height, GL_FLOAT, GL_LINEAR, 3, (float*) pTextureImage->imageData);
     119          TRACE("file(%s) has been loaded\n", path);
     120          //cvReleaseImage(&pTextureImage);
     121      } else {
     122          TRACE("not found\n");
     123      }
     124      if (path) delete [] path;
     125    */
     126
     127#endif
     128
     129#else
     130    _arrowsTex = new Texture2D();
     131    _arrowsTex->setWrapS(TW_MIRROR);
     132    _arrowsTex->setWrapT(TW_MIRROR);
    126133#ifdef WIN32
    127         AUX_RGBImageRec *pTextureImage = auxDIBImageLoad("arrows.bmp");
    128         _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pTextureImage->data);
    129 
    130         //delete pTextureImage;
    131 #else
    132         IplImage* pTextureImage = cvLoadImage("arrows_flip2.png");
    133         _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->width, pTextureImage->height, (void*) pTextureImage->imageData);
    134 
    135         //cvReleaseImage(&pTextureImage);
     134    AUX_RGBImageRec *pTextureImage = auxDIBImageLoad("arrows.bmp");
     135    _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->sizeX, pTextureImage->sizeY, (void*) pTextureImage->data);
     136
     137    //delete pTextureImage;
     138#else
     139    IplImage* pTextureImage = cvLoadImage("arrows_flip2.png");
     140    _arrowsTex->setPixels(CF_RGB, DT_UBYTE, pTextureImage->width, pTextureImage->height, (void*) pTextureImage->imageData);
     141
     142    //cvReleaseImage(&pTextureImage);
    136143#endif
    137144
     
    150157
    151158#ifdef USE_NANOVIS_LIB
    152         delete _arrowsTex;
    153 #else
    154         _arrowsTex->unref();
    155 #endif
    156         cgDestroyProgram(_particleFP);
    157         cgDestroyProgram(_particleVP);
    158 
    159         glDeleteBuffers(1, &_vertexBufferGraphicsID);
    160         delete [] _velocities;
     159    delete _arrowsTex;
     160#else
     161    _arrowsTex->unref();
     162#endif
     163    cgDestroyProgram(_particleFP);
     164    cgDestroyProgram(_particleVP);
     165
     166    glDeleteBuffers(1, &_vertexBufferGraphicsID);
     167    delete [] _velocities;
    161168}
    162169
    163170void VelocityArrowsSlice::createRenderTarget()
    164171{
    165         glGenFramebuffersEXT(1, &_fbo);
     172    glGenFramebuffersEXT(1, &_fbo);
    166173    glGenTextures(1, &_tex);
    167174
    168175    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fbo);
    169176   
    170         glViewport(0, 0, _renderTargetWidth, _renderTargetHeight);
    171         glMatrixMode(GL_PROJECTION);
    172         glLoadIdentity();
    173         glOrtho(0, _renderTargetWidth, 0, _renderTargetHeight, -10.0f, 10.0f);
    174         glMatrixMode(GL_MODELVIEW);
    175         glLoadIdentity();
     177    glViewport(0, 0, _renderTargetWidth, _renderTargetHeight);
     178    glMatrixMode(GL_PROJECTION);
     179    glLoadIdentity();
     180    glOrtho(0, _renderTargetWidth, 0, _renderTargetHeight, -10.0f, 10.0f);
     181    glMatrixMode(GL_MODELVIEW);
     182    glLoadIdentity();
    176183
    177184    glBindTexture(GL_TEXTURE_RECTANGLE_NV, _tex);
    178185    glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    179186    glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    180         glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    181         glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     187    glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     188    glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    182189
    183190    glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV,
    184         _renderTargetWidth, _renderTargetHeight, 0, GL_RGBA, GL_FLOAT, NULL);
    185 
     191                 _renderTargetWidth, _renderTargetHeight, 0,
     192                 GL_RGBA, GL_FLOAT, NULL);
    186193 
    187         glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
    188                 GL_TEXTURE_RECTANGLE_NV, _tex, 0);
     194    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
     195                              GL_TEXTURE_RECTANGLE_NV, _tex, 0);
    189196
    190197    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     
    193200void VelocityArrowsSlice::axis(int axis)
    194201{
    195         _axis = axis;
    196         switch (_axis)
    197         {
    198         case 0 :
    199                 _projectionVector.x = 0;
    200                 _projectionVector.y = 1;
    201                 _projectionVector.z = 1;
    202                 break;
    203         case 1 :
    204                 _projectionVector.x = 1;
    205                 _projectionVector.y = 0;
    206                 _projectionVector.z = 1;
    207                 break;
    208         case 2 :
    209                 _projectionVector.x = 1;
    210                 _projectionVector.y = 1;
    211                 _projectionVector.z = 0;
    212                 break;
    213         }
    214         _dirtySamplingPosition = true;
    215         _dirtyRenderTarget = true;
     202    _axis = axis;
     203    switch (_axis) {
     204    case 0:
     205        _projectionVector.x = 0;
     206        _projectionVector.y = 1;
     207        _projectionVector.z = 1;
     208        break;
     209    case 1 :
     210        _projectionVector.x = 1;
     211        _projectionVector.y = 0;
     212        _projectionVector.z = 1;
     213        break;
     214    case 2:
     215        _projectionVector.x = 1;
     216        _projectionVector.y = 1;
     217        _projectionVector.z = 0;
     218        break;
     219    }
     220    _dirtySamplingPosition = true;
     221    _dirtyRenderTarget = true;
    216222    //_dirty = true;
    217223}
    218224
    219 
    220225void VelocityArrowsSlice::queryVelocity()
    221226{
    222         if (!_enabled) return;
    223 
    224         glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fbo);
    225         glDisable(GL_DEPTH_TEST);
    226         cgGLBindProgram(_queryVelocityFP);
    227         cgGLEnableProfile(CG_PROFILE_FP30);
    228         cgGLSetTextureParameter(_qvVectorFieldParam, _vectorFieldGraphicsID);
    229         cgGLEnableTextureParameter(_qvVectorFieldParam);
    230 
    231         glPushAttrib(GL_VIEWPORT_BIT);
    232         glViewport(0, 0, _renderTargetWidth, _renderTargetHeight);
    233         glMatrixMode(GL_PROJECTION);
    234         glPushMatrix();
    235         glLoadIdentity();
    236         glOrtho(0, _renderTargetWidth, 0, _renderTargetHeight, -10.0f, 10.0f);
    237         glMatrixMode(GL_MODELVIEW);
    238         glPushMatrix();
    239         glLoadIdentity();
    240         glBegin(GL_POINTS);
    241 
    242         for (unsigned int index = 0; index < _samplingPositions.size(); ++index)
    243         {
    244                 glMultiTexCoord3f(0, _samplingPositions[index].x,_samplingPositions[index].y,_samplingPositions[index].z);
    245                 glVertex2f(index % _renderTargetWidth,
    246                         index / _renderTargetHeight);
    247         }
    248 
    249         glEnd();
    250 
    251         glDisable(GL_TEXTURE_RECTANGLE_NV);
    252         cgGLDisableTextureParameter(_qvVectorFieldParam);
    253         cgGLDisableProfile(CG_PROFILE_FP30);
    254 
    255         glReadPixels(0, 0, _renderTargetWidth, _renderTargetHeight, GL_RGB, GL_FLOAT, _velocities);
    256 
    257         glMatrixMode(GL_PROJECTION);
    258         glPopMatrix();
    259         glMatrixMode(GL_MODELVIEW);
    260         glPopMatrix();
    261         glPopAttrib();
    262 
    263         glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     227    if (!_enabled) return;
     228
     229    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fbo);
     230    glDisable(GL_DEPTH_TEST);
     231    cgGLBindProgram(_queryVelocityFP);
     232    cgGLEnableProfile(CG_PROFILE_FP30);
     233    cgGLSetTextureParameter(_qvVectorFieldParam, _vectorFieldGraphicsID);
     234    cgGLEnableTextureParameter(_qvVectorFieldParam);
     235
     236    glPushAttrib(GL_VIEWPORT_BIT);
     237    glViewport(0, 0, _renderTargetWidth, _renderTargetHeight);
     238    glMatrixMode(GL_PROJECTION);
     239    glPushMatrix();
     240    glLoadIdentity();
     241    glOrtho(0, _renderTargetWidth, 0, _renderTargetHeight, -10.0f, 10.0f);
     242    glMatrixMode(GL_MODELVIEW);
     243    glPushMatrix();
     244    glLoadIdentity();
     245
     246    glBegin(GL_POINTS);
     247
     248    for (unsigned int index = 0; index < _samplingPositions.size(); ++index) {
     249        glMultiTexCoord3f(0, _samplingPositions[index].x,_samplingPositions[index].y,_samplingPositions[index].z);
     250        glVertex2f(index % _renderTargetWidth,
     251                   index / _renderTargetHeight);
     252    }
     253
     254    glEnd();
     255
     256    glDisable(GL_TEXTURE_RECTANGLE_NV);
     257    cgGLDisableTextureParameter(_qvVectorFieldParam);
     258    cgGLDisableProfile(CG_PROFILE_FP30);
     259
     260    glReadPixels(0, 0, _renderTargetWidth, _renderTargetHeight, GL_RGB, GL_FLOAT, _velocities);
     261
     262    glMatrixMode(GL_PROJECTION);
     263    glPopMatrix();
     264    glMatrixMode(GL_MODELVIEW);
     265    glPopMatrix();
     266    glPopAttrib();
     267
     268    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    264269}
    265270
     
    268273    //if (!_enabled || (_vectorFieldGraphicsID == 0)) return;   
    269274    if (!_enabled) return;
    270    
     275
    271276    if (_dirty) {
    272277        computeSamplingTicks();
     
    274279        _dirty = false;
    275280    }
    276    
    277    
     281
    278282    glPushMatrix();
    279     
     283 
    280284    glScalef(_vfXscale,_vfYscale, _vfZscale);
    281285    glTranslatef(-0.5f, -0.5f, -0.5f);
    282286    if (_renderMode == LINES) {
    283        
    284287        glDisable(GL_TEXTURE_2D);
    285288        glLineWidth(2.0);
     
    299302                    glVertex3f(pos2.x, pos2.y, pos2.z);
    300303                    /*v = pos - pos2;
    301                      
    302                    
    303                     v2.x = 1;
    304                     v2.y = 1;
    305                     v2.z = (-(x1-x2)-(y1-y2))/(z1-z2)
    306                     adj = v.length() / (4 * sqrt((x3^2)+(y3^2)+(z3^2)));
    307                     x3 *= adj
    308                     y3 *= adj
    309                     z3 *= adj
     304                      v2.x = 1;
     305                      v2.y = 1;
     306                      v2.z = (-(x1-x2)-(y1-y2))/(z1-z2)
     307                      adj = v.length() / (4 * sqrt((x3^2)+(y3^2)+(z3^2)));
     308                      x3 *= adj
     309                      y3 *= adj
     310                      z3 *= adj
    310311                    */
    311                    
    312312                }
    313313            }
    314314        } else if (_axis == 1) {
    315315            int index = 0;
    316             for (int z = 1; z <= _tickCountZ; ++z)
     316            for (int z = 1; z <= _tickCountZ; ++z) {
    317317                for (int x = 1; x <= _tickCountX; ++x, ++index) {
    318318                    pos = _samplingPositions[index];
     
    322322                    glVertex3f(pos2.x, pos2.y, pos2.z);
    323323                }
     324            }
    324325        } else if (_axis == 0) {
    325326            int index = 0;
    326             for (int z = 1; z <= _tickCountZ; ++z)
     327            for (int z = 1; z <= _tickCountZ; ++z) {
    327328                for (int y = 1; y <= _tickCountY; ++y, ++index) {
    328329                    pos = _samplingPositions[index];
     
    332333                    glVertex3f(pos2.x, pos2.y, pos2.z);
    333334                }
     335            }
    334336        }
    335        
     337
    336338        glEnd();
    337339        glLineWidth(1.0);
     
    420422void VelocityArrowsSlice::tickCountForMinSizeAxis(int tickCount)
    421423{
    422         _tickCountForMinSizeAxis = tickCount;
     424    _tickCountForMinSizeAxis = tickCount;
    423425       
    424426    //_dirty = true;
    425427}
    426428
    427 
    428429void VelocityArrowsSlice::computeSamplingTicks()
    429430{
    430         if (_vfXscale < _vfYscale)
    431         {
    432                 if (_vfXscale < _vfZscale)
    433                 {
    434                         // vfXscale
    435                         _tickCountX = _tickCountForMinSizeAxis;
     431    if (_vfXscale < _vfYscale) {
     432        if (_vfXscale < _vfZscale) {
     433            // vfXscale
     434            _tickCountX = _tickCountForMinSizeAxis;
    436435                       
    437                         float step = _vfXscale / (_tickCountX + 1);
     436            float step = _vfXscale / (_tickCountX + 1);
    438437                       
    439                         _tickCountY = (int) (_vfYscale/step);
    440                         _tickCountZ = (int) (_vfZscale/step);
    441                         //vscalex = 1;
    442                         //vscaley = _vfXscale / _vfXscale;
    443                         //vscalez = _vfZscale / _vfXscale;
    444                 }
    445                 else
    446                 {
    447                         // vfZscale
    448                         _tickCountZ = _tickCountForMinSizeAxis;
    449 
    450                         float step = _vfZscale / (_tickCountZ + 1);
    451                         _tickCountX = (int) (_vfXscale/step);
    452                         _tickCountY = (int) (_vfYscale/step);
    453                         //vscalex = _vfXscale / _vfZscale;
    454                         //vscaley = _vfYscale / _vfZscale;
    455                         //vscalez = 1;
    456                 }
    457 
    458         }
    459         else
    460         {
    461                 if (_vfYscale < _vfZscale)
    462                 {
    463                         // _vfYscale
    464                         _tickCountY = _tickCountForMinSizeAxis;
    465 
    466                         float step = _vfYscale / (_tickCountY + 1);
    467                         _tickCountX = (int) (_vfXscale/step);
    468                         _tickCountZ = (int) (_vfZscale/step);
    469 
    470                         //vscalex = _vfXscale / _vfYscale;
    471                         //vscaley = 1;
    472                         //vscalez = _vfZscale / _vfYscale;
    473                 }
    474                 else
    475                 {
    476                         // vfZscale
    477                         _tickCountZ = _tickCountForMinSizeAxis;
     438            _tickCountY = (int)(_vfYscale/step);
     439            _tickCountZ = (int)(_vfZscale/step);
     440            //vscalex = 1;
     441            //vscaley = _vfXscale / _vfXscale;
     442            //vscalez = _vfZscale / _vfXscale;
     443        } else {
     444            // vfZscale
     445            _tickCountZ = _tickCountForMinSizeAxis;
     446
     447            float step = _vfZscale / (_tickCountZ + 1);
     448            _tickCountX = (int)(_vfXscale/step);
     449            _tickCountY = (int)(_vfYscale/step);
     450            //vscalex = _vfXscale / _vfZscale;
     451            //vscaley = _vfYscale / _vfZscale;
     452            //vscalez = 1;
     453        }
     454    } else {
     455        if (_vfYscale < _vfZscale) {
     456            // _vfYscale
     457            _tickCountY = _tickCountForMinSizeAxis;
     458
     459            float step = _vfYscale / (_tickCountY + 1);
     460            _tickCountX = (int)(_vfXscale/step);
     461            _tickCountZ = (int)(_vfZscale/step);
     462
     463            //vscalex = _vfXscale / _vfYscale;
     464            //vscaley = 1;
     465            //vscalez = _vfZscale / _vfYscale;
     466        } else {
     467            // vfZscale
     468            _tickCountZ = _tickCountForMinSizeAxis;
    478469                       
    479                         float step = _vfZscale / (_tickCountZ + 1);
    480                         _tickCountX = (int) (_vfXscale/step);
    481                         _tickCountY = (int) (_vfYscale/step);
    482 
    483                         //vscalex = _vfXscale / _vfZscale;
    484                         //vscaley = _vfYscale / _vfZscale;
    485                         //vscalez = 1;
    486                
    487                        
    488                 }
    489         }
    490        
    491         _maxVelocityScale.x = 1.0f / _tickCountX * 0.8f;
    492         _maxVelocityScale.y = 1.0f / _tickCountY * 0.8f;
    493         _maxVelocityScale.z = 1.0f / _tickCountZ * 0.8f;
    494        
    495         int pointCount = _tickCountX * _tickCountY * _tickCountZ;
    496         if (_pointCount != pointCount)
    497         {
    498                 _samplingPositions.clear();
    499                 _samplingPositions.reserve(pointCount);
    500                 _pointCount = pointCount;
    501         }
    502 
    503         if (_renderMode == LINES)
    504         {
    505                 Vector3 pos;
    506                 if (_axis == 2)
    507                 {
    508                         for (int y = 1; y <= _tickCountY; ++y)
    509                                 for (int x = 1; x <= _tickCountX; ++x)
    510                                 {
    511                                         pos.x = (1.0f / (_tickCountX + 1)) * x;
    512                                         pos.y = (1.0f / (_tickCountY + 1)) * y;
    513                                         pos.z = _slicePos;
    514                                         _samplingPositions.push_back(pos);
    515        
    516                                 }
    517                 }
    518                 else if (_axis == 1)
    519                 {
    520                         for (int z = 1; z <= _tickCountZ; ++z)
    521                                 for (int x = 1; x <= _tickCountX; ++x)
    522                                 {
    523                                         pos.x = (1.0f / (_tickCountX + 1)) * x;
    524                                         pos.y = _slicePos;
    525                                         pos.z = (1.0f / (_tickCountZ + 1)) * z;
    526                                         _samplingPositions.push_back(pos);
    527                                 }
    528                 }
    529                 else if (_axis == 0)
    530                 {
    531                         for (int z = 1; z <= _tickCountZ; ++z)
    532                                 for (int y = 1; y <= _tickCountY; ++y)
    533                                 {
    534                                         pos.x = _slicePos;
    535                                         pos.y = (1.0f / (_tickCountY + 1)) * y;
    536                                         pos.z = (1.0f / (_tickCountZ + 1)) * z;
    537                                         _samplingPositions.push_back(pos);
    538                                 }
    539                 }
    540         }
    541         else
    542         {
    543                 glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vertexBufferGraphicsID);
    544                 Vector3* pinfo = (Vector3*) glMapBufferARB(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
    545 
    546                 Vector3 pos;
    547                 if (_axis == 2)
    548                 {
    549                         for (int y = 1; y <= _tickCountY; ++y)
    550                                 for (int x = 1; x <= _tickCountX; ++x)
    551                                 {
    552                                         pos.x = (1.0f / (_tickCountX + 1)) * x;
    553                                         pos.y = (1.0f / (_tickCountY + 1)) * y;
    554                                         pos.z = _slicePos;
    555 
    556                                         *pinfo = pos;
    557                                         ++pinfo;
    558                         }
    559                 }
    560                 else if (_axis == 1)
    561                 {
    562                         for (int z = 1; z <= _tickCountZ; ++z)
    563                                 for (int x = 1; x <= _tickCountX; ++x)
    564                                 {
    565                                         pos.x = (1.0f / (_tickCountX + 1)) * x;
    566                                         pos.y = _slicePos;
    567                                         pos.z = (1.0f / (_tickCountZ + 1)) * z;
    568        
    569                                         *pinfo = pos;
    570                                         ++pinfo;
    571                                 }
    572                 }
    573                 else if (_axis == 0)
    574                 {
    575                         for (int z = 1; z <= _tickCountZ; ++z)
    576                                 for (int y = 1; y <= _tickCountY; ++y)
    577                                 {
    578                                         pos.x = _slicePos;
    579                                         pos.y = (1.0f / (_tickCountY + 1)) * y;
    580                                         pos.z = (1.0f / (_tickCountZ + 1)) * z;
    581                                        
    582                                         *pinfo = pos;
    583                                         ++pinfo;
    584                                 }
    585                 }
    586 
    587                 glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
    588         }
     470            float step = _vfZscale / (_tickCountZ + 1);
     471            _tickCountX = (int)(_vfXscale/step);
     472            _tickCountY = (int)(_vfYscale/step);
     473
     474            //vscalex = _vfXscale / _vfZscale;
     475            //vscaley = _vfYscale / _vfZscale;
     476            //vscalez = 1;
     477        }
     478    }
     479
     480    _maxVelocityScale.x = 1.0f / _tickCountX * 0.8f;
     481    _maxVelocityScale.y = 1.0f / _tickCountY * 0.8f;
     482    _maxVelocityScale.z = 1.0f / _tickCountZ * 0.8f;
     483
     484    int pointCount = _tickCountX * _tickCountY * _tickCountZ;
     485    if (_pointCount != pointCount) {
     486        _samplingPositions.clear();
     487        _samplingPositions.reserve(pointCount);
     488        _pointCount = pointCount;
     489    }
     490
     491    if (_renderMode == LINES) {
     492        Vector3 pos;
     493        if (_axis == 2) {
     494            for (int y = 1; y <= _tickCountY; ++y) {
     495                for (int x = 1; x <= _tickCountX; ++x) {
     496                    pos.x = (1.0f / (_tickCountX + 1)) * x;
     497                    pos.y = (1.0f / (_tickCountY + 1)) * y;
     498                    pos.z = _slicePos;
     499                    _samplingPositions.push_back(pos);
     500                }
     501            }
     502        } else if (_axis == 1) {
     503            for (int z = 1; z <= _tickCountZ; ++z) {
     504                for (int x = 1; x <= _tickCountX; ++x) {
     505                    pos.x = (1.0f / (_tickCountX + 1)) * x;
     506                    pos.y = _slicePos;
     507                    pos.z = (1.0f / (_tickCountZ + 1)) * z;
     508                    _samplingPositions.push_back(pos);
     509                }
     510            }
     511        } else if (_axis == 0) {
     512            for (int z = 1; z <= _tickCountZ; ++z) {
     513                for (int y = 1; y <= _tickCountY; ++y) {
     514                    pos.x = _slicePos;
     515                    pos.y = (1.0f / (_tickCountY + 1)) * y;
     516                    pos.z = (1.0f / (_tickCountZ + 1)) * z;
     517                    _samplingPositions.push_back(pos);
     518                }
     519            }
     520        }
     521    } else {
     522        glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vertexBufferGraphicsID);
     523        Vector3* pinfo = (Vector3*) glMapBufferARB(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
     524
     525        Vector3 pos;
     526        if (_axis == 2) {
     527            for (int y = 1; y <= _tickCountY; ++y) {
     528                for (int x = 1; x <= _tickCountX; ++x) {
     529                    pos.x = (1.0f / (_tickCountX + 1)) * x;
     530                    pos.y = (1.0f / (_tickCountY + 1)) * y;
     531                    pos.z = _slicePos;
     532
     533                    *pinfo = pos;
     534                    ++pinfo;
     535                }
     536            }
     537        } else if (_axis == 1) {
     538            for (int z = 1; z <= _tickCountZ; ++z) {
     539                for (int x = 1; x <= _tickCountX; ++x) {
     540                    pos.x = (1.0f / (_tickCountX + 1)) * x;
     541                    pos.y = _slicePos;
     542                    pos.z = (1.0f / (_tickCountZ + 1)) * z;
     543
     544                    *pinfo = pos;
     545                    ++pinfo;
     546                }
     547            }
     548        } else if (_axis == 0) {
     549            for (int z = 1; z <= _tickCountZ; ++z) {
     550                for (int y = 1; y <= _tickCountY; ++y) {
     551                    pos.x = _slicePos;
     552                    pos.y = (1.0f / (_tickCountY + 1)) * y;
     553                    pos.z = (1.0f / (_tickCountZ + 1)) * z;
     554
     555                    *pinfo = pos;
     556                    ++pinfo;
     557                }
     558            }
     559        }
     560
     561        glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
     562    }
    589563}
    590564
     
    594568    _dirty = true;
    595569}
    596 
  • trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h

    r2798 r2818  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22#ifndef VELOCITY_ARROW_SLICE_H
    3 #define VELOCITY_ARROW_SLICE_H 1
     3#define VELOCITY_ARROW_SLICE_H
    44
    55#include <Cg/cg.h>
     
    1717typedef vrTexture2D Texture2D;
    1818
    19 class Vector3 {
    20 public :
    21         float x, y, z;
    22         Vector3() : x(0.0f), y(0.0f), z(0.0f) {}
    23         Vector3(float x1, float y1, float z1) : x(x1), y(y1), z(z1) {}
    24         Vector3 operator*(float scale)
    25         {
    26                 Vector3 vec;
    27                 vec.x = x * scale;
    28                 vec.y = y * scale;
    29                 vec.z = z * scale;
    30                 return vec;
    31         }
     19class Vector3
     20{
     21public:
     22    float x, y, z;
     23
     24    Vector3() :
     25        x(0.0f), y(0.0f), z(0.0f)
     26    {}
     27
     28    Vector3(float x1, float y1, float z1) :
     29        x(x1), y(y1), z(z1)
     30    {}
     31
     32    Vector3 operator*(float scale)
     33    {
     34        Vector3 vec;
     35        vec.x = x * scale;
     36        vec.y = y * scale;
     37        vec.z = z * scale;
     38        return vec;
     39    }
     40
    3241    Vector3 scale(const Vector3& scale)
    3342    {
     
    3645        vec.y = y * scale.y;
    3746        vec.z = z * scale.z;
    38             return vec;
     47        return vec;
    3948    }
    4049
    41         Vector3 operator*(const Vector3& scale)
    42         {
    43                 Vector3 vec;
    44                 vec.x = x * scale.x;
    45                 vec.y = y * scale.y;
    46                 vec.z = z * scale.z;
    47                 return vec;
     50    Vector3 operator*(const Vector3& scale)
     51    {
     52        Vector3 vec;
     53        vec.x = x * scale.x;
     54        vec.y = y * scale.y;
     55        vec.z = z * scale.z;
     56        return vec;
     57    }
    4858
    49         }
    50         friend Vector3 operator+(const Vector3& value1, const Vector3& value2);
     59    friend Vector3 operator+(const Vector3& value1, const Vector3& value2);
    5160
    5261    void set(float x1, float y1, float z1)
     
    5867inline Vector3 operator+(const Vector3& value1, const Vector3& value2)
    5968{
    60         return Vector3(value1.x + value2.x, value1.y + value2.y, value1.z + value2.z);
     69    return Vector3(value1.x + value2.x, value1.y + value2.y, value1.z + value2.z);
    6170}
    6271
     
    6473
    6574
    66 class VelocityArrowsSlice {
    67 public :
    68         enum RenderMode {
    69                 LINES,
    70                 GLYPHES,
    71         };
    72 private :
    73         unsigned int _vectorFieldGraphicsID;
    74         float _vfXscale;
    75         float _vfYscale;
    76         float _vfZscale;
    77         float _slicePos;
    78         int _axis;
     75class VelocityArrowsSlice
     76{
     77public:
     78    enum RenderMode {
     79        LINES,
     80        GLYPHS,
     81    };
     82
     83private:
     84    unsigned int _vectorFieldGraphicsID;
     85    float _vfXscale;
     86    float _vfYscale;
     87    float _vfZscale;
     88    float _slicePos;
     89    int _axis;
    7990       
    80         unsigned int _fbo;     
     91    unsigned int _fbo; 
    8192    unsigned int _tex;
    8293       
    83         CGcontext _context;
    84         CGprogram _queryVelocityFP;
    85         CGparameter _qvVectorFieldParam;
     94    CGcontext _context;
     95    CGprogram _queryVelocityFP;
     96    CGparameter _qvVectorFieldParam;
    8697
    87         int _renderTargetWidth;
    88         int _renderTargetHeight;
    89         Vector3* _velocities;
    90         std::vector<Vector3> _samplingPositions;
    91         Vector3 _projectionVector;
     98    int _renderTargetWidth;
     99    int _renderTargetHeight;
     100    Vector3 *_velocities;
     101    std::vector<Vector3> _samplingPositions;
     102    Vector3 _projectionVector;
    92103
    93         int _tickCountForMinSizeAxis;
    94         int _tickCountX;
    95         int _tickCountY;
    96         int _tickCountZ;
     104    int _tickCountForMinSizeAxis;
     105    int _tickCountX;
     106    int _tickCountY;
     107    int _tickCountZ;
    97108       
    98         int _pointCount;
     109    int _pointCount;
    99110
    100         Vector3 _maxVelocityScale;
    101         Vector3 _arrowColor;
     111    Vector3 _maxVelocityScale;
     112    Vector3 _arrowColor;
    102113
    103         bool _enabled; 
    104         bool _dirty;
    105         bool _dirtySamplingPosition;
    106         bool _dirtyRenderTarget;
     114    bool _enabled;     
     115    bool _dirty;
     116    bool _dirtySamplingPosition;
     117    bool _dirtyRenderTarget;
    107118
    108         unsigned int _vertexBufferGraphicsID;
     119    unsigned int _vertexBufferGraphicsID;
    109120
    110         CGprogram _particleVP;
    111         CGparameter _mvpParticleParam;
    112         CGparameter _mvParticleParam;
    113         CGparameter _mvTanHalfFOVParam;
    114         CGparameter _mvCurrentTimeParam;
     121    CGprogram _particleVP;
     122    CGparameter _mvpParticleParam;
     123    CGparameter _mvParticleParam;
     124    CGparameter _mvTanHalfFOVParam;
     125    CGparameter _mvCurrentTimeParam;
    115126       
    116         CGprogram _particleFP;
    117         CGparameter _vectorParticleParam;
     127    CGprogram _particleFP;
     128    CGparameter _vectorParticleParam;
    118129
    119         Texture2D* _arrowsTex;
     130    Texture2D *_arrowsTex;
    120131
    121         RenderMode _renderMode;
    122 private :
    123         void createRenderTarget();
    124         void computeSamplingTicks();
    125 public :
    126         VelocityArrowsSlice();
    127         ~VelocityArrowsSlice();
     132    RenderMode _renderMode;
    128133
    129         void vectorField(unsigned int vfGraphicsID, float xScale, float yScale, float zScale);
    130         void axis(int axis);
    131         int axis() const;
    132         void slicePos(float pos);
    133         float slicePos() const;
    134         void queryVelocity();
    135         void render();
    136     void enabled(bool enabled) {
    137         _enabled = enabled;
     134    void createRenderTarget();
     135    void computeSamplingTicks();
     136
     137public:
     138    VelocityArrowsSlice();
     139    ~VelocityArrowsSlice();
     140
     141    void vectorField(unsigned int vfGraphicsID, float xScale, float yScale, float zScale);
     142    void axis(int axis);
     143    int axis() const;
     144    void slicePos(float pos);
     145    float slicePos() const;
     146    void queryVelocity();
     147    void render();
     148    void enabled(bool enabled)
     149    {
     150        _enabled = enabled;
    138151    }
    139     bool enabled(void) const {
    140         return _enabled;
     152    bool enabled(void) const
     153    {
     154        return _enabled;
    141155    }
    142156    void tickCountForMinSizeAxis(int tickCount);
     
    149163inline int VelocityArrowsSlice::axis() const
    150164{
    151         return _axis;
     165    return _axis;
    152166}
    153167
    154168inline float VelocityArrowsSlice::slicePos() const
    155169{
    156         return _slicePos;
     170    return _slicePos;
    157171}
    158172
     
    160174inline int VelocityArrowsSlice::tickCountForMinSizeAxis() const
    161175{
    162         return _tickCountForMinSizeAxis;
     176    return _tickCountForMinSizeAxis;
    163177}
    164178
     
    170184inline void VelocityArrowsSlice::renderMode(VelocityArrowsSlice::RenderMode mode)
    171185{
    172         _renderMode = mode;
    173         _dirty = true;
     186    _renderMode = mode;
     187    _dirty = true;
    174188}
    175189
    176190inline VelocityArrowsSlice::RenderMode VelocityArrowsSlice::renderMode() const
    177191{
    178         return _renderMode;
     192    return _renderMode;
    179193}
    180194 
    181 #endif /* VELOCITY_ARROW_SLICE_H */
     195#endif
  • trunk/packages/vizservers/nanovis/nanovis.h

    r2801 r2818  
    4141#include <signal.h>
    4242
     43#include <rappture.h>
     44
    4345#include "define.h"
    4446#include "global.h"
    45 #include "rappture.h"
    4647#include "NvCamera.h"
    4748#include "ConvexPolygon.h"
Note: See TracChangeset for help on using the changeset viewer.