00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00059 #ifndef __vtkLODProp3D_h
00060 #define __vtkLODProp3D_h
00061 
00062 #include "vtkProp3D.h"
00063 #include "vtkTransform.h"
00064 
00065 class vtkRenderer;
00066 class vtkMapper;
00067 class vtkVolumeMapper;
00068 class vtkProperty;
00069 class vtkVolumeProperty;
00070 class vtkTexture;
00071 
00072 typedef struct
00073 {
00074   vtkProp3D   *Prop3D;
00075   int         Prop3DType;
00076   int         ID;
00077   float       EstimatedTime;
00078   int         State;
00079   float       Level;
00080 } vtkLODProp3DEntry;
00081 
00082 class VTK_EXPORT vtkLODProp3D : public vtkProp3D
00083 {
00084 public:
00086   static vtkLODProp3D *New();
00087 
00088   vtkTypeMacro(vtkLODProp3D,vtkProp3D);
00089   void PrintSelf(ostream& os, vtkIndent indent);
00090 
00092   float *GetBounds();
00093   void GetBounds(float bounds[6]) { this->vtkProp3D::GetBounds( bounds ); };
00094 
00096   int RequiresRayCasting();
00097 
00099   int RequiresRenderingIntoImage();
00100  
00108   int AddLOD( vtkMapper *m, vtkProperty *p, vtkTexture *t, float time );
00109   int AddLOD( vtkMapper *m, vtkProperty *p, float time );
00110   int AddLOD( vtkMapper *m, vtkTexture *t, float time );
00111   int AddLOD( vtkMapper *m, float time );
00112   int AddLOD( vtkVolumeMapper *m, vtkVolumeProperty *p, float time );
00113   int AddLOD( vtkVolumeMapper *m, float time );
00114 
00117   void RemoveLOD( int id );
00118 
00123   void SetLODProperty( int id, vtkProperty  *p );
00124   void GetLODProperty( int id, vtkProperty  **p );
00125   void SetLODProperty( int id, vtkVolumeProperty  *p );
00126   void GetLODProperty( int id, vtkVolumeProperty  **p );
00127 
00132   void SetLODMapper( int id, vtkMapper  *m );
00133   void GetLODMapper( int id, vtkMapper  **m );
00134   void SetLODMapper( int id, vtkVolumeMapper  *m );
00135   void GetLODMapper( int id, vtkVolumeMapper  **m );
00136 
00139   void SetLODTexture( int id, vtkTexture *t );
00140   void GetLODTexture( int id, vtkTexture **t );
00141 
00145   void EnableLOD( int id );
00146   void DisableLOD( int id );
00147 
00153   void SetLODLevel( int id, float level );
00154   float GetLODLevel( int id );
00155   float GetLODIndexLevel( int index );
00156 
00160   float GetLODEstimatedRenderTime( int id );
00161   float GetLODIndexEstimatedRenderTime( int index );
00162 
00166   vtkSetClampMacro( AutomaticLODSelection, int, 0, 1 );
00167   vtkGetMacro( AutomaticLODSelection, int );
00168   vtkBooleanMacro( AutomaticLODSelection, int );
00169 
00172   vtkSetMacro( SelectedLODID, int );
00173   vtkGetMacro( SelectedLODID, int );
00174 
00177   int GetLastRenderedLODID();
00178 
00182   virtual void GetActors(vtkPropCollection *);
00183 
00186   void SetPickMethod(void (*f)(void *), void *arg);
00187   void SetPickMethodArgDelete(void (*f)(void *));
00188 
00191   void SetSelectedPickLODID(int id);
00192   vtkGetMacro( SelectedPickLODID, int );
00193 
00197   vtkSetClampMacro( AutomaticPickLODSelection, int, 0, 1 );
00198   vtkGetMacro( AutomaticPickLODSelection, int );
00199   vtkBooleanMacro( AutomaticPickLODSelection, int );
00200 
00202   void ShallowCopy(vtkProp *prop);
00203 
00204 
00205 
00207   int RenderOpaqueGeometry(vtkViewport *viewport);
00208   int RenderTranslucentGeometry(vtkViewport *viewport);
00209   int RenderIntoImage(vtkViewport *viewport);
00210   int CastViewRay( VTKRayCastRayInfo *rayInfo );
00211   int InitializeRayCasting( vtkViewport *viewport);
00212 
00216   void ReleaseGraphicsResources(vtkWindow *);
00217 
00221   void SetAllocatedRenderTime( float t, vtkViewport *vp );
00222 
00227   void RestoreEstimatedRenderTime( );
00228   
00231   virtual void AddEstimatedRenderTime( float t, vtkViewport *vp );
00232 
00233 
00234 
00235 protected:
00236   vtkLODProp3D();
00237   ~vtkLODProp3D();
00238   vtkLODProp3D(const vtkLODProp3D&) {};
00239   void operator=(const vtkLODProp3D&) {};
00240 
00241   int GetAutomaticPickPropIndex(void);
00242 
00243   vtkLODProp3DEntry *LODs;
00244   int               NumberOfEntries;
00245   int               NumberOfLODs;
00246   int               CurrentIndex;
00247 
00248   int               GetNextEntryIndex();
00249   int               ConvertIDToIndex( int id );
00250   int               SelectedLODIndex;
00251 
00252   int               AutomaticLODSelection;
00253   int               SelectedLODID;
00254   int               SelectedPickLODID;
00255   int               AutomaticPickLODSelection;
00256   vtkProp*          PreviousPickProp;
00257   void (*PreviousPickMethod)(void *);
00258   void *            PreviousPickMethodArg;
00259 };
00260 
00261 #endif
00262