Changeset 2800 for trunk/packages/vizservers/nanovis
- Timestamp:
- Mar 6, 2012 2:04:43 AM (12 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r2798 r2800 85 85 86 86 // in nanovis.cpp 87 extern vector<PointSet*> g_pointSet;87 extern std::vector<PointSet*> g_pointSet; 88 88 89 89 extern PlaneRenderer* plane_render; … … 364 364 static int 365 365 GetVolumes(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, 366 vector<Volume *>* vectorPtr)366 std::vector<Volume *>* vectorPtr) 367 367 { 368 368 if (objc == 0) { … … 405 405 static int 406 406 GetHeightMaps(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, 407 vector<HeightMap *>* vectorPtr)407 std::vector<HeightMap *>* vectorPtr) 408 408 { 409 409 if (objc == 0) { … … 737 737 } 738 738 739 vector<Volume *> ivol;739 std::vector<Volume *> ivol; 740 740 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 741 741 return TCL_ERROR; 742 742 } 743 vector<Volume *>::iterator iter;743 std::vector<Volume *>::iterator iter; 744 744 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 745 745 (*iter)->move_cutplane(axis, relval); … … 765 765 } 766 766 767 vector<Volume *> ivol;767 std::vector<Volume *> ivol; 768 768 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 769 769 return TCL_ERROR; 770 770 } 771 771 if (state) { 772 vector<Volume *>::iterator iter;772 std::vector<Volume *>::iterator iter; 773 773 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 774 774 (*iter)->enable_cutplane(axis); 775 775 } 776 776 } else { 777 vector<Volume *>::iterator iter;777 std::vector<Volume *>::iterator iter; 778 778 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 779 779 (*iter)->disable_cutplane(axis); … … 1087 1087 Tcl_Obj *const *objv) 1088 1088 { 1089 vector<Volume *> volumes;1089 std::vector<Volume *> volumes; 1090 1090 if (GetVolumes(interp, objc - 3, objv + 3, &volumes) != TCL_OK) { 1091 1091 return TCL_ERROR; … … 1277 1277 return TCL_ERROR; 1278 1278 } 1279 vector<Volume *> ivol;1279 std::vector<Volume *> ivol; 1280 1280 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1281 1281 return TCL_ERROR; 1282 1282 } 1283 vector<Volume *>::iterator iter;1283 std::vector<Volume *>::iterator iter; 1284 1284 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1285 1285 (*iter)->data_enabled(state); … … 1393 1393 return TCL_ERROR; 1394 1394 } 1395 vector<Volume *> ivol;1395 std::vector<Volume *> ivol; 1396 1396 if (GetVolumes(interp, objc - 6, objv + 6, &ivol) != TCL_OK) { 1397 1397 return TCL_ERROR; 1398 1398 } 1399 vector<Volume *>::iterator iter;1399 std::vector<Volume *>::iterator iter; 1400 1400 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1401 1401 (*iter)->set_outline_color(rgb); … … 1412 1412 return TCL_ERROR; 1413 1413 } 1414 vector<Volume *> ivol;1414 std::vector<Volume *> ivol; 1415 1415 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1416 1416 return TCL_ERROR; 1417 1417 } 1418 vector<Volume *>::iterator iter;1418 std::vector<Volume *>::iterator iter; 1419 1419 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1420 1420 (*iter)->outline(state); … … 1454 1454 } 1455 1455 1456 vector<Volume *> ivol;1456 std::vector<Volume *> ivol; 1457 1457 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1458 1458 return TCL_ERROR; 1459 1459 } 1460 vector<Volume *>::iterator iter;1460 std::vector<Volume *>::iterator iter; 1461 1461 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1462 1462 (*iter)->diffuse(diffuse); … … 1473 1473 return TCL_ERROR; 1474 1474 } 1475 vector<Volume *> ivol;1475 std::vector<Volume *> ivol; 1476 1476 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1477 1477 return TCL_ERROR; 1478 1478 } 1479 vector<Volume *>::iterator iter;1479 std::vector<Volume *>::iterator iter; 1480 1480 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1481 1481 (*iter)->isosurface(iso_surface); … … 1494 1494 } 1495 1495 TRACE("set opacity %f\n", opacity); 1496 vector<Volume *> ivol;1496 std::vector<Volume *> ivol; 1497 1497 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1498 1498 return TCL_ERROR; 1499 1499 } 1500 vector<Volume *>::iterator iter;1500 std::vector<Volume *>::iterator iter; 1501 1501 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1502 1502 (*iter)->opacity_scale(opacity); … … 1513 1513 return TCL_ERROR; 1514 1514 } 1515 vector<Volume *> ivol;1515 std::vector<Volume *> ivol; 1516 1516 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1517 1517 return TCL_ERROR; 1518 1518 } 1519 vector<Volume *>::iterator iter;1519 std::vector<Volume *>::iterator iter; 1520 1520 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1521 1521 (*iter)->specular(specular); … … 1536 1536 return TCL_ERROR; 1537 1537 } 1538 vector<Volume *> ivol;1538 std::vector<Volume *> ivol; 1539 1539 if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) { 1540 1540 return TCL_ERROR; 1541 1541 } 1542 vector<Volume *>::iterator iter;1542 std::vector<Volume *>::iterator iter; 1543 1543 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1544 1544 TRACE("setting %s with transfer function %s\n", (*iter)->name(), … … 1591 1591 return TCL_ERROR; 1592 1592 } 1593 vector<Volume *> ivol;1593 std::vector<Volume *> ivol; 1594 1594 if (GetVolumes(interp, objc - 5, objv + 5, &ivol) != TCL_OK) { 1595 1595 return TCL_ERROR; 1596 1596 } 1597 vector<Volume *>::iterator iter;1597 std::vector<Volume *>::iterator iter; 1598 1598 const char *label; 1599 1599 label = Tcl_GetString(objv[4]); … … 1617 1617 return TCL_ERROR; 1618 1618 } 1619 vector<Volume *> ivol;1619 std::vector<Volume *> ivol; 1620 1620 if (GetVolumes(interp, objc - 3, objv + 3, &ivol) != TCL_OK) { 1621 1621 return TCL_ERROR; 1622 1622 } 1623 vector<Volume *>::iterator iter;1623 std::vector<Volume *>::iterator iter; 1624 1624 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 1625 1625 (*iter)->visible(state); … … 1750 1750 return TCL_ERROR; 1751 1751 } 1752 vector<HeightMap *> imap;1752 std::vector<HeightMap *> imap; 1753 1753 if (GetHeightMaps(interp, objc - 4, objv + 4, &imap) != TCL_OK) { 1754 1754 return TCL_ERROR; 1755 1755 } 1756 vector<HeightMap *>::iterator iter;1756 std::vector<HeightMap *>::iterator iter; 1757 1757 for (iter = imap.begin(); iter != imap.end(); iter++) { 1758 1758 (*iter)->setVisible(visible); … … 1791 1791 return TCL_ERROR; 1792 1792 } 1793 vector<HeightMap *> imap;1793 std::vector<HeightMap *> imap; 1794 1794 if (GetHeightMaps(interp, objc - 6, objv + 6, &imap) != TCL_OK) { 1795 1795 return TCL_ERROR; 1796 1796 } 1797 vector<HeightMap *>::iterator iter;1797 std::vector<HeightMap *>::iterator iter; 1798 1798 for (iter = imap.begin(); iter != imap.end(); iter++) { 1799 1799 (*iter)->setLineContourColor(rgb); … … 1811 1811 return TCL_ERROR; 1812 1812 } 1813 vector<HeightMap *> imap;1813 std::vector<HeightMap *> imap; 1814 1814 if (GetHeightMaps(interp, objc - 4, objv + 4, &imap) != TCL_OK) { 1815 1815 return TCL_ERROR; 1816 1816 } 1817 vector<HeightMap *>::iterator iter;1817 std::vector<HeightMap *>::iterator iter; 1818 1818 for (iter = imap.begin(); iter != imap.end(); iter++) { 1819 1819 (*iter)->setLineContourVisible(visible); … … 2018 2018 return TCL_ERROR; 2019 2019 } 2020 vector<HeightMap *> imap;2020 std::vector<HeightMap *> imap; 2021 2021 if (GetHeightMaps(interp, objc - 3, objv + 3, &imap) != TCL_OK) { 2022 2022 return TCL_ERROR; 2023 2023 } 2024 vector<HeightMap *>::iterator iter;2024 std::vector<HeightMap *>::iterator iter; 2025 2025 for (iter = imap.begin(); iter != imap.end(); iter++) { 2026 2026 (*iter)->transferFunction(tfPtr); … … 2039 2039 return TCL_ERROR; 2040 2040 } 2041 vector<HeightMap *> heightmaps;2041 std::vector<HeightMap *> heightmaps; 2042 2042 if (GetHeightMaps(interp, objc - 3, objv + 3, &heightmaps) != TCL_OK) { 2043 2043 return TCL_ERROR; 2044 2044 } 2045 vector<HeightMap *>::iterator iter;2045 std::vector<HeightMap *>::iterator iter; 2046 2046 for (iter = heightmaps.begin(); iter != heightmaps.end(); iter++) { 2047 2047 (*iter)->opacity(opacity); -
trunk/packages/vizservers/nanovis/EventPlayer.cpp
r2798 r2800 27 27 #include "../Event.h" 28 28 29 using namespace std;30 31 29 Event* event[300]; 32 30 int cur_event = 0; -
trunk/packages/vizservers/nanovis/ParticleSystem.h
r2798 r2800 2 2 #pragma once 3 3 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> 4 14 #include <vr3d/vrTexture3D.h> 15 5 16 #include "ParticleEmitter.h" 6 17 #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 16 19 #include "CircularQueue.h" 17 20 #include "datatype.h" 21 18 22 struct NewParticle { 19 20 21 22 23 23 int index; 24 float3 position; 25 float3 velocity; 26 float timeOfDeath; 27 float initTimeStep; 24 28 }; 25 29 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> 30 template <typename Type, typename Compare=std::less<Type> > 31 class priority_queue_vector : public std::priority_queue<Type, std::vector<Type>, Compare> 31 32 { 32 33 public: 33 34 34 void reserve(typename priority_queue_vector<Type>::size_type count) 35 { 35 36 #ifdef _WIN32 36 37 c.reserve(count); 37 38 #else 38 39 //priority_queue<Type,vector<Type>, Compare>::reserve(count); 39 40 #endif 40 41 } 41 42 }; 42 43 43 struct ActiveParticle 44 { 45 float timeOfDeath; 46 int index; 44 struct ActiveParticle { 45 float timeOfDeath; 46 int index; 47 47 }; 48 48 49 49 namespace std 50 50 { 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 60 struct Particle { 61 float timeOfBirth; 62 float lifeTime; 63 float attributeType; 64 float index; 67 65 }; 68 66 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 67 class ParticleSystem 68 { 69 public: 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; 95 150 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; 122 214 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; 157 231 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); 325 299 326 300 void setUserDefinedNumOfParticles(int numParticles); 327 301 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 313 protected: 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(); 338 329 }; 339 330 340 331 inline unsigned int ParticleSystem::getNumEmitters() const 341 332 { 342 333 return _emitters.size(); 343 334 } 344 335 345 336 inline int ParticleSystem::getMaxSize() const 346 337 { 347 338 return _width * _height; 348 339 } 349 340 350 341 inline void ParticleSystem::setDefaultPointSize(float size) 351 342 { 352 343 _pointSize = size; 353 344 } 354 345 355 346 inline unsigned int ParticleSystem::getNumOfActiveParticles() const 356 347 { 357 348 return _activeParticles.size(); 358 349 } 359 350 360 351 inline ParticleEmitter* ParticleSystem::getEmitter(int index) 361 352 { 362 363 364 353 if ((unsigned int) index < _emitters.size()) 354 return _emitters[index]; 355 return 0; 365 356 } 366 357 367 358 inline void ParticleSystem::setScreenSize(int screenWidth, int screenHeight) 368 359 { 369 370 360 _screenWidth = screenWidth; 361 _screenHeight = screenHeight; 371 362 } 372 363 373 364 inline void ParticleSystem::setFOV(float fov) 374 365 { 375 366 _fov = fov; 376 367 } 377 368 378 369 inline float ParticleSystem::getScaleX()const 379 370 { 380 371 return _scalex; 381 372 } 382 373 383 374 inline float ParticleSystem::getScaleY()const 384 375 { 385 return _scaley; 386 } 376 return _scaley; 377 } 378 387 379 inline float ParticleSystem::getScaleZ()const 388 380 { 389 390 391 } 381 return _scalez; 382 } 383 392 384 inline unsigned int ParticleSystem::getVectorFieldGraphicsID()const 393 385 { 394 return _curVectorFieldID; 395 386 return _curVectorFieldID; 396 387 } 397 388 398 389 inline bool ParticleSystem::isTimeVaryingField() const 399 390 { 400 391 return _isTimeVaryingField; 401 392 } 402 393 403 394 inline void ParticleSystem::setTimeVaryingField(bool timeVarying) 404 395 { 405 396 _isTimeVaryingField = timeVarying; 406 397 } 407 398 408 399 inline void ParticleSystem::setDepthCueEnabled(bool enabled) 409 400 { 410 401 _depthCueEnabled = enabled; 411 402 } 412 403 413 404 inline bool ParticleSystem::getDepthCueEnabled() const 414 405 { 415 416 } 406 return _depthCueEnabled; 407 } -
trunk/packages/vizservers/nanovis/PlaneRenderer.cpp
r2798 r2800 33 33 PlaneRenderer::~PlaneRenderer() 34 34 { 35 /*empty*/36 35 } 37 36 … … 47 46 m_render_param = cgGetNamedParameter(m_fprog, "render_param"); 48 47 } 49 50 48 51 49 int … … 66 64 void 67 65 PlaneRenderer::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; 70 68 71 69 plane.erase(piter); … … 74 72 n_planes--; 75 73 } 76 77 74 78 75 void … … 123 120 } 124 121 125 126 122 void 127 123 PlaneRenderer::deactivate_shader() -
trunk/packages/vizservers/nanovis/PlaneRenderer.h
r2798 r2800 14 14 * ====================================================================== 15 15 */ 16 17 16 #ifndef _PLANE_RENDERER_H_ 18 17 #define _PLANE_RENDERER_H_ … … 32 31 #include "Texture2D.h" 33 32 34 using namespace std; 35 36 class PlaneRenderer{ 37 33 class PlaneRenderer 34 { 38 35 private: 39 vector<Texture2D*> plane; // Array of volumes40 vector<TransferFunction*> tf; // Array of corresponding transfer functions36 std::vector<Texture2D*> plane; // Array of volumes 37 std::vector<TransferFunction*> tf; // Array of corresponding transfer functions 41 38 int active_plane; // The active plane, only one is rendered 42 39 int n_planes; -
trunk/packages/vizservers/nanovis/RenderVertexArray.cpp
r2798 r2800 39 39 #include <GL/gl.h> 40 40 #include <stdio.h> 41 42 using namespace std;43 41 44 42 RenderVertexArray::RenderVertexArray(int nverts, GLint size, GLenum type) : -
trunk/packages/vizservers/nanovis/nanovis.cpp
r2798 r2800 112 112 VolumeRenderer* NanoVis::vol_renderer = NULL; 113 113 PointSetRenderer* NanoVis::pointset_renderer = NULL; 114 vector<PointSet*> NanoVis::pointSet;114 std::vector<PointSet*> NanoVis::pointSet; 115 115 PlaneRenderer* NanoVis::plane_render = NULL; 116 116 Texture2D* NanoVis::plane[10]; … … 219 219 float NanoVis::lic_slice_z = 0.5f; 220 220 int NanoVis::lic_axis = 2; // z axis 221 222 using namespace std;223 221 224 222 #define RM_VOLUME 1
Note: See TracChangeset
for help on using the changeset viewer.