VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkLODProp3D.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 =========================================================================*/ 00038 #ifndef __vtkLODProp3D_h 00039 #define __vtkLODProp3D_h 00040 00041 #include "vtkProp3D.h" 00042 00043 class vtkRenderer; 00044 class vtkMapper; 00045 class vtkAbstractVolumeMapper; 00046 class vtkAbstractMapper3D; 00047 class vtkImageMapper3D; 00048 class vtkProperty; 00049 class vtkVolumeProperty; 00050 class vtkImageProperty; 00051 class vtkTexture; 00052 class vtkLODProp3DCallback; 00053 00054 typedef struct 00055 { 00056 vtkProp3D *Prop3D; 00057 int Prop3DType; 00058 int ID; 00059 double EstimatedTime; 00060 int State; 00061 double Level; 00062 } vtkLODProp3DEntry; 00063 00064 class VTK_RENDERING_EXPORT vtkLODProp3D : public vtkProp3D 00065 { 00066 public: 00068 static vtkLODProp3D *New(); 00069 00070 vtkTypeMacro(vtkLODProp3D,vtkProp3D); 00071 void PrintSelf(ostream& os, vtkIndent indent); 00072 00074 00075 double *GetBounds(); 00076 void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds( bounds ); }; 00078 00080 00087 int AddLOD( vtkMapper *m, vtkProperty *p, vtkProperty *back, 00088 vtkTexture *t, double time ); 00089 int AddLOD( vtkMapper *m, vtkProperty *p, vtkTexture *t, double time ); 00090 int AddLOD( vtkMapper *m, vtkProperty *p, vtkProperty *back, double time ); 00091 int AddLOD( vtkMapper *m, vtkProperty *p, double time ); 00092 int AddLOD( vtkMapper *m, vtkTexture *t, double time ); 00093 int AddLOD( vtkMapper *m, double time ); 00094 int AddLOD( vtkAbstractVolumeMapper *m, vtkVolumeProperty *p, double time ); 00095 int AddLOD( vtkAbstractVolumeMapper *m, double time ); 00096 int AddLOD( vtkImageMapper3D *m, vtkImageProperty *p, double time ); 00097 int AddLOD( vtkImageMapper3D *m, double time ); 00099 00101 00102 vtkGetMacro(NumberOfLODs, int); 00104 00106 00110 vtkGetMacro(CurrentIndex, int); 00112 00115 void RemoveLOD( int id ); 00116 00118 00122 void SetLODProperty( int id, vtkProperty *p ); 00123 void GetLODProperty( int id, vtkProperty **p ); 00124 void SetLODProperty( int id, vtkVolumeProperty *p ); 00125 void GetLODProperty( int id, vtkVolumeProperty **p ); 00126 void SetLODProperty( int id, vtkImageProperty *p ); 00127 void GetLODProperty( int id, vtkImageProperty **p ); 00129 00131 00135 void SetLODMapper( int id, vtkMapper *m ); 00136 void GetLODMapper( int id, vtkMapper **m ); 00137 void SetLODMapper( int id, vtkAbstractVolumeMapper *m ); 00138 void GetLODMapper( int id, vtkAbstractVolumeMapper **m ); 00139 void SetLODMapper( int id, vtkImageMapper3D *m ); 00140 void GetLODMapper( int id, vtkImageMapper3D **m ); 00142 00146 vtkAbstractMapper3D *GetLODMapper(int id); 00147 00149 00151 void SetLODBackfaceProperty( int id, vtkProperty *t ); 00152 void GetLODBackfaceProperty( int id, vtkProperty **t ); 00154 00156 00158 void SetLODTexture( int id, vtkTexture *t ); 00159 void GetLODTexture( int id, vtkTexture **t ); 00161 00163 00166 void EnableLOD( int id ); 00167 void DisableLOD( int id ); 00168 int IsLODEnabled( int id ); 00170 00172 00177 void SetLODLevel( int id, double level ); 00178 double GetLODLevel( int id ); 00179 double GetLODIndexLevel( int index ); 00181 00183 00186 double GetLODEstimatedRenderTime( int id ); 00187 double GetLODIndexEstimatedRenderTime( int index ); 00189 00191 00194 vtkSetClampMacro( AutomaticLODSelection, int, 0, 1 ); 00195 vtkGetMacro( AutomaticLODSelection, int ); 00196 vtkBooleanMacro( AutomaticLODSelection, int ); 00198 00200 00202 vtkSetMacro( SelectedLODID, int ); 00203 vtkGetMacro( SelectedLODID, int ); 00205 00208 int GetLastRenderedLODID(); 00209 00211 int GetPickLODID(void); 00212 00214 00217 virtual void GetActors(vtkPropCollection *); 00218 virtual void GetVolumes(vtkPropCollection *); 00220 00222 00224 void SetSelectedPickLODID(int id); 00225 vtkGetMacro( SelectedPickLODID, int ); 00227 00229 00232 vtkSetClampMacro( AutomaticPickLODSelection, int, 0, 1 ); 00233 vtkGetMacro( AutomaticPickLODSelection, int ); 00234 vtkBooleanMacro( AutomaticPickLODSelection, int ); 00236 00238 void ShallowCopy(vtkProp *prop); 00239 00240 //BTX 00241 00243 00244 int RenderOpaqueGeometry(vtkViewport *viewport); 00245 virtual int RenderTranslucentPolygonalGeometry( vtkViewport *ren); 00246 virtual int RenderVolumetricGeometry( vtkViewport *ren); 00248 00250 virtual int HasTranslucentPolygonalGeometry(); 00251 00255 void ReleaseGraphicsResources(vtkWindow *); 00256 00260 void SetAllocatedRenderTime( double t, vtkViewport *vp ); 00261 00266 void RestoreEstimatedRenderTime( ); 00267 00270 virtual void AddEstimatedRenderTime( double t, vtkViewport *vp ); 00271 00272 //ETX 00273 00274 protected: 00275 vtkLODProp3D(); 00276 ~vtkLODProp3D(); 00277 00278 int GetAutomaticPickPropIndex(void); 00279 00280 vtkLODProp3DEntry *LODs; 00281 int NumberOfEntries; 00282 int NumberOfLODs; 00283 int CurrentIndex; 00284 00285 int GetNextEntryIndex(); 00286 int ConvertIDToIndex( int id ); 00287 int SelectedLODIndex; 00288 00289 int AutomaticLODSelection; 00290 int SelectedLODID; 00291 int SelectedPickLODID; 00292 int AutomaticPickLODSelection; 00293 vtkLODProp3DCallback *PickCallback; 00294 00295 private: 00296 vtkLODProp3D(const vtkLODProp3D&); // Not implemented. 00297 void operator=(const vtkLODProp3D&); // Not implemented. 00298 }; 00299 00300 #endif 00301