VTK  9.3.0
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 <vector> // STL Header
39
40VTK_ABI_NAMESPACE_BEGIN
43class vtkCamera;
44class vtkLight;
47
48class VTKRENDERINGOPENGL2_EXPORT vtkShadowMapBakerPass : public vtkOpenGLRenderPass
49{
50public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
59 void Render(const vtkRenderState* s) override;
60
67
69
75 vtkGetObjectMacro(OpaqueSequence, vtkRenderPass);
76 virtual void SetOpaqueSequence(vtkRenderPass* opaqueSequence);
78
80
86 vtkGetObjectMacro(CompositeZPass, vtkRenderPass);
87 virtual void SetCompositeZPass(vtkRenderPass* compositeZPass);
89
91
96 vtkSetMacro(Resolution, unsigned int);
97 vtkGetMacro(Resolution, unsigned int);
99
108
119
126 std::vector<vtkSmartPointer<vtkTextureObject>>* GetShadowMaps();
127
134 std::vector<vtkSmartPointer<vtkCamera>>* GetLightCameras();
135
145
146 // // Description:
147 // INTERNAL USE ONLY.
148 // Internally used by vtkShadowMapBakerPass and vtkShadowMapPass.
149 //
150 // Set NeedUpate to false. Called by vtkShadowMapPass.
152
153protected:
158
163
164 // vtkOpenGLRenderPass virtuals:
165 bool PreReplaceShaderValues(std::string& vertexShader, std::string& geometryShader,
166 std::string& fragmentShader, vtkAbstractMapper* mapper, vtkProp* prop) override;
168 vtkOpenGLVertexArrayObject* VAO = nullptr) override;
169
178 double* v, double* pt, double* dir, double& mNear, double& mFar, bool initialized);
179
186 void BoxNearFar(double* bb, double* pt, double* dir, double& mNear, double& mFar);
187
193 void BuildCameraLight(vtkLight* light, double* boundingBox, vtkCamera* lcamera);
194
200
202
204
205 unsigned int Resolution;
206
208
213
214 std::vector<vtkSmartPointer<vtkTextureObject>>* ShadowMaps;
215 std::vector<vtkSmartPointer<vtkCamera>>* LightCameras;
216
220
221private:
223 void operator=(const vtkShadowMapBakerPass&) = delete;
224};
225
226VTK_ABI_NAMESPACE_END
227#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.
a virtual light for 3D rendering
Definition vtkLight.h:49
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: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.
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:25