Ignore:
Timestamp:
Mar 6, 2012 2:04:43 AM (12 years ago)
Author:
ldelgass
Message:

Don't pollute namespace with using directives in headers, also prefer using
std:: prefix to 'using namespace std' in implementation files.

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

Legend:

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

    r2798 r2800  
    8585
    8686// in nanovis.cpp
    87 extern vector<PointSet*> g_pointSet;
     87extern std::vector<PointSet*> g_pointSet;
    8888
    8989extern PlaneRenderer* plane_render;
     
    364364static int
    365365GetVolumes(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv,
    366            vector<Volume *>* vectorPtr)
     366           std::vector<Volume *>* vectorPtr)
    367367{
    368368    if (objc == 0) {
     
    405405static int
    406406GetHeightMaps(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv,
    407            vector<HeightMap *>* vectorPtr)
     407              std::vector<HeightMap *>* vectorPtr)
    408408{
    409409    if (objc == 0) {
     
    737737    }
    738738
    739     vector<Volume *> ivol;
     739    std::vector<Volume *> ivol;
    740740    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    741741        return TCL_ERROR;
    742742    }
    743     vector<Volume *>::iterator iter;
     743    std::vector<Volume *>::iterator iter;
    744744    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    745745        (*iter)->move_cutplane(axis, relval);
     
    765765    }
    766766
    767     vector<Volume *> ivol;
     767    std::vector<Volume *> ivol;
    768768    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    769769        return TCL_ERROR;
    770770    }
    771771    if (state) {
    772         vector<Volume *>::iterator iter;
     772        std::vector<Volume *>::iterator iter;
    773773        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    774774            (*iter)->enable_cutplane(axis);
    775775        }
    776776    } else {
    777         vector<Volume *>::iterator iter;
     777        std::vector<Volume *>::iterator iter;
    778778        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    779779            (*iter)->disable_cutplane(axis);
     
    10871087                         Tcl_Obj *const *objv)
    10881088{
    1089     vector<Volume *> volumes;
     1089    std::vector<Volume *> volumes;
    10901090    if (GetVolumes(interp, objc - 3, objv + 3, &volumes) != TCL_OK) {
    10911091        return TCL_ERROR;
     
    12771277        return TCL_ERROR;
    12781278    }
    1279     vector<Volume *> ivol;
     1279    std::vector<Volume *> ivol;
    12801280    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    12811281        return TCL_ERROR;
    12821282    }
    1283     vector<Volume *>::iterator iter;
     1283    std::vector<Volume *>::iterator iter;
    12841284    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    12851285        (*iter)->data_enabled(state);
     
    13931393        return TCL_ERROR;
    13941394    }
    1395     vector<Volume *> ivol;
     1395    std::vector<Volume *> ivol;
    13961396    if (GetVolumes(interp, objc - 6, objv + 6, &ivol) != TCL_OK) {
    13971397        return TCL_ERROR;
    13981398    }
    1399     vector<Volume *>::iterator iter;
     1399    std::vector<Volume *>::iterator iter;
    14001400    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    14011401        (*iter)->set_outline_color(rgb);
     
    14121412        return TCL_ERROR;
    14131413    }
    1414     vector<Volume *> ivol;
     1414    std::vector<Volume *> ivol;
    14151415    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    14161416        return TCL_ERROR;
    14171417    }
    1418     vector<Volume *>::iterator iter;
     1418    std::vector<Volume *>::iterator iter;
    14191419    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    14201420        (*iter)->outline(state);
     
    14541454    }
    14551455
    1456     vector<Volume *> ivol;
     1456    std::vector<Volume *> ivol;
    14571457    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    14581458        return TCL_ERROR;
    14591459    }
    1460     vector<Volume *>::iterator iter;
     1460    std::vector<Volume *>::iterator iter;
    14611461    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    14621462        (*iter)->diffuse(diffuse);
     
    14731473        return TCL_ERROR;
    14741474    }
    1475     vector<Volume *> ivol;
     1475    std::vector<Volume *> ivol;
    14761476    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    14771477        return TCL_ERROR;
    14781478    }
    1479     vector<Volume *>::iterator iter;
     1479    std::vector<Volume *>::iterator iter;
    14801480    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    14811481        (*iter)->isosurface(iso_surface);
     
    14941494    }
    14951495    TRACE("set opacity %f\n", opacity);
    1496     vector<Volume *> ivol;
     1496    std::vector<Volume *> ivol;
    14971497    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    14981498        return TCL_ERROR;
    14991499    }
    1500     vector<Volume *>::iterator iter;
     1500    std::vector<Volume *>::iterator iter;
    15011501    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    15021502        (*iter)->opacity_scale(opacity);
     
    15131513        return TCL_ERROR;
    15141514    }
    1515     vector<Volume *> ivol;
     1515    std::vector<Volume *> ivol;
    15161516    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    15171517        return TCL_ERROR;
    15181518    }
    1519     vector<Volume *>::iterator iter;
     1519    std::vector<Volume *>::iterator iter;
    15201520    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    15211521        (*iter)->specular(specular);
     
    15361536        return TCL_ERROR;
    15371537    }
    1538     vector<Volume *> ivol;
     1538    std::vector<Volume *> ivol;
    15391539    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    15401540        return TCL_ERROR;
    15411541    }
    1542     vector<Volume *>::iterator iter;
     1542    std::vector<Volume *>::iterator iter;
    15431543    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    15441544        TRACE("setting %s with transfer function %s\n", (*iter)->name(),
     
    15911591            return TCL_ERROR;
    15921592        }
    1593         vector<Volume *> ivol;
     1593        std::vector<Volume *> ivol;
    15941594        if (GetVolumes(interp, objc - 5, objv + 5, &ivol) != TCL_OK) {
    15951595            return TCL_ERROR;
    15961596        }
    1597         vector<Volume *>::iterator iter;
     1597        std::vector<Volume *>::iterator iter;
    15981598        const char *label;
    15991599        label = Tcl_GetString(objv[4]);
     
    16171617        return TCL_ERROR;
    16181618    }
    1619     vector<Volume *> ivol;
     1619    std::vector<Volume *> ivol;
    16201620    if (GetVolumes(interp, objc - 3, objv + 3, &ivol) != TCL_OK) {
    16211621        return TCL_ERROR;
    16221622    }
    1623     vector<Volume *>::iterator iter;
     1623    std::vector<Volume *>::iterator iter;
    16241624    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    16251625        (*iter)->visible(state);
     
    17501750        return TCL_ERROR;
    17511751    }
    1752     vector<HeightMap *> imap;
     1752    std::vector<HeightMap *> imap;
    17531753    if (GetHeightMaps(interp, objc - 4, objv + 4, &imap) != TCL_OK) {
    17541754        return TCL_ERROR;
    17551755    }
    1756     vector<HeightMap *>::iterator iter;
     1756    std::vector<HeightMap *>::iterator iter;
    17571757    for (iter = imap.begin(); iter != imap.end(); iter++) {
    17581758        (*iter)->setVisible(visible);
     
    17911791        return TCL_ERROR;
    17921792    }
    1793     vector<HeightMap *> imap;
     1793    std::vector<HeightMap *> imap;
    17941794    if (GetHeightMaps(interp, objc - 6, objv + 6, &imap) != TCL_OK) {
    17951795        return TCL_ERROR;
    17961796    }
    1797     vector<HeightMap *>::iterator iter;
     1797    std::vector<HeightMap *>::iterator iter;
    17981798    for (iter = imap.begin(); iter != imap.end(); iter++) {
    17991799        (*iter)->setLineContourColor(rgb);
     
    18111811        return TCL_ERROR;
    18121812    }
    1813     vector<HeightMap *> imap;
     1813    std::vector<HeightMap *> imap;
    18141814    if (GetHeightMaps(interp, objc - 4, objv + 4, &imap) != TCL_OK) {
    18151815        return TCL_ERROR;
    18161816    }
    1817     vector<HeightMap *>::iterator iter;
     1817    std::vector<HeightMap *>::iterator iter;
    18181818    for (iter = imap.begin(); iter != imap.end(); iter++) {
    18191819        (*iter)->setLineContourVisible(visible);
     
    20182018        return TCL_ERROR;
    20192019    }
    2020     vector<HeightMap *> imap;
     2020    std::vector<HeightMap *> imap;
    20212021    if (GetHeightMaps(interp, objc - 3, objv + 3, &imap) != TCL_OK) {
    20222022        return TCL_ERROR;
    20232023    }
    2024     vector<HeightMap *>::iterator iter;
     2024    std::vector<HeightMap *>::iterator iter;
    20252025    for (iter = imap.begin(); iter != imap.end(); iter++) {
    20262026        (*iter)->transferFunction(tfPtr);
     
    20392039        return TCL_ERROR;
    20402040    }
    2041     vector<HeightMap *> heightmaps;
     2041    std::vector<HeightMap *> heightmaps;
    20422042    if (GetHeightMaps(interp, objc - 3, objv + 3, &heightmaps) != TCL_OK) {
    20432043        return TCL_ERROR;
    20442044    }
    2045     vector<HeightMap *>::iterator iter;
     2045    std::vector<HeightMap *>::iterator iter;
    20462046    for (iter = heightmaps.begin(); iter != heightmaps.end(); iter++) {
    20472047        (*iter)->opacity(opacity);
  • trunk/packages/vizservers/nanovis/EventPlayer.cpp

    r2798 r2800  
    2727#include "../Event.h"
    2828
    29 using namespace std;
    30 
    3129Event* event[300];
    3230int cur_event = 0;
  • trunk/packages/vizservers/nanovis/ParticleSystem.h

    r2798 r2800  
    22#pragma once
    33
     4#include <vector>
     5#include <queue>
     6#include <string>
     7#include <algorithm>
     8#include <limits>
     9
     10#include <Cg/cg.h>
     11#include <Cg/cgGL.h>
     12
     13#include <vr3d/vrTexture2D.h>
    414#include <vr3d/vrTexture3D.h>
     15
    516#include "ParticleEmitter.h"
    617#include "RenderVertexArray.h"
    7 #include <vr3d/vrTexture2D.h>
    8 #include <vector>
    9 #include <string>
    10 #include <algorithm>
    11 #include <Cg/cg.h>
    12 #include <Cg/cgGL.h>
    13 #include <limits>
    14 #include <vector>
    15 #include <queue>
     18
    1619#include "CircularQueue.h"
    1720#include "datatype.h"
     21
    1822struct NewParticle {
    19         int index;
    20         float3 position;
    21         float3 velocity;
    22         float timeOfDeath;
    23         float initTimeStep;
     23    int index;
     24    float3 position;
     25    float3 velocity;
     26    float timeOfDeath;
     27    float initTimeStep;
    2428};
    2529
    26 using namespace std;
    27 
    28 
    29 template <typename Type, typename Compare=less<Type> >
    30 class priority_queue_vector : public priority_queue<Type, vector<Type>, Compare>
     30template <typename Type, typename Compare=std::less<Type> >
     31class priority_queue_vector : public std::priority_queue<Type, std::vector<Type>, Compare>
    3132{
    3233public:
    33         void reserve(typename priority_queue_vector<Type>::size_type count)
    34         {
     34    void reserve(typename priority_queue_vector<Type>::size_type count)
     35    {
    3536#ifdef _WIN32
    36                 c.reserve(count);
     37        c.reserve(count);
    3738#else
    38                 //priority_queue<Type,vector<Type>, Compare>::reserve(count);
     39        //priority_queue<Type,vector<Type>, Compare>::reserve(count);
    3940#endif
    40         }
     41    }
    4142};
    4243
    43 struct ActiveParticle
    44 {
    45         float timeOfDeath;
    46         int index;
     44struct ActiveParticle {
     45    float timeOfDeath;
     46    int index;
    4747};
    4848
    4949namespace std
    5050{
    51         template <>
    52         struct greater<ActiveParticle>
    53         {
    54                 bool operator() (const ActiveParticle& left, const ActiveParticle& right)
    55                 {
    56                         return left.timeOfDeath > right.timeOfDeath;
    57                 }
    58         };
    59 }
    60 
    61 struct Particle
    62 {
    63         float timeOfBirth;
    64         float lifeTime;
    65         float attributeType;
    66         float index;
     51    template <>
     52    struct greater<ActiveParticle> {
     53        bool operator() (const ActiveParticle& left, const ActiveParticle& right)
     54        {
     55            return left.timeOfDeath > right.timeOfDeath;
     56        }
     57    };
     58}
     59
     60struct Particle {
     61    float timeOfBirth;
     62    float lifeTime;
     63    float attributeType;
     64    float index;
    6765};
    6866
    69 
    70 class ParticleSystem {
    71 public :
    72         enum EnableEnum {
    73                 PS_SORT = 1,
    74                 PS_GLYPE = 2,
    75                 PS_DRAW_BBOX = 4,
    76                 PS_ADVECTION = 8,
    77                 PS_STREAMLINE = 16,
    78         };
    79 public :
    80         const int _width;
    81         const int _height;
    82         /**
    83          * @brief The total number of particles (= _width * _height)
    84          */
    85         int _particleMaxCount;
    86         /**
    87          * @brief The total number of particles avaiable (1 <= _userDefinedParticleMaxCount <= _width * _height)
    88          */
    89         unsigned int _userDefinedParticleMaxCount;
    90 
    91         int _currentSortPass;
    92         int _maxSortPasses;
    93         int _sortPassesPerFrame;
    94 
     67class ParticleSystem
     68{
     69public:
     70    enum EnableEnum {
     71        PS_SORT = 1,
     72        PS_GLYPE = 2,
     73        PS_DRAW_BBOX = 4,
     74        PS_ADVECTION = 8,
     75        PS_STREAMLINE = 16,
     76    };
     77
     78    const int _width;
     79    const int _height;
     80    /**
     81     * @brief The total number of particles (= _width * _height)
     82     */
     83    int _particleMaxCount;
     84    /**
     85     * @brief The total number of particles avaiable (1 <= _userDefinedParticleMaxCount <= _width * _height)
     86     */
     87    unsigned int _userDefinedParticleMaxCount;
     88
     89    int _currentSortPass;
     90    int _maxSortPasses;
     91    int _sortPassesPerFrame;
     92
     93    int _sortBegin;
     94    int _sortEnd;
     95
     96    float _pointSize;
     97
     98    /**
     99     * @brief The index for the source render target
     100     */
     101    int _currentSortIndex;
     102
     103    /**
     104     * @brief The index for the destination render target
     105     */
     106    int _destSortIndex;
     107
     108    int _currentPosIndex;
     109    int _destPosIndex;
     110
     111    std::vector<ParticleEmitter*> _emitters;
     112
     113    float _currentTime;
     114
     115    priority_queue_vector<int, std::greater<int> > _availableIndices;
     116    priority_queue_vector<ActiveParticle, std::greater<ActiveParticle> > _activeParticles;
     117    std::vector<NewParticle> _newParticles;
     118
     119    /**
     120     * @brief frame buffer objects: two are defined, flip them as input output every step
     121     */
     122    unsigned int psys_fbo[2];   
     123
     124    /**
     125     * @brief color textures attached to frame buffer objects
     126     */
     127    unsigned int psys_tex[2];   
     128
     129    unsigned int sort_fbo[2];
     130    unsigned int sort_tex[2];
     131
     132    unsigned int velocity_fbo[2];
     133    unsigned int velocity_tex[2];
     134
     135    // TEMP
     136    ///////////////////////////////////////////////////
     137    // TIME SERIES
     138    std::vector<unsigned int> _vectorFieldIDs;
     139    std::vector<vrTexture3D*> _vectorFields;
     140    unsigned int _curVectorFieldID;
     141    float _time_series_vel_mag_min;
     142    float _time_series_vel_mag_max;
     143    CircularFifo<float*, 10> _queue;
     144    int _flowFileStartIndex;
     145    int _flowFileEndIndex;
     146    ///////////////////////////////////////////////////
     147    int _skipByte;
     148
     149    float _maxVelocityScale;
    95150       
    96 
    97         int _sortBegin;
    98         int _sortEnd;
    99 
    100         float _pointSize;
    101 
    102         /**
    103          * @brief The index for the source render target
    104          */
    105         int _currentSortIndex;
    106 
    107         /**
    108          * @brief The index for the destination render target
    109          */
    110         int _destSortIndex;
    111 
    112         int _currentPosIndex;
    113         int _destPosIndex;
    114 
    115         std::vector<ParticleEmitter*> _emitters;
    116 
    117         float _currentTime;
    118 
    119         priority_queue_vector<int, greater<int> > _availableIndices;
    120         priority_queue_vector<ActiveParticle, greater<ActiveParticle> > _activeParticles;
    121         std::vector<NewParticle> _newParticles;
     151    RenderVertexArray* _vertices;
     152
     153    Particle* _particles;
     154    float3* _positionBuffer;
     155    color4* _colorBuffer;
     156    unsigned _colorBufferID;
     157
     158    //////////////////////////////////////////
     159    vrTexture2D* _arrows;
     160
     161    float _camx;
     162    float _camy;
     163    float _camz;
     164
     165    float _scalex, _scaley, _scalez;
     166
     167    bool _sortEnabled;
     168    bool _glypEnabled;
     169    bool _drawBBoxEnabled;
     170    bool _advectionEnabled;
     171    bool _streamlineEnabled;
     172    bool _depthCueEnabled;
     173
     174    // TEMP
     175    static void callbackForCgError();
     176    static CGcontext _context;
     177
     178    CGprogram _distanceInitFP;
     179
     180    CGprogram _distanceSortFP;
     181    CGparameter _viewPosParam;
     182
     183    CGprogram _distanceSortLookupFP;
     184
     185    CGprogram _passthroughFP;
     186    CGparameter _scaleParam;
     187    CGparameter _biasParam;
     188
     189    CGprogram _sortRecursionFP;
     190    CGparameter _srSizeParam;
     191    CGparameter _srStepParam;
     192    CGparameter _srCountParam;
     193
     194    CGprogram _sortEndFP;
     195    CGparameter _seSizeParam;
     196    CGparameter _seStepParam;
     197
     198    CGprogram _moveParticlesFP;
     199    CGparameter _mpTimeScale;
     200    CGparameter _mpVectorField;
     201    CGparameter _mpUseInitTex;
     202    CGparameter _mpCurrentTime;
     203    CGparameter _mpMaxScale;
     204    CGparameter _mpScale;
     205
     206    CGprogram _initParticlePosFP;
     207    CGparameter _ipVectorFieldParam;
     208
     209    CGprogram _particleVP;
     210    CGparameter _mvpParticleParam;
     211    CGparameter _mvParticleParam;
     212    CGparameter _mvTanHalfFOVParam;
     213    CGparameter _mvCurrentTimeParam;
    122214       
    123 
    124         ////////////////////////////////////
    125         /**
    126      * @brief frame buffer objects: two are defined, flip them as input output every step
    127      */
    128         unsigned int psys_fbo[2];       
    129 
    130     /**
    131      * @brief color textures attached to frame buffer objects
    132      */
    133     unsigned int psys_tex[2];   
    134 
    135         unsigned int sort_fbo[2];
    136         unsigned int sort_tex[2];
    137 
    138         unsigned int velocity_fbo[2];
    139         unsigned int velocity_tex[2];
    140 
    141         // TEMP
    142         ///////////////////////////////////////////////////
    143         // TIME SERIES
    144         std::vector<unsigned int> _vectorFieldIDs;
    145         std::vector<vrTexture3D*> _vectorFields;
    146         unsigned int _curVectorFieldID;
    147         float _time_series_vel_mag_min;
    148         float _time_series_vel_mag_max;
    149         CircularFifo<float*, 10> _queue;
    150         int _flowFileStartIndex;
    151         int _flowFileEndIndex;
    152         ///////////////////////////////////////////////////
    153         int _skipByte;
    154 
    155         float _maxVelocityScale;
    156 
     215    CGprogram _particleFP;
     216    CGparameter _vectorParticleParam;
     217
     218    //////////////////////////////////////////
     219    // STREAMLINE
     220    unsigned int _maxAtlasCount;
     221    unsigned int _currentStreamlineIndex;
     222    int _currentStreamlineOffset;
     223    int _particleCount;
     224    int _stepSizeStreamline;
     225    int _curStepCount;
     226    int _atlasWidth, _atlasHeight;
     227    unsigned int _atlas_fbo;
     228    unsigned int _atlas_tex;
     229    RenderVertexArray* _streamVertices;
     230    unsigned int _atlasIndexBufferID;
    157231       
    158         RenderVertexArray* _vertices;
    159 
    160         Particle* _particles;
    161         float3* _positionBuffer;
    162         color4* _colorBuffer;
    163         unsigned _colorBufferID;
    164         //////////////////////////////////////////
    165         //
    166         vrTexture2D* _arrows;
    167 
    168         float _camx;
    169         float _camy;
    170         float _camz;
    171 
    172         float _scalex, _scaley, _scalez;
    173 
    174        
    175 
    176         bool _sortEnabled;
    177         bool _glypEnabled;
    178         bool _drawBBoxEnabled;
    179         bool _advectionEnabled;
    180         bool _streamlineEnabled;
    181         bool _depthCueEnabled;
    182 public :
    183         // TEMP
    184         static void callbackForCgError();
    185         static CGcontext _context;
    186 public :
    187         CGprogram _distanceInitFP;
    188 
    189         CGprogram _distanceSortFP;
    190         CGparameter _viewPosParam;
    191 
    192         CGprogram _distanceSortLookupFP;
    193 
    194         CGprogram _passthroughFP;
    195         CGparameter _scaleParam;
    196         CGparameter _biasParam;
    197 
    198         CGprogram _sortRecursionFP;
    199         CGparameter _srSizeParam;
    200         CGparameter _srStepParam;
    201         CGparameter _srCountParam;
    202 
    203         CGprogram _sortEndFP;
    204         CGparameter _seSizeParam;
    205         CGparameter _seStepParam;
    206 
    207         CGprogram _moveParticlesFP;
    208         CGparameter _mpTimeScale;
    209         CGparameter _mpVectorField;
    210         CGparameter _mpUseInitTex;
    211         CGparameter _mpCurrentTime;
    212         CGparameter _mpMaxScale;
    213         CGparameter _mpScale;
    214 
    215         CGprogram _initParticlePosFP;
    216         CGparameter _ipVectorFieldParam;
    217 
    218         CGprogram _particleVP;
    219         CGparameter _mvpParticleParam;
    220         CGparameter _mvParticleParam;
    221         CGparameter _mvTanHalfFOVParam;
    222         CGparameter _mvCurrentTimeParam;
    223        
    224         CGprogram _particleFP;
    225         CGparameter _vectorParticleParam;
    226 
    227         //////////////////////////////////////////
    228         // STREAMLINE
    229         unsigned int _maxAtlasCount;
    230         unsigned int _currentStreamlineIndex;
    231         int _currentStreamlineOffset;
    232         int _particleCount;
    233         int _stepSizeStreamline;
    234         int _curStepCount;
    235         int _atlasWidth, _atlasHeight;
    236         unsigned int _atlas_fbo;
    237         unsigned int _atlas_tex;
    238         RenderVertexArray* _streamVertices;
    239         unsigned int _atlasIndexBufferID;
    240        
    241         unsigned int _maxIndexBufferSize;
    242         unsigned int* _indexBuffer;
    243         int _atlas_x, _atlas_y;
    244 
    245         //////////////////////////////////////////
    246         // Initial Position
    247         unsigned int _initPos_fbo;
    248         unsigned int _initPosTex;
    249 
    250         /////////////////////////////////////////
    251         // Particle Info Vertex Buffer
    252         unsigned int _particleInfoBufferID;
    253 
    254         int _screenWidth;
    255         int _screenHeight;
    256         float _fov;
    257 
    258         bool _isTimeVaryingField;
    259 
    260         int _flowWidth;
    261         int _flowHeight;
    262         int _flowDepth;
    263 
    264         std::string _fileNameFormat;
    265 
    266         // INSOO
    267         // TEST
    268         std::vector<vrVector3f>* _criticalPoints;
    269 public :
    270         static void* dataLoadMain(void* data);
    271 public :
    272         ParticleSystem(int width, int height, const std::string& fileName, int fieldWidth, int fieldHeight, int fieldDepth,
    273                 bool timeVaryingData, int flowFileStartIndex, int flowFileEndIndex);
    274         ~ParticleSystem();
    275         void createRenderTargets();
    276         void createSortRenderTargets();
    277         void createStreamlineRenderTargets();
    278        
    279        
    280 protected :
    281         void mergeSort(int count);
    282         void merge(int count, int step);
    283         void sort();
    284         void drawQuad();
    285         void drawUnitBox();
    286         void drawQuad(int x1, int y1, int x2, int y2);
    287         void initShaders();
    288         void passThoughPositions();
    289         void initStreamlines(int width, int height);
    290         void resetStreamlines();
    291         void initInitPosTex();
    292 
    293         void allocateParticle(const float3&, const float3&, float, float);
    294         void initNewParticles();
    295         void cleanUpParticles();
    296 public :
    297         void advectStreamlines();
    298         void renderStreamlines();
    299 
    300         bool advect(float deltaT, float camx, float camy, float camz);
    301         void enable(EnableEnum enabled);
    302         void disable(EnableEnum enabled);
    303         bool isEnabled(EnableEnum enabled);
    304 
    305         ////////////////////////////////////////////
    306         void addEmitter(ParticleEmitter* emitter);
    307         ParticleEmitter* getEmitter(int index);
    308         unsigned int getNumEmitters() const;
    309         void removeEmitter(int index);
    310         void removeAllEmitters();
    311 
    312         int getMaxSize() const;
    313 
    314         void render();
    315 
    316         void reset();
    317 
    318         void setDefaultPointSize(float size);
    319 
    320         unsigned int getNumOfActiveParticles() const;
    321 
    322         void setScreenSize(int sreenWidth, int screenHeight);
    323 
    324         void setFOV(float fov);
     232    unsigned int _maxIndexBufferSize;
     233    unsigned int* _indexBuffer;
     234    int _atlas_x, _atlas_y;
     235
     236    //////////////////////////////////////////
     237    // Initial Position
     238    unsigned int _initPos_fbo;
     239    unsigned int _initPosTex;
     240
     241    /////////////////////////////////////////
     242    // Particle Info Vertex Buffer
     243    unsigned int _particleInfoBufferID;
     244
     245    int _screenWidth;
     246    int _screenHeight;
     247    float _fov;
     248
     249    bool _isTimeVaryingField;
     250
     251    int _flowWidth;
     252    int _flowHeight;
     253    int _flowDepth;
     254
     255    std::string _fileNameFormat;
     256
     257    // INSOO
     258    // TEST
     259    std::vector<vrVector3f>* _criticalPoints;
     260
     261    static void* dataLoadMain(void* data);
     262
     263    ParticleSystem(int width, int height, const std::string& fileName,
     264                   int fieldWidth, int fieldHeight, int fieldDepth,
     265                   bool timeVaryingData, int flowFileStartIndex, int flowFileEndIndex);
     266    ~ParticleSystem();
     267    void createRenderTargets();
     268    void createSortRenderTargets();
     269    void createStreamlineRenderTargets();
     270
     271    void advectStreamlines();
     272    void renderStreamlines();
     273
     274    bool advect(float deltaT, float camx, float camy, float camz);
     275    void enable(EnableEnum enabled);
     276    void disable(EnableEnum enabled);
     277    bool isEnabled(EnableEnum enabled);
     278
     279    ////////////////////////////////////////////
     280    void addEmitter(ParticleEmitter* emitter);
     281    ParticleEmitter* getEmitter(int index);
     282    unsigned int getNumEmitters() const;
     283    void removeEmitter(int index);
     284    void removeAllEmitters();
     285
     286    int getMaxSize() const;
     287
     288    void render();
     289
     290    void reset();
     291
     292    void setDefaultPointSize(float size);
     293
     294    unsigned int getNumOfActiveParticles() const;
     295
     296    void setScreenSize(int sreenWidth, int screenHeight);
     297
     298    void setFOV(float fov);
    325299
    326300    void setUserDefinedNumOfParticles(int numParticles);
    327301
    328         float getScaleX()const;
    329         float getScaleY()const;
    330         float getScaleZ()const;
    331         unsigned int getVectorFieldGraphicsID() const;
    332 
    333         bool isTimeVaryingField() const;
    334         void setTimeVaryingField(bool timeVarying);
    335 
    336         void setDepthCueEnabled(bool enabled);
    337         bool getDepthCueEnabled() const;
     302    float getScaleX()const;
     303    float getScaleY()const;
     304    float getScaleZ()const;
     305    unsigned int getVectorFieldGraphicsID() const;
     306
     307    bool isTimeVaryingField() const;
     308    void setTimeVaryingField(bool timeVarying);
     309
     310    void setDepthCueEnabled(bool enabled);
     311    bool getDepthCueEnabled() const;
     312
     313protected:
     314    void mergeSort(int count);
     315    void merge(int count, int step);
     316    void sort();
     317    void drawQuad();
     318    void drawUnitBox();
     319    void drawQuad(int x1, int y1, int x2, int y2);
     320    void initShaders();
     321    void passThoughPositions();
     322    void initStreamlines(int width, int height);
     323    void resetStreamlines();
     324    void initInitPosTex();
     325
     326    void allocateParticle(const float3&, const float3&, float, float);
     327    void initNewParticles();
     328    void cleanUpParticles();
    338329};
    339330
    340331inline unsigned int ParticleSystem::getNumEmitters() const
    341332{
    342         return _emitters.size();
     333    return _emitters.size();
    343334}
    344335
    345336inline int ParticleSystem::getMaxSize() const
    346337{
    347         return _width * _height;
     338    return _width * _height;
    348339}
    349340
    350341inline void ParticleSystem::setDefaultPointSize(float size)
    351342{
    352         _pointSize = size;
     343    _pointSize = size;
    353344}
    354345
    355346inline unsigned int ParticleSystem::getNumOfActiveParticles() const
    356347{
    357         return _activeParticles.size();
     348    return _activeParticles.size();
    358349}
    359350
    360351inline ParticleEmitter* ParticleSystem::getEmitter(int index)
    361352{
    362         if ((unsigned int) index < _emitters.size())
    363                 return _emitters[index];
    364         return 0;
     353    if ((unsigned int) index < _emitters.size())
     354        return _emitters[index];
     355    return 0;
    365356}
    366357
    367358inline void ParticleSystem::setScreenSize(int screenWidth, int screenHeight)
    368359{
    369         _screenWidth = screenWidth;
    370         _screenHeight = screenHeight;
     360    _screenWidth = screenWidth;
     361    _screenHeight = screenHeight;
    371362}
    372363
    373364inline void ParticleSystem::setFOV(float fov)
    374365{
    375         _fov = fov;
     366    _fov = fov;
    376367}
    377368
    378369inline float ParticleSystem::getScaleX()const
    379370{
    380         return _scalex;
     371    return _scalex;
    381372}
    382373
    383374inline float ParticleSystem::getScaleY()const
    384375{
    385         return _scaley;
    386 }
     376    return _scaley;
     377}
     378
    387379inline float ParticleSystem::getScaleZ()const
    388380{
    389         return _scalez;
    390 
    391 }
     381    return _scalez;
     382}
     383
    392384inline unsigned int ParticleSystem::getVectorFieldGraphicsID()const
    393385{
    394         return _curVectorFieldID;
    395 
     386    return _curVectorFieldID;
    396387}
    397388
    398389inline bool ParticleSystem::isTimeVaryingField() const
    399390{
    400         return _isTimeVaryingField;
     391    return _isTimeVaryingField;
    401392}
    402393
    403394inline void ParticleSystem::setTimeVaryingField(bool timeVarying)
    404395{
    405         _isTimeVaryingField = timeVarying;
     396    _isTimeVaryingField = timeVarying;
    406397}
    407398
    408399inline void ParticleSystem::setDepthCueEnabled(bool enabled)
    409400{
    410         _depthCueEnabled = enabled;
     401    _depthCueEnabled = enabled;
    411402}
    412403
    413404inline bool ParticleSystem::getDepthCueEnabled() const
    414405{
    415         return _depthCueEnabled;
    416 }
     406    return _depthCueEnabled;
     407}
  • trunk/packages/vizservers/nanovis/PlaneRenderer.cpp

    r2798 r2800  
    3333PlaneRenderer::~PlaneRenderer()
    3434{
    35     /*empty*/
    3635}
    3736
     
    4746    m_render_param = cgGetNamedParameter(m_fprog, "render_param");
    4847}
    49 
    5048
    5149int
     
    6664void
    6765PlaneRenderer::remove_plane(int index) {
    68     vector<Texture2D*>::iterator piter = plane.begin()+index;
    69     vector<TransferFunction*>::iterator tfiter = tf.begin()+index;
     66    std::vector<Texture2D*>::iterator piter = plane.begin()+index;
     67    std::vector<TransferFunction*>::iterator tfiter = tf.begin()+index;
    7068
    7169    plane.erase(piter);
     
    7472    n_planes--;
    7573}
    76 
    7774
    7875void
     
    123120}
    124121
    125 
    126122void
    127123PlaneRenderer::deactivate_shader()
  • trunk/packages/vizservers/nanovis/PlaneRenderer.h

    r2798 r2800  
    1414 * ======================================================================
    1515 */
    16 
    1716#ifndef _PLANE_RENDERER_H_
    1817#define _PLANE_RENDERER_H_
     
    3231#include "Texture2D.h"
    3332
    34 using namespace std;
    35 
    36 class PlaneRenderer{
    37 
     33class PlaneRenderer
     34{
    3835private:
    39     vector <Texture2D*> plane;  // Array of volumes
    40     vector <TransferFunction*> tf; // Array of corresponding transfer functions
     36    std::vector<Texture2D*> plane;      // Array of volumes
     37    std::vector<TransferFunction*> tf; // Array of corresponding transfer functions
    4138    int active_plane;           // The active plane, only one is rendered
    4239    int n_planes;
  • trunk/packages/vizservers/nanovis/RenderVertexArray.cpp

    r2798 r2800  
    3939#include <GL/gl.h>
    4040#include <stdio.h>
    41 
    42 using namespace std;
    4341
    4442RenderVertexArray::RenderVertexArray(int nverts, GLint size, GLenum type) :
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r2798 r2800  
    112112VolumeRenderer* NanoVis::vol_renderer = NULL;
    113113PointSetRenderer* NanoVis::pointset_renderer = NULL;
    114 vector<PointSet*> NanoVis::pointSet;
     114std::vector<PointSet*> NanoVis::pointSet;
    115115PlaneRenderer* NanoVis::plane_render = NULL;
    116116Texture2D* NanoVis::plane[10];
     
    219219float NanoVis::lic_slice_z = 0.5f;
    220220int NanoVis::lic_axis = 2; // z axis
    221 
    222 using namespace std;
    223221
    224222#define RM_VOLUME 1
Note: See TracChangeset for help on using the changeset viewer.