VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVolumeProperty.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 =========================================================================*/ 00015 00049 #ifndef __vtkVolumeProperty_h 00050 #define __vtkVolumeProperty_h 00051 00052 #include "vtkRenderingCoreModule.h" // For export macro 00053 #include "vtkObject.h" 00054 00055 class vtkPiecewiseFunction; 00056 class vtkTimeStamp; 00057 class vtkColorTransferFunction; 00058 00059 class VTKRENDERINGCORE_EXPORT vtkVolumeProperty : public vtkObject 00060 { 00061 public: 00062 static vtkVolumeProperty *New(); 00063 vtkTypeMacro(vtkVolumeProperty, vtkObject); 00064 void PrintSelf(ostream& os, vtkIndent indent); 00065 void DeepCopy(vtkVolumeProperty *p); 00066 00069 unsigned long GetMTime(); 00070 00072 00086 vtkSetClampMacro(IndependentComponents, int, 0, 1); 00087 vtkGetMacro(IndependentComponents, int); 00088 vtkBooleanMacro(IndependentComponents, int); 00090 00092 00094 vtkSetClampMacro(InterpolationType, int, 00095 VTK_NEAREST_INTERPOLATION, VTK_LINEAR_INTERPOLATION); 00096 vtkGetMacro(InterpolationType, int); 00097 void SetInterpolationTypeToNearest() 00098 { this->SetInterpolationType(VTK_NEAREST_INTERPOLATION); } 00099 void SetInterpolationTypeToLinear() 00100 { this->SetInterpolationType(VTK_LINEAR_INTERPOLATION); } 00101 const char *GetInterpolationTypeAsString(void); 00103 00105 00106 virtual void SetComponentWeight(int index, double value); 00107 virtual double GetComponentWeight(int index); 00109 00111 00114 void SetColor(int index, vtkPiecewiseFunction *function); 00115 void SetColor(vtkPiecewiseFunction *function) 00116 { this->SetColor(0, function); } 00118 00120 00123 void SetColor(int index, vtkColorTransferFunction *function); 00124 void SetColor(vtkColorTransferFunction *function) 00125 { this->SetColor(0, function); } 00127 00129 00131 int GetColorChannels(int index); 00132 int GetColorChannels() 00133 { return this->GetColorChannels(0); } 00135 00137 00139 vtkPiecewiseFunction *GetGrayTransferFunction(int index); 00140 vtkPiecewiseFunction *GetGrayTransferFunction() 00141 { return this->GetGrayTransferFunction(0); } 00143 00145 00148 vtkColorTransferFunction *GetRGBTransferFunction(int index); 00149 vtkColorTransferFunction *GetRGBTransferFunction() 00150 { return this->GetRGBTransferFunction(0); } 00152 00154 00156 void SetScalarOpacity(int index, vtkPiecewiseFunction *function); 00157 void SetScalarOpacity(vtkPiecewiseFunction *function) 00158 { this->SetScalarOpacity(0, function); } 00160 00162 00165 vtkPiecewiseFunction *GetScalarOpacity(int index); 00166 vtkPiecewiseFunction *GetScalarOpacity() 00167 { return this->GetScalarOpacity(0); } 00169 00171 00176 void SetScalarOpacityUnitDistance(int index, double distance); 00177 void SetScalarOpacityUnitDistance(double distance) 00178 { this->SetScalarOpacityUnitDistance(0, distance); } 00179 double GetScalarOpacityUnitDistance(int index); 00180 double GetScalarOpacityUnitDistance() 00181 { return this->GetScalarOpacityUnitDistance(0); } 00183 00184 00186 00188 void SetGradientOpacity(int index, vtkPiecewiseFunction *function); 00189 void SetGradientOpacity(vtkPiecewiseFunction *function) 00190 { this->SetGradientOpacity(0, function); } 00192 00194 00198 vtkPiecewiseFunction *GetGradientOpacity(int index); 00199 vtkPiecewiseFunction *GetGradientOpacity() 00200 { return this->GetGradientOpacity(0); } 00202 00204 00209 virtual void SetDisableGradientOpacity(int index, int value); 00210 virtual void SetDisableGradientOpacity(int value) 00211 { this->SetDisableGradientOpacity(0, value); } 00212 virtual void DisableGradientOpacityOn(int index ) 00213 { this->SetDisableGradientOpacity(index, 1); } 00214 virtual void DisableGradientOpacityOn() 00215 { this->DisableGradientOpacityOn(0); } 00216 virtual void DisableGradientOpacityOff(int index) 00217 { this->SetDisableGradientOpacity(index, 0); } 00218 virtual void DisableGradientOpacityOff() 00219 { this->DisableGradientOpacityOff(0); } 00220 virtual int GetDisableGradientOpacity(int index); 00221 virtual int GetDisableGradientOpacity() 00222 { return this->GetDisableGradientOpacity(0); } 00223 vtkPiecewiseFunction *GetStoredGradientOpacity(int index); 00224 vtkPiecewiseFunction *GetStoredGradientOpacity() 00225 { return this->GetStoredGradientOpacity(0); } 00227 00229 00237 void SetShade(int index, int value); 00238 void SetShade(int value) 00239 { this->SetShade(0,value); } 00240 int GetShade(int index); 00241 int GetShade() 00242 { return this->GetShade(0); } 00243 void ShadeOn(int index); 00244 void ShadeOn() 00245 { this->ShadeOn(0); } 00246 void ShadeOff(int index); 00247 void ShadeOff() 00248 { this->ShadeOff(0); } 00250 00252 00253 void SetAmbient(int index, double value); 00254 void SetAmbient(double value) 00255 { this->SetAmbient(0, value); } 00256 double GetAmbient(int index); 00257 double GetAmbient() 00258 { return this->GetAmbient(0); } 00260 00262 00263 void SetDiffuse(int index, double value); 00264 void SetDiffuse(double value) 00265 { this->SetDiffuse(0, value); } 00266 double GetDiffuse(int index); 00267 double GetDiffuse() 00268 { return this->GetDiffuse(0); } 00270 00272 00273 void SetSpecular(int index, double value); 00274 void SetSpecular(double value) 00275 { this->SetSpecular(0, value); } 00276 double GetSpecular(int index); 00277 double GetSpecular() 00278 { return this->GetSpecular(0); } 00280 00282 00283 void SetSpecularPower(int index, double value); 00284 void SetSpecularPower(double value) 00285 { this->SetSpecularPower(0, value); } 00286 double GetSpecularPower(int index); 00287 double GetSpecularPower() 00288 { return this->GetSpecularPower(0); } 00290 00291 //BTX 00296 void UpdateMTimes(); 00297 00299 00301 vtkTimeStamp GetGradientOpacityMTime(int index); 00302 vtkTimeStamp GetGradientOpacityMTime() 00303 { return this->GetGradientOpacityMTime(0); } 00305 00307 00309 vtkTimeStamp GetScalarOpacityMTime(int index); 00310 vtkTimeStamp GetScalarOpacityMTime() 00311 { return this->GetScalarOpacityMTime(0); } 00313 00315 00317 vtkTimeStamp GetRGBTransferFunctionMTime(int index); 00318 vtkTimeStamp GetRGBTransferFunctionMTime() 00319 { return this->GetRGBTransferFunctionMTime(0); } 00321 00323 00325 vtkTimeStamp GetGrayTransferFunctionMTime(int index); 00326 vtkTimeStamp GetGrayTransferFunctionMTime() 00327 { return this->GetGrayTransferFunctionMTime(0); } 00328 //ETX 00330 00331 protected: 00332 vtkVolumeProperty(); 00333 ~vtkVolumeProperty(); 00334 00335 int IndependentComponents; 00336 double ComponentWeight[VTK_MAX_VRCOMP]; 00337 00338 int InterpolationType; 00339 00340 int ColorChannels[VTK_MAX_VRCOMP]; 00341 00342 vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP]; 00343 vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP]; 00344 00345 vtkColorTransferFunction *RGBTransferFunction[VTK_MAX_VRCOMP]; 00346 vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP]; 00347 00348 vtkPiecewiseFunction *ScalarOpacity[VTK_MAX_VRCOMP]; 00349 vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP]; 00350 double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP]; 00351 00352 vtkPiecewiseFunction *GradientOpacity[VTK_MAX_VRCOMP]; 00353 vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP]; 00354 vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP]; 00355 int DisableGradientOpacity[VTK_MAX_VRCOMP]; 00356 00357 int Shade[VTK_MAX_VRCOMP]; 00358 double Ambient[VTK_MAX_VRCOMP]; 00359 double Diffuse[VTK_MAX_VRCOMP]; 00360 double Specular[VTK_MAX_VRCOMP]; 00361 double SpecularPower[VTK_MAX_VRCOMP]; 00362 00363 virtual void CreateDefaultGradientOpacity(int index); 00364 00365 private: 00366 vtkVolumeProperty(const vtkVolumeProperty&); // Not implemented. 00367 void operator=(const vtkVolumeProperty&); // Not implemented. 00368 }; 00369 00371 00372 inline const char *vtkVolumeProperty::GetInterpolationTypeAsString(void) 00373 { 00374 if (this->InterpolationType == VTK_NEAREST_INTERPOLATION) 00375 { 00376 return "Nearest Neighbor"; 00377 } 00378 if (this->InterpolationType == VTK_LINEAR_INTERPOLATION) 00379 { 00380 return "Linear"; 00381 } 00382 return "Unknown"; 00383 } 00385 00386 #endif