00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00053 #ifndef __vtkRenderer_h
00054 #define __vtkRenderer_h
00055
00056 #include "vtkViewport.h"
00057
00058 #include "vtkVolumeCollection.h"
00059 #include "vtkActorCollection.h"
00060
00061 class vtkRenderWindow;
00062 class vtkVolume;
00063 class vtkCuller;
00064 class vtkActor;
00065 class vtkActor2D;
00066 class vtkCamera;
00067 class vtkLightCollection;
00068 class vtkCullerCollection;
00069 class vtkLight;
00070
00071 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport
00072 {
00073 public:
00074 vtkTypeRevisionMacro(vtkRenderer,vtkViewport);
00075 void PrintSelf(ostream& os, vtkIndent indent);
00076
00080 static vtkRenderer *New();
00081
00083
00086 void AddActor(vtkProp *p) {this->AddProp(p);};
00087 void AddVolume(vtkProp *p) {this->AddProp(p);};
00088 void RemoveActor(vtkProp *p) {this->Actors->RemoveItem(p);this->RemoveProp(p);};
00089 void RemoveVolume(vtkProp *p) {this->Volumes->RemoveItem(p);this->RemoveProp(p);};
00091
00093 void AddLight(vtkLight *);
00094
00096 void RemoveLight(vtkLight *);
00097
00099 vtkLightCollection *GetLights();
00100
00102 void CreateLight(void);
00103
00107 virtual vtkLight *MakeLight();
00108
00110
00114 vtkGetMacro(TwoSidedLighting,int);
00115 vtkSetMacro(TwoSidedLighting,int);
00116 vtkBooleanMacro(TwoSidedLighting,int);
00118
00120
00130 vtkSetMacro(LightFollowCamera,int);
00131 vtkGetMacro(LightFollowCamera,int);
00132 vtkBooleanMacro(LightFollowCamera,int);
00134
00136
00142 vtkGetMacro(AutomaticLightCreation,int);
00143 vtkSetMacro(AutomaticLightCreation,int);
00144 vtkBooleanMacro(AutomaticLightCreation,int);
00146
00150 virtual int UpdateLightsGeometryToFollowCamera(void);
00151
00153 vtkVolumeCollection *GetVolumes();
00154
00156 vtkActorCollection *GetActors();
00157
00159 void SetActiveCamera(vtkCamera *);
00160
00162 vtkCamera *GetActiveCamera();
00163
00167 virtual vtkCamera *MakeCamera();
00168
00170
00174 vtkSetMacro(Erase, int);
00175 vtkGetMacro(Erase, int);
00176 vtkBooleanMacro(Erase, int);
00178
00180 void AddCuller(vtkCuller *);
00181
00183 void RemoveCuller(vtkCuller *);
00184
00186 vtkCullerCollection *GetCullers();
00187
00189
00190 vtkSetVector3Macro(Ambient,double);
00191 vtkGetVectorMacro(Ambient,double,3);
00193
00195
00197 vtkSetMacro(AllocatedRenderTime,double);
00198 virtual double GetAllocatedRenderTime();
00200
00205 virtual double GetTimeFactor();
00206
00209 virtual void Render();
00210
00213 virtual void DeviceRender() =0;
00214
00216 virtual void Clear() {};
00217
00219 int VisibleActorCount();
00220
00222 int VisibleVolumeCount();
00223
00226 void ComputeVisiblePropBounds( double bounds[6] );
00227
00229 double *ComputeVisiblePropBounds();
00230
00233 void ResetCameraClippingRange();
00234
00236
00238 void ResetCameraClippingRange( double bounds[6] );
00239 void ResetCameraClippingRange( double xmin, double xmax,
00240 double ymin, double ymax,
00241 double zmin, double zmax);
00243
00245
00249 vtkSetClampMacro(NearClippingPlaneTolerance,double,0,0.99);
00250 vtkGetMacro(NearClippingPlaneTolerance,double);
00252
00258 void ResetCamera();
00259
00267 void ResetCamera(double bounds[6]);
00268
00270
00271 void ResetCamera(double xmin, double xmax, double ymin, double ymax,
00272 double zmin, double zmax);
00274
00276
00279 void SetRenderWindow(vtkRenderWindow *);
00280 vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00281 virtual vtkWindow *GetVTKWindow();
00283
00285
00288 vtkSetMacro(BackingStore,int);
00289 vtkGetMacro(BackingStore,int);
00290 vtkBooleanMacro(BackingStore,int);
00292
00294
00297 vtkSetMacro(Interactive,int);
00298 vtkGetMacro(Interactive,int);
00299 vtkBooleanMacro(Interactive,int);
00301
00303
00305 vtkSetMacro(Layer, int);
00306 vtkGetMacro(Layer, int);
00308
00311 int Transparent();
00312
00314 void WorldToView();
00315
00317
00318 void ViewToWorld();
00319 virtual void ViewToWorld(double &wx, double &wy, double &wz);
00321
00323 virtual void WorldToView(double &wx, double &wy, double &wz);
00324
00327 double GetZ (int x, int y);
00328
00330 unsigned long GetMTime();
00331
00333
00334 vtkGetMacro( LastRenderTimeInSeconds, double );
00336
00338
00342 vtkGetMacro( NumberOfPropsRendered, int );
00344
00350 vtkAssemblyPath* PickProp(double selectionX, double selectionY);
00351
00355 virtual void StereoMidpoint() { return; };
00356
00361 double GetTiledAspectRatio();
00362
00363 protected:
00364 vtkRenderer();
00365 ~vtkRenderer();
00366
00367
00368 virtual void PickRender(vtkPropCollection *props);
00369 virtual void PickGeometry();
00370
00371 vtkCamera *ActiveCamera;
00372 vtkLight *CreatedLight;
00373
00374 vtkLightCollection *Lights;
00375 vtkCullerCollection *Cullers;
00376
00377 vtkActorCollection *Actors;
00378 vtkVolumeCollection *Volumes;
00379
00380 double Ambient[3];
00381 vtkRenderWindow *RenderWindow;
00382 double AllocatedRenderTime;
00383 double TimeFactor;
00384 int TwoSidedLighting;
00385 int AutomaticLightCreation;
00386 int BackingStore;
00387 unsigned char *BackingImage;
00388 int BackingStoreSize[2];
00389 vtkTimeStamp RenderTime;
00390
00391 double LastRenderTimeInSeconds;
00392
00393 int LightFollowCamera;
00394
00395
00396 void AllocateTime();
00397
00398
00399
00400 int NumberOfPropsRendered;
00401
00402
00403
00404 vtkProp **PropArray;
00405 int PropArrayCount;
00406
00407
00408 vtkAssemblyPath **PathArray;
00409 int PathArrayCount;
00410
00411
00412
00413 int Interactive;
00414
00415
00416
00417 int Layer;
00418
00419
00420
00421 double ComputedVisiblePropBounds[6];
00422
00428 double NearClippingPlaneTolerance;
00429
00434 int Erase;
00435
00439 virtual int UpdateGeometry(void);
00440
00443 virtual int UpdateCamera(void);
00444
00448 virtual int UpdateLightGeometry(void);
00449
00452 virtual int UpdateLights(void) {return 0;};
00453
00454 private:
00455 vtkRenderer(const vtkRenderer&);
00456 void operator=(const vtkRenderer&);
00457 };
00458
00459 inline vtkLightCollection *vtkRenderer::GetLights() {
00460 return this->Lights;
00461 }
00462
00464 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00465
00466
00467 #endif