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 
23 #include "vtkRenderingLICOpenGL2Module.h" // for export
24 #include "vtkPixelExtent.h"
25 #include "vtkWeakPointer.h"
26 #include "vtkSmartPointer.h"
27 #include "vtkOpenGLHelper.h"
28 #include "vtk_glew.h"
29 #include "vtkTextureObject.h"
30 
31 #include <deque> // for methods
32 
36 class vtkImageData;
39 class vtkRenderer;
40 class vtkActor;
41 class vtkDataObject;
42 
44 {
45 public:
48 
52  static bool IsSupported(vtkOpenGLRenderWindow *context);
53 
58 
62  void ClearTextures();
63 
67  void AllocateTextures(
68  vtkOpenGLRenderWindow *context,
69  int *viewsize);
70 
74  void AllocateTexture(
75  vtkOpenGLRenderWindow *context,
76  int *viewsize,
78  int filter = vtkTextureObject::Nearest);
79 
84  vtkOpenGLRenderWindow *context,
85  int *viewsize,
87 
91  void Updated();
92 
97  void UpdateAll();
98 
100 
103  void ViewportQuadTextureCoords(GLfloat *tcoords)
104  {
105  tcoords[0] = tcoords[2] = 0.0f;
106  tcoords[1] = tcoords[3] = 1.0f;
107  }
109 
114  void ViewportQuadPoints(const vtkPixelExtent &viewportExt, GLfloat *quadpts)
115  {
116  viewportExt.GetData(quadpts);
117  }
118 
124  const vtkPixelExtent &viewExt,
125  const vtkPixelExtent &viewportExt,
126  GLfloat *tcoords);
127 
129 
133  void ViewQuadPoints(GLfloat *quadpts)
134  {
135  quadpts[0] = quadpts[2] = 0.0f;
136  quadpts[1] = quadpts[3] = 1.0f;
137  }
139 
141 
145  void ViewQuadTextureCoords(GLfloat *tcoords)
146  {
147  tcoords[0] = tcoords[2] = 0.0f;
148  tcoords[1] = tcoords[3] = 1.0f;
149  }
151 
155  void RenderQuad(
156  const vtkPixelExtent &viewExt,
157  const vtkPixelExtent &viewportExt,
158  vtkOpenGLHelper *cbo);
159 
163  inline int idx(int row, int col) { return 4*col+row; }
164 
175  bool VisibilityTest(double ndcBBox[24]);
176 
185  bool ProjectBounds(
186  double PMV[16],
187  int viewsize[2],
188  double bounds[6],
189  vtkPixelExtent &screenExt);
190 
196  int ProjectBounds(
197  vtkRenderer *ren,
198  vtkActor *actor,
199  vtkDataObject *dobj,
200  int viewsize[2],
201  vtkPixelExtent &dataExt,
202  std::deque<vtkPixelExtent> &blockExts);
203 
207  void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext);
208 
213  void GetPixelBounds(float *rgba, int ni, std::deque<vtkPixelExtent> &blockExts);
214 
215  static void StreamingFindMinMax(
217  std::deque<vtkPixelExtent> &blockExts,
218  float &min, float &max);
219 
231 
233  std::deque<vtkPixelExtent> BlockExts;
234 
238 
239  int Viewsize[2];
242 
246 
248 
251 
252 
253 protected:
254 
255 };
256 
257 #endif
258 // VTK-HeaderTest-Exclude: vtkSurfaceLICHelper.h
OpenGL rendering window.
vtkSmartPointer< vtkLineIntegralConvolution2D > LICer
void ViewQuadPoints(GLfloat *quadpts)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
void AllocateTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex, int filter=vtkTextureObject::Nearest)
Allocate a size texture, store in the given smart pointer.
vtkSmartPointer< vtkTextureObject > HSLColorImage
void ReleaseGraphicsResources(vtkWindow *win)
Free textures and shader programs we're holding a reference to.
vtkSmartPointer< vtkTextureObject > MaskVectorImage
void ViewportQuadPoints(const vtkPixelExtent &viewportExt, GLfloat *quadpts)
Convert a viewport to a bounding box and it's texture coordinates for a screen size texture...
void ClearTextures()
Free textures we're holding a reference to.
vtkSmartPointer< vtkFrameBufferObject2 > FBO
vtkSmartPointer< vtkTextureObject > RGBColorImage
vtkOpenGLHelper * ColorPass
std::deque< vtkPixelExtent > BlockExts
abstract specification for renderers
Definition: vtkRenderer.h:63
void AllocateTextures(vtkOpenGLRenderWindow *context, int *viewsize)
Allocate textures.
int * GetData()
Direct access to internal data.
GPU-based implementation of Line Integral Convolution (LIC)
vtkSmartPointer< vtkSurfaceLICComposite > Compositor
vtkWeakPointer< vtkOpenGLRenderWindow > Context
vtkSmartPointer< vtkTextureObject > CompositeVectorImage
static bool IsSupported(vtkOpenGLRenderWindow *context)
Check for OpenGL support.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkSmartPointer< vtkTextureObject > VectorImage
vtkSmartPointer< vtkTextureObject > GeometryImage
bool VisibilityTest(double ndcBBox[24])
given a axes aligned bounding box in normalized device coordinates test for view frustum visibility...
vtkPainterCommunicator * Communicator
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
void UpdateAll()
Force all stages to re-execute.
void ViewQuadTextureCoords(GLfloat *tcoords)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture...
void Updated()
After LIC has been computed reset/clean internal state.
void RenderQuad(const vtkPixelExtent &viewExt, const vtkPixelExtent &viewportExt, vtkOpenGLHelper *cbo)
Render a quad (to trigger a shader to run)
vtkSmartPointer< vtkTextureObject > NoiseImage
vtkSmartPointer< vtkTextureObject > LICImage
void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext)
Shrink an extent to tightly bound non-zero values.
vtkOpenGLHelper * CopyPass
Representation of a cartesian pixel plane and common operations on it.
void ViewportQuadTextureCoords(GLfloat *tcoords)
Convert viewport to texture coordinates.
A communicator that can safely be used inside a painter.
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
vtkOpenGLHelper * ColorEnhancePass
int idx(int row, int col)
Compute the index into the 4x4 OpenGL ordered matrix.
general representation of visualization data
Definition: vtkDataObject.h:64
vtkSmartPointer< vtkTextureObject > CompositeMaskVectorImage
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...
A small collection of noise routines for LIC.
#define max(a, b)
Interface to OpenGL framebuffer object.
static void StreamingFindMinMax(vtkFrameBufferObject2 *fbo, std::deque< vtkPixelExtent > &blockExts, float &min, float &max)
vtkSmartPointer< vtkTextureObject > DepthImage
void AllocateDepthTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex)
Allocate a size texture, store in the given smart pointer.
vtkSmartPointer< vtkImageData > Noise