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 =========================================================================*/
44 #ifndef vtkShadowMapBakerPass_h
45 #define vtkShadowMapBakerPass_h
46 
47 #include "vtkRenderingOpenGL2Module.h" // For export macro
48 #include "vtkSmartPointer.h" // for ivars
49 #include <vector> // STL Header
50 #include "vtkOpenGLRenderPass.h"
51 
54 class vtkCamera;
55 class vtkLight;
57 class vtkTextureObject;
58 
59 class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkOpenGLRenderPass
60 {
61 public:
62  static vtkShadowMapBakerPass *New();
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
70  void Render(const vtkRenderState *s) override;
71 
77  void ReleaseGraphicsResources(vtkWindow *w) override;
78 
80 
86  vtkGetObjectMacro(OpaqueSequence,vtkRenderPass);
87  virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence);
89 
91 
97  vtkGetObjectMacro(CompositeZPass,vtkRenderPass);
98  virtual void SetCompositeZPass(vtkRenderPass *compositeZPass);
100 
102 
107  vtkSetMacro(Resolution,unsigned int);
108  vtkGetMacro(Resolution,unsigned int);
110 
118  bool GetHasShadows();
119 
129  bool LightCreatesShadow(vtkLight *l);
130 
137  std::vector<vtkSmartPointer<vtkTextureObject> > *GetShadowMaps();
138 
145  std::vector<vtkSmartPointer<vtkCamera> > *GetLightCameras();
146 
155  bool GetNeedUpdate();
156 
157  // // Description:
158  // INTERNAL USE ONLY.
159  // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
160  //
161  // Set NeedUpate to false. Called by vtkShadowMapPass.
162  void SetUpToDate();
163 
164  protected:
169 
173  ~vtkShadowMapBakerPass() override;
174 
175  // vtkOpenGLRenderPass virtuals:
176  bool PreReplaceShaderValues(std::string &vertexShader,
177  std::string &geometryShader,
178  std::string &fragmentShader,
179  vtkAbstractMapper *mapper,
180  vtkProp *prop) override;
182  vtkAbstractMapper *mapper, vtkProp *prop,
183  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
184 
192  void PointNearFar(double *v,
193  double *pt,
194  double *dir,
195  double &mNear,
196  double &mFar,
197  bool initialized);
198 
205  void BoxNearFar(double *bb,
206  double *pt,
207  double *dir,
208  double &mNear,
209  double &mFar);
210 
216  void BuildCameraLight(vtkLight *light,
217  double *boundingBox,
218  vtkCamera *lcamera);
219 
224  void CheckSupport(vtkOpenGLRenderWindow *w);
225 
227 
229 
230  unsigned int Resolution;
231 
233 
238 
239  std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
240  std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
241 
242 
246 
247 
248 private:
250  void operator=(const vtkShadowMapBakerPass&) = delete;
251 };
252 
253 #endif
OpenGL rendering window.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:35
std::vector< vtkSmartPointer< vtkTextureObject > > * ShadowMaps
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
Context in which a vtkRenderPass will render.
a simple class to control print indentation
Definition: vtkIndent.h:39
The VertexArrayObject class uses, or emulates, vertex array objects.
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
Key for integer values in vtkInformation.
a virtual light for 3D rendering
Definition: vtkLight.h:62
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:58
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.