VTK  9.5.20251127
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
60
61#ifndef vtkShadowMapBakerPass_h
62#define vtkShadowMapBakerPass_h
63
64#include "vtkOpenGLRenderPass.h"
65#include "vtkRenderingOpenGL2Module.h" // For export macro
66#include "vtkSmartPointer.h" // for ivars
67#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
68#include <vector> // STL Header
69
70VTK_ABI_NAMESPACE_BEGIN
73class vtkCamera;
74class vtkLight;
77
78class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkShadowMapBakerPass : public vtkOpenGLRenderPass
79{
80public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
89 void Render(const vtkRenderState* s) override;
90
97
99
105 vtkGetObjectMacro(OpaqueSequence, vtkRenderPass);
106 virtual void SetOpaqueSequence(vtkRenderPass* opaqueSequence);
108
110
116 vtkGetObjectMacro(CompositeZPass, vtkRenderPass);
117 virtual void SetCompositeZPass(vtkRenderPass* compositeZPass);
119
121
126 vtkSetMacro(Resolution, unsigned int);
127 vtkGetMacro(Resolution, unsigned int);
129
131
143 vtkSetMacro(ExponentialConstant, float);
144 vtkGetMacro(ExponentialConstant, float);
146
155
166
173 std::vector<vtkSmartPointer<vtkTextureObject>>* GetShadowMaps();
174
181 std::vector<vtkSmartPointer<vtkCamera>>* GetLightCameras();
182
192
193 // // Description:
194 // INTERNAL USE ONLY.
195 // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
196 //
197 // Set NeedUpate to false. Called by vtkShadowMapPass.
199
200protected:
205
210
211 // vtkOpenGLRenderPass virtuals:
212 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
213 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
215 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
216
225 double* v, double* pt, double* dir, double& mNear, double& mFar, bool initialized);
226
233 void BoxNearFar(double* bb, double* pt, double* dir, double& mNear, double& mFar);
234
240 void BuildCameraLight(vtkLight* light, double* boundingBox, vtkCamera* lcamera);
241
247
249
251
252 unsigned int Resolution;
253 float ExponentialConstant{ 11.0f };
254
256
261
262 std::vector<vtkSmartPointer<vtkTextureObject>>* ShadowMaps;
263 std::vector<vtkSmartPointer<vtkCamera>>* LightCameras;
264
268
269private:
271 void operator=(const vtkShadowMapBakerPass&) = delete;
272};
273
274VTK_ABI_NAMESPACE_END
275#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.
a virtual light for 3D rendering
Definition vtkLight.h:159
Internal class which encapsulates OpenGL FramebufferObject.
OpenGL rendering window.
The VertexArrayObject class uses, or emulates, vertex array objects.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
vtkRenderPass()
Default constructor.
Context in which a vtkRenderPass will render.
The ShaderProgram uses one or more Shader objects.
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:48
#define VTK_MARSHALAUTO