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 "vtkRenderPass.h"
51 
54 class vtkCamera;
55 class vtkLight;
57 class vtkTextureObject;
58 
59 class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkRenderPass
60 {
61 public:
62  static vtkShadowMapBakerPass *New();
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
70  virtual void Render(const vtkRenderState *s);
71 
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  virtual ~vtkShadowMapBakerPass();
174 
182  void PointNearFar(double *v,
183  double *pt,
184  double *dir,
185  double &mNear,
186  double &mFar,
187  bool initialized);
188 
195  void BoxNearFar(double *bb,
196  double *pt,
197  double *dir,
198  double &mNear,
199  double &mFar);
200 
206  void BuildCameraLight(vtkLight *light,
207  double *boundingBox,
208  vtkCamera *lcamera);
209 
214  void CheckSupport(vtkOpenGLRenderWindow *w);
215 
217 
218  vtkRenderPass *CompositeZPass;
219 
220  unsigned int Resolution;
221 
222  bool HasShadows;
223 
227  vtkFrameBufferObject *FrameBufferObject;
228 
229  std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
230  std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
231 
232 
233  vtkTimeStamp LastRenderTime;
234  bool NeedUpdate;
235 
236 private:
237  vtkShadowMapBakerPass(const vtkShadowMapBakerPass&) VTK_DELETE_FUNCTION;
238  void operator=(const vtkShadowMapBakerPass&) VTK_DELETE_FUNCTION;
239 };
240 
241 #endif
OpenGL rendering window.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
std::vector< vtkSmartPointer< vtkTextureObject > > * ShadowMaps
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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:61
std::vector< vtkSmartPointer< vtkCamera > > * LightCameras
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
internal class which encapsulates OpenGL frame buffer object.
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
Implement a builder of shadow map pass.