VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPainter.h 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 =========================================================================*/ 00015 00016 /* 00017 * Copyright 2004 Sandia Corporation. 00018 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00019 * license for use of this work by or on behalf of the 00020 * U.S. Government. Redistribution and use in source and binary forms, with 00021 * or without modification, are permitted provided that this Notice and any 00022 * statement of authorship are reproduced on all copies. 00023 */ 00024 00045 #ifndef vtkPainter_h 00046 #define vtkPainter_h 00047 00048 #include "vtkRenderingOpenGLModule.h" // For export macro 00049 #include "vtkObject.h" 00050 #include "vtkWeakPointer.h" // needed for vtkWeakPointer. 00051 00052 class vtkAbstractArray; 00053 class vtkActor; 00054 class vtkDataObject; 00055 class vtkDataSet; 00056 class vtkInformation; 00057 class vtkInformationIntegerKey; 00058 class vtkPainterObserver; 00059 class vtkRenderer; 00060 class vtkTimerLog; 00061 class vtkWindow; 00062 00063 class VTKRENDERINGOPENGL_EXPORT vtkPainter : public vtkObject 00064 { 00065 public: 00066 vtkTypeMacro(vtkPainter, vtkObject); 00067 virtual void PrintSelf(ostream &os, vtkIndent indent); 00068 00073 static vtkInformationIntegerKey* STATIC_DATA(); 00074 00079 static vtkInformationIntegerKey* CONSERVE_MEMORY(); 00080 00084 static vtkInformationIntegerKey* HIGH_QUALITY(); 00085 00087 00088 vtkGetObjectMacro(Information, vtkInformation); 00089 virtual void SetInformation(vtkInformation*); 00091 00093 00095 vtkGetObjectMacro(DelegatePainter, vtkPainter); 00096 virtual void SetDelegatePainter(vtkPainter*); 00098 00100 00101 virtual void Register(vtkObjectBase *o); 00102 virtual void UnRegister(vtkObjectBase *o); 00104 00105 //BTX 00106 enum { 00107 VERTS = 0x1, 00108 LINES = 0x2, 00109 POLYS = 0x4, 00110 STRIPS = 0x8 00111 }; 00112 //ETX 00113 00115 00120 virtual void Render(vtkRenderer* renderer, vtkActor* actor, 00121 unsigned long typeflags, bool forceCompileOnly); 00123 00128 virtual void ReleaseGraphicsResources(vtkWindow *); 00129 00131 00132 vtkSetClampMacro(Progress,double,0.0,1.0); 00133 vtkGetMacro(Progress,double); 00135 00139 virtual double GetTimeToDraw(); 00140 00144 virtual void UpdateBounds(double bounds[6]); 00145 00147 00149 void SetInput(vtkDataObject*); 00150 vtkGetObjectMacro(Input, vtkDataObject); 00152 00154 00156 virtual vtkDataObject* GetOutput() 00157 { return this->Input; } 00159 00160 //BTX 00161 protected: 00162 vtkPainter(); 00163 ~vtkPainter(); 00164 00166 virtual void ReportReferences(vtkGarbageCollector *collector); 00167 00173 void UpdateDelegatePainter(); 00174 00178 virtual void PassInformation(vtkPainter* toPainter); 00179 00184 virtual void PrepareForRendering(vtkRenderer*, vtkActor*) { } 00185 00187 00192 virtual void RenderInternal(vtkRenderer* renderer, vtkActor* actor, 00193 unsigned long typeflags, bool forceCompileOnly); 00195 00198 virtual void UpdateDelegateProgress(vtkPainter* delegate, double amount); 00199 00202 virtual void ProcessInformation(vtkInformation*) { } 00203 00206 virtual void ObserverPainterProgress(vtkPainter* toObserve); 00207 00211 void UpdateProgress(double amount); 00212 00214 00215 vtkAbstractArray* GetInputArrayToProcess(int fieldAssociation, 00216 int fieldAttributeType, 00217 vtkDataSet* ds, 00218 bool *use_cell_data=0); 00219 vtkAbstractArray* GetInputArrayToProcess(int fieldAssociation, 00220 const char* name, vtkDataSet* dsl, 00221 bool *use_cell_data=0); 00223 00224 // Time of most recent call to ProcessInformation(). 00225 vtkTimeStamp InformationProcessTime; 00226 friend class vtkPainterObserver; 00227 vtkPainterObserver* Observer; 00228 00229 vtkInformation* Information; 00230 vtkPainter* DelegatePainter; 00231 00232 double Progress; 00233 double ProgressOffset; 00234 double ProgressScaleFactor; 00235 00236 double TimeToDraw; 00237 vtkTimerLog* Timer; 00238 00239 00240 vtkWeakPointer<vtkWindow> LastWindow; // Window used for previous render. 00241 // This is not reference counted. 00242 private: 00243 vtkPainter(const vtkPainter &); // Not implemented. 00244 void operator=(const vtkPainter &); // Not implemented. 00245 00246 vtkDataObject* Input; 00247 //ETX 00248 }; 00249 00250 #endif //vtkPainter_h