VTK  9.2.6
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 "vtkOpenGLRenderPass.h"
48 #include "vtkRenderingOpenGL2Module.h" // For export macro
49 #include "vtkSmartPointer.h" // for ivars
50 #include <vector> // STL Header
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, std::string& geometryShader,
177  std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
178  bool SetShaderParameters(vtkShaderProgram* program, vtkAbstractMapper* mapper, vtkProp* prop,
179  vtkOpenGLVertexArrayObject* VAO = nullptr) override;
180 
188  void PointNearFar(
189  double* v, double* pt, double* dir, double& mNear, double& mFar, bool initialized);
190 
197  void BoxNearFar(double* bb, double* pt, double* dir, double& mNear, double& mFar);
198 
204  void BuildCameraLight(vtkLight* light, double* boundingBox, vtkCamera* lcamera);
205 
210  void CheckSupport(vtkOpenGLRenderWindow* w);
211 
213 
215 
216  unsigned int Resolution;
217 
219 
224 
225  std::vector<vtkSmartPointer<vtkTextureObject>>* ShadowMaps;
226  std::vector<vtkSmartPointer<vtkCamera>>* LightCameras;
227 
231 
232 private:
234  void operator=(const vtkShadowMapBakerPass&) = delete;
235 };
236 
237 #endif
OpenGL rendering window.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
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:38
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:51
Key for integer values in vtkInformation.
a virtual light for 3D rendering
Definition: vtkLight.h:59
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.
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:59
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.