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"
30PXR_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 SetStateFromOpenGL();
103 size_t ComputeShaderSourceHash();
106 std::string
const & ComputeShaderSource(
TfToken const &shaderStageKey);
112 GlfSimpleLightingContext();
114 ~GlfSimpleLightingContext();
116 void _ComputePostSurfaceShaderState();
118 GlfSimpleLightVector _lights;
119 GlfSimpleShadowArrayRefPtr _shadows;
124 GlfSimpleMaterial _material;
129 bool _useColorMaterialDiffuse;
131 class _PostSurfaceShaderState {
133 _PostSurfaceShaderState(
size_t hash, GlfSimpleLightVector
const & lights)
139 std::string
const & GetShaderSource()
const {
140 return _shaderSource;
143 VtUCharArray
const & GetUniformData()
const {
147 size_t GetHash()
const {
152 void _Init(GlfSimpleLightVector
const & lights);
154 std::string _shaderSource;
155 VtUCharArray _uniformData;
158 std::unique_ptr<_PostSurfaceShaderState> _postSurfaceShaderState;
160 bool _lightingUniformBlockValid;
161 bool _shadowUniformBlockValid;
162 bool _materialUniformBlockValid;
163 bool _postSurfaceShaderStateValid;
167PXR_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...