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 
00061 #ifndef __vtkRenderer_h
00062 #define __vtkRenderer_h
00063 
00064 #include "vtkMatrix4x4.h"
00065 #include "vtkLightCollection.h"
00066 #include "vtkVolumeCollection.h"
00067 #include "vtkCullerCollection.h"
00068 #include "vtkCamera.h"
00069 #include "vtkActor.h"
00070 #include "vtkActor2D.h"
00071 #include "vtkViewport.h"
00072 #include "vtkActorCollection.h"
00073 
00074 class vtkRenderWindow;
00075 class vtkRayCaster;
00076 class vtkVolume;
00077 class vtkRayCaster;
00078 class vtkCuller;
00079 
00080 class VTK_EXPORT vtkRenderer : public vtkViewport
00081 {
00082 public:
00083   vtkTypeMacro(vtkRenderer,vtkViewport);
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085 
00089   static vtkRenderer *New();
00090 
00092   void AddLight(vtkLight *);
00093 
00097   void AddActor(vtkProp *p) {this->AddProp(p);};
00098   void AddVolume(vtkProp *p) {this->AddProp(p);};
00099   void RemoveActor(vtkProp *p) {this->Actors->RemoveItem(p);this->RemoveProp(p);};
00100   void RemoveVolume(vtkProp *p) {this->Volumes->RemoveItem(p);this->RemoveProp(p);};
00101 
00103   void RemoveLight(vtkLight *);
00104 
00106   vtkLightCollection *GetLights();
00107   
00109   vtkVolumeCollection *GetVolumes();
00110 
00112   vtkActorCollection *GetActors();
00113 
00115   void SetActiveCamera(vtkCamera *);
00116 
00118   vtkCamera *GetActiveCamera();
00119 
00121   void AddCuller(vtkCuller *);
00122 
00124   void RemoveCuller(vtkCuller *);
00125 
00127   vtkCullerCollection *GetCullers();
00128 
00130   vtkSetVector3Macro(Ambient,float);
00131   vtkGetVectorMacro(Ambient,float,3);
00132 
00135   vtkSetMacro(AllocatedRenderTime,float);
00136   virtual float GetAllocatedRenderTime();
00137 
00139   virtual float GetTimeFactor();
00140 
00143   virtual void Render();
00144 
00147   virtual void DeviceRender() =0;
00148   
00149 
00151   virtual void Clear() {};
00152 
00154   int VisibleActorCount();
00155 
00157   int VisibleVolumeCount();
00158 
00160   void CreateLight(void);
00161 
00164   void ComputeVisiblePropBounds( float bounds[6] );
00165 
00168   void ResetCameraClippingRange();
00169 
00172   void ResetCameraClippingRange( float bounds[6] );
00173   void ResetCameraClippingRange( float xmin, float xmax, 
00174              float ymin, float ymax, 
00175              float zmin, float zmax);
00176 
00182   void ResetCamera();
00183 
00191   void ResetCamera(float bounds[6]);
00192 
00194   void ResetCamera(float xmin, float xmax, float ymin, float ymax, 
00195                    float zmin, float zmax);
00196 
00200   void SetRenderWindow(vtkRenderWindow *);
00201   vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00202   virtual vtkWindow *GetVTKWindow();
00203   
00208   vtkGetMacro(TwoSidedLighting,int);
00209   vtkSetMacro(TwoSidedLighting,int);
00210   vtkBooleanMacro(TwoSidedLighting,int);
00211 
00215   vtkSetMacro(BackingStore,int);
00216   vtkGetMacro(BackingStore,int);
00217   vtkBooleanMacro(BackingStore,int);
00218 
00222   vtkSetMacro(Interactive,int);
00223   vtkGetMacro(Interactive,int);
00224   vtkBooleanMacro(Interactive,int);
00225 
00228   vtkSetMacro(Layer, int);
00229   vtkGetMacro(Layer, int);
00230 
00233   int  Transparent();
00234 
00236   void WorldToView();
00237 
00239   void ViewToWorld();
00240   virtual void ViewToWorld(float &wx, float &wy, float &wz);
00241 
00243   virtual void WorldToView(float &wx, float &wy, float &wz);
00244 
00246   vtkGetObjectMacro(RayCaster,vtkRayCaster);
00247 
00249   float GetZ (int x, int y);
00250 
00254   void RenderOverlay();
00255 
00257   unsigned long GetMTime();
00258 
00260   vtkGetMacro( LastRenderTimeInSeconds, float );
00261 
00263   void UnRegister(vtkObject *o);
00264 
00269   vtkGetMacro( NumberOfPropsRenderedAsGeometry, int );
00270 
00276   vtkAssemblyPath* PickProp(float selectionX, float selectionY);
00277 
00290   vtkSetMacro(LightFollowCamera,int);
00291   vtkGetMacro(LightFollowCamera,int);
00292   vtkBooleanMacro(LightFollowCamera,int);
00293 
00294 protected:
00295   vtkRenderer();
00296   ~vtkRenderer();
00297   vtkRenderer(const vtkRenderer&) {};
00298   void operator=(const vtkRenderer&) {};
00299 
00300   
00301   virtual void PickRender(vtkPropCollection *props);
00302   virtual void PickGeometry();
00303   
00304   vtkRayCaster *RayCaster;
00305 
00306   vtkCamera *ActiveCamera;
00307   vtkLight  *CreatedLight;
00308 
00309   vtkLightCollection *Lights;
00310   vtkCullerCollection *Cullers;
00311 
00312   vtkActorCollection *Actors;
00313   vtkVolumeCollection *Volumes;
00314   
00315   float              Ambient[3];  
00316   vtkRenderWindow    *RenderWindow;
00317   float              AllocatedRenderTime;
00318   float              TimeFactor;
00319   int                TwoSidedLighting;
00320   int                BackingStore;
00321   unsigned char      *BackingImage;
00322   vtkTimeStamp       RenderTime;
00323 
00324   float              LastRenderTimeInSeconds;
00325 
00326   int                LightFollowCamera;
00327 
00328   
00329   void               AllocateTime();
00330 
00331   
00332   
00333   int                NumberOfPropsRenderedAsGeometry;
00334   int                NumberOfPropsToRayCast;
00335   int                NumberOfPropsToRenderIntoImage;
00336 
00337   
00338   
00339   vtkProp            **PropArray;
00340   int                PropArrayCount;
00341 
00342   
00343   vtkProp            **RayCastPropArray;
00344 
00345   
00346   vtkProp            **RenderIntoImagePropArray;
00347 
00348   
00349   vtkAssemblyPath    **PathArray;
00350   int                PathArrayCount;
00351 
00352   
00353   
00354   int                Interactive;
00355 
00356   
00357   
00358   int                Layer;
00359 
00363   virtual int UpdateGeometry(void);
00364 
00367   virtual int UpdateCamera(void);
00368 
00372   virtual int UpdateLightGeometry(void);
00373 
00376   virtual int UpdateLights(void) {return 0;};
00377 };
00378 
00380 inline vtkLightCollection *vtkRenderer::GetLights() {return this->Lights;}
00381 
00383 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00384 
00385 
00386 #endif