VTK  9.4.20251203
vtkShadowMapBakerPass.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 vtkShadowMapBakerPass_h
33#define vtkShadowMapBakerPass_h
34
35#include "vtkOpenGLRenderPass.h"
36#include "vtkRenderingOpenGL2Module.h" // For export macro
37#include "vtkSmartPointer.h" // for ivars
38#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
39#include <vector> // STL Header
40
41VTK_ABI_NAMESPACE_BEGIN
44class vtkCamera;
45class vtkLight;
48
49class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkShadowMapBakerPass : public vtkOpenGLRenderPass
50{
51public:
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
60 void Render(const vtkRenderState* s) override;
61
68
70
76 vtkGetObjectMacro(OpaqueSequence, vtkRenderPass);
77 virtual void SetOpaqueSequence(vtkRenderPass* opaqueSequence);
79
81
87 vtkGetObjectMacro(CompositeZPass, vtkRenderPass);
88 virtual void SetCompositeZPass(vtkRenderPass* compositeZPass);
90
92
97 vtkSetMacro(Resolution, unsigned int);
98 vtkGetMacro(Resolution, unsigned int);
100
102
114 vtkSetMacro(ExponentialConstant, float);
115 vtkGetMacro(ExponentialConstant, float);
117
126
137
144 std::vector<vtkSmartPointer<vtkTextureObject>>* GetShadowMaps();
145
152 std::vector<vtkSmartPointer<vtkCamera>>* GetLightCameras();
153
163
164 // // Description:
165 // INTERNAL USE ONLY.
166 // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
167 //
168 // Set NeedUpate to false. Called by vtkShadowMapPass.
170
171protected:
176
181
182 // vtkOpenGLRenderPass virtuals:
183 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
184 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
186 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
187
196 double* v, double* pt, double* dir, double& mNear, double& mFar, bool initialized);
197
204 void BoxNearFar(double* bb, double* pt, double* dir, double& mNear, double& mFar);
205
211 void BuildCameraLight(vtkLight* light, double* boundingBox, vtkCamera* lcamera);
212
218
220
222
223 unsigned int Resolution;
224 float ExponentialConstant{ 11.0f };
225
227
232
233 std::vector<vtkSmartPointer<vtkTextureObject>>* ShadowMaps;
234 std::vector<vtkSmartPointer<vtkCamera>>* LightCameras;
235
239
240private:
242 void operator=(const vtkShadowMapBakerPass&) = delete;
243};
244
245VTK_ABI_NAMESPACE_END
246#endif
abstract class specifies interface to map data
a virtual camera for 3D rendering
Definition vtkCamera.h:42
a simple class to control print indentation
Definition vtkIndent.h:29
Key for integer values in vtkInformation.
a virtual light for 3D rendering
Definition vtkLight.h:50
Internal class which encapsulates OpenGL FramebufferObject.
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:47
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.
bool SetShaderParameters(vtkShaderProgram *program, vtkAbstractMapper *mapper, vtkProp *prop, vtkOpenGLVertexArrayObject *VAO=nullptr) override
Update the uniforms of the shader program.
vtkShadowMapBakerPass()
Default constructor.
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)
Delegate for rendering the camera, lights, and opaque geometry.
void CheckSupport(vtkOpenGLRenderWindow *w)
Check if shadow mapping is supported by the current OpenGL context.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::vector< vtkSmartPointer< vtkCamera > > * LightCameras
void BoxNearFar(double *bb, double *pt, double *dir, double &mNear, double &mFar)
Compute the min/max of the projection of a box in a given direction.
bool LightCreatesShadow(vtkLight *l)
INTERNAL USE ONLY.
~vtkShadowMapBakerPass() override
Destructor.
void PointNearFar(double *v, double *pt, double *dir, double &mNear, double &mFar, bool initialized)
Helper method to compute the mNearest point in a given direction.
void ReleaseGraphicsResources(vtkWindow *w) override
Release graphics resources and ask components to release their own resources.
bool GetHasShadows()
INTERNAL USE ONLY.
std::vector< vtkSmartPointer< vtkTextureObject > > * GetShadowMaps()
INTERNAL USE ONLY Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
void BuildCameraLight(vtkLight *light, double *boundingBox, vtkCamera *lcamera)
Build a camera from spot light parameters.
static vtkShadowMapBakerPass * New()
std::vector< vtkSmartPointer< vtkCamera > > * GetLightCameras()
INTERNAL USE ONLY.
void Render(const vtkRenderState *s) override
Perform rendering according to a render state s.
vtkOpenGLFramebufferObject * FrameBufferObject
Graphics resources.
bool GetNeedUpdate()
INTERNAL USE ONLY.
std::vector< vtkSmartPointer< vtkTextureObject > > * ShadowMaps
virtual void SetCompositeZPass(vtkRenderPass *compositeZPass)
Delegate for compositing of the shadow maps across processors.
abstracts an OpenGL texture object.
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
#define VTK_MARSHALAUTO