24 #ifndef PXR_IMAGING_GLF_SIMPLE_LIGHTING_CONTEXT_H 25 #define PXR_IMAGING_GLF_SIMPLE_LIGHTING_CONTEXT_H 30 #include "pxr/imaging/glf/api.h" 45 PXR_NAMESPACE_OPEN_SCOPE
55 typedef GlfSimpleLightingContext This;
58 static GlfSimpleLightingContextRefPtr New();
61 void SetLights(GlfSimpleLightVector
const & lights);
63 GlfSimpleLightVector
const & GetLights()
const;
68 int GetNumLightsUsed()
const;
73 int ComputeNumShadowsUsed()
const;
76 void SetShadows(GlfSimpleShadowArrayRefPtr
const & shadows);
78 GlfSimpleShadowArrayRefPtr
const & GetShadows()
const;
81 void SetMaterial(GlfSimpleMaterial
const & material);
83 GlfSimpleMaterial
const & GetMaterial()
const;
86 void SetSceneAmbient(
GfVec4f const & sceneAmbient);
88 GfVec4f const & GetSceneAmbient()
const;
91 void SetCamera(
GfMatrix4d const &worldToViewMatrix,
95 void SetUseLighting(
bool val);
97 bool GetUseLighting()
const;
101 bool GetUseShadows()
const;
104 void SetUseColorMaterialDiffuse(
bool val);
106 bool GetUseColorMaterialDiffuse()
const;
109 void InitUniformBlockBindings(GlfBindingMapPtr
const &bindingMap)
const;
111 void InitSamplerUnitBindings(GlfBindingMapPtr
const &bindingMap)
const;
114 void BindUniformBlocks(GlfBindingMapPtr
const &bindingMap);
116 void BindSamplers(GlfBindingMapPtr
const &bindingMap);
119 void UnbindSamplers(GlfBindingMapPtr
const &bindingMap);
122 void SetStateFromOpenGL();
133 size_t ComputeShaderSourceHash();
136 std::string
const & ComputeShaderSource(
TfToken const &shaderStageKey);
142 GlfSimpleLightingContext();
144 ~GlfSimpleLightingContext();
146 void _ComputePostSurfaceShaderState();
147 void _BindPostSurfaceShaderParams(GlfBindingMapPtr
const &bindingMap);
150 GlfSimpleLightVector _lights;
151 GlfSimpleShadowArrayRefPtr _shadows;
156 GlfSimpleMaterial _material;
161 bool _useColorMaterialDiffuse;
163 GlfUniformBlockRefPtr _lightingUniformBlock;
164 GlfUniformBlockRefPtr _shadowUniformBlock;
165 GlfUniformBlockRefPtr _materialUniformBlock;
166 GlfUniformBlockRefPtr _bindlessShadowlUniformBlock;
168 class _PostSurfaceShaderState;
169 std::unique_ptr<_PostSurfaceShaderState> _postSurfaceShaderState;
171 bool _lightingUniformBlockValid;
172 bool _shadowUniformBlockValid;
173 bool _materialUniformBlockValid;
174 bool _postSurfaceShaderStateValid;
178 PXR_NAMESPACE_CLOSE_SCOPE
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Enable a concrete base class for use with TfRefPtr.
Token for efficient comparison, assignment, and hashing of known strings.
Stores a 4x4 matrix of double elements.
Basic type for a vector of 4 float components.
Enable a concrete base class for use with TfWeakPtr.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...