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"
41PXR_NAMESPACE_OPEN_SCOPE
44class GlfSimpleShadowArray :
public TfRefBase,
49 GlfSimpleShadowArray();
51 ~GlfSimpleShadowArray()
override;
54 GlfSimpleShadowArray(
const GlfSimpleShadowArray&) =
delete;
55 GlfSimpleShadowArray& operator=(
const GlfSimpleShadowArray&) =
delete;
59 GLuint GetShadowMapTexture(
int shadowIndex)
const;
64 GLuint GetShadowMapDepthSampler()
const;
68 GLuint GetShadowMapCompareSampler()
const;
74 void SetShadowMapResolutions(std::vector<GfVec2i>
const& resolutions);
79 size_t GetNumShadowMapPasses()
const;
84 GfVec2i GetShadowMapSize(
size_t pass)
const;
91 void SetViewMatrix(
size_t index,
GfMatrix4d const & matrix);
96 GfMatrix4d GetProjectionMatrix(
size_t index)
const;
98 void SetProjectionMatrix(
size_t index,
GfMatrix4d const & matrix);
101 GfMatrix4d GetWorldToShadowMatrix(
size_t index)
const;
105 void BeginCapture(
size_t index,
bool clear);
109 void EndCapture(
size_t index);
114 void SetTextures(std::vector<GLuint> textureIds);
118 void AllocSamplers();
121 void _AllocResources();
122 void _AllocTextures();
123 void _FreeResources();
124 void _FreeTextures();
125 bool _ShadowMapExists()
const;
126 void _BindFramebuffer(
size_t index);
127 void _UnbindFramebuffer();
130 std::vector<GfVec2i> _resolutions;
131 std::vector<GLuint> _textures;
133 std::vector<GfMatrix4d> _viewMatrix;
134 std::vector<GfMatrix4d> _projectionMatrix;
138 GLuint _shadowDepthSampler;
139 GLuint _shadowCompareSampler;
141 GLuint _unbindRestoreDrawFramebuffer;
142 GLuint _unbindRestoreReadFramebuffer;
144 GLint _unbindRestoreViewport[4];
146 bool _texturesAllocatedExternally;
150PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type for a vector of 2 int components.
Enable a concrete base class for use with TfRefPtr.
Enable a concrete base class for use with TfWeakPtr.
Standard pointer typedefs.
Pointer storage with deletion detection.