VTK  9.1.0
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 #ifndef __VTK_WRAP__
22 
23 #include "vtkOpenGLHelper.h"
24 #include "vtkPixelExtent.h"
25 #include "vtkRenderingLICOpenGL2Module.h" // for export
26 #include "vtkSmartPointer.h"
27 #include "vtkTextureObject.h"
28 #include "vtkWeakPointer.h"
29 #include "vtk_glew.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(vtkOpenGLRenderWindow* context, int* viewsize);
68 
72  void AllocateTexture(vtkOpenGLRenderWindow* context, int* viewsize,
74 
79  vtkOpenGLRenderWindow* context, int* viewsize, vtkSmartPointer<vtkTextureObject>& tex);
80 
84  void Updated();
85 
90  void UpdateAll();
91 
93 
96  void ViewportQuadTextureCoords(GLfloat* tcoords)
97  {
98  tcoords[0] = tcoords[2] = 0.0f;
99  tcoords[1] = tcoords[3] = 1.0f;
100  }
102 
107  void ViewportQuadPoints(const vtkPixelExtent& viewportExt, GLfloat* quadpts)
108  {
109  viewportExt.GetData(quadpts);
110  }
111 
117  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, GLfloat* tcoords);
118 
120 
124  void ViewQuadPoints(GLfloat* quadpts)
125  {
126  quadpts[0] = quadpts[2] = 0.0f;
127  quadpts[1] = quadpts[3] = 1.0f;
128  }
130 
132 
136  void ViewQuadTextureCoords(GLfloat* tcoords)
137  {
138  tcoords[0] = tcoords[2] = 0.0f;
139  tcoords[1] = tcoords[3] = 1.0f;
140  }
142 
147  const vtkPixelExtent& viewExt, const vtkPixelExtent& viewportExt, vtkOpenGLHelper* cbo);
148 
152  inline int idx(int row, int col) { return 4 * col + row; }
153 
164  bool VisibilityTest(double ndcBBox[24]);
165 
174  bool ProjectBounds(double PMV[16], int viewsize[2], double bounds[6], vtkPixelExtent& screenExt);
175 
181  int ProjectBounds(vtkRenderer* ren, vtkActor* actor, vtkDataObject* dobj, int viewsize[2],
182  vtkPixelExtent& dataExt, std::deque<vtkPixelExtent>& blockExts);
183 
187  void GetPixelBounds(float* rgba, int ni, vtkPixelExtent& ext);
188 
193  void GetPixelBounds(float* rgba, int ni, std::deque<vtkPixelExtent>& blockExts);
194 
195  static void StreamingFindMinMax(
196  vtkOpenGLFramebufferObject* fbo, std::deque<vtkPixelExtent>& blockExts, float& min, float& max);
197 
209 
211  std::deque<vtkPixelExtent> BlockExts;
212 
216 
217  int Viewsize[2];
220 
224 
226 
229 
230 protected:
231 };
232 
233 #endif
234 #endif
235 // 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:152
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:204
vtkSurfaceLICHelper::LICImage
vtkSmartPointer< vtkTextureObject > LICImage
Definition: vtkSurfaceLICHelper.h:206
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:136
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:107
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
A small collection of noise routines for LIC.
Definition: vtkSurfaceLICHelper.h:44
vtkSurfaceLICHelper::ViewportQuadTextureCoords
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.
vtkSurfaceLICHelper::Compositor
vtkSmartPointer< vtkSurfaceLICComposite > Compositor
Definition: vtkSurfaceLICHelper.h:218
vtkSurfaceLICHelper::ColorEnhancePass
vtkOpenGLHelper * ColorEnhancePass
Definition: vtkSurfaceLICHelper.h:213
vtkSurfaceLICHelper::Communicator
vtkPainterCommunicator * Communicator
Definition: vtkSurfaceLICHelper.h:222
vtkSurfaceLICHelper::Noise
vtkSmartPointer< vtkImageData > Noise
Definition: vtkSurfaceLICHelper.h:198
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkPixelExtent
Representation of a cartesian pixel plane and common operations on it.
Definition: vtkPixelExtent.h:39
vtkSurfaceLICHelper::UpdateAll
void UpdateAll()
Force all stages to re-execute.
vtkSurfaceLICHelper::ViewportQuadTextureCoords
void ViewportQuadTextureCoords(GLfloat *tcoords)
Convert viewport to texture coordinates.
Definition: vtkSurfaceLICHelper.h:96
vtkSurfaceLICHelper::GeometryImage
vtkSmartPointer< vtkTextureObject > GeometryImage
Definition: vtkSurfaceLICHelper.h:201
vtkSurfaceLICHelper::Viewsize
int Viewsize[2]
Definition: vtkSurfaceLICHelper.h:217
vtkSurfaceLICComposite
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
Definition: vtkSurfaceLICComposite.h:40
vtkSurfaceLICHelper::~vtkSurfaceLICHelper
~vtkSurfaceLICHelper()
vtkSurfaceLICHelper::ColorPass
vtkOpenGLHelper * ColorPass
Definition: vtkSurfaceLICHelper.h:215
vtkPixelExtent.h
vtkSurfaceLICHelper::BlockExts
std::deque< vtkPixelExtent > BlockExts
Definition: vtkSurfaceLICHelper.h:211
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:80
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:31
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkTextureObject.h
vtkSurfaceLICHelper::Updated
void Updated()
After LIC has been computed reset/clean internal state.
vtkSurfaceLICHelper::GetPixelBounds
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.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:203
vtkWeakPointer.h
vtkSurfaceLICHelper::DataSetExt
vtkPixelExtent DataSetExt
Definition: vtkSurfaceLICHelper.h:223
vtkSurfaceLICHelper::CommunicatorNeedsUpdate
bool CommunicatorNeedsUpdate
Definition: vtkSurfaceLICHelper.h:228
vtkSurfaceLICHelper::NoiseImage
vtkSmartPointer< vtkTextureObject > NoiseImage
Definition: vtkSurfaceLICHelper.h:199
vtkSurfaceLICHelper::Context
vtkWeakPointer< vtkOpenGLRenderWindow > Context
Definition: vtkSurfaceLICHelper.h:225
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:124
vtkSurfaceLICHelper::HSLColorImage
vtkSmartPointer< vtkTextureObject > HSLColorImage
Definition: vtkSurfaceLICHelper.h:208
vtkTextureObject::Nearest
@ Nearest
Definition: vtkTextureObject.h:93
vtkSurfaceLICHelper::AllocateTextures
void AllocateTextures(vtkOpenGLRenderWindow *context, int *viewsize)
Allocate textures.
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:31
vtkSurfaceLICHelper::ContextNeedsUpdate
bool ContextNeedsUpdate
Definition: vtkSurfaceLICHelper.h:227
vtkSurfaceLICHelper::FBO
vtkSmartPointer< vtkOpenGLFramebufferObject > FBO
Definition: vtkSurfaceLICHelper.h:219
vtkSurfaceLICHelper::DepthImage
vtkSmartPointer< vtkTextureObject > DepthImage
Definition: vtkSurfaceLICHelper.h:200
vtkSurfaceLICHelper::HasVectors
bool HasVectors
Definition: vtkSurfaceLICHelper.h:210
vtkSurfaceLICHelper::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *win)
Free textures and shader programs we're holding a reference to.
vtkSurfaceLICHelper::CopyPass
vtkOpenGLHelper * CopyPass
Definition: vtkSurfaceLICHelper.h:214
vtkLineIntegralConvolution2D
GPU-based implementation of Line Integral Convolution (LIC)
Definition: vtkLineIntegralConvolution2D.h:110
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkSurfaceLICHelper::VectorImage
vtkSmartPointer< vtkTextureObject > VectorImage
Definition: vtkSurfaceLICHelper.h:202
vtkSurfaceLICHelper::StreamingFindMinMax
static void StreamingFindMinMax(vtkOpenGLFramebufferObject *fbo, std::deque< vtkPixelExtent > &blockExts, float &min, float &max)
vtkSurfaceLICHelper::RGBColorImage
vtkSmartPointer< vtkTextureObject > RGBColorImage
Definition: vtkSurfaceLICHelper.h:207
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:83
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkSurfaceLICHelper::ProjectBounds
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.
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkSurfaceLICHelper::CompositeMaskVectorImage
vtkSmartPointer< vtkTextureObject > CompositeMaskVectorImage
Definition: vtkSurfaceLICHelper.h:205
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:221