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

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 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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   // internal method for doing a render for picking purposes
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   // Allocate the time for each prop
00370   void               AllocateTime();
00371 
00372   // Internal variables indicating the number of props
00373   // that have been or will be rendered in each category.
00374   int                NumberOfPropsRenderedAsGeometry;
00375   int                NumberOfPropsToRayCast;
00376   int                NumberOfPropsToRenderIntoImage;
00377 
00378   // A temporary list of props used for culling, and traversal
00379   // of all props when rendering
00380   vtkProp            **PropArray;
00381   int                PropArrayCount;
00382 
00383   // A temporary list used for picking
00384   vtkAssemblyPath    **PathArray;
00385   int                PathArrayCount;
00386 
00387   // Indicates if the renderer should receive events from an interactor.
00388   // Typically only used in conjunction with transparent renderers.
00389   int                Interactive;
00390 
00391   // Shows what layer this renderer belongs to.  Only of interested when
00392   // there are layered renderers.
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&);  // Not implemented.
00416   void operator=(const vtkRenderer&);  // Not implemented.
00417 };
00418 
00420 inline vtkLightCollection *vtkRenderer::GetLights() {return this->Lights;}
00421 
00423 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00424 
00425 
00426 #endif

Generated on Thu Mar 28 14:19:34 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001