VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkRenderWindow.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00046 #ifndef __vtkRenderWindow_h 00047 #define __vtkRenderWindow_h 00048 00049 #include "vtkWindow.h" 00050 00051 class vtkFloatArray; 00052 class vtkPainterDeviceAdapter; 00053 class vtkRenderWindowInteractor; 00054 class vtkRenderer; 00055 class vtkRendererCollection; 00056 class vtkUnsignedCharArray; 00057 00058 // lets define the different types of stereo 00059 #define VTK_STEREO_CRYSTAL_EYES 1 00060 #define VTK_STEREO_RED_BLUE 2 00061 #define VTK_STEREO_INTERLACED 3 00062 #define VTK_STEREO_LEFT 4 00063 #define VTK_STEREO_RIGHT 5 00064 #define VTK_STEREO_DRESDEN 6 00065 #define VTK_STEREO_ANAGLYPH 7 00066 #define VTK_STEREO_CHECKERBOARD 8 00067 00068 #define VTK_CURSOR_DEFAULT 0 00069 #define VTK_CURSOR_ARROW 1 00070 #define VTK_CURSOR_SIZENE 2 00071 #define VTK_CURSOR_SIZENW 3 00072 #define VTK_CURSOR_SIZESW 4 00073 #define VTK_CURSOR_SIZESE 5 00074 #define VTK_CURSOR_SIZENS 6 00075 #define VTK_CURSOR_SIZEWE 7 00076 #define VTK_CURSOR_SIZEALL 8 00077 #define VTK_CURSOR_HAND 9 00078 #define VTK_CURSOR_CROSSHAIR 10 00079 00081 00088 #ifdef VTK_LEAN_AND_MEAN 00089 # define vtkGraphicErrorMacro(renderWindow,message) 00090 00091 #else 00092 # define vtkGraphicErrorMacro(renderWindow,message) \ 00093 if(renderWindow->GetReportGraphicErrors()) \ 00094 { \ 00095 renderWindow->CheckGraphicError(); \ 00096 if(renderWindow->HasGraphicError()) \ 00097 { \ 00098 vtkErrorMacro(<<message<<" "<<renderWindow->GetLastGraphicErrorString()); \ 00099 } \ 00100 } 00101 #endif 00102 00103 class VTK_RENDERING_EXPORT vtkRenderWindow : public vtkWindow 00104 { 00105 public: 00106 vtkTypeRevisionMacro(vtkRenderWindow,vtkWindow); 00107 void PrintSelf(ostream& os, vtkIndent indent); 00108 00112 static vtkRenderWindow *New(); 00113 00115 virtual void AddRenderer(vtkRenderer *); 00116 00118 void RemoveRenderer(vtkRenderer *); 00119 00121 int HasRenderer(vtkRenderer *); 00122 00124 static const char *GetRenderLibrary(); 00125 00127 vtkRendererCollection *GetRenderers() {return this->Renderers;}; 00128 00131 virtual void Render(); 00132 00134 virtual void Start() = 0; 00135 00137 virtual void Finalize() = 0; 00138 00141 virtual void Frame() = 0; 00142 00145 virtual void CopyResultFrame(); 00146 00150 virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor(); 00151 00153 00156 virtual void HideCursor() = 0; 00157 virtual void ShowCursor() = 0; 00158 virtual void SetCursorPosition(int , int ) {}; 00160 00162 00163 vtkSetMacro(CurrentCursor,int); 00164 vtkGetMacro(CurrentCursor,int); 00166 00168 00169 virtual void SetFullScreen(int) = 0; 00170 vtkGetMacro(FullScreen,int); 00171 vtkBooleanMacro(FullScreen,int); 00173 00175 00178 vtkSetMacro(Borders,int); 00179 vtkGetMacro(Borders,int); 00180 vtkBooleanMacro(Borders,int); 00182 00184 00186 vtkGetMacro(StereoCapableWindow,int); 00187 vtkBooleanMacro(StereoCapableWindow,int); 00188 virtual void SetStereoCapableWindow(int capable); 00190 00192 00193 vtkGetMacro(StereoRender,int); 00194 void SetStereoRender(int stereo); 00195 vtkBooleanMacro(StereoRender,int); 00197 00199 00200 vtkSetMacro(AlphaBitPlanes, int); 00201 vtkGetMacro(AlphaBitPlanes, int); 00202 vtkBooleanMacro(AlphaBitPlanes, int); 00204 00206 00208 vtkSetMacro(PointSmoothing,int); 00209 vtkGetMacro(PointSmoothing,int); 00210 vtkBooleanMacro(PointSmoothing,int); 00212 00214 00216 vtkSetMacro(LineSmoothing,int); 00217 vtkGetMacro(LineSmoothing,int); 00218 vtkBooleanMacro(LineSmoothing,int); 00220 00222 00224 vtkSetMacro(PolygonSmoothing,int); 00225 vtkGetMacro(PolygonSmoothing,int); 00226 vtkBooleanMacro(PolygonSmoothing,int); 00228 00230 00242 vtkGetMacro(StereoType,int); 00243 vtkSetMacro(StereoType,int); 00244 void SetStereoTypeToCrystalEyes() 00245 {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);} 00246 void SetStereoTypeToRedBlue() 00247 {this->SetStereoType(VTK_STEREO_RED_BLUE);} 00248 void SetStereoTypeToInterlaced() 00249 {this->SetStereoType(VTK_STEREO_INTERLACED);} 00250 void SetStereoTypeToLeft() 00251 {this->SetStereoType(VTK_STEREO_LEFT);} 00252 void SetStereoTypeToRight() 00253 {this->SetStereoType(VTK_STEREO_RIGHT);} 00254 void SetStereoTypeToDresden() 00255 {this->SetStereoType(VTK_STEREO_DRESDEN);} 00256 void SetStereoTypeToAnaglyph() 00257 {this->SetStereoType(VTK_STEREO_ANAGLYPH);} 00258 void SetStereoTypeToCheckerboard() 00259 {this->SetStereoType(VTK_STEREO_CHECKERBOARD);} 00261 00262 const char *GetStereoTypeAsString(); 00263 00267 virtual void StereoUpdate(); 00268 00271 virtual void StereoMidpoint(); 00272 00275 virtual void StereoRenderComplete(); 00276 00278 00283 vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f); 00284 vtkGetMacro(AnaglyphColorSaturation,float); 00286 00288 00299 vtkSetVector2Macro(AnaglyphColorMask,int); 00300 vtkGetVectorMacro(AnaglyphColorMask,int,2); 00302 00306 virtual void WindowRemap() = 0; 00307 00309 00310 vtkSetMacro(SwapBuffers,int); 00311 vtkGetMacro(SwapBuffers,int); 00312 vtkBooleanMacro(SwapBuffers,int); 00314 00316 00325 virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data, 00326 int front) = 0; 00327 virtual int SetPixelData(int x, int y, int x2, int y2, 00328 vtkUnsignedCharArray *data, int front) = 0; 00330 00332 00337 virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0; 00338 virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front, 00339 vtkFloatArray *data) = 0; 00340 virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *, 00341 int front, int blend=0) = 0; 00342 virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*, 00343 int, int blend=0) = 0; 00344 virtual void ReleaseRGBAPixelData(float *data)=0; 00345 virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2, 00346 int front) = 0; 00347 virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front, 00348 vtkUnsignedCharArray *data) = 0; 00349 virtual int SetRGBACharPixelData(int x,int y, int x2, int y2, 00350 unsigned char *data, int front, 00351 int blend=0) = 0; 00352 virtual int SetRGBACharPixelData(int x, int y, int x2, int y2, 00353 vtkUnsignedCharArray *data, int front, 00354 int blend=0) = 0; 00356 00358 00360 virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0; 00361 virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0; 00362 virtual int GetZbufferData(int x, int y, int x2, int y2, 00363 vtkFloatArray *z) = 0; 00364 virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0; 00365 virtual int SetZbufferData(int x, int y, int x2, int y2, 00366 vtkFloatArray *z) = 0; 00367 float GetZbufferDataAtPoint(int x, int y) 00368 { 00369 float value; 00370 this->GetZbufferData(x, y, x, y, &value); 00371 return value; 00372 } 00374 00376 00379 vtkGetMacro(AAFrames,int); 00380 vtkSetMacro(AAFrames,int); 00382 00384 00389 vtkGetMacro(FDFrames,int); 00390 vtkSetMacro(FDFrames,int); 00392 00394 00400 vtkGetMacro(SubFrames,int); 00401 virtual void SetSubFrames(int subFrames); 00403 00405 00406 vtkGetMacro(NeverRendered,int); 00408 00410 00412 vtkGetMacro(AbortRender,int); 00413 vtkSetMacro(AbortRender,int); 00414 vtkGetMacro(InAbortCheck,int); 00415 vtkSetMacro(InAbortCheck,int); 00416 virtual int CheckAbortStatus(); 00418 00419 vtkGetMacro(IsPicking,int); 00420 vtkSetMacro(IsPicking,int); 00421 vtkBooleanMacro(IsPicking,int); 00422 00427 virtual int GetEventPending() = 0; 00428 00430 virtual int CheckInRenderStatus() { return this->InRender; } 00431 00433 virtual void ClearInRenderStatus() { this->InRender = 0; } 00434 00436 00441 virtual void SetDesiredUpdateRate(double); 00442 vtkGetMacro(DesiredUpdateRate,double); 00444 00446 00450 vtkGetMacro(NumberOfLayers, int); 00451 vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER); 00453 00455 00456 vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor); 00458 00460 void SetInteractor(vtkRenderWindowInteractor *); 00461 00464 virtual void UnRegister(vtkObjectBase *o); 00465 00467 00468 virtual void SetDisplayId(void *) = 0; 00469 virtual void SetWindowId(void *) = 0; 00470 virtual void SetNextWindowId(void *) = 0; 00471 virtual void SetParentId(void *) = 0; 00472 virtual void *GetGenericDisplayId() = 0; 00473 virtual void *GetGenericWindowId() = 0; 00474 virtual void *GetGenericParentId() = 0; 00475 virtual void *GetGenericContext() = 0; 00476 virtual void *GetGenericDrawable() = 0; 00477 virtual void SetWindowInfo(char *) = 0; 00478 virtual void SetNextWindowInfo(char *) = 0; 00479 virtual void SetParentInfo(char *) = 0; 00481 00483 virtual void MakeCurrent() = 0; 00484 00488 virtual void SetForceMakeCurrent() {}; 00489 00491 virtual const char *ReportCapabilities() { return "Not Implemented";}; 00492 00494 virtual int SupportsOpenGL() { return 0;}; 00495 00497 virtual int IsDirect() { return 0;}; 00498 00501 virtual int GetDepthBufferSize() = 0; 00502 00505 virtual int GetColorBufferSizes(int *rgba) = 0; 00506 00508 00510 vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter); 00512 00514 00516 vtkSetMacro(MultiSamples,int); 00517 vtkGetMacro(MultiSamples,int); 00519 00521 00522 vtkSetMacro(StencilCapable, int); 00523 vtkGetMacro(StencilCapable, int); 00524 vtkBooleanMacro(StencilCapable, int); 00526 00528 00530 vtkSetMacro(ReportGraphicErrors,int); 00531 vtkGetMacro(ReportGraphicErrors,int); 00532 vtkBooleanMacro(ReportGraphicErrors,int); 00534 00538 virtual void CheckGraphicError()=0; 00539 00541 virtual int HasGraphicError()=0; 00542 00544 virtual const char *GetLastGraphicErrorString()=0; 00545 00546 protected: 00547 vtkRenderWindow(); 00548 ~vtkRenderWindow(); 00549 00550 virtual void DoStereoRender(); 00551 virtual void DoFDRender(); 00552 virtual void DoAARender(); 00553 00554 vtkPainterDeviceAdapter* PainterDeviceAdapter; 00555 vtkRendererCollection *Renderers; 00556 int Borders; 00557 int FullScreen; 00558 int OldScreen[5]; 00559 int PointSmoothing; 00560 int LineSmoothing; 00561 int PolygonSmoothing; 00562 int StereoRender; 00563 int StereoType; 00564 int StereoStatus; // used for keeping track of what's going on 00565 int StereoCapableWindow; 00566 int AlphaBitPlanes; 00567 vtkRenderWindowInteractor *Interactor; 00568 unsigned char* StereoBuffer; // used for red blue stereo 00569 float *AccumulationBuffer; // used for many techniques 00570 unsigned int AccumulationBufferSize; 00571 int AAFrames; 00572 int FDFrames; 00573 int SubFrames; // number of sub frames 00574 int CurrentSubFrame; // what one are we on 00575 unsigned char *ResultFrame; // used for any non immediate rendering 00576 int SwapBuffers; 00577 double DesiredUpdateRate; 00578 int AbortRender; 00579 int InAbortCheck; 00580 int InRender; 00581 int NeverRendered; 00582 int NumberOfLayers; 00583 int CurrentCursor; 00584 int IsPicking; 00585 float AnaglyphColorSaturation; 00586 int AnaglyphColorMask[2]; 00587 int MultiSamples; 00588 int StencilCapable; 00589 00592 int ReportGraphicErrors; 00593 00595 double AbortCheckTime; 00596 00597 private: 00598 vtkRenderWindow(const vtkRenderWindow&); // Not implemented. 00599 void operator=(const vtkRenderWindow&); // Not implemented. 00600 }; 00601 00602 #endif