VTK  9.2.6
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 =========================================================================*/
19 #ifndef vtkSurfaceLICHelper_h
20 #define vtkSurfaceLICHelper_h
21 
22 #include "vtkOpenGLHelper.h"
23 #include "vtkPixelExtent.h"
24 #include "vtkRenderingLICOpenGL2Module.h" // for export
25 #include "vtkSmartPointer.h"
26 #include "vtkTextureObject.h"
27 #include "vtkWeakPointer.h"
28 #include "vtk_glew.h"
29 
30 #include <deque> // for methods
31 
35 class vtkImageData;
38 class vtkRenderer;
39 class vtkActor;
40 class vtkDataObject;
41 
43 {
44 public:
47 
51  static bool IsSupported(vtkOpenGLRenderWindow* context);
52 
57 
61  void ClearTextures();
62 
66  void AllocateTextures(vtkOpenGLRenderWindow* context, int* viewsize);
67 
71  void AllocateTexture(vtkOpenGLRenderWindow* context, int* viewsize,
73 
78  vtkOpenGLRenderWindow* context, int* viewsize, vtkSmartPointer<vtkTextureObject>& tex);
79 
83  void Updated();
84 
89  void UpdateAll();
90 
92 
95  void ViewportQuadTextureCoords(GLfloat* tcoords)
96  {
97  tcoords[0] = tcoords[2] = 0.0f;
98  tcoords[1] = tcoords[3] = 1.0f;
99  }
101 
106  void ViewportQuadPoints(const vtkPixelExtent& viewportExt, GLfloat* quadpts)
107  {
108  viewportExt.GetData(quadpts);
109  }
110 
116  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, GLfloat* tcoords);
117 
119 
123  void ViewQuadPoints(GLfloat* quadpts)
124  {
125  quadpts[0] = quadpts[2] = 0.0f;
126  quadpts[1] = quadpts[3] = 1.0f;
127  }
129 
131 
135  void ViewQuadTextureCoords(GLfloat* tcoords)
136  {
137  tcoords[0] = tcoords[2] = 0.0f;
138  tcoords[1] = tcoords[3] = 1.0f;
139  }
141 
145  void RenderQuad(
146  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, vtkOpenGLHelper* cbo);
147 
151  inline int idx(int row, int col) { return 4 * col + row; }
152 
163  bool VisibilityTest(double ndcBBox[24]);
164 
173  bool ProjectBounds(double PMV[16], int viewsize[2], double bounds[6], vtkPixelExtent& screenExt);
174 
180  int ProjectBounds(vtkRenderer* ren, vtkActor* actor, vtkDataObject* dobj, int viewsize[2],
181  vtkPixelExtent& dataExt, std::deque<vtkPixelExtent>& blockExts);
182 
186  void GetPixelBounds(float* rgba, int ni, vtkPixelExtent& ext);
187 
192  void GetPixelBounds(float* rgba, int ni, std::deque<vtkPixelExtent>& blockExts);
193 
194  static void StreamingFindMinMax(
195  vtkOpenGLFramebufferObject* fbo, std::deque<vtkPixelExtent>& blockExts, float& min, float& max);
196 
208 
210  std::deque<vtkPixelExtent> BlockExts;
211 
215 
216  int Viewsize[2];
219 
223 
225 
228 
229 protected:
230 };
231 
232 #endif
233 // 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.
static void StreamingFindMinMax(vtkOpenGLFramebufferObject *fbo, std::deque< vtkPixelExtent > &blockExts, float &min, float &max)
vtkSmartPointer< vtkTextureObject > RGBColorImage
vtkOpenGLHelper * ColorPass
std::deque< vtkPixelExtent > BlockExts
abstract specification for renderers
Definition: vtkRenderer.h:72
void AllocateTextures(vtkOpenGLRenderWindow *context, int *viewsize)
Allocate textures.
vtkSmartPointer< vtkOpenGLFramebufferObject > FBO
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:38
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:53
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.
Internal class which encapsulates OpenGL FramebufferObject.
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:65
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)
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