00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 3-22-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 /// volume.h 00019 00020 #ifndef __VOLUME_DOT_H 00021 #define __VOLUME_DOT_H 00022 00023 #include <volume/Volytope.h> 00024 #include <smartptr.h> 00025 #include <nrro/nrro.h> 00026 #include <textureGlift.h> 00027 #include <texture/simTexture.h> 00028 #include <volume/VolField.h> 00029 00030 //////////////////////////////////////////////////////////////////////////// 00031 /// Volume, basic container for multi-channel volume data 00032 /// contains VolFields and Volytopes, see these class definitions for 00033 /// for more functionality 00034 //////////////////////////////////////////////////////////////////////////// 00035 /// Notes: 00036 /// 00037 /// Add data to the fields using the fieldvec: 00038 /// vol->fields->addNrro(myNrro); 00039 /// 00040 /// Call vol->update() when you have added all of the fields you want. 00041 /// update calls update on all the fields and creates the volytopes that 00042 /// you will need for rendering the volume. 00043 00044 00045 class Volume : 00046 public gutz::Counted, 00047 public SimBase 00048 { 00049 public: 00050 Volume(); 00051 virtual ~Volume(){} 00052 00053 ////////////////////////////////////////////////// 00054 ///@name Field & Volytope: Public data and accesors 00055 /// We have public data, since the interface to it 00056 /// throught this class would have to duplicate 00057 /// their interface, exactly. So what's the point? \n 00058 /// Set/Get provided for symetry. 00059 /// 00060 /// TODO: this class really shouldn't own these objects! 00061 ///@{ 00062 VolFieldVec fields; //fields, your data 00063 VolFieldVec getFields() const { return fields; } 00064 void setFields(const VolFieldVec &vfv) { fields = vfv; } 00065 00066 VolytopeVec volys; //volytopes, generated by "update()" 00067 VolytopeVec getVolytopes() const { return volys; } 00068 void setVolytopes(const VolytopeVec &vtv) { volys = vtv; } 00069 ///@} 00070 ////////////////////////////////////////////////// 00071 00072 /////////////////////////////////////////////////// 00073 /// is this object good to go? \n 00074 /// if not, needs update (most likely), or 00075 /// it is mis-configured 00076 bool isValid() const {return _valid;} 00077 00078 /////////////////////////////////////////////////// 00079 ///@name Types of volumes supported 00080 ///@{ 00081 enum VOLUME_KIND{ 00082 RECTLIN, //rectilinear - default 00083 CURVLIN, //curvilinear - not supported yet 00084 VOLYTOPE, //generic volytope volume 00085 UNSTRUCT, //unstructured - not supported yet 00086 }; 00087 int getVolType() const {return _vtype;} 00088 void setVolType(int vtype) {_vtype = vtype;} 00089 ///@} 00090 /////////////////////////////////////////////////// 00091 00092 /////////////////////////////////////////////////// 00093 ///@name Default texture qualities 00094 /// from simTexture.h 00095 ///@{ 00096 int getTexQual() const { return _texqual; } 00097 void setTexQual(int tq = SIMT_BEST) {_texqual = tq; } 00098 ///@} 00099 00100 ////////////////////////////////////////////////// 00101 /// Update the Volume if something changes 00102 virtual void update(); 00103 00104 ////////////////////////////////////////////////// 00105 ///@name Bricking info 00106 /// default brick size set to {128,128,128} 00107 ///@{ 00108 gutz::vec3i getBrickDims() const { return _brickDims; } 00109 void setBrickDims(gutz::vec3i bd) {_brickDims = bd;} 00110 ///@} 00111 00112 ////////////////////////////////////////////////// 00113 ///@name Set/Get size of volume. 00114 /// -1 means that the size isn't set, 00115 /// and you are using the volytopes native size, 00116 /// setting the size scales the volytopes so that 00117 /// collectively they are no larger than the size 00118 /// along any axis 00119 /// need to call "update()" for this to take effect 00120 ///@{ 00121 float getSize() const { return _size; } 00122 void setSize(float size = -1); 00123 ///@} 00124 00125 ////////////////////////////////////////////////// 00126 ///@name toggle centering on and off, 00127 /// need to call "update()" for this to take effect 00128 ///@{ 00129 bool getCentered() const { return _centered; } 00130 void setCentered(bool onoff) 00131 { if(onoff != _centered) _valid = false; _centered = onoff; } 00132 ///@} 00133 00134 protected: 00135 void clearVolytopes(); 00136 void updateVolytopesRL(); ///rectilinear volytopes 00137 00138 void updateRectLin(); 00139 00140 void setDefault(); 00141 00142 bool _valid; ///< is the volume valid? 00143 int _vtype; ///< what type of volume is this? 00144 gutz::vec3i _brickDims; 00145 int _texqual; 00146 00147 float _size; 00148 bool _centered; 00149 }; 00150 00151 typedef gutz::SmartPtr<Volume> VolumeSP; 00152 00153 #endif 00154