00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
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 WaitForCompletion()=0;
00146
00149 virtual void CopyResultFrame();
00150
00154 virtual vtkRenderWindowInteractor *MakeRenderWindowInteractor();
00155
00157
00160 virtual void HideCursor() = 0;
00161 virtual void ShowCursor() = 0;
00162 virtual void SetCursorPosition(int , int ) {};
00164
00166
00167 vtkSetMacro(CurrentCursor,int);
00168 vtkGetMacro(CurrentCursor,int);
00170
00172
00173 virtual void SetFullScreen(int) = 0;
00174 vtkGetMacro(FullScreen,int);
00175 vtkBooleanMacro(FullScreen,int);
00177
00179
00182 vtkSetMacro(Borders,int);
00183 vtkGetMacro(Borders,int);
00184 vtkBooleanMacro(Borders,int);
00186
00188
00190 vtkGetMacro(StereoCapableWindow,int);
00191 vtkBooleanMacro(StereoCapableWindow,int);
00192 virtual void SetStereoCapableWindow(int capable);
00194
00196
00197 vtkGetMacro(StereoRender,int);
00198 void SetStereoRender(int stereo);
00199 vtkBooleanMacro(StereoRender,int);
00201
00203
00204 vtkSetMacro(AlphaBitPlanes, int);
00205 vtkGetMacro(AlphaBitPlanes, int);
00206 vtkBooleanMacro(AlphaBitPlanes, int);
00208
00210
00212 vtkSetMacro(PointSmoothing,int);
00213 vtkGetMacro(PointSmoothing,int);
00214 vtkBooleanMacro(PointSmoothing,int);
00216
00218
00220 vtkSetMacro(LineSmoothing,int);
00221 vtkGetMacro(LineSmoothing,int);
00222 vtkBooleanMacro(LineSmoothing,int);
00224
00226
00228 vtkSetMacro(PolygonSmoothing,int);
00229 vtkGetMacro(PolygonSmoothing,int);
00230 vtkBooleanMacro(PolygonSmoothing,int);
00232
00234
00246 vtkGetMacro(StereoType,int);
00247 vtkSetMacro(StereoType,int);
00248 void SetStereoTypeToCrystalEyes()
00249 {this->SetStereoType(VTK_STEREO_CRYSTAL_EYES);}
00250 void SetStereoTypeToRedBlue()
00251 {this->SetStereoType(VTK_STEREO_RED_BLUE);}
00252 void SetStereoTypeToInterlaced()
00253 {this->SetStereoType(VTK_STEREO_INTERLACED);}
00254 void SetStereoTypeToLeft()
00255 {this->SetStereoType(VTK_STEREO_LEFT);}
00256 void SetStereoTypeToRight()
00257 {this->SetStereoType(VTK_STEREO_RIGHT);}
00258 void SetStereoTypeToDresden()
00259 {this->SetStereoType(VTK_STEREO_DRESDEN);}
00260 void SetStereoTypeToAnaglyph()
00261 {this->SetStereoType(VTK_STEREO_ANAGLYPH);}
00262 void SetStereoTypeToCheckerboard()
00263 {this->SetStereoType(VTK_STEREO_CHECKERBOARD);}
00265
00266 const char *GetStereoTypeAsString();
00267
00271 virtual void StereoUpdate();
00272
00275 virtual void StereoMidpoint();
00276
00279 virtual void StereoRenderComplete();
00280
00282
00287 vtkSetClampMacro(AnaglyphColorSaturation,float, 0.0f, 1.0f);
00288 vtkGetMacro(AnaglyphColorSaturation,float);
00290
00292
00303 vtkSetVector2Macro(AnaglyphColorMask,int);
00304 vtkGetVectorMacro(AnaglyphColorMask,int,2);
00306
00310 virtual void WindowRemap() = 0;
00311
00313
00314 vtkSetMacro(SwapBuffers,int);
00315 vtkGetMacro(SwapBuffers,int);
00316 vtkBooleanMacro(SwapBuffers,int);
00318
00320
00329 virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data,
00330 int front) = 0;
00331 virtual int SetPixelData(int x, int y, int x2, int y2,
00332 vtkUnsignedCharArray *data, int front) = 0;
00334
00336
00341 virtual float *GetRGBAPixelData(int x, int y, int x2, int y2, int front) = 0;
00342 virtual int GetRGBAPixelData(int x, int y, int x2, int y2, int front,
00343 vtkFloatArray *data) = 0;
00344 virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *,
00345 int front, int blend=0) = 0;
00346 virtual int SetRGBAPixelData(int, int, int, int, vtkFloatArray*,
00347 int, int blend=0) = 0;
00348 virtual void ReleaseRGBAPixelData(float *data)=0;
00349 virtual unsigned char *GetRGBACharPixelData(int x, int y, int x2, int y2,
00350 int front) = 0;
00351 virtual int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
00352 vtkUnsignedCharArray *data) = 0;
00353 virtual int SetRGBACharPixelData(int x,int y, int x2, int y2,
00354 unsigned char *data, int front,
00355 int blend=0) = 0;
00356 virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
00357 vtkUnsignedCharArray *data, int front,
00358 int blend=0) = 0;
00360
00362
00364 virtual float *GetZbufferData(int x, int y, int x2, int y2) = 0;
00365 virtual int GetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
00366 virtual int GetZbufferData(int x, int y, int x2, int y2,
00367 vtkFloatArray *z) = 0;
00368 virtual int SetZbufferData(int x, int y, int x2, int y2, float *z) = 0;
00369 virtual int SetZbufferData(int x, int y, int x2, int y2,
00370 vtkFloatArray *z) = 0;
00371 float GetZbufferDataAtPoint(int x, int y)
00372 {
00373 float value;
00374 this->GetZbufferData(x, y, x, y, &value);
00375 return value;
00376 }
00378
00380
00383 vtkGetMacro(AAFrames,int);
00384 vtkSetMacro(AAFrames,int);
00386
00388
00393 vtkGetMacro(FDFrames,int);
00394 vtkSetMacro(FDFrames,int);
00396
00398
00404 vtkGetMacro(SubFrames,int);
00405 virtual void SetSubFrames(int subFrames);
00407
00409
00410 vtkGetMacro(NeverRendered,int);
00412
00414
00416 vtkGetMacro(AbortRender,int);
00417 vtkSetMacro(AbortRender,int);
00418 vtkGetMacro(InAbortCheck,int);
00419 vtkSetMacro(InAbortCheck,int);
00420 virtual int CheckAbortStatus();
00422
00423 vtkGetMacro(IsPicking,int);
00424 vtkSetMacro(IsPicking,int);
00425 vtkBooleanMacro(IsPicking,int);
00426
00431 virtual int GetEventPending() = 0;
00432
00434 virtual int CheckInRenderStatus() { return this->InRender; }
00435
00437 virtual void ClearInRenderStatus() { this->InRender = 0; }
00438
00440
00445 virtual void SetDesiredUpdateRate(double);
00446 vtkGetMacro(DesiredUpdateRate,double);
00448
00450
00454 vtkGetMacro(NumberOfLayers, int);
00455 vtkSetClampMacro(NumberOfLayers, int, 1, VTK_LARGE_INTEGER);
00457
00459
00460 vtkGetObjectMacro(Interactor,vtkRenderWindowInteractor);
00462
00464 void SetInteractor(vtkRenderWindowInteractor *);
00465
00468 virtual void UnRegister(vtkObjectBase *o);
00469
00471
00472 virtual void SetDisplayId(void *) = 0;
00473 virtual void SetWindowId(void *) = 0;
00474 virtual void SetNextWindowId(void *) = 0;
00475 virtual void SetParentId(void *) = 0;
00476 virtual void *GetGenericDisplayId() = 0;
00477 virtual void *GetGenericWindowId() = 0;
00478 virtual void *GetGenericParentId() = 0;
00479 virtual void *GetGenericContext() = 0;
00480 virtual void *GetGenericDrawable() = 0;
00481 virtual void SetWindowInfo(char *) = 0;
00482 virtual void SetNextWindowInfo(char *) = 0;
00483 virtual void SetParentInfo(char *) = 0;
00485
00488 virtual void MakeCurrent() = 0;
00489
00492 virtual bool IsCurrent()=0;
00493
00497 virtual void SetForceMakeCurrent() {};
00498
00500 virtual const char *ReportCapabilities() { return "Not Implemented";};
00501
00503 virtual int SupportsOpenGL() { return 0;};
00504
00506 virtual int IsDirect() { return 0;};
00507
00510 virtual int GetDepthBufferSize() = 0;
00511
00514 virtual int GetColorBufferSizes(int *rgba) = 0;
00515
00517
00519 vtkGetObjectMacro(PainterDeviceAdapter, vtkPainterDeviceAdapter);
00521
00523
00525 vtkSetMacro(MultiSamples,int);
00526 vtkGetMacro(MultiSamples,int);
00528
00530
00531 vtkSetMacro(StencilCapable, int);
00532 vtkGetMacro(StencilCapable, int);
00533 vtkBooleanMacro(StencilCapable, int);
00535
00537
00539 vtkSetMacro(ReportGraphicErrors,int);
00540 vtkGetMacro(ReportGraphicErrors,int);
00541 vtkBooleanMacro(ReportGraphicErrors,int);
00543
00547 virtual void CheckGraphicError()=0;
00548
00550 virtual int HasGraphicError()=0;
00551
00553 virtual const char *GetLastGraphicErrorString()=0;
00554
00555 protected:
00556 vtkRenderWindow();
00557 ~vtkRenderWindow();
00558
00559 virtual void DoStereoRender();
00560 virtual void DoFDRender();
00561 virtual void DoAARender();
00562
00563 vtkPainterDeviceAdapter* PainterDeviceAdapter;
00564 vtkRendererCollection *Renderers;
00565 int Borders;
00566 int FullScreen;
00567 int OldScreen[5];
00568 int PointSmoothing;
00569 int LineSmoothing;
00570 int PolygonSmoothing;
00571 int StereoRender;
00572 int StereoType;
00573 int StereoStatus;
00574 int StereoCapableWindow;
00575 int AlphaBitPlanes;
00576 vtkRenderWindowInteractor *Interactor;
00577 unsigned char* StereoBuffer;
00578 float *AccumulationBuffer;
00579 unsigned int AccumulationBufferSize;
00580 int AAFrames;
00581 int FDFrames;
00582 int SubFrames;
00583 int CurrentSubFrame;
00584 unsigned char *ResultFrame;
00585 int SwapBuffers;
00586 double DesiredUpdateRate;
00587 int AbortRender;
00588 int InAbortCheck;
00589 int InRender;
00590 int NeverRendered;
00591 int NumberOfLayers;
00592 int CurrentCursor;
00593 int IsPicking;
00594 float AnaglyphColorSaturation;
00595 int AnaglyphColorMask[2];
00596 int MultiSamples;
00597 int StencilCapable;
00598
00601 int ReportGraphicErrors;
00602
00604 double AbortCheckTime;
00605
00606 private:
00607 vtkRenderWindow(const vtkRenderWindow&);
00608 void operator=(const vtkRenderWindow&);
00609 };
00610
00611 #endif