VTK  9.3.0
vtkShadowMapPass.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
32#ifndef vtkShadowMapPass_h
33#define vtkShadowMapPass_h
34
35#include "vtkOpenGLRenderPass.h"
36#include "vtkRenderingOpenGL2Module.h" // For export macro
37#include <string> // For member variables.
38#include <vector> // STL Header
39
40VTK_ABI_NAMESPACE_BEGIN
43class vtkCamera;
44class vtkLight;
45class vtkFrameBufferObject;
46class vtkShadowMapPassTextures; // internal
47class vtkShadowMapPassLightCameras; // internal
51
52class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapPass : public vtkOpenGLRenderPass
53{
54public:
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
63 void Render(const vtkRenderState* s) override;
64
71
73
79 vtkGetObjectMacro(ShadowMapBakerPass, vtkShadowMapBakerPass);
80 virtual void SetShadowMapBakerPass(vtkShadowMapBakerPass* shadowMapBakerPass);
82
84
88 vtkGetObjectMacro(OpaqueSequence, vtkRenderPass);
89 virtual void SetOpaqueSequence(vtkRenderPass* opaqueSequence);
91
96 std::vector<double> ShadowMapTransforms() { return this->ShadowTransforms; }
97
103 std::vector<int> GetShadowMapTextureUnits() { return this->ShadowTextureUnits; }
104
109
114 std::string GetFragmentDeclaration() { return this->FragmentDeclaration; }
115 std::string GetFragmentImplementation() { return this->FragmentImplementation; }
116
117 // vtkOpenGLRenderPass virtuals:
118 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
119 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
120 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
121 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
123 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
124
125protected:
130
135
141
144
146
150 vtkFrameBufferObject* FrameBufferObject;
151
152 vtkShadowMapPassTextures* ShadowMaps;
153 vtkShadowMapPassLightCameras* LightCameras;
154
156
157 // to store the shader code and settings
161 std::vector<int> ShadowTextureUnits;
162 std::vector<double> ShadowTransforms;
163 std::vector<float> ShadowAttenuation;
164 std::vector<int> ShadowParallel;
165
166private:
167 vtkShadowMapPass(const vtkShadowMapPass&) = delete;
168 void operator=(const vtkShadowMapPass&) = delete;
169};
170
171VTK_ABI_NAMESPACE_END
172#endif
abstract class specifies interface to map data
a virtual camera for 3D rendering
Definition vtkCamera.h:41
a simple class to control print indentation
Definition vtkIndent.h:29
Key for integer values in vtkInformation.
Key for vtkObjectBase values.
a virtual light for 3D rendering
Definition vtkLight.h:49
Abstract render pass with shader modifications.
OpenGL rendering window.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:43
Perform part of the rendering of a vtkRenderer.
Context in which a vtkRenderPass will render.
The ShaderProgram uses one or more Shader objects.
Implement a builder of shadow map pass.
Implement a shadow mapping render pass.
std::vector< int > ShadowTextureUnits
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< int > ShadowParallel
std::vector< float > ShadowAttenuation
std::string FragmentDeclaration
static vtkShadowMapPass * New()
std::vector< int > GetShadowMapTextureUnits()
get the texture units for the shadow maps for each light.
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
vtkShadowMapPassLightCameras * LightCameras
std::string FragmentImplementation
vtkShadowMapBakerPass * ShadowMapBakerPass
bool PreReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Use vtkShaderProgram::Substitute to replace.
vtkRenderPass * OpaqueSequence
virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence)
Pass that render the lights and opaque geometry Typically a sequence pass with a light pass and opaqu...
void CheckSupport(vtkOpenGLRenderWindow *w)
Check if shadow mapping is supported by the current OpenGL context.
virtual void SetShadowMapBakerPass(vtkShadowMapBakerPass *shadowMapBakerPass)
Pass that generates the shadow maps.
static vtkInformationObjectBaseKey * ShadowMapPass()
this key will contain the shadow map pass
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkFrameBufferObject * FrameBufferObject
Graphics resources.
void BuildShaderCode()
std::string GetFragmentDeclaration()
Get the shader code to compute light factors based on a mappers vertexVC variable.
vtkShadowMapPassTextures * ShadowMaps
~vtkShadowMapPass() override
Destructor.
std::vector< double > ShadowTransforms
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
std::vector< double > ShadowMapTransforms()
get the matricies for all the shadow maps.
std::string GetFragmentImplementation()
vtkRenderPass * CompositeRGBAPass
bool PostReplaceShaderValues(std::string &vertexShader, std::string &geometryShader, std::string &fragmentShader, vtkAbstractMapper *mapper, vtkProp *prop) override
Use vtkShaderProgram::Substitute to replace.
vtkShadowMapPass()
Default constructor.
vtkTimeStamp LastRenderTime
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:25