7#ifndef PXR_IMAGING_GLF_SIMPLE_SHADOW_ARRAY_H
8#define PXR_IMAGING_GLF_SIMPLE_SHADOW_ARRAY_H
13#include "pxr/imaging/glf/api.h"
20#include "pxr/imaging/garch/glApi.h"
24PXR_NAMESPACE_OPEN_SCOPE
27class GlfSimpleShadowArray :
public TfRefBase,
32 GlfSimpleShadowArray();
34 ~GlfSimpleShadowArray()
override;
37 GlfSimpleShadowArray(
const GlfSimpleShadowArray&) =
delete;
38 GlfSimpleShadowArray& operator=(
const GlfSimpleShadowArray&) =
delete;
42 GLuint GetShadowMapTexture(
int shadowIndex)
const;
47 GLuint GetShadowMapDepthSampler()
const;
51 GLuint GetShadowMapCompareSampler()
const;
57 void SetShadowMapResolutions(std::vector<GfVec2i>
const& resolutions);
62 size_t GetNumShadowMapPasses()
const;
67 GfVec2i GetShadowMapSize(
size_t pass)
const;
74 void SetViewMatrix(
size_t index,
GfMatrix4d const & matrix);
79 GfMatrix4d GetProjectionMatrix(
size_t index)
const;
81 void SetProjectionMatrix(
size_t index,
GfMatrix4d const & matrix);
84 GfMatrix4d GetWorldToShadowMatrix(
size_t index)
const;
88 void BeginCapture(
size_t index,
bool clear);
92 void EndCapture(
size_t index);
97 void SetTextures(std::vector<GLuint> textureIds);
101 void AllocSamplers();
104 void _AllocResources();
105 void _AllocTextures();
106 void _FreeResources();
107 void _FreeTextures();
108 bool _ShadowMapExists()
const;
109 void _BindFramebuffer(
size_t index);
110 void _UnbindFramebuffer();
113 std::vector<GfVec2i> _resolutions;
114 std::vector<GLuint> _textures;
116 std::vector<GfMatrix4d> _viewMatrix;
117 std::vector<GfMatrix4d> _projectionMatrix;
121 GLuint _shadowDepthSampler;
122 GLuint _shadowCompareSampler;
124 GLuint _unbindRestoreDrawFramebuffer;
125 GLuint _unbindRestoreReadFramebuffer;
127 GLint _unbindRestoreViewport[4];
129 bool _texturesAllocatedExternally;
133PXR_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.