VTK
vtkSurfaceLICHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
20 #ifndef vtkSurfaceLICHelper_h
21 #define vtkSurfaceLICHelper_h
22 #ifndef __VTK_WRAP__
23 
24 #include "vtkRenderingLICOpenGL2Module.h" // for export
25 #include "vtkPixelExtent.h"
26 #include "vtkWeakPointer.h"
27 #include "vtkSmartPointer.h"
28 #include "vtkOpenGLHelper.h"
29 #include "vtk_glew.h"
30 #include "vtkTextureObject.h"
31 
32 #include <deque> // for methods
33 
37 class vtkImageData;
40 class vtkRenderer;
41 class vtkActor;
42 class vtkDataObject;
43 
45 {
46 public:
49 
53  static bool IsSupported(vtkOpenGLRenderWindow *context);
54 
59 
63  void ClearTextures();
64 
68  void AllocateTextures(
69  vtkOpenGLRenderWindow *context,
70  int *viewsize);
71 
75  void AllocateTexture(
76  vtkOpenGLRenderWindow *context,
77  int *viewsize,
79  int filter = vtkTextureObject::Nearest);
80 
85  vtkOpenGLRenderWindow *context,
86  int *viewsize,
88 
92  void Updated();
93 
98  void UpdateAll();
99 
101 
104  void ViewportQuadTextureCoords(GLfloat *tcoords)
105  {
106  tcoords[0] = tcoords[2] = 0.0f;
107  tcoords[1] = tcoords[3] = 1.0f;
108  }
110 
115  void ViewportQuadPoints(const vtkPixelExtent &viewportExt, GLfloat *quadpts)
116  {
117  viewportExt.GetData(quadpts);
118  }
119 
125  const vtkPixelExtent &viewExt,
126  const vtkPixelExtent &viewportExt,
127  GLfloat *tcoords);
128 
130 
134  void ViewQuadPoints(GLfloat *quadpts)
135  {
136  quadpts[0] = quadpts[2] = 0.0f;
137  quadpts[1] = quadpts[3] = 1.0f;
138  }
140 
142 
146  void ViewQuadTextureCoords(GLfloat *tcoords)
147  {
148  tcoords[0] = tcoords[2] = 0.0f;
149  tcoords[1] = tcoords[3] = 1.0f;
150  }
152 
156  void RenderQuad(
157  const vtkPixelExtent &viewExt,
158  const vtkPixelExtent &viewportExt,
159  vtkOpenGLHelper *cbo);
160 
164  inline int idx(int row, int col) { return 4*col+row; }
165 
176  bool VisibilityTest(double ndcBBox[24]);
177 
186  bool ProjectBounds(
187  double PMV[16],
188  int viewsize[2],
189  double bounds[6],
190  vtkPixelExtent &screenExt);
191 
197  int ProjectBounds(
198  vtkRenderer *ren,
199  vtkActor *actor,
200  vtkDataObject *dobj,
201  int viewsize[2],
202  vtkPixelExtent &dataExt,
203  std::deque<vtkPixelExtent> &blockExts);
204 
208  void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext);
209 
214  void GetPixelBounds(float *rgba, int ni, std::deque<vtkPixelExtent> &blockExts);
215 
216  static void StreamingFindMinMax(
218  std::deque<vtkPixelExtent> &blockExts,
219  float &min, float &max);
220 
232 
234  std::deque<vtkPixelExtent> BlockExts;
235 
239 
240  int Viewsize[2];
243 
247 
249 
252 
253 
254 protected:
255 
256 };
257 
258 #endif
259 #endif
260 // VTK-HeaderTest-Exclude: vtkSurfaceLICHelper.h
vtkSurfaceLICHelper::idx
int idx(int row, int col)
Compute the index into the 4x4 OpenGL ordered matrix.
Definition: vtkSurfaceLICHelper.h:164
vtkSurfaceLICHelper::VisibilityTest
bool VisibilityTest(double ndcBBox[24])
given a axes aligned bounding box in normalized device coordinates test for view frustum visibility.
vtkSurfaceLICHelper::MaskVectorImage
vtkSmartPointer< vtkTextureObject > MaskVectorImage
Definition: vtkSurfaceLICHelper.h:227
vtkSurfaceLICHelper::LICImage
vtkSmartPointer< vtkTextureObject > LICImage
Definition: vtkSurfaceLICHelper.h:229
vtkSurfaceLICHelper::AllocateDepthTexture
void AllocateDepthTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex)
Allocate a size texture, store in the given smart pointer.
vtkSurfaceLICHelper::ViewQuadTextureCoords
void ViewQuadTextureCoords(GLfloat *tcoords)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture.
Definition: vtkSurfaceLICHelper.h:146
vtkSurfaceLICHelper::ViewportQuadPoints
void ViewportQuadPoints(const vtkPixelExtent &viewportExt, GLfloat *quadpts)
Convert a viewport to a bounding box and it's texture coordinates for a screen size texture.
Definition: vtkSurfaceLICHelper.h:115
vtkSurfaceLICHelper::IsSupported
static bool IsSupported(vtkOpenGLRenderWindow *context)
Check for OpenGL support.
vtkOpenGLFramebufferObject
Internal class which encapsulates OpenGL FramebufferObject.
Definition: vtkOpenGLFramebufferObject.h:182
vtkOpenGLHelper.h
vtkSurfaceLICHelper::ClearTextures
void ClearTextures()
Free textures we're holding a reference to.
vtkSmartPointer< vtkTextureObject >
vtkSurfaceLICHelper::vtkSurfaceLICHelper
vtkSurfaceLICHelper()
vtkSurfaceLICHelper
Definition: vtkSurfaceLICHelper.h:44
vtkSurfaceLICHelper::Compositor
vtkSmartPointer< vtkSurfaceLICComposite > Compositor
Definition: vtkSurfaceLICHelper.h:241
vtkSurfaceLICHelper::ColorEnhancePass
vtkOpenGLHelper * ColorEnhancePass
Definition: vtkSurfaceLICHelper.h:236
vtkSurfaceLICHelper::Communicator
vtkPainterCommunicator * Communicator
Definition: vtkSurfaceLICHelper.h:245
vtkSurfaceLICHelper::Noise
vtkSmartPointer< vtkImageData > Noise
Definition: vtkSurfaceLICHelper.h:221
vtkTextureObject::Nearest
Definition: vtkTextureObject.h:86
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkPixelExtent
Definition: vtkPixelExtent.h:41
vtkSurfaceLICHelper::UpdateAll
void UpdateAll()
Force all stages to re-execute.
vtkSurfaceLICHelper::ViewportQuadTextureCoords
void ViewportQuadTextureCoords(GLfloat *tcoords)
Convert viewport to texture coordinates.
Definition: vtkSurfaceLICHelper.h:104
vtkSurfaceLICHelper::GeometryImage
vtkSmartPointer< vtkTextureObject > GeometryImage
Definition: vtkSurfaceLICHelper.h:224
vtkSurfaceLICHelper::Viewsize
int Viewsize[2]
Definition: vtkSurfaceLICHelper.h:240
vtkSurfaceLICComposite
Definition: vtkSurfaceLICComposite.h:39
vtkSurfaceLICHelper::~vtkSurfaceLICHelper
~vtkSurfaceLICHelper()
vtkSurfaceLICHelper::ColorPass
vtkOpenGLHelper * ColorPass
Definition: vtkSurfaceLICHelper.h:238
vtkPixelExtent.h
vtkSurfaceLICHelper::BlockExts
std::deque< vtkPixelExtent > BlockExts
Definition: vtkSurfaceLICHelper.h:234
vtkSurfaceLICHelper::ProjectBounds
bool ProjectBounds(double PMV[16], int viewsize[2], double bounds[6], vtkPixelExtent &screenExt)
Given world space bounds, compute bounding boxes in clip and normalized device coordinates and perfor...
vtkPixelExtent::GetData
int * GetData()
Direct access to internal data.
Definition: vtkPixelExtent.h:81
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTextureObject.h
vtkSurfaceLICHelper::Updated
void Updated()
After LIC has been computed reset/clean internal state.
vtkSmartPointer.h
vtkSurfaceLICHelper::AllocateTexture
void AllocateTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex, int filter=vtkTextureObject::Nearest)
Allocate a size texture, store in the given smart pointer.
vtkSurfaceLICHelper::GetPixelBounds
void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext)
Shrink an extent to tightly bound non-zero values.
vtkSurfaceLICHelper::CompositeVectorImage
vtkSmartPointer< vtkTextureObject > CompositeVectorImage
Definition: vtkSurfaceLICHelper.h:226
vtkWeakPointer.h
vtkSurfaceLICHelper::DataSetExt
vtkPixelExtent DataSetExt
Definition: vtkSurfaceLICHelper.h:246
vtkSurfaceLICHelper::CommunicatorNeedsUpdate
bool CommunicatorNeedsUpdate
Definition: vtkSurfaceLICHelper.h:251
vtkSurfaceLICHelper::NoiseImage
vtkSmartPointer< vtkTextureObject > NoiseImage
Definition: vtkSurfaceLICHelper.h:222
vtkSurfaceLICHelper::Context
vtkWeakPointer< vtkOpenGLRenderWindow > Context
Definition: vtkSurfaceLICHelper.h:248
vtkSurfaceLICHelper::ViewQuadPoints
void ViewQuadPoints(GLfloat *quadpts)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture.
Definition: vtkSurfaceLICHelper.h:134
vtkSurfaceLICHelper::HSLColorImage
vtkSmartPointer< vtkTextureObject > HSLColorImage
Definition: vtkSurfaceLICHelper.h:231
vtkSurfaceLICHelper::AllocateTextures
void AllocateTextures(vtkOpenGLRenderWindow *context, int *viewsize)
Allocate textures.
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:30
vtkSurfaceLICHelper::ContextNeedsUpdate
bool ContextNeedsUpdate
Definition: vtkSurfaceLICHelper.h:250
vtkSurfaceLICHelper::FBO
vtkSmartPointer< vtkOpenGLFramebufferObject > FBO
Definition: vtkSurfaceLICHelper.h:242
vtkSurfaceLICHelper::DepthImage
vtkSmartPointer< vtkTextureObject > DepthImage
Definition: vtkSurfaceLICHelper.h:223
vtkSurfaceLICHelper::HasVectors
bool HasVectors
Definition: vtkSurfaceLICHelper.h:233
vtkSurfaceLICHelper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *win)
Free textures and shader programs we're holding a reference to.
vtkSurfaceLICHelper::CopyPass
vtkOpenGLHelper * CopyPass
Definition: vtkSurfaceLICHelper.h:237
vtkLineIntegralConvolution2D
GPU-based implementation of Line Integral Convolution (LIC)
Definition: vtkLineIntegralConvolution2D.h:109
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkSurfaceLICHelper::VectorImage
vtkSmartPointer< vtkTextureObject > VectorImage
Definition: vtkSurfaceLICHelper.h:225
vtkSurfaceLICHelper::StreamingFindMinMax
static void StreamingFindMinMax(vtkOpenGLFramebufferObject *fbo, std::deque< vtkPixelExtent > &blockExts, float &min, float &max)
vtkSurfaceLICHelper::RGBColorImage
vtkSmartPointer< vtkTextureObject > RGBColorImage
Definition: vtkSurfaceLICHelper.h:230
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:53
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkSurfaceLICHelper::CompositeMaskVectorImage
vtkSmartPointer< vtkTextureObject > CompositeMaskVectorImage
Definition: vtkSurfaceLICHelper.h:228
vtkSurfaceLICHelper::RenderQuad
void RenderQuad(const vtkPixelExtent &viewExt, const vtkPixelExtent &viewportExt, vtkOpenGLHelper *cbo)
Render a quad (to trigger a shader to run)
vtkSurfaceLICHelper::LICer
vtkSmartPointer< vtkLineIntegralConvolution2D > LICer
Definition: vtkSurfaceLICHelper.h:244