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

graphics/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 =========================================================================*/
00062 #ifndef __vtkRenderWindow_h
00063 #define __vtkRenderWindow_h
00064 
00065 #include "vtkWindow.h"
00066 #include "vtkRendererCollection.h"
00067 #include <stdio.h>
00068 #include "vtkGraphicsFactory.h"
00069 
00070 class vtkRenderWindowInteractor;
00071 
00072 
00073 
00074 // lets define the different types of stereo
00075 #define VTK_STEREO_CRYSTAL_EYES 1
00076 #define VTK_STEREO_RED_BLUE     2
00077 #define VTK_STEREO_INTERLACED   3
00078 #define VTK_STEREO_LEFT         4
00079 #define VTK_STEREO_RIGHT        5
00080 #define VTK_STEREO_DRESDEN      6
00081 
00082 class VTK_EXPORT vtkRenderWindow : public vtkWindow
00083 {
00084 public:
00085   vtkTypeMacro(vtkRenderWindow,vtkWindow);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00087 
00091   static vtkRenderWindow *New();
00092 
00094   void AddRenderer(vtkRenderer *);
00095 
00097   void RemoveRenderer(vtkRenderer *);
00098 
00100   static const char *GetRenderLibrary() {
00101     return vtkGraphicsFactory::GetRenderLibrary();};
00102 
00104   vtkRendererCollection *GetRenderers() {return this->Renderers;};
00105 
00108   virtual void Render();
00109 
00111   virtual void Start() {};
00112   
00115   virtual void Frame() {};
00116 
00119   virtual void CopyResultFrame();
00120 
00124   virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
00125 
00128   virtual void HideCursor() {};
00129   virtual void ShowCursor() {};
00130 
00132   virtual void SetFullScreen(int) {};
00133   vtkGetMacro(FullScreen,int);
00134   vtkBooleanMacro(FullScreen,int);
00135 
00139   vtkSetMacro(Borders,int);
00140   vtkGetMacro(Borders,int);
00141   vtkBooleanMacro(Borders,int);
00142 
00145   vtkGetMacro(StereoCapableWindow,int);
00146   vtkBooleanMacro(StereoCapableWindow,int);
00147   virtual void SetStereoCapableWindow(int capable);
00148 
00150   vtkGetMacro(StereoRender,int);
00151   void SetStereoRender(int stereo);
00152   vtkBooleanMacro(StereoRender,int);
00153 
00156   vtkSetMacro(PointSmoothing,int);
00157   vtkGetMacro(PointSmoothing,int);
00158   vtkBooleanMacro(PointSmoothing,int);
00159 
00162   vtkSetMacro(LineSmoothing,int);
00163   vtkGetMacro(LineSmoothing,int);
00164   vtkBooleanMacro(LineSmoothing,int);
00165 
00168   vtkSetMacro(PolygonSmoothing,int);
00169   vtkGetMacro(PolygonSmoothing,int);
00170   vtkBooleanMacro(PolygonSmoothing,int);
00171 
00173   vtkGetMacro(StereoType,int);
00174   vtkSetMacro(StereoType,int);
00175   void SetStereoTypeToCrystalEyes() 
00176     {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);};
00177   void SetStereoTypeToRedBlue() 
00178     {this->SetStereoType(VTK_STEREO_RED_BLUE);};
00179   void SetStereoTypeToInterlaced() 
00180     {this->SetStereoType(VTK_STEREO_INTERLACED);};
00181   void SetStereoTypeToLeft() 
00182     {this->SetStereoType(VTK_STEREO_LEFT);};
00183   void SetStereoTypeToRight() 
00184     {this->SetStereoType(VTK_STEREO_RIGHT);};
00185   void SetStereoTypeToDresden() 
00186     {this->SetStereoType(VTK_STEREO_DRESDEN);};  
00187   char *GetStereoTypeAsString();
00188 
00192   virtual void StereoUpdate();
00193 
00196   virtual void StereoMidpoint();
00197 
00200   virtual void StereoRenderComplete();
00201 
00205   virtual void WindowRemap() {};
00206   
00208   vtkSetMacro(SwapBuffers,int);
00209   vtkGetMacro(SwapBuffers,int);
00210   vtkBooleanMacro(SwapBuffers,int);
00211   
00214   vtkSetStringMacro(FileName);
00215   vtkGetStringMacro(FileName);
00216 
00218   virtual void SaveImageAsPPM();
00219   virtual  int OpenPPMImageFile();
00220   virtual void WritePPMImageFile();
00221   virtual void ClosePPMImageFile();
00222 
00223 
00232   virtual void SetPixelData(int, int, int, int, unsigned char *,int) {};
00233 
00239   virtual float *GetRGBAPixelData(int ,int ,int ,int ,int ) {
00240     return (float *)NULL;};
00241   virtual void SetRGBAPixelData(int ,int ,int ,int ,float *,int,
00242                                 int blend=0) { blend = blend;}
00243   virtual unsigned char *GetRGBACharPixelData(int ,int ,int ,int ,int ) {
00244     return (unsigned char*)NULL;}
00245   virtual void SetRGBACharPixelData(int ,int ,int ,int ,unsigned char *, int,
00246                 int blend=0) { blend = blend;}
00247   
00248 
00250   virtual float *GetZbufferData(int, int, int, int ) {return (float *)NULL;};
00251   virtual void SetZbufferData(int, int, int, int, float *) {};
00252 
00256   vtkGetMacro(AAFrames,int);
00257   vtkSetMacro(AAFrames,int);
00258 
00264   vtkGetMacro(FDFrames,int);
00265   vtkSetMacro(FDFrames,int);
00266 
00272   vtkGetMacro(SubFrames,int);
00273   vtkSetMacro(SubFrames,int);
00274 
00276   vtkGetMacro(NeverRendered,int);
00277 
00280   vtkGetMacro(AbortRender,int);
00281   vtkSetMacro(AbortRender,int);
00282   vtkGetMacro(InAbortCheck,int);
00283   vtkSetMacro(InAbortCheck,int);
00284   virtual int CheckAbortStatus();
00285   virtual int GetEventPending() { return 0;};
00286   
00289   void SetAbortCheckMethod(void (*f)(void *), void *arg);
00290 
00292   void SetAbortCheckMethodArgDelete(void (*f)(void *));
00293 
00299   void SetDesiredUpdateRate(float);
00300   vtkGetMacro(DesiredUpdateRate,float);
00301 
00306   vtkGetMacro(NumLayers, int);
00307   vtkSetClampMacro(NumLayers, int, 1, VTK_LARGE_INTEGER);
00308 
00310   vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
00311   void SetInteractor(vtkRenderWindowInteractor *);
00312 
00315   void UnRegister(vtkObject *o);
00316   
00318   virtual void SetDisplayId(void *) {};
00319   virtual void SetWindowId(void *)  {};
00320   virtual void SetParentId(void *)  {};
00321   virtual void *GetGenericDisplayId() {return NULL;};
00322   virtual void *GetGenericWindowId() {return NULL;};
00323   virtual void *GetGenericParentId() {return NULL;};
00324   virtual void *GetGenericContext() {return NULL;};
00325   virtual void *GetGenericDrawable() {return NULL;};
00326   virtual void SetWindowInfo(char *) {};
00327 
00329   virtual void MakeCurrent() {};
00330 
00333   virtual int GetDepthBufferSize() {return -1;};
00334 
00335 protected:
00336   vtkRenderWindow();
00337   ~vtkRenderWindow();
00338   vtkRenderWindow(const vtkRenderWindow&) {};
00339   void operator=(const vtkRenderWindow&) {};
00340 
00341   virtual void DoStereoRender();
00342   virtual void DoFDRender();
00343   virtual void DoAARender();
00344 
00345   vtkRendererCollection *Renderers;
00346   int Borders;
00347   int FullScreen;
00348   int OldScreen[5];
00349   int PointSmoothing;
00350   int LineSmoothing;
00351   int PolygonSmoothing;
00352   int StereoRender;
00353   int StereoType;
00354   int StereoStatus; // used for keeping track of what's going on
00355   int StereoCapableWindow;
00356   vtkRenderWindowInteractor *Interactor;
00357   char *FileName;
00358   unsigned char* StereoBuffer; // used for red blue stereo
00359   float *AccumulationBuffer;   // used for many techniques
00360   int AAFrames;
00361   int FDFrames;
00362   int SubFrames;               // number of sub frames
00363   int CurrentSubFrame;         // what one are we on
00364   unsigned char *ResultFrame;  // used for any non immediate rendering
00365   int   SwapBuffers;
00366   float DesiredUpdateRate;
00367   FILE* PPMImageFilePtr;
00368   int   AbortRender;
00369   int   InAbortCheck;
00370   int   InRender;
00371   int   NeverRendered;
00372   int   NumLayers;
00373   void (*AbortCheckMethod)(void *);
00374   void (*AbortCheckMethodArgDelete)(void *);
00375   void *AbortCheckMethodArg;
00376 };
00377 
00379 inline char *vtkRenderWindow::GetStereoTypeAsString(void)
00380 {
00381   switch ( this->StereoType )
00382     {
00383     case VTK_STEREO_CRYSTAL_EYES:
00384       return (char *)"CrystalEyes";
00385     case VTK_STEREO_RED_BLUE:
00386       return (char *)"RedBlue";
00387     case VTK_STEREO_LEFT:
00388       return (char *)"Left";
00389     case VTK_STEREO_RIGHT:
00390       return (char *)"Right";
00391     case VTK_STEREO_DRESDEN:
00392       return (char *)"DresdenDisplay";
00393     default:
00394       return (char *)"";
00395     }
00396 }
00397 
00398 #endif
00399 
00400 

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