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

graphics/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 =========================================================================*/
00061 #ifndef __vtkRenderer_h
00062 #define __vtkRenderer_h
00063 
00064 #include "vtkMatrix4x4.h"
00065 #include "vtkLightCollection.h"
00066 #include "vtkVolumeCollection.h"
00067 #include "vtkCullerCollection.h"
00068 #include "vtkCamera.h"
00069 #include "vtkActor.h"
00070 #include "vtkActor2D.h"
00071 #include "vtkViewport.h"
00072 #include "vtkActorCollection.h"
00073 
00074 class vtkRenderWindow;
00075 class vtkRayCaster;
00076 class vtkVolume;
00077 class vtkRayCaster;
00078 class vtkCuller;
00079 
00080 class VTK_EXPORT vtkRenderer : public vtkViewport
00081 {
00082 public:
00083   vtkTypeMacro(vtkRenderer,vtkViewport);
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085 
00089   static vtkRenderer *New();
00090 
00092   void AddLight(vtkLight *);
00093 
00097   void AddActor(vtkProp *p) {this->AddProp(p);};
00098   void AddVolume(vtkProp *p) {this->AddProp(p);};
00099   void RemoveActor(vtkProp *p) {this->Actors->RemoveItem(p);this->RemoveProp(p);};
00100   void RemoveVolume(vtkProp *p) {this->Volumes->RemoveItem(p);this->RemoveProp(p);};
00101 
00103   void RemoveLight(vtkLight *);
00104 
00106   vtkLightCollection *GetLights();
00107   
00109   vtkVolumeCollection *GetVolumes();
00110 
00112   vtkActorCollection *GetActors();
00113 
00115   void SetActiveCamera(vtkCamera *);
00116 
00118   vtkCamera *GetActiveCamera();
00119 
00121   void AddCuller(vtkCuller *);
00122 
00124   void RemoveCuller(vtkCuller *);
00125 
00127   vtkCullerCollection *GetCullers();
00128 
00130   vtkSetVector3Macro(Ambient,float);
00131   vtkGetVectorMacro(Ambient,float,3);
00132 
00135   vtkSetMacro(AllocatedRenderTime,float);
00136   virtual float GetAllocatedRenderTime();
00137 
00139   virtual float GetTimeFactor();
00140 
00143   virtual void Render();
00144 
00147   virtual void DeviceRender() =0;
00148   
00149 
00151   virtual void Clear() {};
00152 
00154   int VisibleActorCount();
00155 
00157   int VisibleVolumeCount();
00158 
00160   void CreateLight(void);
00161 
00164   void ComputeVisiblePropBounds( float bounds[6] );
00165 
00168   void ResetCameraClippingRange();
00169 
00172   void ResetCameraClippingRange( float bounds[6] );
00173   void ResetCameraClippingRange( float xmin, float xmax, 
00174              float ymin, float ymax, 
00175              float zmin, float zmax);
00176 
00182   void ResetCamera();
00183 
00191   void ResetCamera(float bounds[6]);
00192 
00194   void ResetCamera(float xmin, float xmax, float ymin, float ymax, 
00195                    float zmin, float zmax);
00196 
00200   void SetRenderWindow(vtkRenderWindow *);
00201   vtkRenderWindow *GetRenderWindow() {return this->RenderWindow;};
00202   virtual vtkWindow *GetVTKWindow();
00203   
00208   vtkGetMacro(TwoSidedLighting,int);
00209   vtkSetMacro(TwoSidedLighting,int);
00210   vtkBooleanMacro(TwoSidedLighting,int);
00211 
00215   vtkSetMacro(BackingStore,int);
00216   vtkGetMacro(BackingStore,int);
00217   vtkBooleanMacro(BackingStore,int);
00218 
00222   vtkSetMacro(Interactive,int);
00223   vtkGetMacro(Interactive,int);
00224   vtkBooleanMacro(Interactive,int);
00225 
00228   vtkSetMacro(Layer, int);
00229   vtkGetMacro(Layer, int);
00230 
00233   int  Transparent();
00234 
00236   void WorldToView();
00237 
00239   void ViewToWorld();
00240   virtual void ViewToWorld(float &wx, float &wy, float &wz);
00241 
00243   virtual void WorldToView(float &wx, float &wy, float &wz);
00244 
00246   vtkGetObjectMacro(RayCaster,vtkRayCaster);
00247 
00249   float GetZ (int x, int y);
00250 
00254   void RenderOverlay();
00255 
00257   unsigned long GetMTime();
00258 
00260   vtkGetMacro( LastRenderTimeInSeconds, float );
00261 
00263   void UnRegister(vtkObject *o);
00264 
00269   vtkGetMacro( NumberOfPropsRenderedAsGeometry, int );
00270 
00276   vtkAssemblyPath* PickProp(float selectionX, float selectionY);
00277 
00290   vtkSetMacro(LightFollowCamera,int);
00291   vtkGetMacro(LightFollowCamera,int);
00292   vtkBooleanMacro(LightFollowCamera,int);
00293 
00294 protected:
00295   vtkRenderer();
00296   ~vtkRenderer();
00297   vtkRenderer(const vtkRenderer&) {};
00298   void operator=(const vtkRenderer&) {};
00299 
00300   // internal method for doing a render for picking purposes
00301   virtual void PickRender(vtkPropCollection *props);
00302   virtual void PickGeometry();
00303   
00304   vtkRayCaster *RayCaster;
00305 
00306   vtkCamera *ActiveCamera;
00307   vtkLight  *CreatedLight;
00308 
00309   vtkLightCollection *Lights;
00310   vtkCullerCollection *Cullers;
00311 
00312   vtkActorCollection *Actors;
00313   vtkVolumeCollection *Volumes;
00314   
00315   float              Ambient[3];  
00316   vtkRenderWindow    *RenderWindow;
00317   float              AllocatedRenderTime;
00318   float              TimeFactor;
00319   int                TwoSidedLighting;
00320   int                BackingStore;
00321   unsigned char      *BackingImage;
00322   vtkTimeStamp       RenderTime;
00323 
00324   float              LastRenderTimeInSeconds;
00325 
00326   int                LightFollowCamera;
00327 
00328   // Allocate the time for each prop
00329   void               AllocateTime();
00330 
00331   // Internal variables indicating the number of props
00332   // that have been or will be rendered in each category.
00333   int                NumberOfPropsRenderedAsGeometry;
00334   int                NumberOfPropsToRayCast;
00335   int                NumberOfPropsToRenderIntoImage;
00336 
00337   // A temporary list of props used for culling, and traversal
00338   // of all props when rendering
00339   vtkProp            **PropArray;
00340   int                PropArrayCount;
00341 
00342   // A sublist of props that need ray casting
00343   vtkProp            **RayCastPropArray;
00344 
00345   // A sublist of props that want to be rendered into an image
00346   vtkProp            **RenderIntoImagePropArray;
00347 
00348   // A temporary list used for picking
00349   vtkAssemblyPath    **PathArray;
00350   int                PathArrayCount;
00351 
00352   // Indicates if the renderer should receive events from an interactor.
00353   // Typically only used in conjunction with transparent renderers.
00354   int                Interactive;
00355 
00356   // Shows what layer this renderer belongs to.  Only of interested when
00357   // there are layered renderers.
00358   int                Layer;
00359 
00363   virtual int UpdateGeometry(void);
00364 
00367   virtual int UpdateCamera(void);
00368 
00372   virtual int UpdateLightGeometry(void);
00373 
00376   virtual int UpdateLights(void) {return 0;};
00377 };
00378 
00380 inline vtkLightCollection *vtkRenderer::GetLights() {return this->Lights;}
00381 
00383 inline vtkCullerCollection *vtkRenderer::GetCullers(){return this->Cullers;}
00384 
00385 
00386 #endif

Generated on Wed Nov 21 12:27:02 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001