VTK
vtkShadowMapBakerPass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkShadowMapBakerPass.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef vtkShadowMapBakerPass_h
42 #define vtkShadowMapBakerPass_h
43 
44 #include "vtkRenderingOpenGL2Module.h" // For export macro
45 #include "vtkSmartPointer.h" // for ivars
46 #include <vector> // STL Header
47 #include "vtkOpenGLRenderPass.h"
48 
51 class vtkCamera;
52 class vtkLight;
54 class vtkTextureObject;
55 
56 class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkOpenGLRenderPass
57 {
58 public:
59  static vtkShadowMapBakerPass *New();
61  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
67  void Render(const vtkRenderState *s) override;
68 
74  void ReleaseGraphicsResources(vtkWindow *w) override;
75 
77 
83  vtkGetObjectMacro(OpaqueSequence,vtkRenderPass);
84  virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence);
86 
88 
94  vtkGetObjectMacro(CompositeZPass,vtkRenderPass);
95  virtual void SetCompositeZPass(vtkRenderPass *compositeZPass);
97 
99 
104  vtkSetMacro(Resolution,unsigned int);
105  vtkGetMacro(Resolution,unsigned int);
107 
115  bool GetHasShadows();
116 
126  bool LightCreatesShadow(vtkLight *l);
127 
134  std::vector<vtkSmartPointer<vtkTextureObject> > *GetShadowMaps();
135 
142  std::vector<vtkSmartPointer<vtkCamera> > *GetLightCameras();
143 
152  bool GetNeedUpdate();
153 
154  // // Description:
155  // INTERNAL USE ONLY.
156  // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
157  //
158  // Set NeedUpate to false. Called by vtkShadowMapPass.
159  void SetUpToDate();
160 
161  protected:
166 
170  ~vtkShadowMapBakerPass() override;
171 
172  // vtkOpenGLRenderPass virtuals:
173  bool PreReplaceShaderValues(std::string &vertexShader,
174  std::string &geometryShader,
175  std::string &fragmentShader,
176  vtkAbstractMapper *mapper,
177  vtkProp *prop) override;
179  vtkAbstractMapper *mapper, vtkProp *prop,
180  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
181 
189  void PointNearFar(double *v,
190  double *pt,
191  double *dir,
192  double &mNear,
193  double &mFar,
194  bool initialized);
195 
202  void BoxNearFar(double *bb,
203  double *pt,
204  double *dir,
205  double &mNear,
206  double &mFar);
207 
213  void BuildCameraLight(vtkLight *light,
214  double *boundingBox,
215  vtkCamera *lcamera);
216 
221  void CheckSupport(vtkOpenGLRenderWindow *w);
222 
224 
226 
227  unsigned int Resolution;
228 
230 
235 
236  std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
237  std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
238 
239 
243 
244 
245 private:
247  void operator=(const vtkShadowMapBakerPass&) = delete;
248 };
249 
250 #endif
OpenGL rendering window.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:46
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
record modification and/or execution time
Definition: vtkTimeStamp.h:32
std::vector< vtkSmartPointer< vtkTextureObject > > * ShadowMaps
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
The VertexArrayObject class uses, or emulates, vertex array objects.
a virtual camera for 3D rendering
Definition: vtkCamera.h:44
Key for integer values in vtkInformation.
a virtual light for 3D rendering
Definition: vtkLight.h:56
std::vector< vtkSmartPointer< vtkCamera > > * LightCameras
Internal class which encapsulates OpenGL FramebufferObject.
abstract class specifies interface to map data
virtual bool PreReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop)
Use vtkShaderProgram::Substitute to replace //VTK::XXX:YYY declarations in the shader sources.
abstracts an OpenGL texture object.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:55
virtual bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr)
Update the uniforms of the shader program.
Abstract render pass with shader modifications.
vtkOpenGLFramebufferObject * FrameBufferObject
Graphics resources.
The ShaderProgram uses one or more Shader objects.
Implement a builder of shadow map pass.