VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTexture.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00051 #ifndef __vtkTexture_h 00052 #define __vtkTexture_h 00053 00054 #include "vtkImageAlgorithm.h" 00055 00056 class vtkImageData; 00057 class vtkScalarsToColors; 00058 class vtkRenderer; 00059 class vtkUnsignedCharArray; 00060 class vtkWindow; 00061 class vtkDataArray; 00062 class vtkTransform; 00063 00064 #define VTK_TEXTURE_QUALITY_DEFAULT 0 00065 #define VTK_TEXTURE_QUALITY_16BIT 16 00066 #define VTK_TEXTURE_QUALITY_32BIT 32 00067 00068 class VTK_RENDERING_EXPORT vtkTexture : public vtkImageAlgorithm 00069 { 00070 public: 00071 static vtkTexture *New(); 00072 vtkTypeMacro(vtkTexture,vtkImageAlgorithm); 00073 void PrintSelf(ostream& os, vtkIndent indent); 00074 00078 virtual void Render(vtkRenderer *ren); 00079 00082 virtual void PostRender(vtkRenderer *) {}; 00083 00087 virtual void ReleaseGraphicsResources(vtkWindow *) {}; 00088 00092 virtual void Load(vtkRenderer *) {}; 00093 00095 00097 vtkGetMacro(Repeat,int); 00098 vtkSetMacro(Repeat,int); 00099 vtkBooleanMacro(Repeat,int); 00101 00103 00106 vtkGetMacro(EdgeClamp,int); 00107 vtkSetMacro(EdgeClamp,int); 00108 vtkBooleanMacro(EdgeClamp,int); 00110 00112 00113 vtkGetMacro(Interpolate,int); 00114 vtkSetMacro(Interpolate,int); 00115 vtkBooleanMacro(Interpolate,int); 00117 00119 00121 vtkSetMacro(Quality,int); 00122 vtkGetMacro(Quality,int); 00123 void SetQualityToDefault() {this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT);}; 00124 void SetQualityTo16Bit() {this->SetQuality(VTK_TEXTURE_QUALITY_16BIT);}; 00125 void SetQualityTo32Bit() {this->SetQuality(VTK_TEXTURE_QUALITY_32BIT);}; 00127 00129 00135 vtkGetMacro(MapColorScalarsThroughLookupTable,int); 00136 vtkSetMacro(MapColorScalarsThroughLookupTable,int); 00137 vtkBooleanMacro(MapColorScalarsThroughLookupTable,int); 00139 00140 //BTX 00143 vtkImageData *GetInput(); 00144 //ETX 00145 00147 00148 void SetLookupTable(vtkScalarsToColors *); 00149 vtkGetObjectMacro(LookupTable,vtkScalarsToColors); 00151 00153 00154 vtkGetObjectMacro(MappedScalars,vtkUnsignedCharArray); 00156 00158 unsigned char *MapScalarsToColors (vtkDataArray *scalars); 00159 00161 00163 void SetTransform(vtkTransform *transform); 00164 vtkGetObjectMacro(Transform, vtkTransform); 00166 00168 00171 enum VTKTextureBlendingMode 00172 { 00173 VTK_TEXTURE_BLENDING_MODE_NONE = 0, 00174 VTK_TEXTURE_BLENDING_MODE_REPLACE, 00175 VTK_TEXTURE_BLENDING_MODE_MODULATE, 00176 VTK_TEXTURE_BLENDING_MODE_ADD, 00177 VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED, 00178 VTK_TEXTURE_BLENDING_MODE_INTERPOLATE, 00179 VTK_TEXTURE_BLENDING_MODE_SUBTRACT 00180 }; 00181 //ETX 00183 00185 00187 vtkGetMacro(BlendingMode, int); 00188 vtkSetMacro(BlendingMode, int); 00190 00192 00194 vtkGetMacro(PremultipliedAlpha,bool); 00195 vtkSetMacro(PremultipliedAlpha,bool); 00196 vtkBooleanMacro(PremultipliedAlpha,bool); 00198 00200 00205 vtkGetMacro(RestrictPowerOf2ImageSmaller,int); 00206 vtkSetMacro(RestrictPowerOf2ImageSmaller,int); 00207 vtkBooleanMacro(RestrictPowerOf2ImageSmaller,int); 00209 protected: 00210 vtkTexture(); 00211 ~vtkTexture(); 00212 00213 int Repeat; 00214 int EdgeClamp; 00215 int Interpolate; 00216 int Quality; 00217 int MapColorScalarsThroughLookupTable; 00218 vtkScalarsToColors *LookupTable; 00219 vtkUnsignedCharArray *MappedScalars; 00220 vtkTransform *Transform; 00221 00222 int BlendingMode; 00223 int RestrictPowerOf2ImageSmaller; 00224 // this is to duplicated the previous behavior of SelfCreatedLookUpTable 00225 int SelfAdjustingTableRange; 00226 bool PremultipliedAlpha; 00227 private: 00228 vtkTexture(const vtkTexture&); // Not implemented. 00229 void operator=(const vtkTexture&); // Not implemented. 00230 }; 00231 00232 #endif