VTK  9.7.20261109
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
60
61#ifndef vtkShadowMapPass_h
62#define vtkShadowMapPass_h
63
64#include "vtkOpenGLRenderPass.h"
65#include "vtkRenderingOpenGL2Module.h" // For export macro
66#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
67#include <string> // For member variables.
68#include <vector> // STL Header
69
70VTK_ABI_NAMESPACE_BEGIN
73class vtkCamera;
74class vtkLight;
75class vtkFrameBufferObject;
76class vtkShadowMapPassTextures; // internal
77class vtkShadowMapPassLightCameras; // internal
81
82class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkShadowMapPass : public vtkOpenGLRenderPass
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
93 void Render(const vtkRenderState* s) override;
94
101
103
110 virtual void SetShadowMapBakerPass(vtkShadowMapBakerPass* shadowMapBakerPass);
112
114 VTK_DEPRECATED_IN_9_8_0("Useless GetDelegatePass() instead.")
115 virtual vtkRenderPass* GetOpaqueSequence() { return this->GetDelegatePass(); }
116
117 VTK_DEPRECATED_IN_9_8_0("Useless SetDelegatePass() instead.")
118 virtual void SetOpaqueSequence(vtkRenderPass* opaqueSequence)
119 {
120 this->SetDelegatePass(opaqueSequence);
121 }
122
123
125
129 vtkGetObjectMacro(DelegatePass, vtkRenderPass);
130 virtual void SetDelegatePass(vtkRenderPass* delegatePass);
132
137 std::vector<double> ShadowMapTransforms() { return this->ShadowTransforms; }
138
144 std::vector<int> GetShadowMapTextureUnits() { return this->ShadowTextureUnits; }
145
146 VTK_DEPRECATED_IN_9_8_0("Useless key, do not use.")
148
155
161 std::string GetFragmentImplementation() { return this->FragmentImplementation; }
162
163 // vtkOpenGLRenderPass virtuals:
164 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
165 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
166 bool PostReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
167 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
169 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
170
171protected:
176
181
187
190
194 vtkFrameBufferObject* FrameBufferObject;
195
196 vtkShadowMapPassTextures* ShadowMaps;
197 vtkShadowMapPassLightCameras* LightCameras;
198
200
201 // to store the shader code and settings
205 std::vector<int> ShadowTextureUnits;
206 std::vector<double> ShadowTransforms;
207 std::vector<float> ShadowAttenuation;
208 std::vector<int> ShadowParallel;
209
210private:
211 vtkShadowMapPass(const vtkShadowMapPass&) = delete;
212 void operator=(const vtkShadowMapPass&) = delete;
213
214 static bool IsReceiver(vtkAbstractMapper* mapper, vtkProp* prop);
215
216 vtkRenderPass* DelegatePass;
217};
218
219VTK_ABI_NAMESPACE_END
220#endif
abstract class specifies interface to map data
a virtual camera for 3D rendering
Definition vtkCamera.h:151
a simple class to control print indentation
Definition vtkIndent.h:108
Key for integer values in vtkInformation.
Key for vtkObjectBase values.
a virtual light for 3D rendering
Definition vtkLight.h:159
OpenGL rendering window.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:68
vtkRenderPass()
Default constructor.
Context in which a vtkRenderPass will render.
The ShaderProgram uses one or more Shader objects.
Implement a builder of shadow map 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
virtual vtkRenderPass * GetOpaqueSequence()
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.
virtual vtkRenderPass * GetDelegatePass()
Pass that render the lights and geometry Typically a sequence pass with a light pass and opaque pass.
virtual void SetDelegatePass(vtkRenderPass *delegatePass)
Pass that render the lights and geometry Typically a sequence pass with a light pass and opaque pass.
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.
virtual void SetOpaqueSequence(vtkRenderPass *opaqueSequence)
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()
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
static vtkInformationIntegerKey * RECEIVER()
key that can be used on actors to define if they receive shadows.
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
std::vector< double > ShadowMapTransforms()
get the matrices 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:62
#define VTK_DEPRECATED_IN_9_8_0(reason)
#define VTK_MARSHALAUTO