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 "vtkRenderPass.h"
48 
51 class vtkCamera;
52 class vtkLight;
54 class vtkTextureObject;
55 
56 class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkRenderPass
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 
179  void PointNearFar(double *v,
180  double *pt,
181  double *dir,
182  double &mNear,
183  double &mFar,
184  bool initialized);
185 
192  void BoxNearFar(double *bb,
193  double *pt,
194  double *dir,
195  double &mNear,
196  double &mFar);
197 
203  void BuildCameraLight(vtkLight *light,
204  double *boundingBox,
205  vtkCamera *lcamera);
206 
211  void CheckSupport(vtkOpenGLRenderWindow *w);
212 
214 
215  vtkRenderPass *CompositeZPass;
216 
217  unsigned int Resolution;
218 
219  bool HasShadows;
220 
225 
226  std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
227  std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
228 
229 
230  vtkTimeStamp LastRenderTime;
231  bool NeedUpdate;
232 
233 private:
235  void operator=(const vtkShadowMapBakerPass&) = delete;
236 };
237 
238 #endif
OpenGL rendering window.
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
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.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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
vtkOpenGLFramebufferObject * FrameBufferObject
Graphics resources.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Implement a builder of shadow map pass.