7#ifndef PXR_IMAGING_GLF_SIMPLE_LIGHTING_CONTEXT_H
8#define PXR_IMAGING_GLF_SIMPLE_LIGHTING_CONTEXT_H
13#include "pxr/imaging/glf/api.h"
28PXR_NAMESPACE_OPEN_SCOPE
38 typedef GlfSimpleLightingContext This;
41 static GlfSimpleLightingContextRefPtr New();
44 void SetLights(GlfSimpleLightVector
const & lights);
46 GlfSimpleLightVector
const & GetLights()
const;
51 int GetNumLightsUsed()
const;
56 int ComputeNumShadowsUsed()
const;
59 void SetShadows(GlfSimpleShadowArrayRefPtr
const & shadows);
61 GlfSimpleShadowArrayRefPtr
const & GetShadows()
const;
64 void SetMaterial(GlfSimpleMaterial
const & material);
66 GlfSimpleMaterial
const & GetMaterial()
const;
69 void SetSceneAmbient(
GfVec4f const & sceneAmbient);
71 GfVec4f const & GetSceneAmbient()
const;
74 void SetCamera(
GfMatrix4d const &worldToViewMatrix,
78 void SetUseLighting(
bool val);
80 bool GetUseLighting()
const;
84 bool GetUseShadows()
const;
87 void SetUseColorMaterialDiffuse(
bool val);
89 bool GetUseColorMaterialDiffuse()
const;
92 void InitUniformBlockBindings(GlfBindingMapPtr
const &bindingMap)
const;
94 void InitSamplerUnitBindings(GlfBindingMapPtr
const &bindingMap)
const;
97 void BindUniformBlocks(GlfBindingMapPtr
const &bindingMap);
99 void BindSamplers(GlfBindingMapPtr
const &bindingMap);
102 void UnbindSamplers(GlfBindingMapPtr
const &bindingMap);
105 void SetStateFromOpenGL();
116 size_t ComputeShaderSourceHash();
119 std::string
const & ComputeShaderSource(
TfToken const &shaderStageKey);
125 GlfSimpleLightingContext();
127 ~GlfSimpleLightingContext();
129 void _ComputePostSurfaceShaderState();
130 void _BindPostSurfaceShaderParams(GlfBindingMapPtr
const &bindingMap);
133 GlfSimpleLightVector _lights;
134 GlfSimpleShadowArrayRefPtr _shadows;
139 GlfSimpleMaterial _material;
144 bool _useColorMaterialDiffuse;
146 GlfUniformBlockRefPtr _lightingUniformBlock;
147 GlfUniformBlockRefPtr _shadowUniformBlock;
148 GlfUniformBlockRefPtr _materialUniformBlock;
149 GlfUniformBlockRefPtr _bindlessShadowlUniformBlock;
151 class _PostSurfaceShaderState;
152 std::unique_ptr<_PostSurfaceShaderState> _postSurfaceShaderState;
154 bool _lightingUniformBlockValid;
155 bool _shadowUniformBlockValid;
156 bool _materialUniformBlockValid;
157 bool _postSurfaceShaderStateValid;
161PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
Basic type for a vector of 4 float components.
Enable a concrete base class for use with TfRefPtr.
Token for efficient comparison, assignment, and hashing of known strings.
Enable a concrete base class for use with TfWeakPtr.
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...