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

Rendering/vtkRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRenderWindow.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 =========================================================================*/
00069 #ifndef __vtkRenderWindow_h
00070 #define __vtkRenderWindow_h
00071 
00072 #include "vtkWindow.h"
00073 #include "vtkRendererCollection.h"
00074 #include <stdio.h>
00075 #include "vtkGraphicsFactory.h"
00076 
00077 class vtkRenderWindowInteractor;
00078 
00079 
00080 
00081 // lets define the different types of stereo
00082 #define VTK_STEREO_CRYSTAL_EYES 1
00083 #define VTK_STEREO_RED_BLUE     2
00084 #define VTK_STEREO_INTERLACED   3
00085 #define VTK_STEREO_LEFT         4
00086 #define VTK_STEREO_RIGHT        5
00087 #define VTK_STEREO_DRESDEN      6
00088 
00089 class VTK_RENDERING_EXPORT vtkRenderWindow : public vtkWindow
00090 {
00091 public:
00092   vtkTypeMacro(vtkRenderWindow,vtkWindow);
00093   void PrintSelf(ostream& os, vtkIndent indent);
00094 
00098   static vtkRenderWindow *New();
00099 
00101   void AddRenderer(vtkRenderer *);
00102 
00104   void RemoveRenderer(vtkRenderer *);
00105 
00107 
00108   static const char *GetRenderLibrary() {
00109     return vtkGraphicsFactory::GetRenderLibrary();};
00111 
00113   vtkRendererCollection *GetRenderers() {return this->Renderers;};
00114 
00117   virtual void Render();
00118 
00120   virtual void Start() {};
00121   
00124   virtual void Frame() {};
00125 
00128   virtual void CopyResultFrame();
00129 
00133   virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
00134 
00136 
00138   virtual void HideCursor() {};
00139   virtual void ShowCursor() {};
00141 
00143 
00144   virtual void SetFullScreen(int) {};
00145   vtkGetMacro(FullScreen,int);
00146   vtkBooleanMacro(FullScreen,int);
00148 
00150 
00153   vtkSetMacro(Borders,int);
00154   vtkGetMacro(Borders,int);
00155   vtkBooleanMacro(Borders,int);
00157 
00159 
00161   vtkGetMacro(StereoCapableWindow,int);
00162   vtkBooleanMacro(StereoCapableWindow,int);
00163   virtual void SetStereoCapableWindow(int capable);
00165 
00167 
00168   vtkGetMacro(StereoRender,int);
00169   void SetStereoRender(int stereo);
00170   vtkBooleanMacro(StereoRender,int);
00172 
00174 
00176   vtkSetMacro(PointSmoothing,int);
00177   vtkGetMacro(PointSmoothing,int);
00178   vtkBooleanMacro(PointSmoothing,int);
00180 
00182 
00184   vtkSetMacro(LineSmoothing,int);
00185   vtkGetMacro(LineSmoothing,int);
00186   vtkBooleanMacro(LineSmoothing,int);
00188 
00190 
00192   vtkSetMacro(PolygonSmoothing,int);
00193   vtkGetMacro(PolygonSmoothing,int);
00194   vtkBooleanMacro(PolygonSmoothing,int);
00196 
00198 
00199   vtkGetMacro(StereoType,int);
00200   vtkSetMacro(StereoType,int);
00201   void SetStereoTypeToCrystalEyes() 
00202     {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);};
00203   void SetStereoTypeToRedBlue() 
00204     {this->SetStereoType(VTK_STEREO_RED_BLUE);};
00205   void SetStereoTypeToInterlaced() 
00206     {this->SetStereoType(VTK_STEREO_INTERLACED);};
00207   void SetStereoTypeToLeft() 
00208     {this->SetStereoType(VTK_STEREO_LEFT);};
00209   void SetStereoTypeToRight() 
00210     {this->SetStereoType(VTK_STEREO_RIGHT);};
00211   void SetStereoTypeToDresden() 
00212     {this->SetStereoType(VTK_STEREO_DRESDEN);};  
00213   char *GetStereoTypeAsString();
00215 
00219   virtual void StereoUpdate();
00220 
00223   virtual void StereoMidpoint();
00224 
00227   virtual void StereoRenderComplete();
00228 
00232   virtual void WindowRemap() {};
00233   
00235 
00236   vtkSetMacro(SwapBuffers,int);
00237   vtkGetMacro(SwapBuffers,int);
00238   vtkBooleanMacro(SwapBuffers,int);
00240   
00249   virtual void SetPixelData(int, int, int, int, unsigned char *,int) {};
00250 
00252 
00257   virtual float *GetRGBAPixelData(int ,int ,int ,int ,int ) {
00258     return (float *)NULL;};
00259   virtual void SetRGBAPixelData(int ,int ,int ,int ,float *,int,
00260                                 int blend=0) { blend = blend;}
00261   virtual unsigned char *GetRGBACharPixelData(int ,int ,int ,int ,int ) {
00262     return (unsigned char*)NULL;}
00263   virtual void SetRGBACharPixelData(int ,int ,int ,int ,unsigned char *, int,
00264                                     int blend=0) { blend = blend;}
00266   
00267 
00269 
00270   virtual float *GetZbufferData(int, int, int, int ) {return (float *)NULL;};
00271   virtual void SetZbufferData(int, int, int, int, float *) {};
00273 
00275 
00278   vtkGetMacro(AAFrames,int);
00279   vtkSetMacro(AAFrames,int);
00281 
00283 
00288   vtkGetMacro(FDFrames,int);
00289   vtkSetMacro(FDFrames,int);
00291 
00293 
00298   vtkGetMacro(SubFrames,int);
00299   vtkSetMacro(SubFrames,int);
00301 
00303 
00304   vtkGetMacro(NeverRendered,int);
00306 
00308 
00310   vtkGetMacro(AbortRender,int);
00311   vtkSetMacro(AbortRender,int);
00312   vtkGetMacro(InAbortCheck,int);
00313   vtkSetMacro(InAbortCheck,int);
00314   virtual int CheckAbortStatus();
00315   virtual int GetEventPending() { return 0;};
00317   
00320   void SetAbortCheckMethod(void (*f)(void *), void *arg);
00321 
00323   void SetAbortCheckMethodArgDelete(void (*f)(void *));
00324 
00326 
00331   void SetDesiredUpdateRate(float);
00332   vtkGetMacro(DesiredUpdateRate,float);
00334 
00336 
00340   vtkGetMacro(NumberOfLayers, int);
00341   vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
00343 
00345 
00346   vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
00347   void SetInteractor(vtkRenderWindowInteractor *);
00349 
00352   void UnRegister(vtkObject *o);
00353   
00355 
00356   virtual void SetDisplayId(void *) {}
00357   virtual void SetWindowId(void *)  {}
00358   virtual void SetParentId(void *)  {}
00359   virtual void *GetGenericDisplayId() {return NULL;}
00360   virtual void *GetGenericWindowId() {return NULL;}
00361   virtual void *GetGenericParentId() {return NULL;}
00362   virtual void *GetGenericContext() {return NULL;}
00363   virtual void *GetGenericDrawable() {return NULL;}
00364   virtual void SetWindowInfo(char *) {}
00365   virtual void SetParentInfo(char *) {};
00367 
00369   virtual void MakeCurrent() {};
00370 
00373   virtual int GetDepthBufferSize() {return -1;}
00374 
00375 protected:
00376   vtkRenderWindow();
00377   ~vtkRenderWindow();
00378 
00379   virtual void DoStereoRender();
00380   virtual void DoFDRender();
00381   virtual void DoAARender();
00382 
00383   vtkRendererCollection *Renderers;
00384   int Borders;
00385   int FullScreen;
00386   int OldScreen[5];
00387   int PointSmoothing;
00388   int LineSmoothing;
00389   int PolygonSmoothing;
00390   int StereoRender;
00391   int StereoType;
00392   int StereoStatus; // used for keeping track of what's going on
00393   int StereoCapableWindow;
00394   vtkRenderWindowInteractor *Interactor;
00395   unsigned char* StereoBuffer; // used for red blue stereo
00396   float *AccumulationBuffer;   // used for many techniques
00397   unsigned int AccumulationBufferSize;
00398   int AAFrames;
00399   int FDFrames;
00400   int SubFrames;               // number of sub frames
00401   int CurrentSubFrame;         // what one are we on
00402   unsigned char *ResultFrame;  // used for any non immediate rendering
00403   int   SwapBuffers;
00404   float DesiredUpdateRate;
00405   int   AbortRender;
00406   int   InAbortCheck;
00407   int   InRender;
00408   int   NeverRendered;
00409   int   NumberOfLayers;
00410   void (*AbortCheckMethod)(void *);
00411   void (*AbortCheckMethodArgDelete)(void *);
00412   void *AbortCheckMethodArg;
00413 private:
00414   vtkRenderWindow(const vtkRenderWindow&);  // Not implemented.
00415   void operator=(const vtkRenderWindow&);  // Not implemented.
00416 };
00417 
00419 inline char *vtkRenderWindow::GetStereoTypeAsString(void)
00420 {
00421   switch ( this->StereoType )
00422     {
00423     case VTK_STEREO_CRYSTAL_EYES:
00424       return (char *)"CrystalEyes";
00425     case VTK_STEREO_RED_BLUE:
00426       return (char *)"RedBlue";
00427     case VTK_STEREO_LEFT:
00428       return (char *)"Left";
00429     case VTK_STEREO_RIGHT:
00430       return (char *)"Right";
00431     case VTK_STEREO_DRESDEN:
00432       return (char *)"DresdenDisplay";
00433     default:
00434       return (char *)"";
00435     }
00436 }
00437 
00438 #endif
00439 
00440 

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