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
00068 #ifndef __vtkRenderer_h
00069 #define __vtkRenderer_h
00070
00071 #include "vtkMatrix4x4.h"
00072 #include "vtkLightCollection.h"
00073 #include "vtkVolumeCollection.h"
00074 #include "vtkCullerCollection.h"
00075 #include "vtkCamera.h"
00076 #include "vtkActor.h"
00077 #include "vtkActor2D.h"
00078 #include "vtkViewport.h"
00079 #include "vtkActorCollection.h"
00080
00081 class vtkRayCaster;
00082 class vtkRenderWindow;
00083 class vtkVolume;
00084 class vtkCuller;
00085
00086 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport
00087 {
00088 public:
00089 vtkTypeMacro(vtkRenderer,vtkViewport);
00090 void PrintSelf(ostream& os, vtkIndent indent);
00091
00095 static vtkRenderer *New();
00096
00098 void AddLight(vtkLight *);
00099
00101
00104 void AddActor(vtkProp *p) {this->AddProp(p);};
00105 void AddVolume(vtkProp *p) {this->AddProp(p);};
00106 void RemoveActor(vtkProp *p) {this->Actors->RemoveItem(p);this->RemoveProp(p);};
00107 void RemoveVolume(vtkProp *p) {this->Volumes->RemoveItem(p);this->RemoveProp(p);};
00109
00111 void RemoveLight(vtkLight *);
00112
00114 vtkLightCollection *GetLights();
00115
00117 vtkVolumeCollection *GetVolumes();
00118
00120 vtkActorCollection *GetActors();
00121
00123 void SetActiveCamera(vtkCamera *);
00124
00126 vtkCamera *GetActiveCamera();
00127
00131 virtual vtkCamera *MakeCamera();
00132
00134 void AddCuller(vtkCuller *);
00135
00137 void RemoveCuller(vtkCuller *);
00138
00140 vtkCullerCollection *GetCullers();
00141
00143
00144 vtkSetVector3Macro(Ambient,float);
00145 vtkGetVectorMacro(Ambient,float,3);
00147
00149
00151 vtkSetMacro(AllocatedRenderTime,float);
00152 virtual float GetAllocatedRenderTime();
00154
00159 virtual float GetTimeFactor();
00160
00163 virtual void Render();
00164
00167 virtual void DeviceRender() =0;
00168
00169
00171 virtual void Clear() {};
00172
00174 int VisibleActorCount();
00175
00177 int VisibleVolumeCount();
00178
00180 void CreateLight(void);
00181
00185 virtual vtkLight *MakeLight();
00186
00189 void ComputeVisiblePropBounds( float bounds[6] );
00190
00193 void ResetCameraClippingRange();
00194
00196
00198 void ResetCameraClippingRange( float bounds[6] );
00199 void ResetCameraClippingRange( float xmin, float xmax,
00200 float ymin, float ymax,
00201 float zmin, float zmax);
00203
00209 void ResetCamera();
00210
00218 void ResetCamera(float bounds[6]);
00219
00221
00222 void ResetCamera(float xmin, float xmax, float ymin, float ymax,
00223 float zmin, float zmax);
00225
00227
00230 void SetRenderWindow(vtkRenderWindow *);
00231 vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00232 virtual vtkWindow *GetVTKWindow();
00234
00236
00240 vtkGetMacro(TwoSidedLighting,int);
00241 vtkSetMacro(TwoSidedLighting,int);
00242 vtkBooleanMacro(TwoSidedLighting,int);
00244
00246
00249 vtkSetMacro(BackingStore,int);
00250 vtkGetMacro(BackingStore,int);
00251 vtkBooleanMacro(BackingStore,int);
00253
00255
00258 vtkSetMacro(Interactive,int);
00259 vtkGetMacro(Interactive,int);
00260 vtkBooleanMacro(Interactive,int);
00262
00264
00266 vtkSetMacro(Layer, int);
00267 vtkGetMacro(Layer, int);
00269
00272 int Transparent();
00273
00275 void WorldToView();
00276
00278
00279 void ViewToWorld();
00280 virtual void ViewToWorld(float &wx, float &wy, float &wz);
00282
00284 virtual void WorldToView(float &wx, float &wy, float &wz);
00285
00287 float GetZ (int x, int y);
00288
00292 void RenderOverlay();
00293
00295 unsigned long GetMTime();
00296
00298
00299 vtkGetMacro( LastRenderTimeInSeconds, float );
00301
00303
00307 vtkGetMacro( NumberOfPropsRenderedAsGeometry, int );
00309
00315 vtkAssemblyPath* PickProp(float selectionX, float selectionY);
00316
00318
00330 vtkSetMacro(LightFollowCamera,int);
00331 vtkGetMacro(LightFollowCamera,int);
00332 vtkBooleanMacro(LightFollowCamera,int);
00334
00335 vtkRayCaster *GetRayCaster()
00336 {VTK_LEGACY_METHOD(GetRayCaster,"4.0");return this->RayCaster;};
00337
00338
00339 protected:
00340 vtkRenderer();
00341 ~vtkRenderer();
00342
00343
00344 virtual void PickRender(vtkPropCollection *props);
00345 virtual void PickGeometry();
00346
00347 vtkCamera *ActiveCamera;
00348 vtkLight *CreatedLight;
00349
00350 vtkLightCollection *Lights;
00351 vtkCullerCollection *Cullers;
00352
00353 vtkActorCollection *Actors;
00354 vtkVolumeCollection *Volumes;
00355
00356 float Ambient[3];
00357 vtkRenderWindow *RenderWindow;
00358 float AllocatedRenderTime;
00359 float TimeFactor;
00360 int TwoSidedLighting;
00361 int BackingStore;
00362 unsigned char *BackingImage;
00363 vtkTimeStamp RenderTime;
00364
00365 float LastRenderTimeInSeconds;
00366
00367 int LightFollowCamera;
00368
00369
00370 void AllocateTime();
00371
00372
00373
00374 int NumberOfPropsRenderedAsGeometry;
00375 int NumberOfPropsToRayCast;
00376 int NumberOfPropsToRenderIntoImage;
00377
00378
00379
00380 vtkProp **PropArray;
00381 int PropArrayCount;
00382
00383
00384 vtkAssemblyPath **PathArray;
00385 int PathArrayCount;
00386
00387
00388
00389 int Interactive;
00390
00391
00392
00393 int Layer;
00394
00398 virtual int UpdateGeometry(void);
00399
00402 virtual int UpdateCamera(void);
00403
00407 virtual int UpdateLightGeometry(void);
00408
00411 virtual int UpdateLights(void) {return 0;};
00412
00413 vtkRayCaster *RayCaster;
00414 private:
00415 vtkRenderer(const vtkRenderer&);
00416 void operator=(const vtkRenderer&);
00417 };
00418
00420 inline vtkLightCollection *vtkRenderer::GetLights() {return this->Lights;}
00421
00423 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00424
00425
00426 #endif