VTK
vtkShadowMapPass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkShadowMapPass.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 vtkShadowMapPass_h
41 #define vtkShadowMapPass_h
42 
43 #include "vtkRenderingOpenGL2Module.h" // For export macro
44 #include "vtkRenderPass.h"
45 #include <vector> // STL Header
46 #include <string> // For member variables.
47 
50 class vtkCamera;
51 class vtkLight;
53 class vtkShadowMapPassTextures; // internal
54 class vtkShadowMapPassLightCameras; // internal
55 class vtkImageExport;
56 class vtkTextureObject;
57 class vtkImplicitHalo;
58 class vtkSampleFunction;
61 class vtkShaderProgram;
62 
64 {
65 public:
66  static vtkShadowMapPass *New();
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
70  //BTX
72 
74  virtual void Render(const vtkRenderState *s);
75  //ETX
77 
81 
83 
85  vtkGetObjectMacro(ShadowMapBakerPass,vtkShadowMapBakerPass);
86  virtual void SetShadowMapBakerPass(
87  vtkShadowMapBakerPass *shadowMapBakerPass);
89 
91 
93  vtkGetObjectMacro(OpaqueSequence,vtkRenderPass);
94  virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence);
96 
98 
99  std::vector<double> ShadowMapTransforms() {
100  return this->ShadowTransforms; }
102 
104 
106  std::vector<int> GetShadowMapTextureUnits() {
107  return this->ShadowTextureUnits; }
109 
111  static vtkInformationObjectBaseKey *ShadowMapPass();
112 
114 
117  return this->FragmentDeclaration; }
119  return this->FragmentImplementation; }
121 
123  void SetUniforms(vtkShaderProgram *program);
124 
125  protected:
128 
130  virtual ~vtkShadowMapPass();
131 
133  void BuildSpotLightIntensityMap();
134 
137  void CheckSupport(vtkOpenGLRenderWindow *w);
138 
139  vtkShadowMapBakerPass *ShadowMapBakerPass;
140  vtkRenderPass *CompositeRGBAPass;
141 
143 
145  vtkFrameBufferObject *FrameBufferObject;
146 
147  vtkShadowMapPassTextures *ShadowMaps;
148  vtkShadowMapPassLightCameras *LightCameras;
149 
150  vtkTextureObject *IntensityMap;
151 
152  vtkSampleFunction *IntensitySource;
153  vtkImageExport *IntensityExporter;
154  vtkImplicitHalo *Halo;
155 
156  vtkTimeStamp LastRenderTime;
157 
158  // to store the shader code and settings
159  void BuildShaderCode();
162  std::vector<int> ShadowTextureUnits;
163  std::vector<double> ShadowTransforms;
164  std::vector<float> ShadowAttenuation;
165 
166 private:
167  vtkShadowMapPass(const vtkShadowMapPass&); // Not implemented.
168  void operator=(const vtkShadowMapPass&); // Not implemented.
169 };
170 
171 #endif
OpenGL rendering window.
sample an implicit function over a structured point set
#define VTKRENDERINGOPENGL2_EXPORT
record modification and/or execution time
Definition: vtkTimeStamp.h:34
std::string GetFragmentDeclaration()
std::vector< float > ShadowAttenuation
implicit function for an halo
Export VTK images to third-party systems.
std::vector< double > ShadowTransforms
void PrintSelf(ostream &os, vtkIndent indent)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
Context in which a vtkRenderPass will render.
std::vector< int > GetShadowMapTextureUnits()
vtkRenderPass * OpaqueSequence
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
Key for vtkObjectBase values.
std::vector< int > ShadowTextureUnits
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
std::vector< double > ShadowMapTransforms()
std::string GetFragmentImplementation()
std::string FragmentImplementation
virtual void ReleaseGraphicsResources(vtkWindow *w)
Implement a shadow mapping render pass.
static vtkObject * New()
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:57
std::string FragmentDeclaration
The ShaderProgram uses one or more Shader objects.
Implement a builder of shadow map pass.