VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkVolumeProperty.h,v $ 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 00046 #ifndef __vtkVolumeProperty_h 00047 #define __vtkVolumeProperty_h 00048 00049 #include "vtkObject.h" 00050 00051 class vtkPiecewiseFunction; 00052 class vtkTimeStamp; 00053 class vtkColorTransferFunction; 00054 00055 class VTK_RENDERING_EXPORT vtkVolumeProperty : public vtkObject 00056 { 00057 public: 00058 static vtkVolumeProperty *New(); 00059 vtkTypeRevisionMacro(vtkVolumeProperty,vtkObject); 00060 void PrintSelf(ostream& os, vtkIndent indent); 00061 void DeepCopy(vtkVolumeProperty *p); 00062 00065 unsigned long GetMTime(); 00066 00068 00082 vtkSetClampMacro( IndependentComponents, int, 0, 1 ); 00083 vtkGetMacro( IndependentComponents, int ); 00084 vtkBooleanMacro( IndependentComponents, int ); 00086 00088 00089 vtkSetClampMacro( InterpolationType, int, 00090 VTK_NEAREST_INTERPOLATION, VTK_LINEAR_INTERPOLATION); 00091 vtkGetMacro(InterpolationType,int); 00092 void SetInterpolationTypeToNearest() 00093 {this->SetInterpolationType(VTK_NEAREST_INTERPOLATION);}; 00094 void SetInterpolationTypeToLinear() 00095 {this->SetInterpolationType(VTK_LINEAR_INTERPOLATION);}; 00096 const char *GetInterpolationTypeAsString(void); 00098 00100 00101 virtual void SetComponentWeight(int index, double value); 00102 virtual double GetComponentWeight(int index); 00104 00106 00109 void SetColor( int index, vtkPiecewiseFunction *function ); 00110 void SetColor( vtkPiecewiseFunction *f ){this->SetColor(0,f);}; 00112 00114 00117 void SetColor( int index, vtkColorTransferFunction *function ); 00118 void SetColor( vtkColorTransferFunction *f ){this->SetColor(0,f);}; 00120 00122 00124 int GetColorChannels( int index ); 00125 int GetColorChannels(){return this->GetColorChannels(0);}; 00127 00129 00131 vtkPiecewiseFunction *GetGrayTransferFunction( int index ); 00132 vtkPiecewiseFunction *GetGrayTransferFunction() 00133 {return this->GetGrayTransferFunction(0);}; 00135 00137 00140 vtkColorTransferFunction *GetRGBTransferFunction( int index ); 00141 vtkColorTransferFunction *GetRGBTransferFunction() 00142 {return this->GetRGBTransferFunction(0);}; 00144 00146 00148 void SetScalarOpacity( int index, vtkPiecewiseFunction *function ); 00149 void SetScalarOpacity( vtkPiecewiseFunction *f ) 00150 {this->SetScalarOpacity(0,f);}; 00152 00154 00157 vtkPiecewiseFunction *GetScalarOpacity( int index ); 00158 vtkPiecewiseFunction *GetScalarOpacity() 00159 {return this->GetScalarOpacity(0);}; 00161 00163 00168 void SetScalarOpacityUnitDistance( int index, double distance ); 00169 void SetScalarOpacityUnitDistance( double distance ) 00170 {this->SetScalarOpacityUnitDistance( 0, distance );} 00171 double GetScalarOpacityUnitDistance( int index ); 00172 double GetScalarOpacityUnitDistance() 00173 {return this->GetScalarOpacityUnitDistance(0);} 00175 00176 00178 00180 void SetGradientOpacity( int index, vtkPiecewiseFunction *function ); 00181 void SetGradientOpacity( vtkPiecewiseFunction *function ) 00182 {this->SetGradientOpacity(0,function);} 00184 00186 00190 vtkPiecewiseFunction *GetGradientOpacity( int index ); 00191 vtkPiecewiseFunction *GetGradientOpacity() 00192 {return this->GetGradientOpacity( 0 );} 00194 00196 00201 virtual void SetDisableGradientOpacity( int index, int value ); 00202 virtual void SetDisableGradientOpacity( int value ) 00203 { this->SetDisableGradientOpacity(0, value); } 00204 virtual void DisableGradientOpacityOn( int index ) 00205 { this->SetDisableGradientOpacity(index, 1); } 00206 virtual void DisableGradientOpacityOn() 00207 { this->DisableGradientOpacityOn(0); } 00208 virtual void DisableGradientOpacityOff( int index ) 00209 { this->SetDisableGradientOpacity(index, 0); } 00210 virtual void DisableGradientOpacityOff() 00211 { this->DisableGradientOpacityOff(0); } 00212 virtual int GetDisableGradientOpacity( int index ); 00213 virtual int GetDisableGradientOpacity() 00214 { return this->GetDisableGradientOpacity(0); } 00215 vtkPiecewiseFunction *GetStoredGradientOpacity( int index ); 00216 vtkPiecewiseFunction *GetStoredGradientOpacity() 00217 {return this->GetStoredGradientOpacity( 0 );} 00219 00221 00229 void SetShade( int index, int value ); 00230 void SetShade( int value ) {this->SetShade(0,value);} 00231 int GetShade( int index ); 00232 int GetShade() {return this->GetShade(0);} 00233 void ShadeOn( int index ); 00234 void ShadeOn() {this->ShadeOn(0);} 00235 void ShadeOff( int index ); 00236 void ShadeOff() {this->ShadeOff(0);} 00238 00240 00241 void SetAmbient( int index, double value ); 00242 void SetAmbient( double value ) {this->SetAmbient( 0, value );} 00243 double GetAmbient( int index ); 00244 double GetAmbient() {return this->GetAmbient(0);} 00246 00248 00249 void SetDiffuse( int index, double value ); 00250 void SetDiffuse( double value ) {this->SetDiffuse( 0, value );} 00251 double GetDiffuse( int index ); 00252 double GetDiffuse() {return this->GetDiffuse(0);} 00254 00256 00257 void SetSpecular( int index, double value ); 00258 void SetSpecular( double value ) {this->SetSpecular( 0, value );} 00259 double GetSpecular( int index ); 00260 double GetSpecular() {return this->GetSpecular(0);} 00262 00264 00265 void SetSpecularPower( int index, double value ); 00266 void SetSpecularPower( double value ) {this->SetSpecularPower( 0, value );} 00267 double GetSpecularPower( int index ); 00268 double GetSpecularPower() {return this->GetSpecularPower(0);} 00270 00271 //BTX 00276 void UpdateMTimes(); 00277 00279 00281 vtkTimeStamp GetGradientOpacityMTime( int index ); 00282 vtkTimeStamp GetGradientOpacityMTime() 00283 { return this->GetGradientOpacityMTime(0); } 00285 00287 00289 vtkTimeStamp GetScalarOpacityMTime( int index ); 00290 vtkTimeStamp GetScalarOpacityMTime() 00291 { return this->GetScalarOpacityMTime(0); } 00293 00295 00297 vtkTimeStamp GetRGBTransferFunctionMTime( int index ); 00298 vtkTimeStamp GetRGBTransferFunctionMTime() 00299 { return this->GetRGBTransferFunctionMTime(0); } 00301 00303 00305 vtkTimeStamp GetGrayTransferFunctionMTime( int index ); 00306 vtkTimeStamp GetGrayTransferFunctionMTime() 00307 { return this->GetGrayTransferFunctionMTime(0); } 00308 //ETX 00310 00311 protected: 00312 vtkVolumeProperty(); 00313 ~vtkVolumeProperty(); 00314 00315 int IndependentComponents; 00316 double ComponentWeight[VTK_MAX_VRCOMP]; 00317 00318 int InterpolationType; 00319 00320 int ColorChannels[VTK_MAX_VRCOMP]; 00321 00322 vtkPiecewiseFunction *GrayTransferFunction[VTK_MAX_VRCOMP]; 00323 vtkTimeStamp GrayTransferFunctionMTime[VTK_MAX_VRCOMP]; 00324 00325 vtkColorTransferFunction *RGBTransferFunction[VTK_MAX_VRCOMP]; 00326 vtkTimeStamp RGBTransferFunctionMTime[VTK_MAX_VRCOMP]; 00327 00328 vtkPiecewiseFunction *ScalarOpacity[VTK_MAX_VRCOMP]; 00329 vtkTimeStamp ScalarOpacityMTime[VTK_MAX_VRCOMP]; 00330 double ScalarOpacityUnitDistance[VTK_MAX_VRCOMP]; 00331 00332 vtkPiecewiseFunction *GradientOpacity[VTK_MAX_VRCOMP]; 00333 vtkTimeStamp GradientOpacityMTime[VTK_MAX_VRCOMP]; 00334 vtkPiecewiseFunction *DefaultGradientOpacity[VTK_MAX_VRCOMP]; 00335 int DisableGradientOpacity[VTK_MAX_VRCOMP]; 00336 00337 int Shade[VTK_MAX_VRCOMP]; 00338 double Ambient[VTK_MAX_VRCOMP]; 00339 double Diffuse[VTK_MAX_VRCOMP]; 00340 double Specular[VTK_MAX_VRCOMP]; 00341 double SpecularPower[VTK_MAX_VRCOMP]; 00342 00343 virtual void CreateDefaultGradientOpacity(int index); 00344 00345 private: 00346 vtkVolumeProperty(const vtkVolumeProperty&); // Not implemented. 00347 void operator=(const vtkVolumeProperty&); // Not implemented. 00348 }; 00349 00351 inline const char *vtkVolumeProperty::GetInterpolationTypeAsString(void) 00352 { 00353 if( this->InterpolationType == VTK_NEAREST_INTERPOLATION ) 00354 { 00355 return "Nearest Neighbor"; 00356 } 00357 else if( this->InterpolationType == VTK_LINEAR_INTERPOLATION ) 00358 { 00359 return "Linear"; 00360 } 00361 else 00362 { 00363 return "Unknown"; 00364 } 00365 } 00366 00367 #endif