Changeset 1478 for trunk/packages/vizservers/nanovis/Volume.h
- Timestamp:
- May 30, 2009 8:07:17 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Volume.h
r1477 r1478 26 26 #include "AxisRange.h" 27 27 #include "R2/R2Object.h" 28 #include "TransferFunction.h" 28 29 29 30 struct CutPlane{ … … 38 39 }; 39 40 40 enum {CUBIC, VOLQD, ZINCBLENDE}; 41 42 class Volume : public R2Object { 41 class VolumeInterpolator; 42 43 44 class Volume { 45 protected: 46 TransferFunction *_tfPtr; // This is the designated transfer 47 // to use to render this volume. 48 49 float _specular; // Specular lighting parameter 50 float _diffuse; // Diffuse lighting parameter 51 float _opacity_scale; // The scale multiplied to the opacity 52 // assigned by the transfer function. 53 // Rule of thumb: higher opacity_scale 54 // the object is to appear like 55 // plastic 56 int _volumeDataID; 57 Vector3 _physical_min; 58 Vector3 _physical_max; 59 float* _data; 60 61 int _n_components; 62 63 double _nonzero_min; 64 65 std::vector <CutPlane> _plane; // cut planes 66 67 Texture3D* _tex; // OpenGL texture storing the volume 68 69 70 int _pointsetIndex; 71 72 Vector3 _location; 73 74 int _n_slices; // Number of slices when rendered. The greater 75 // the better quality, lower speed. 76 77 bool _enabled; 78 79 bool _data_enabled; // show/hide cloud of volume data 80 81 bool _outline_enabled; // show/hide outline around volume 82 83 Color _outline_color; // color for outline around volume 84 85 int _volume_type; // cubic or zincblende 86 87 int _iso_surface; 88 43 89 public: 44 int _volumeDataID; 90 enum { CUBIC, VOLQD, ZINCBLENDE }; 91 float aspect_ratio_width; 92 float aspect_ratio_height; 93 float aspect_ratio_depth; 94 95 NVISid id; //OpenGL textue identifier (==tex->id) 45 96 46 97 int width; // The resolution of the data (how many points … … 50 101 int depth; // Width, height and depth together determing 51 102 // the proprotion of the volume ONLY. 52 53 103 float size; // This is the scaling factor that will size 54 104 // the volume on screen. A render program … … 57 107 // objects. This size is provided by the 58 108 // render engine. 59 Vector3 _physical_min;60 Vector3 _physical_max;61 109 62 110 AxisRange xAxis, yAxis, zAxis, wAxis; 63 111 static bool update_pending; 64 112 static double valueMin, valueMax; 65 66 int n_components;67 68 double nonzero_min;69 70 std::vector <CutPlane> plane; // cut planes71 72 Texture3D* tex; // OpenGL texture storing the volume73 74 float* _data;75 76 int pointsetIndex;77 78 Vector3 location;79 80 bool enabled;81 82 int n_slice; // Number of slices when rendered. The greater83 // the better quality, lower speed.84 85 float _specular; // specular lighting parameter86 float _diffuse; // diffuse lighting parameter87 float _opacity_scale; // The scale multiplied to the opacity assigned88 // by the transfer function. Rule of thumb:89 // higher opacity_scale the object is to appear90 // like plastic91 92 bool data_enabled; // show/hide cloud of volume data93 94 bool outline_enabled; // show/hide outline around volume95 96 Color outline_color; // color for outline around volume97 98 int volume_type; // cubic or zincblende99 100 float aspect_ratio_width;101 float aspect_ratio_height;102 float aspect_ratio_depth;103 104 NVISid id; //OpenGL textue identifier (==tex->id)105 106 int iso_surface;107 113 108 114 public : … … 110 116 float size, int n_component, float* data, double vmin, double vmax, 111 117 double nonzero_min); 112 113 protected : 114 virtual ~Volume(); 118 ~Volume(); 115 119 116 120 public : 117 121 void visible(bool value) { 118 enabled = value;122 _enabled = value; 119 123 } 120 124 bool visible(void) { 121 return enabled; 122 } 123 void move(Vector3 _loc) { 124 location = _loc; 125 } 126 127 Vector3* get_location(); 128 129 void set_isosurface(int iso); 130 int get_isosurface() const; 131 132 double range_nzero_min() { return nonzero_min; } 133 134 void set_n_slice(int val); // set number of slices 135 int get_n_slice(); // return number of slices 136 125 return _enabled; 126 } 127 void location(Vector3 loc) { 128 _location = loc; 129 } 130 Vector3 location(void) const { 131 return _location; 132 } 133 int isosurface(void) const { 134 return _iso_surface; 135 } 136 void isosurface(int iso) { 137 _iso_surface = iso; 138 } 139 int n_components(void) { 140 return _n_components; 141 } 142 double nonzero_min(void) { 143 return _nonzero_min; 144 } 145 int volume_type(void) { 146 return _volume_type; 147 } 148 float *data(void) { 149 return _data; 150 } 151 Texture3D *tex(void) { 152 return _tex; 153 } 154 155 double range_nzero_min() { return _nonzero_min; } 156 157 int n_slices(void) const { 158 return _n_slices; 159 } 160 void n_slices(int n) { 161 _n_slices = n; 162 } 163 137 164 void set_size(float s); //set the drawing size of volume 138 165 … … 166 193 _opacity_scale = value; 167 194 } 168 void data (bool value) {169 data_enabled = value;170 } 171 bool data (void) {172 return data_enabled;195 void data_enabled(bool value) { 196 _data_enabled = value; 197 } 198 bool data_enabled(void) { 199 return _data_enabled; 173 200 } 174 201 void outline(bool value) { 175 outline_enabled = value;202 _outline_enabled = value; 176 203 } 177 204 bool outline(void) { 178 return outline_enabled; 205 return _outline_enabled; 206 } 207 TransferFunction *transferFunction(void) { 208 return _tfPtr; 209 } 210 void transferFunction(TransferFunction *tfPtr) { 211 _tfPtr = tfPtr; 179 212 } 180 213 void set_outline_color(float* rgb); … … 189 222 Vector3& getPhysicalBBoxMax(); 190 223 191 void setDataID(int id); 192 int getDataID() const; 224 void dataID(size_t index) { 225 _volumeDataID = index; 226 } 227 size_t dataID(void) const { 228 return _volumeDataID; 229 } 193 230 }; 194 231 195 inline Vector3* Volume::get_location() {196 return &location;197 }198 232 inline 199 int Volume::add_cutplane(int _orientation, float _location) {200 plane.push_back(CutPlane(1, 0.5));201 return plane.size() - 1;233 int Volume::add_cutplane(int orientation, float location) { 234 _plane.push_back(CutPlane(1, 0.5)); 235 return _plane.size() - 1; 202 236 } 203 237 … … 206 240 { 207 241 //assert(index < plane.size()); 208 plane[index].enabled = true;242 _plane[index].enabled = true; 209 243 } 210 244 inline void … … 212 246 { 213 247 //assert(index < plane.size()); 214 plane[index].enabled = false;248 _plane[index].enabled = false; 215 249 } 216 250 … … 219 253 { 220 254 //assert(index < plane.size()); 221 plane[index].offset = location;255 _plane[index].offset = location; 222 256 } 223 257 … … 226 260 { 227 261 //assert(index < plane.size()); 228 return & plane[index];262 return &_plane[index]; 229 263 } 230 264 … … 232 266 Volume::get_cutplane_count() 233 267 { 234 return plane.size();268 return _plane.size(); 235 269 } 236 270 … … 239 273 { 240 274 //assert(index < plane.size()); 241 return plane[index].enabled; 242 } 243 244 inline void 245 Volume::set_n_slice(int n) 246 { 247 n_slice = n; 248 } 249 250 inline int 251 Volume::get_n_slice() 252 { 253 return n_slice; 275 return _plane[index].enabled; 254 276 } 255 277 … … 258 280 { 259 281 size = s; 260 aspect_ratio_width = s*tex->aspect_ratio_width;261 aspect_ratio_height = s *tex->aspect_ratio_height;262 aspect_ratio_depth = s*tex->aspect_ratio_depth;282 aspect_ratio_width = s * _tex->aspect_ratio_width; 283 aspect_ratio_height = s * _tex->aspect_ratio_height; 284 aspect_ratio_depth = s * _tex->aspect_ratio_depth; 263 285 } 264 286 … … 266 288 Volume::set_outline_color(float *rgb) 267 289 { 268 outline_color = Color(rgb[0],rgb[1],rgb[2]);290 _outline_color = Color(rgb[0],rgb[1],rgb[2]); 269 291 } 270 292 … … 272 294 Volume::get_outline_color(float *rgb) 273 295 { 274 outline_color.GetRGB(rgb);296 _outline_color.GetRGB(rgb); 275 297 } 276 298 … … 281 303 } 282 304 283 inline int284 Volume::get_isosurface() const285 {286 return iso_surface;287 }288 289 inline void290 Volume::set_isosurface(int iso)291 {292 iso_surface = iso;293 }294 305 295 306 inline void … … 322 333 } 323 334 324 inline void325 Volume::setDataID(int id)326 {327 _volumeDataID = id;328 }329 330 inline int331 Volume::getDataID() const332 {333 return _volumeDataID;334 }335 335 336 336 #endif
Note: See TracChangeset
for help on using the changeset viewer.