VTK
vtkEDLShading.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: VTK
4  Module: vtkEDLShading.h
5 
6  Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 =========================================================================*/
32 /*----------------------------------------------------------------------
33 Acknowledgement:
34 This algorithm is the result of joint work by Electricité de France,
35 CNRS, Collège de France and Université J. Fourier as part of the
36 Ph.D. thesis of Christian BOUCHENY.
37 ------------------------------------------------------------------------*/
56 #ifndef vtkEDLShading_h
57 #define vtkEDLShading_h
58 
59 #define EDL_HIGH_RESOLUTION_ON 1
60 #define EDL_LOW_RESOLUTION_ON 1
61 
63 #include "vtkRenderingOpenGL2Module.h" // For export macro
64 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
65 #include "vtkOpenGLHelper.h" // used for ivars
66 
69 class vtkTextureObject;
70 
71 class VTKRENDERINGOPENGL2_EXPORT vtkEDLShading : public vtkDepthImageProcessingPass
72 {
73 public:
74  static vtkEDLShading *New();
76  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
77 
82  void Render(const vtkRenderState *s) VTK_OVERRIDE;
83 
89  void ReleaseGraphicsResources(vtkWindow *w) VTK_OVERRIDE;
90 
91  protected:
95  vtkEDLShading();
96 
100  ~vtkEDLShading() VTK_OVERRIDE;
101 
105  void EDLInitializeFramebuffers(vtkRenderState &s);
106 
110  void EDLInitializeShaders(vtkOpenGLRenderWindow *);
111 
115  bool EDLShadeHigh(vtkRenderState &s, vtkOpenGLRenderWindow *);
116 
120  bool EDLShadeLow(vtkRenderState &s, vtkOpenGLRenderWindow *);
121 
125  bool EDLBlurLow(vtkRenderState &s, vtkOpenGLRenderWindow *);
126 
130  bool EDLCompose(const vtkRenderState *s, vtkOpenGLRenderWindow *);
131 
133 
137  // used to record scene data
138  vtkTextureObject *ProjectionColorTexture;
139  // color render target for projection pass
140  vtkTextureObject *ProjectionDepthTexture;
141  // depth render target for projection pass
143 
144  // Framebuffer objects and textures for EDL
146  // for EDL full res shading
147  vtkTextureObject *EDLHighShadeTexture;
148  // color render target for EDL full res pass
150  // for EDL low res shading (image size/4)
151  vtkTextureObject *EDLLowShadeTexture;
152  // color render target for EDL low res pass
153  vtkTextureObject *EDLLowBlurTexture;
154  // color render target for EDL low res
155  // bilateral filter pass
156 
157  // Shader prohrams
158  vtkOpenGLHelper EDLShadeProgram;
159  vtkOpenGLHelper EDLComposeProgram;
160  vtkOpenGLHelper BilateralProgram;
161 
162  float EDLNeighbours[8][4];
163  bool EDLIsFiltered;
164  int EDLLowResFactor; // basically 4
165 
166  float Zn; // near clipping plane
167  float Zf; // far clipping plane
168 
169  private:
170  vtkEDLShading(const vtkEDLShading&) VTK_DELETE_FUNCTION;
171  void operator=(const vtkEDLShading&) VTK_DELETE_FUNCTION;
172 };
173 
174 #endif
OpenGL rendering window.
Implement an EDL offscreen shading.
Definition: vtkEDLShading.h:71
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
Context in which a vtkRenderPass will render.
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Internal class which encapsulates OpenGL FramebufferObject.
abstracts an OpenGL texture object.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Convenient class for post-processing passes.