Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Rendering/vtkRenderer.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkRenderer.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00044 #ifndef __vtkRenderer_h 00045 #define __vtkRenderer_h 00046 00047 #include "vtkViewport.h" 00048 00049 #include "vtkVolumeCollection.h" // Needed for access in inline members 00050 #include "vtkActorCollection.h" // Needed for access in inline members 00051 00052 class vtkRenderWindow; 00053 class vtkVolume; 00054 class vtkCuller; 00055 class vtkActor; 00056 class vtkActor2D; 00057 class vtkCamera; 00058 class vtkLightCollection; 00059 class vtkCullerCollection; 00060 class vtkLight; 00061 00062 class VTK_RENDERING_EXPORT vtkRenderer : public vtkViewport 00063 { 00064 public: 00065 vtkTypeRevisionMacro(vtkRenderer,vtkViewport); 00066 void PrintSelf(ostream& os, vtkIndent indent); 00067 00071 static vtkRenderer *New(); 00072 00074 00077 void AddActor(vtkProp *p) {this->AddProp(p);}; 00078 void AddVolume(vtkProp *p) {this->AddProp(p);}; 00079 void RemoveActor(vtkProp *p) {this->Actors->RemoveItem(p);this->RemoveProp(p);}; 00080 void RemoveVolume(vtkProp *p) {this->Volumes->RemoveItem(p);this->RemoveProp(p);}; 00082 00084 void AddLight(vtkLight *); 00085 00087 void RemoveLight(vtkLight *); 00088 00090 vtkLightCollection *GetLights(); 00091 00093 void CreateLight(void); 00094 00098 virtual vtkLight *MakeLight(); 00099 00101 00105 vtkGetMacro(TwoSidedLighting,int); 00106 vtkSetMacro(TwoSidedLighting,int); 00107 vtkBooleanMacro(TwoSidedLighting,int); 00109 00111 00121 vtkSetMacro(LightFollowCamera,int); 00122 vtkGetMacro(LightFollowCamera,int); 00123 vtkBooleanMacro(LightFollowCamera,int); 00125 00129 virtual int UpdateLightsGeometryToFollowCamera(void); 00130 00132 vtkVolumeCollection *GetVolumes(); 00133 00135 vtkActorCollection *GetActors(); 00136 00138 void SetActiveCamera(vtkCamera *); 00139 00141 vtkCamera *GetActiveCamera(); 00142 00146 virtual vtkCamera *MakeCamera(); 00147 00149 void AddCuller(vtkCuller *); 00150 00152 void RemoveCuller(vtkCuller *); 00153 00155 vtkCullerCollection *GetCullers(); 00156 00158 00159 vtkSetVector3Macro(Ambient,float); 00160 vtkGetVectorMacro(Ambient,float,3); 00162 00164 00166 vtkSetMacro(AllocatedRenderTime,float); 00167 virtual float GetAllocatedRenderTime(); 00169 00174 virtual float GetTimeFactor(); 00175 00178 virtual void Render(); 00179 00182 virtual void DeviceRender() =0; 00183 00185 virtual void Clear() {}; 00186 00188 int VisibleActorCount(); 00189 00191 int VisibleVolumeCount(); 00192 00195 void ComputeVisiblePropBounds( float bounds[6] ); 00196 00198 float *ComputeVisiblePropBounds(); 00199 00202 void ResetCameraClippingRange(); 00203 00205 00207 void ResetCameraClippingRange( float bounds[6] ); 00208 void ResetCameraClippingRange( float xmin, float xmax, 00209 float ymin, float ymax, 00210 float zmin, float zmax); 00212 00218 void ResetCamera(); 00219 00227 void ResetCamera(float bounds[6]); 00228 00230 00231 void ResetCamera(float xmin, float xmax, float ymin, float ymax, 00232 float zmin, float zmax); 00234 00236 00239 void SetRenderWindow(vtkRenderWindow *); 00240 vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;}; 00241 virtual vtkWindow *GetVTKWindow(); 00243 00245 00248 vtkSetMacro(BackingStore,int); 00249 vtkGetMacro(BackingStore,int); 00250 vtkBooleanMacro(BackingStore,int); 00252 00254 00257 vtkSetMacro(Interactive,int); 00258 vtkGetMacro(Interactive,int); 00259 vtkBooleanMacro(Interactive,int); 00261 00263 00265 vtkSetMacro(Layer, int); 00266 vtkGetMacro(Layer, int); 00268 00271 int Transparent(); 00272 00274 void WorldToView(); 00275 00277 00278 void ViewToWorld(); 00279 virtual void ViewToWorld(float &wx, float &wy, float &wz); 00281 00283 virtual void WorldToView(float &wx, float &wy, float &wz); 00284 00286 float GetZ (int x, int y); 00287 00289 unsigned long GetMTime(); 00290 00292 00293 vtkGetMacro( LastRenderTimeInSeconds, float ); 00295 00297 00301 vtkGetMacro( NumberOfPropsRendered, int ); 00303 00309 vtkAssemblyPath* PickProp(float selectionX, float selectionY); 00310 00311 protected: 00312 vtkRenderer(); 00313 ~vtkRenderer(); 00314 00315 // internal method for doing a render for picking purposes 00316 virtual void PickRender(vtkPropCollection *props); 00317 virtual void PickGeometry(); 00318 00319 vtkCamera *ActiveCamera; 00320 vtkLight *CreatedLight; 00321 00322 vtkLightCollection *Lights; 00323 vtkCullerCollection *Cullers; 00324 00325 vtkActorCollection *Actors; 00326 vtkVolumeCollection *Volumes; 00327 00328 float Ambient[3]; 00329 vtkRenderWindow *RenderWindow; 00330 float AllocatedRenderTime; 00331 float TimeFactor; 00332 int TwoSidedLighting; 00333 int BackingStore; 00334 unsigned char *BackingImage; 00335 vtkTimeStamp RenderTime; 00336 00337 float LastRenderTimeInSeconds; 00338 00339 int LightFollowCamera; 00340 00341 // Allocate the time for each prop 00342 void AllocateTime(); 00343 00344 // Internal variables indicating the number of props 00345 // that have been or will be rendered in each category. 00346 int NumberOfPropsRendered; 00347 00348 // A temporary list of props used for culling, and traversal 00349 // of all props when rendering 00350 vtkProp **PropArray; 00351 int PropArrayCount; 00352 00353 // A temporary list used for picking 00354 vtkAssemblyPath **PathArray; 00355 int PathArrayCount; 00356 00357 // Indicates if the renderer should receive events from an interactor. 00358 // Typically only used in conjunction with transparent renderers. 00359 int Interactive; 00360 00361 // Shows what layer this renderer belongs to. Only of interested when 00362 // there are layered renderers. 00363 int Layer; 00364 00365 // Holds the result of ComputeVisiblePropBounds so that it is visible from wrapped languages 00366 float ComputedVisiblePropBounds[6]; 00367 00371 virtual int UpdateGeometry(void); 00372 00375 virtual int UpdateCamera(void); 00376 00380 virtual int UpdateLightGeometry(void); 00381 00384 virtual int UpdateLights(void) {return 0;}; 00385 00386 private: 00387 vtkRenderer(const vtkRenderer&); // Not implemented. 00388 void operator=(const vtkRenderer&); // Not implemented. 00389 }; 00390 00391 inline vtkLightCollection *vtkRenderer::GetLights() { 00392 return this->Lights; 00393 } 00394 00396 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;} 00397 00398 00399 #endif