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 =========================================================================*/
40 #ifndef vtkShadowMapBakerPass_h
41 #define vtkShadowMapBakerPass_h
42 
43 #include "vtkRenderingOpenGL2Module.h" // For export macro
44 #include "vtkSmartPointer.h" // for ivars
45 #include <vector> // STL Header
46 #include "vtkRenderPass.h"
47 
50 class vtkCamera;
51 class vtkLight;
53 class vtkTextureObject;
54 
56 {
57 public:
58  static vtkShadowMapBakerPass *New();
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
62  //BTX
64 
66  virtual void Render(const vtkRenderState *s);
67  //ETX
69 
73 
75 
79  vtkGetObjectMacro(OpaqueSequence,vtkRenderPass);
80  virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence);
82 
84 
88  vtkGetObjectMacro(CompositeZPass,vtkRenderPass);
89  virtual void SetCompositeZPass(vtkRenderPass *compositeZPass);
91 
93 
96  vtkSetMacro(Resolution,unsigned int);
97  vtkGetMacro(Resolution,unsigned int);
99 
103  bool GetHasShadows();
104 
109  bool LightCreatesShadow(vtkLight *l);
110 
111 //BTX
114  std::vector<vtkSmartPointer<vtkTextureObject> > *GetShadowMaps();
115 
117 
119  std::vector<vtkSmartPointer<vtkCamera> > *GetLightCameras();
120 //ETX
122 
127  bool GetNeedUpdate();
128 
129  // // Description:
130  // INTERNAL USE ONLY.
131  // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
132  //
133  // Set NeedUpate to false. Called by vtkShadowMapPass.
134  void SetUpToDate();
135 
136  protected:
139 
141  virtual ~vtkShadowMapBakerPass();
142 
144 
147  void PointNearFar(double *v,
148  double *pt,
149  double *dir,
150  double &mNear,
151  double &mFar,
152  bool initialized);
154 
156 
158  void BoxNearFar(double *bb,
159  double *pt,
160  double *dir,
161  double &mNear,
162  double &mFar);
164 
165  //BTX
167 
169  void BuildCameraLight(vtkLight *light,
170  double *boundingBox,
171  vtkCamera *lcamera);
172  //ETX
174 
177  void CheckSupport(vtkOpenGLRenderWindow *w);
178 
180 
181  vtkRenderPass *CompositeZPass;
182 
183  unsigned int Resolution;
184 
185  bool HasShadows;
186 
188  vtkFrameBufferObject *FrameBufferObject;
189 
190  std::vector<vtkSmartPointer<vtkTextureObject> > *ShadowMaps;
191  std::vector<vtkSmartPointer<vtkCamera> > *LightCameras;
192 
193 
194  vtkTimeStamp LastRenderTime;
195  bool NeedUpdate;
196 
197 private:
198  vtkShadowMapBakerPass(const vtkShadowMapBakerPass&); // Not implemented.
199  void operator=(const vtkShadowMapBakerPass&); // Not implemented.
200 };
201 
202 #endif
OpenGL rendering window.
#define VTKRENDERINGOPENGL2_EXPORT
record modification and/or execution time
Definition: vtkTimeStamp.h:34
std::vector< vtkSmartPointer< vtkTextureObject > > * ShadowMaps
void PrintSelf(ostream &os, vtkIndent indent)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
Context in which a vtkRenderPass will render.
a simple class to control print indentation
Definition: vtkIndent.h:38
a virtual camera for 3D rendering
Definition: vtkCamera.h:49
Key for integer values in vtkInformation.
a virtual light for 3D rendering
Definition: vtkLight.h:60
std::vector< vtkSmartPointer< vtkCamera > > * LightCameras
internal class which encapsulates OpenGL frame buffer object. Not to be used directly.
abstracts an OpenGL texture object.
virtual void Render(const vtkRenderState *s)=0
virtual void ReleaseGraphicsResources(vtkWindow *w)
static vtkObject * New()
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:57
Implement a builder of shadow map pass.