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 =========================================================================*/
44 #ifndef vtkShadowMapPass_h
45 #define vtkShadowMapPass_h
46 
47 #include "vtkRenderingOpenGL2Module.h" // For export macro
48 #include "vtkRenderPass.h"
49 #include <vector> // STL Header
50 #include <string> // For member variables.
51 
54 class vtkCamera;
55 class vtkLight;
57 class vtkShadowMapPassTextures; // internal
58 class vtkShadowMapPassLightCameras; // internal
61 class vtkShaderProgram;
62 
63 class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapPass : public vtkRenderPass
64 {
65 public:
66  static vtkShadowMapPass *New();
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
74  virtual void Render(const vtkRenderState *s);
75 
82 
84 
90  vtkGetObjectMacro(ShadowMapBakerPass,vtkShadowMapBakerPass);
91  virtual void SetShadowMapBakerPass(
92  vtkShadowMapBakerPass *shadowMapBakerPass);
94 
96 
100  vtkGetObjectMacro(OpaqueSequence,vtkRenderPass);
101  virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence);
103 
108  std::vector<double> ShadowMapTransforms() {
109  return this->ShadowTransforms; }
110 
116  std::vector<int> GetShadowMapTextureUnits() {
117  return this->ShadowTextureUnits; }
118 
122  static vtkInformationObjectBaseKey *ShadowMapPass();
123 
129  return this->FragmentDeclaration; }
131  return this->FragmentImplementation; }
132 
137  void SetUniforms(vtkShaderProgram *program);
138 
139  protected:
144 
148  virtual ~vtkShadowMapPass();
149 
154  void CheckSupport(vtkOpenGLRenderWindow *w);
155 
156  vtkShadowMapBakerPass *ShadowMapBakerPass;
157  vtkRenderPass *CompositeRGBAPass;
158 
160 
164  vtkFrameBufferObject *FrameBufferObject;
165 
166  vtkShadowMapPassTextures *ShadowMaps;
167  vtkShadowMapPassLightCameras *LightCameras;
168 
169  vtkTimeStamp LastRenderTime;
170 
171  // to store the shader code and settings
172  void BuildShaderCode();
175  std::vector<int> ShadowTextureUnits;
176  std::vector<double> ShadowTransforms;
177  std::vector<float> ShadowAttenuation;
178 
179 private:
180  vtkShadowMapPass(const vtkShadowMapPass&) VTK_DELETE_FUNCTION;
181  void operator=(const vtkShadowMapPass&) VTK_DELETE_FUNCTION;
182 };
183 
184 #endif
OpenGL rendering window.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
std::string GetFragmentDeclaration()
Get the shader code to compute light factors based on a mappers vertexVC variable.
std::vector< float > ShadowAttenuation
std::vector< double > ShadowTransforms
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.
std::vector< int > GetShadowMapTextureUnits()
get the texture units for the shadow maps for each light.
vtkRenderPass * OpaqueSequence
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
Key for vtkObjectBase values.
std::vector< int > ShadowTextureUnits
internal class which encapsulates OpenGL frame buffer object.
virtual void Render(const vtkRenderState *s)=0
Perform rendering according to a render state s.
std::vector< double > ShadowMapTransforms()
get the matricies for all the shadow maps.
std::string GetFragmentImplementation()
std::string FragmentImplementation
virtual void ReleaseGraphicsResources(vtkWindow *w)
Release graphics resources and ask components to release their own resources.
Implement a shadow mapping render pass.
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
std::string FragmentDeclaration
The ShaderProgram uses one or more Shader objects.
Implement a builder of shadow map pass.