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 "vtkRenderingCoreModule.h" // For export macro 00055 #include "vtkImageAlgorithm.h" 00056 00057 class vtkImageData; 00058 class vtkScalarsToColors; 00059 class vtkRenderer; 00060 class vtkUnsignedCharArray; 00061 class vtkWindow; 00062 class vtkDataArray; 00063 class vtkTransform; 00064 00065 #define VTK_TEXTURE_QUALITY_DEFAULT 0 00066 #define VTK_TEXTURE_QUALITY_16BIT 16 00067 #define VTK_TEXTURE_QUALITY_32BIT 32 00068 00069 class VTKRENDERINGCORE_EXPORT vtkTexture : public vtkImageAlgorithm 00070 { 00071 public: 00072 static vtkTexture* New(); 00073 vtkTypeMacro(vtkTexture, vtkImageAlgorithm); 00074 void PrintSelf(ostream& os, vtkIndent indent); 00075 00079 virtual void Render(vtkRenderer* ren); 00080 00083 virtual void PostRender(vtkRenderer*) {} 00084 00088 virtual void ReleaseGraphicsResources(vtkWindow*) {} 00089 00093 virtual void Load(vtkRenderer*) {} 00094 00096 00098 vtkGetMacro(Repeat, int); 00099 vtkSetMacro(Repeat, int); 00100 vtkBooleanMacro(Repeat, int); 00102 00104 00107 vtkGetMacro(EdgeClamp, int); 00108 vtkSetMacro(EdgeClamp, int); 00109 vtkBooleanMacro(EdgeClamp, int); 00111 00113 00114 vtkGetMacro(Interpolate, int); 00115 vtkSetMacro(Interpolate, int); 00116 vtkBooleanMacro(Interpolate, int); 00118 00120 00122 vtkSetMacro(Quality, int); 00123 vtkGetMacro(Quality, int); 00124 void SetQualityToDefault() 00125 { this->SetQuality(VTK_TEXTURE_QUALITY_DEFAULT); } 00126 void SetQualityTo16Bit() 00127 { this->SetQuality(VTK_TEXTURE_QUALITY_16BIT); } 00128 void SetQualityTo32Bit() 00129 { this->SetQuality(VTK_TEXTURE_QUALITY_32BIT); } 00131 00133 00139 vtkGetMacro(MapColorScalarsThroughLookupTable, int); 00140 vtkSetMacro(MapColorScalarsThroughLookupTable, int); 00141 vtkBooleanMacro(MapColorScalarsThroughLookupTable, int); 00143 00144 //BTX 00146 00148 vtkImageData* GetInput(); 00149 //ETX 00151 00153 00154 void SetLookupTable(vtkScalarsToColors *); 00155 vtkGetObjectMacro(LookupTable, vtkScalarsToColors); 00157 00159 00160 vtkGetObjectMacro(MappedScalars, vtkUnsignedCharArray); 00162 00164 unsigned char* MapScalarsToColors(vtkDataArray* scalars); 00165 00167 00169 void SetTransform(vtkTransform *transform); 00170 vtkGetObjectMacro(Transform, vtkTransform); 00172 00173 //BTX 00175 00177 enum VTKTextureBlendingMode 00178 { 00179 VTK_TEXTURE_BLENDING_MODE_NONE = 0, 00180 VTK_TEXTURE_BLENDING_MODE_REPLACE, 00181 VTK_TEXTURE_BLENDING_MODE_MODULATE, 00182 VTK_TEXTURE_BLENDING_MODE_ADD, 00183 VTK_TEXTURE_BLENDING_MODE_ADD_SIGNED, 00184 VTK_TEXTURE_BLENDING_MODE_INTERPOLATE, 00185 VTK_TEXTURE_BLENDING_MODE_SUBTRACT 00186 }; 00187 //ETX 00189 00191 00193 vtkGetMacro(BlendingMode, int); 00194 vtkSetMacro(BlendingMode, int); 00196 00198 00200 vtkGetMacro(PremultipliedAlpha, bool); 00201 vtkSetMacro(PremultipliedAlpha, bool); 00202 vtkBooleanMacro(PremultipliedAlpha, bool); 00204 00206 00211 vtkGetMacro(RestrictPowerOf2ImageSmaller, int); 00212 vtkSetMacro(RestrictPowerOf2ImageSmaller, int); 00213 vtkBooleanMacro(RestrictPowerOf2ImageSmaller, int); 00215 00219 virtual int IsTranslucent(); 00220 00221 protected: 00222 vtkTexture(); 00223 ~vtkTexture(); 00224 00225 int Repeat; 00226 int EdgeClamp; 00227 int Interpolate; 00228 int Quality; 00229 int MapColorScalarsThroughLookupTable; 00230 vtkScalarsToColors* LookupTable; 00231 vtkUnsignedCharArray* MappedScalars; 00232 vtkTransform * Transform; 00233 00234 int BlendingMode; 00235 int RestrictPowerOf2ImageSmaller; 00236 // this is to duplicated the previous behavior of SelfCreatedLookUpTable 00237 int SelfAdjustingTableRange; 00238 bool PremultipliedAlpha; 00239 00240 // the result of HasTranslucentPolygonalGeometry is cached 00241 vtkTimeStamp TranslucentComputationTime; 00242 int TranslucentCachedResult; 00243 00244 private: 00245 vtkTexture(const vtkTexture&); // Not implemented. 00246 void operator=(const vtkTexture&); // Not implemented. 00247 }; 00248 00249 #endif