24 #ifndef PXR_IMAGING_GLF_SIMPLE_SHADOW_ARRAY_H
25 #define PXR_IMAGING_GLF_SIMPLE_SHADOW_ARRAY_H
30 #include "pxr/imaging/glf/api.h"
37 #include "pxr/imaging/garch/glApi.h"
41 PXR_NAMESPACE_OPEN_SCOPE
44 class GlfSimpleShadowArray :
public TfRefBase,
49 GlfSimpleShadowArray();
51 ~GlfSimpleShadowArray()
override;
54 GlfSimpleShadowArray(
const GlfSimpleShadowArray&) =
delete;
55 GlfSimpleShadowArray& operator=(
const GlfSimpleShadowArray&) =
delete;
61 bool GetBindlessShadowMapsEnabled();
67 void SetSize(
GfVec2i const & size);
73 void SetNumLayers(
size_t numLayers);
77 GLuint GetShadowMapTexture()
const;
82 GLuint GetShadowMapDepthSampler()
const;
86 GLuint GetShadowMapCompareSampler()
const;
94 void SetShadowMapResolutions(std::vector<GfVec2i>
const& resolutions);
99 std::vector<uint64_t>
const& GetBindlessShadowMapHandles()
const;
106 size_t GetNumShadowMapPasses()
const;
112 GfVec2i GetShadowMapSize(
size_t pass)
const;
119 void SetViewMatrix(
size_t index,
GfMatrix4d const & matrix);
124 GfMatrix4d GetProjectionMatrix(
size_t index)
const;
126 void SetProjectionMatrix(
size_t index,
GfMatrix4d const & matrix);
129 GfMatrix4d GetWorldToShadowMatrix(
size_t index)
const;
133 void BeginCapture(
size_t index,
bool clear);
137 void EndCapture(
size_t index);
140 void _AllocResources();
141 void _AllocBindfulTextures();
142 void _AllocBindlessTextures();
143 void _FreeResources();
144 void _FreeBindfulTextures();
145 void _FreeBindlessTextures();
146 bool _ShadowMapExists()
const;
147 void _BindFramebuffer(
size_t index);
148 void _UnbindFramebuffer();
154 GLuint _bindfulTexture;
155 GLuint _shadowDepthSampler;
158 std::vector<GfVec2i> _resolutions;
159 std::vector<GLuint> _bindlessTextures;
160 std::vector<uint64_t> _bindlessTextureHandles;
163 std::vector<GfMatrix4d> _viewMatrix;
164 std::vector<GfMatrix4d> _projectionMatrix;
168 GLuint _shadowCompareSampler;
170 GLuint _unbindRestoreDrawFramebuffer;
171 GLuint _unbindRestoreReadFramebuffer;
173 GLint _unbindRestoreViewport[4];
177 PXR_NAMESPACE_CLOSE_SCOPE
Basic type for a vector of 2 int components.
Standard pointer typedefs.
Pointer storage with deletion detection.
Enable a concrete base class for use with TfRefPtr.
Stores a 4x4 matrix of double elements.
Enable a concrete base class for use with TfWeakPtr.