Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Volume/Regular/Unimodal/3d/1B/Intensity/vuTFDesignSpec.h

Go to the documentation of this file.
00001 #ifndef _VUTFDESIGNSPEC_H_
00002 #define _VUTFDESIGNSPEC_H_
00003 
00004 #include "vuTFDesign.h"
00005 #include "vuSpectral/SPalette.h"
00006 
00008 
00013 class vuTFDesignSpec : public vuTFDesign
00014 {
00015  public:
00016     //-------------------------------------------------------------------------
00018     struct LightNode 
00019     {
00020         LightNode(float _weight = 0, dword ncomp = 32, const float val = 0) :
00021             weight(_weight), wopade(-1)
00022             {
00023                 dword c;
00024                 for(c=0;c<ncomp;c++) {
00025                     col[c] = val;
00026                 }
00027                 for(;c<32;c++) col[c] = 0;
00028             };
00029 
00030         LightNode(float _weight, dword ncomp, const vuColourN& _col) :
00031             weight(_weight), wopade(-1)
00032             {
00033                 if((dword)_col.nComponents() == ncomp) {
00034                     dword c;
00035                     for(c=0;c<ncomp;c++) {
00036                         col[c] = _col[c];
00037                     }
00038                     for(;c<32;c++) col[c] = 0;
00039                 }
00040             };
00041       
00042         LightNode(float _weight, dword ncomp, const float* _col) :
00043             weight(_weight), wopade(-1)
00044             {
00045                 for(dword c=0;c<ncomp;c++) {
00046                     col[c] = _col[c];
00047                 }
00048                 
00049             };
00050         
00051         float weight;
00052         float col[32];
00053         int wopade;     // opacity node to be weighted by this light 
00054     };
00055     
00056  public:
00058     vuTFDesignSpec(dword ncomp = 32, dword range = 256) : vuTFDesign(ncomp,range) {};
00059 
00061 
00063     void generateFunction();
00064 
00066     void generateOpacities();
00067 
00068     /* * returns an interpolated colour from the look-up table. */
00069     //void getRGBa(dword i, vuColourRGBa& rgba);
00070 
00072 
00077     dword addLight(const float* _col);
00079     const LightNode& getLightNode(dword index) const;
00081     dword getNumLights() const;
00085     void setLightWeight(dword index, float _weight);
00086     float getLightWeight(dword index ) const
00087         { return index < getNumLights() ? m_Lights[index].weight : 0; }
00088 
00094     void weightLights(const float* weights);
00096     void setLightIntensity(float intensity) { m_LightIntensity = intensity; };
00098     float getLightIntensity() { return m_LightIntensity; };
00102     void setLightOpacityNode(word lindex, int intensity);
00103     
00108     void generateLight();
00109 
00113     void setupMtlTriAlphaNodes();
00114 
00117     void setAlphaByLight();
00118     
00120     void clearAllNodes();
00121 
00123     SPalette& getPalette() {return m_Palette;};
00124 
00126     void updatePalette();
00127 
00129     void updateFromPalette();
00130     
00131  protected:
00132     
00134     void parseTFunc();
00139     void writeTFunc(ofstream &ofp) const;
00140 
00146     bool readLight();
00147     
00149     bool writeLights(ofstream &ofp) const;
00150 
00151 //------------------------------------------------------------------------------
00152 // member variables
00153     
00154     vuDVector<LightNode> m_Lights;
00155     float m_LightIntensity;
00156     SPalette            m_Palette;
00157 };
00158 
00159 #endif
00160  
00161 
00162 
00163 
00164 
00165 
00166 
00167 

Generated on Wed Dec 15 21:20:38 2004 for vuVolume by  doxygen 1.3.9.1