Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkEncodedGradientShader.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkEncodedGradientShader_h
00012 #define __mitkEncodedGradientShader_h
00013 
00014 #include "mitkObject.h"
00015 #include "mitkVisualizationIncludes.h"
00016 
00017 #define MITK_MAX_SHADING_TABLES   100
00018 
00019 class mitkVolumeModel;
00020 class mitkScene;
00021 class mitkEncodedGradientEstimator;
00022 
00027 class MITK_VISUALIZATION_API mitkEncodedGradientShader : public mitkObject
00028 {
00029 public:
00030     //operations
00031     MITK_TYPE(mitkEncodedGradientShader,mitkObject)
00032         
00033     mitkEncodedGradientShader();    
00034     
00035     virtual void  SetZeroNormalDiffuseIntensity(float fZDiffuseIntensity);
00036     virtual float GetZeroNormalDiffuseIntensityMinValue(){return 0.0f;}
00037     virtual float GetZeroNormalDiffuseIntensityMaxValue(){return 1.0f;}
00038     virtual float GetZeroNormalDiffuseIntensity(){return m_ZeroNormalDiffuseIntensity;}
00039     
00040     virtual void  SetZeroNormalSpecularIntensity(float fZSpecularIntensity);
00041     virtual float GetZeroNormalSpecularIntensityMinValue(){return 0.0f;}
00042     virtual float GetZeroNormalSpecularIntensityMaxValue(){return 1.0f;}    
00043     virtual float GetZeroNormalSpecularIntensity(){return m_ZeroNormalSpecularIntensity;}   
00044     
00045     
00046     void UpdateShadingTable(mitkScene *scene, mitkVolumeModel *vol, mitkEncodedGradientEstimator *gradest);
00047     
00048     
00049     float *GetRedDiffuseShadingTable(    mitkVolumeModel *vol );
00050     float *GetGreenDiffuseShadingTable(  mitkVolumeModel *vol );
00051     float *GetBlueDiffuseShadingTable(   mitkVolumeModel *vol );
00052     float *GetRedSpecularShadingTable(   mitkVolumeModel *vol );
00053     float *GetGreenSpecularShadingTable( mitkVolumeModel *vol );
00054     float *GetBlueSpecularShadingTable(  mitkVolumeModel *vol );
00055     
00056     
00057     
00058 protected:
00059     virtual ~mitkEncodedGradientShader();
00060 
00061     //operations:    
00062     // Description:
00063     // Build a shading table for a light with the specified direction,
00064     // and color for an object of the specified material properties.
00065     // material[0] = ambient, material[1] = diffuse, material[2] = specular
00066     // and material[3] = specular exponent.  If the ambient flag is 1, 
00067     // then ambient illumination is added. If not, then this means we 
00068     // are calculating the "other side" of two sided lighting, so no 
00069     // ambient intensity is added in. If the update flag is 0,
00070     // the shading table is overwritten with these new shading values.
00071     // If the updateFlag is 1, then the computed light contribution is
00072     // added to the current shading table values. There is one shading
00073     // table per volume, and the index value indicated which index table
00074     // should be used. It is computed in the UpdateShadingTable method.
00075     void _buildShadingTable(int index, float lightDirection[3], float lightColor[3], float lightIntensity, float viewDirection[3],
00076                             float material[4], mitkEncodedGradientEstimator *gradest);
00077 
00078     // Attributes
00079     // The six shading tables (r diffuse ,g diffuse ,b diffuse, 
00080     // r specular, g specular, b specular ) - with an entry for each
00081     // encoded normal plus one entry at the end for the zero normal
00082     // There is one shading table per volume listed in the ShadingTableVolume
00083     // array. A null entry indicates an available slot.
00084     float                        *m_ShadingTable[MITK_MAX_SHADING_TABLES][6];
00085     mitkVolumeModel              *m_ShadingTableVolume[MITK_MAX_SHADING_TABLES];
00086     int                          m_ShadingTableSize[MITK_MAX_SHADING_TABLES];
00087     
00088     // The intensity of light used for the zero normals, since it
00089     // can not be computed from the normal angles. Defaults to 0.0.
00090     float    m_ZeroNormalDiffuseIntensity;
00091     float    m_ZeroNormalSpecularIntensity;
00092     
00093     
00094 private:    
00095     mitkEncodedGradientShader(const mitkEncodedGradientShader&);
00096     void operator=(const mitkEncodedGradientShader&);
00097 };
00098 
00099 
00100 //#define DEFINED_mitkEncodedGradientShader
00101  
00102 
00103 
00104 #endif
00105 
00106 /*=========================================================================
00107 
00108   Program:   Visualization Toolkit
00109   Module:    $RCSfile$
00110   Language:  C++
00111   Date:      $Date: 2006-04-28 10:35:09 +0800 (ÐÇÆÚÎå, 28 ËÄÔÂ 2006) $
00112   Version:   $Revision: 2 $
00113 
00114 
00115 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00116 All rights reserved.
00117 
00118 Redistribution and use in source and binary forms, with or without
00119 modification, are permitted provided that the following conditions are met:
00120 
00121  * Redistributions of source code must retain the above copyright notice,
00122    this list of conditions and the following disclaimer.
00123 
00124  * Redistributions in binary form must reproduce the above copyright notice,
00125    this list of conditions and the following disclaimer in the documentation
00126    and/or other materials provided with the distribution.
00127 
00128  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00129    of any contributors may be used to endorse or promote products derived
00130    from this software without specific prior written permission.
00131 
00132  * Modified source versions must be plainly marked as such, and must not be
00133    misrepresented as being the original software.
00134 
00135 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00136 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00137 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00138 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00139 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00140 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00141 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00142 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00143 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00144 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00145 
00146 =========================================================================*/ 
00147 

Generated on Tue Feb 25 15:00:36 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3