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 vtkProperty; 00048 class vtkVolumeProperty; 00049 class vtkTexture; 00050 class vtkLODProp3DCallback; 00051 00052 typedef struct 00053 { 00054 vtkProp3D *Prop3D; 00055 int Prop3DType; 00056 int ID; 00057 double EstimatedTime; 00058 int State; 00059 double Level; 00060 } vtkLODProp3DEntry; 00061 00062 class VTK_RENDERING_EXPORT vtkLODProp3D : public vtkProp3D 00063 { 00064 public: 00066 static vtkLODProp3D *New(); 00067 00068 vtkTypeMacro(vtkLODProp3D,vtkProp3D); 00069 void PrintSelf(ostream& os, vtkIndent indent); 00070 00072 00073 double *GetBounds(); 00074 void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds( bounds ); }; 00076 00078 00085 int AddLOD( vtkMapper *m, vtkProperty *p, vtkProperty *back, 00086 vtkTexture *t, double time ); 00087 int AddLOD( vtkMapper *m, vtkProperty *p, vtkTexture *t, double time ); 00088 int AddLOD( vtkMapper *m, vtkProperty *p, vtkProperty *back, double time ); 00089 int AddLOD( vtkMapper *m, vtkProperty *p, double time ); 00090 int AddLOD( vtkMapper *m, vtkTexture *t, double time ); 00091 int AddLOD( vtkMapper *m, double time ); 00092 int AddLOD( vtkAbstractVolumeMapper *m, vtkVolumeProperty *p, double time ); 00093 int AddLOD( vtkAbstractVolumeMapper *m, double time ); 00095 00097 00098 vtkGetMacro(NumberOfLODs, int); 00100 00102 00106 vtkGetMacro(CurrentIndex, int); 00108 00111 void RemoveLOD( int id ); 00112 00114 00118 void SetLODProperty( int id, vtkProperty *p ); 00119 void GetLODProperty( int id, vtkProperty **p ); 00120 void SetLODProperty( int id, vtkVolumeProperty *p ); 00121 void GetLODProperty( int id, vtkVolumeProperty **p ); 00123 00125 00129 void SetLODMapper( int id, vtkMapper *m ); 00130 void GetLODMapper( int id, vtkMapper **m ); 00131 void SetLODMapper( int id, vtkAbstractVolumeMapper *m ); 00132 void GetLODMapper( int id, vtkAbstractVolumeMapper **m ); 00134 00138 vtkAbstractMapper3D *GetLODMapper(int id); 00139 00141 00143 void SetLODBackfaceProperty( int id, vtkProperty *t ); 00144 void GetLODBackfaceProperty( int id, vtkProperty **t ); 00146 00148 00150 void SetLODTexture( int id, vtkTexture *t ); 00151 void GetLODTexture( int id, vtkTexture **t ); 00153 00155 00158 void EnableLOD( int id ); 00159 void DisableLOD( int id ); 00160 int IsLODEnabled( int id ); 00162 00164 00169 void SetLODLevel( int id, double level ); 00170 double GetLODLevel( int id ); 00171 double GetLODIndexLevel( int index ); 00173 00175 00178 double GetLODEstimatedRenderTime( int id ); 00179 double GetLODIndexEstimatedRenderTime( int index ); 00181 00183 00186 vtkSetClampMacro( AutomaticLODSelection, int, 0, 1 ); 00187 vtkGetMacro( AutomaticLODSelection, int ); 00188 vtkBooleanMacro( AutomaticLODSelection, int ); 00190 00192 00194 vtkSetMacro( SelectedLODID, int ); 00195 vtkGetMacro( SelectedLODID, int ); 00197 00200 int GetLastRenderedLODID(); 00201 00203 int GetPickLODID(void); 00204 00206 00209 virtual void GetActors(vtkPropCollection *); 00210 virtual void GetVolumes(vtkPropCollection *); 00212 00214 00216 void SetSelectedPickLODID(int id); 00217 vtkGetMacro( SelectedPickLODID, int ); 00219 00221 00224 vtkSetClampMacro( AutomaticPickLODSelection, int, 0, 1 ); 00225 vtkGetMacro( AutomaticPickLODSelection, int ); 00226 vtkBooleanMacro( AutomaticPickLODSelection, int ); 00228 00230 void ShallowCopy(vtkProp *prop); 00231 00232 //BTX 00233 00235 00236 int RenderOpaqueGeometry(vtkViewport *viewport); 00237 virtual int RenderTranslucentPolygonalGeometry( vtkViewport *ren); 00238 virtual int RenderVolumetricGeometry( vtkViewport *ren); 00240 00242 virtual int HasTranslucentPolygonalGeometry(); 00243 00247 void ReleaseGraphicsResources(vtkWindow *); 00248 00252 void SetAllocatedRenderTime( double t, vtkViewport *vp ); 00253 00258 void RestoreEstimatedRenderTime( ); 00259 00262 virtual void AddEstimatedRenderTime( double t, vtkViewport *vp ); 00263 00264 //ETX 00265 00266 protected: 00267 vtkLODProp3D(); 00268 ~vtkLODProp3D(); 00269 00270 int GetAutomaticPickPropIndex(void); 00271 00272 vtkLODProp3DEntry *LODs; 00273 int NumberOfEntries; 00274 int NumberOfLODs; 00275 int CurrentIndex; 00276 00277 int GetNextEntryIndex(); 00278 int ConvertIDToIndex( int id ); 00279 int SelectedLODIndex; 00280 00281 int AutomaticLODSelection; 00282 int SelectedLODID; 00283 int SelectedPickLODID; 00284 int AutomaticPickLODSelection; 00285 vtkLODProp3DCallback *PickCallback; 00286 00287 private: 00288 vtkLODProp3D(const vtkLODProp3D&); // Not implemented. 00289 void operator=(const vtkLODProp3D&); // Not implemented. 00290 }; 00291 00292 #endif 00293