VTK  9.3.20240419
vtkSurfaceLICHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
8 #ifndef vtkSurfaceLICHelper_h
9 #define vtkSurfaceLICHelper_h
10 
11 #include "vtkOpenGLHelper.h"
12 #include "vtkPixelExtent.h"
13 #include "vtkRenderingLICOpenGL2Module.h" // for export
14 #include "vtkSmartPointer.h"
15 #include "vtkTextureObject.h"
16 #include "vtkWeakPointer.h"
17 #include "vtk_glew.h"
18 
19 #include <deque> // for methods
20 
21 VTK_ABI_NAMESPACE_BEGIN
25 class vtkImageData;
28 class vtkRenderer;
29 class vtkActor;
30 class vtkDataObject;
31 
33 {
34 public:
37 
41  static bool IsSupported(vtkOpenGLRenderWindow* context);
42 
47 
51  void ClearTextures();
52 
56  void AllocateTextures(vtkOpenGLRenderWindow* context, int* viewsize);
57 
61  void AllocateTexture(vtkOpenGLRenderWindow* context, int* viewsize,
63 
68  vtkOpenGLRenderWindow* context, int* viewsize, vtkSmartPointer<vtkTextureObject>& tex);
69 
73  void Updated();
74 
79  void UpdateAll();
80 
82 
85  void ViewportQuadTextureCoords(GLfloat* tcoords)
86  {
87  tcoords[0] = tcoords[2] = 0.0f;
88  tcoords[1] = tcoords[3] = 1.0f;
89  }
91 
96  void ViewportQuadPoints(const vtkPixelExtent& viewportExt, GLfloat* quadpts)
97  {
98  viewportExt.GetData(quadpts);
99  }
100 
106  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, GLfloat* tcoords);
107 
109 
113  void ViewQuadPoints(GLfloat* quadpts)
114  {
115  quadpts[0] = quadpts[2] = 0.0f;
116  quadpts[1] = quadpts[3] = 1.0f;
117  }
119 
121 
125  void ViewQuadTextureCoords(GLfloat* tcoords)
126  {
127  tcoords[0] = tcoords[2] = 0.0f;
128  tcoords[1] = tcoords[3] = 1.0f;
129  }
131 
136  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, vtkOpenGLHelper* cbo);
137 
141  inline int idx(int row, int col) { return 4 * col + row; }
142 
153  bool VisibilityTest(double ndcBBox[24]);
154 
163  bool ProjectBounds(double PMV[16], int viewsize[2], double bounds[6], vtkPixelExtent& screenExt);
164 
170  int ProjectBounds(vtkRenderer* ren, vtkActor* actor, vtkDataObject* dobj, int viewsize[2],
171  vtkPixelExtent& dataExt, std::deque<vtkPixelExtent>& blockExts);
172 
176  void GetPixelBounds(float* rgba, int ni, vtkPixelExtent& ext);
177 
182  void GetPixelBounds(float* rgba, int ni, std::deque<vtkPixelExtent>& blockExts);
183 
184  static void StreamingFindMinMax(
185  vtkOpenGLFramebufferObject* fbo, std::deque<vtkPixelExtent>& blockExts, float& min, float& max);
186 
198 
200  std::deque<vtkPixelExtent> BlockExts;
201 
205 
206  int Viewsize[2];
209 
213 
215 
218 
219 protected:
220 };
221 
222 VTK_ABI_NAMESPACE_END
223 #endif
224 // VTK-HeaderTest-Exclude: vtkSurfaceLICHelper.h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
general representation of visualization data
topologically and geometrically regular array of data
Definition: vtkImageData.h:156
GPU-based implementation of Line Integral Convolution (LIC)
Internal class which encapsulates OpenGL FramebufferObject.
OpenGL rendering window.
A communicator that can safely be used inside a painter.
Representation of a cartesian pixel plane and common operations on it.
int * GetData()
Direct access to internal data.
abstract specification for renderers
Definition: vtkRenderer.h:172
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
A small collection of noise routines for LIC.
void AllocateTextures(vtkOpenGLRenderWindow *context, int *viewsize)
Allocate textures.
int ProjectBounds(vtkRenderer *ren, vtkActor *actor, vtkDataObject *dobj, int viewsize[2], vtkPixelExtent &dataExt, std::deque< vtkPixelExtent > &blockExts)
Compute screen space extents for each block in the input dataset and for the entire dataset.
void Updated()
After LIC has been computed reset/clean internal state.
void AllocateDepthTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex)
Allocate a size texture, store in the given smart pointer.
vtkOpenGLHelper * ColorPass
void ReleaseGraphicsResources(vtkWindow *win)
Free textures and shader programs we're holding a reference to.
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...
vtkSmartPointer< vtkSurfaceLICComposite > Compositor
vtkSmartPointer< vtkTextureObject > RGBColorImage
vtkSmartPointer< vtkTextureObject > MaskVectorImage
static bool IsSupported(vtkOpenGLRenderWindow *context)
Check for OpenGL support.
vtkSmartPointer< vtkTextureObject > LICImage
void ViewQuadTextureCoords(GLfloat *tcoords)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture.
vtkWeakPointer< vtkOpenGLRenderWindow > Context
vtkSmartPointer< vtkImageData > Noise
int idx(int row, int col)
Compute the index into the 4x4 OpenGL ordered matrix.
std::deque< vtkPixelExtent > BlockExts
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.
void ViewportQuadTextureCoords(GLfloat *tcoords)
Convert viewport to texture coordinates.
vtkSmartPointer< vtkLineIntegralConvolution2D > LICer
vtkSmartPointer< vtkTextureObject > HSLColorImage
void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext)
Shrink an extent to tightly bound non-zero values.
void AllocateTexture(vtkOpenGLRenderWindow *context, int *viewsize, vtkSmartPointer< vtkTextureObject > &tex, int filter=vtkTextureObject::Nearest)
Allocate a size texture, store in the given smart pointer.
vtkOpenGLHelper * ColorEnhancePass
vtkSmartPointer< vtkOpenGLFramebufferObject > FBO
vtkSmartPointer< vtkTextureObject > CompositeMaskVectorImage
void GetPixelBounds(float *rgba, int ni, std::deque< vtkPixelExtent > &blockExts)
Shrink a set of extents to tightly bound non-zero values cull extent if it's empty.
vtkSmartPointer< vtkTextureObject > NoiseImage
vtkOpenGLHelper * CopyPass
void RenderQuad(const vtkPixelExtent &viewExt, const vtkPixelExtent &viewportExt, vtkOpenGLHelper *cbo)
Render a quad (to trigger a shader to run)
vtkSmartPointer< vtkTextureObject > VectorImage
static void StreamingFindMinMax(vtkOpenGLFramebufferObject *fbo, std::deque< vtkPixelExtent > &blockExts, float &min, float &max)
void ViewportQuadTextureCoords(const vtkPixelExtent &viewExt, const vtkPixelExtent &viewportExt, GLfloat *tcoords)
Convert a viewport to a bounding box and it's texture coordinates for a screen size texture.
void UpdateAll()
Force all stages to re-execute.
vtkSmartPointer< vtkTextureObject > DepthImage
vtkPainterCommunicator * Communicator
void ViewQuadPoints(GLfloat *quadpts)
Convert the entire view to a bounding box and it's texture coordinates for a screen size texture.
vtkSmartPointer< vtkTextureObject > CompositeVectorImage
vtkSmartPointer< vtkTextureObject > GeometryImage
bool VisibilityTest(double ndcBBox[24])
given a axes aligned bounding box in normalized device coordinates test for view frustum visibility.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
#define max(a, b)