00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00040 #ifndef __vtkRenderer_h
00041 #define __vtkRenderer_h
00042
00043 #include "vtkViewport.h"
00044
00045 #include "vtkVolumeCollection.h"
00046 #include "vtkActorCollection.h"
00047
00048 class vtkRenderWindow;
00049 class vtkVolume;
00050 class vtkCuller;
00051 class vtkActor;
00052 class vtkActor2D;
00053 class vtkCamera;
00054 class vtkLightCollection;
00055 class vtkCullerCollection;
00056 class vtkLight;
00057 class vtkPainter;
00058 class vtkIdentColoredPainter;
00059 class vtkVisibleCellSelector;
00060
00061 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport
00062 {
00063 public:
00064 vtkTypeRevisionMacro(vtkRenderer,vtkViewport);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00066
00070 static vtkRenderer *New();
00071
00073
00076 void AddActor(vtkProp *p);
00077 void AddVolume(vtkProp *p);
00078 void RemoveActor(vtkProp *p);
00079 void RemoveVolume(vtkProp *p);
00081
00083 void AddLight(vtkLight *);
00084
00086 void RemoveLight(vtkLight *);
00087
00089 void RemoveAllLights();
00090
00092 vtkLightCollection *GetLights();
00093
00095 void CreateLight(void);
00096
00100 virtual vtkLight *MakeLight();
00101
00103
00107 vtkGetMacro(TwoSidedLighting,int);
00108 vtkSetMacro(TwoSidedLighting,int);
00109 vtkBooleanMacro(TwoSidedLighting,int);
00111
00113
00123 vtkSetMacro(LightFollowCamera,int);
00124 vtkGetMacro(LightFollowCamera,int);
00125 vtkBooleanMacro(LightFollowCamera,int);
00127
00129
00135 vtkGetMacro(AutomaticLightCreation,int);
00136 vtkSetMacro(AutomaticLightCreation,int);
00137 vtkBooleanMacro(AutomaticLightCreation,int);
00139
00143 virtual int UpdateLightsGeometryToFollowCamera(void);
00144
00146 vtkVolumeCollection *GetVolumes();
00147
00149 vtkActorCollection *GetActors();
00150
00152 void SetActiveCamera(vtkCamera *);
00153
00157 vtkCamera *GetActiveCamera();
00158
00162 virtual vtkCamera *MakeCamera();
00163
00165
00169 vtkSetMacro(Erase, int);
00170 vtkGetMacro(Erase, int);
00171 vtkBooleanMacro(Erase, int);
00173
00175
00178 vtkSetMacro(Draw, int);
00179 vtkGetMacro(Draw, int);
00180 vtkBooleanMacro(Draw, int);
00182
00184 void AddCuller(vtkCuller *);
00185
00187 void RemoveCuller(vtkCuller *);
00188
00190 vtkCullerCollection *GetCullers();
00191
00193
00194 vtkSetVector3Macro(Ambient,double);
00195 vtkGetVectorMacro(Ambient,double,3);
00197
00199
00201 vtkSetMacro(AllocatedRenderTime,double);
00202 virtual double GetAllocatedRenderTime();
00204
00209 virtual double GetTimeFactor();
00210
00213 virtual void Render();
00214
00217 virtual void DeviceRender() =0;
00218
00223 virtual void DeviceRenderTranslucentPolygonalGeometry();
00224
00226 virtual void Clear() {};
00227
00229 int VisibleActorCount();
00230
00232 int VisibleVolumeCount();
00233
00236 void ComputeVisiblePropBounds( double bounds[6] );
00237
00239 double *ComputeVisiblePropBounds();
00240
00243 void ResetCameraClippingRange();
00244
00246
00248 void ResetCameraClippingRange( double bounds[6] );
00249 void ResetCameraClippingRange( double xmin, double xmax,
00250 double ymin, double ymax,
00251 double zmin, double zmax);
00253
00255
00259 vtkSetClampMacro(NearClippingPlaneTolerance,double,0,0.99);
00260 vtkGetMacro(NearClippingPlaneTolerance,double);
00262
00268 void ResetCamera();
00269
00277 void ResetCamera(double bounds[6]);
00278
00280
00281 void ResetCamera(double xmin, double xmax, double ymin, double ymax,
00282 double zmin, double zmax);
00284
00286
00289 void SetRenderWindow(vtkRenderWindow *);
00290 vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00291 virtual vtkWindow *GetVTKWindow();
00293
00295
00298 vtkSetMacro(BackingStore,int);
00299 vtkGetMacro(BackingStore,int);
00300 vtkBooleanMacro(BackingStore,int);
00302
00304
00307 vtkSetMacro(Interactive,int);
00308 vtkGetMacro(Interactive,int);
00309 vtkBooleanMacro(Interactive,int);
00311
00313
00315 vtkSetMacro(Layer, int);
00316 vtkGetMacro(Layer, int);
00318
00321 int Transparent();
00322
00324 void WorldToView();
00325
00327
00328 void ViewToWorld();
00329 virtual void ViewToWorld(double &wx, double &wy, double &wz);
00331
00333 virtual void WorldToView(double &wx, double &wy, double &wz);
00334
00337 double GetZ (int x, int y);
00338
00340 unsigned long GetMTime();
00341
00343
00344 vtkGetMacro( LastRenderTimeInSeconds, double );
00346
00348
00352 vtkGetMacro( NumberOfPropsRendered, int );
00354
00356
00361 vtkAssemblyPath* PickProp(double selectionX, double selectionY)
00362 {
00363 return this->PickProp(selectionX, selectionY, selectionX, selectionY);
00364 }
00365 vtkAssemblyPath* PickProp(double selectionX1, double selectionY1,
00366 double selectionX2, double selectionY2);
00368
00372 virtual void StereoMidpoint() { return; };
00373
00378 double GetTiledAspectRatio();
00379
00381
00384 int IsActiveCameraCreated()
00385 { return (this->ActiveCamera != NULL); }
00387
00388
00390
00396 vtkSetMacro(UseDepthPeeling,int);
00397 vtkGetMacro(UseDepthPeeling,int);
00398 vtkBooleanMacro(UseDepthPeeling,int);
00400
00402
00409 vtkSetClampMacro(OcclusionRatio,double,0.0,0.5);
00410 vtkGetMacro(OcclusionRatio,double);
00412
00414
00417 vtkSetMacro(MaximumNumberOfPeels,int);
00418 vtkGetMacro(MaximumNumberOfPeels,int);
00420
00422
00424 vtkGetMacro(LastRenderingUsedDepthPeeling,int);
00426
00427 protected:
00428 vtkRenderer();
00429 ~vtkRenderer();
00430
00431
00432 virtual void PickRender(vtkPropCollection *props);
00433 virtual void PickGeometry();
00434
00435 vtkCamera *ActiveCamera;
00436 vtkLight *CreatedLight;
00437
00438 vtkLightCollection *Lights;
00439 vtkCullerCollection *Cullers;
00440
00441 vtkActorCollection *Actors;
00442 vtkVolumeCollection *Volumes;
00443
00444 double Ambient[3];
00445 vtkRenderWindow *RenderWindow;
00446 double AllocatedRenderTime;
00447 double TimeFactor;
00448 int TwoSidedLighting;
00449 int AutomaticLightCreation;
00450 int BackingStore;
00451 unsigned char *BackingImage;
00452 int BackingStoreSize[2];
00453 vtkTimeStamp RenderTime;
00454
00455 double LastRenderTimeInSeconds;
00456
00457 int LightFollowCamera;
00458
00459
00460 void AllocateTime();
00461
00462
00463
00464 int NumberOfPropsRendered;
00465
00466
00467
00468 vtkProp **PropArray;
00469 int PropArrayCount;
00470
00471
00472 vtkAssemblyPath **PathArray;
00473 int PathArrayCount;
00474
00475
00476
00477 int Interactive;
00478
00479
00480
00481 int Layer;
00482
00483
00484
00485 double ComputedVisiblePropBounds[6];
00486
00492 double NearClippingPlaneTolerance;
00493
00498 int Erase;
00499
00503 int Draw;
00504
00508 virtual int UpdateGeometry(void);
00509
00514 virtual int UpdateTranslucentPolygonalGeometry();
00515
00518 virtual int UpdateCamera(void);
00519
00523 virtual int UpdateLightGeometry(void);
00524
00527 virtual int UpdateLights(void) {return 0;};
00528
00531 vtkCamera *GetActiveCameraAndResetIfCreated();
00532
00536 int UseDepthPeeling;
00537
00545 double OcclusionRatio;
00546
00550 int MaximumNumberOfPeels;
00551
00554 int LastRenderingUsedDepthPeeling;
00555
00556
00557
00558 friend class vtkVisibleCellSelector;
00559
00561
00564 enum {NOT_SELECTING = 0, COLOR_BY_PROCESSOR, COLOR_BY_ACTOR,
00565 COLOR_BY_CELL_ID_HIGH, COLOR_BY_CELL_ID_MID, COLOR_BY_CELL_ID_LOW,
00566 COLOR_BY_VERTEX};
00567
00568 vtkSetMacro(SelectMode, int);
00569 vtkSetMacro(SelectConst, unsigned int);
00571
00574 void SetIdentPainter(vtkIdentColoredPainter*);
00575
00577 virtual int UpdateGeometryForSelection(void);
00578
00580
00582 vtkPainter* SwapInSelectablePainter(vtkProp *,
00583 int &);
00585
00587
00589 void SwapOutSelectablePainter(vtkProp *,
00590 vtkPainter*,
00591 int );
00593
00595
00596 vtkProp **PropsSelectedFrom;
00597 int PropsSelectedFromCount;
00599
00600
00601 int SelectMode;
00602 unsigned int SelectConst;
00603 vtkIdentColoredPainter *IdentPainter;
00604
00605
00606
00607
00608 private:
00609 vtkRenderer(const vtkRenderer&);
00610 void operator=(const vtkRenderer&);
00611 };
00612
00613 inline vtkLightCollection *vtkRenderer::GetLights() {
00614 return this->Lights;
00615 }
00616
00618 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00619
00620
00621 #endif