Changeset 1489 for trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h
- Timestamp:
- Jun 3, 2009, 11:47:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h
r1487 r1489 4 4 #include <Cg/cgGL.h> 5 5 #include <vector> 6 7 #define USE_NANOVIS_LIB 8 9 #ifdef USE_NANOVIS_LIB 10 #include "Texture2D.h" 6 11 #include "Vector3.h" 12 #else 13 #include <vr3d/vrTexture2D.h> 14 15 typedef vrTexture2D Texture2D; 16 17 class Vector3 { 18 public : 19 float x, y, z; 20 Vector3() : x(0.0f), y(0.0f), z(0.0f) {} 21 Vector3(float x1, float y1, float z1) : x(x1), y(y1), z(z1) {} 22 Vector3 operator*(float scale) 23 { 24 Vector3 vec; 25 vec.x = x * scale; 26 vec.y = y * scale; 27 vec.z = z * scale; 28 return vec; 29 } 30 Vector3 scale(const Vector3& scale) 31 { 32 Vector3 vec; 33 vec.x = x * scale.x; 34 vec.y = y * scale.y; 35 vec.z = z * scale.z; 36 return vec; 37 } 38 39 Vector3 operator*(const Vector3& scale) 40 { 41 Vector3 vec; 42 vec.x = x * scale.x; 43 vec.y = y * scale.y; 44 vec.z = z * scale.z; 45 return vec; 46 47 } 48 friend Vector3 operator+(const Vector3& value1, const Vector3& value2); 49 50 void set(float x1, float y1, float z1) 51 { 52 x = x1; y = y1; z = z1; 53 } 54 }; 55 56 inline Vector3 operator+(const Vector3& value1, const Vector3& value2) 57 { 58 return Vector3(value1.x + value2.x, value1.y + value2.y, value1.z + value2.z); 59 } 60 61 #endif 62 7 63 8 64 class VelocityArrowsSlice { 9 65 public : 66 enum RenderMode { 67 LINES, 68 GLYPHES, 69 }; 70 private : 10 71 unsigned int _vectorFieldGraphicsID; 11 72 float _vfXscale; … … 20 81 CGcontext _context; 21 82 CGprogram _queryVelocityFP; 22 CGparameter _ ipVectorFieldParam;83 CGparameter _qvVectorFieldParam; 23 84 24 85 int _renderTargetWidth; … … 36 97 37 98 Vector3 _maxVelocityScale; 38 99 Vector3 _arrowColor; 39 100 40 101 bool _enabled; … … 42 103 bool _dirtySamplingPosition; 43 104 bool _dirtyRenderTarget; 105 106 unsigned int _vertexBufferGraphicsID; 107 108 CGprogram _particleVP; 109 CGparameter _mvpParticleParam; 110 CGparameter _mvParticleParam; 111 CGparameter _mvTanHalfFOVParam; 112 CGparameter _mvCurrentTimeParam; 44 113 114 CGprogram _particleFP; 115 CGparameter _vectorParticleParam; 116 117 Texture2D* _arrowsTex; 118 119 RenderMode _renderMode; 45 120 private : 46 121 void createRenderTarget(); … … 48 123 public : 49 124 VelocityArrowsSlice(); 50 125 ~VelocityArrowsSlice(); 51 126 52 127 void vectorField(unsigned int vfGraphicsID, float xScale, float yScale, float zScale); … … 60 135 bool enabled() const; 61 136 void tickCountForMinSizeAxis(int tickCount); 62 int tickCountForMinSizeAxis() const; 63 void arrowColor(const Vector3& color); 137 int tickCountForMinSizeAxis() const; 138 void arrowColor(const Vector3& color); 139 void renderMode(RenderMode mode); 140 RenderMode renderMode() const; 64 141 }; 65 142 … … 90 167 } 91 168 169 inline void VelocityArrowsSlice::renderMode(VelocityArrowsSlice::RenderMode mode) 170 { 171 _renderMode = mode; 172 _dirty = true; 173 } 174 175 inline VelocityArrowsSlice::RenderMode VelocityArrowsSlice::renderMode() const 176 { 177 return _renderMode; 178 }
Note: See TracChangeset
for help on using the changeset viewer.