00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkDataTransferHelper_h
00031 #define __vtkDataTransferHelper_h
00032
00033 #include "vtkObject.h"
00034 #include "vtkWeakPointer.h"
00035 #include "vtkSmartPointer.h"
00036
00037 class vtkDataArray;
00038 class vtkPixelBufferObject;
00039 class vtkTextureObject;
00040 class vtkOpenGLExtensionManager;
00041 class vtkRenderWindow;
00042
00043 class VTK_RENDERING_EXPORT vtkDataTransferHelper : public vtkObject
00044 {
00045 public:
00046 static vtkDataTransferHelper* New();
00047 vtkTypeMacro(vtkDataTransferHelper, vtkObject);
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049
00051
00055 void SetContext(vtkRenderWindow* context);
00056 vtkRenderWindow* GetContext();
00058
00060
00067 vtkSetVector6Macro(CPUExtent, int);
00068 vtkGetVector6Macro(CPUExtent, int);
00070
00072
00077 vtkSetVector6Macro(GPUExtent, int);
00078 vtkGetVector6Macro(GPUExtent, int);
00080
00082
00086 vtkSetVector6Macro(TextureExtent, int);
00087 vtkGetVector6Macro(TextureExtent, int);
00089
00092 bool GetExtentIsValid(int *extent);
00093
00095 bool GetCPUExtentIsValid();
00096
00098 bool GetGPUExtentIsValid();
00099
00101 bool GetTextureExtentIsValid();
00102
00104
00114 vtkSetMacro(MinTextureDimension,int);
00115 vtkGetMacro(MinTextureDimension,int);
00117
00119
00120 vtkGetObjectMacro(Array, vtkDataArray);
00121 void SetArray(vtkDataArray* array);
00123
00125
00126 vtkGetObjectMacro(Texture, vtkTextureObject);
00127 void SetTexture(vtkTextureObject* texture);
00129
00131
00156 bool Upload(int components=0,
00157 int *componentList=NULL);
00159
00185 bool Download();
00186
00188
00191 bool DownloadAsync1();
00192 bool DownloadAsync2();
00194
00195 bool GetShaderSupportsTextureInt();
00196 void SetShaderSupportsTextureInt(bool value);
00197
00199 static bool IsSupported(vtkRenderWindow* renWin);
00200
00201 protected:
00202 vtkDataTransferHelper();
00203 ~vtkDataTransferHelper();
00204
00206 bool LoadRequiredExtensions(vtkOpenGLExtensionManager*);
00207
00208 int CPUExtent[6];
00209 int GPUExtent[6];
00210 int TextureExtent[6];
00211
00212 vtkWeakPointer<vtkRenderWindow> Context;
00213 vtkTextureObject* Texture;
00214 vtkDataArray* Array;
00215 bool ShaderSupportsTextureInt;
00216 int MinTextureDimension;
00217
00218 vtkSmartPointer<vtkPixelBufferObject> AsyncDownloadPBO;
00219
00220 vtkPixelBufferObject* GetPBO();
00221
00222
00223 vtkSmartPointer<vtkPixelBufferObject> PBO;
00224 private:
00225 vtkDataTransferHelper(const vtkDataTransferHelper&);
00226 void operator=(const vtkDataTransferHelper&);
00227
00228 };
00229
00230 #endif