24 #ifndef PXR_IMAGING_HDST_SIMPLE_LIGHTING_SHADER_H 25 #define PXR_IMAGING_HDST_SIMPLE_LIGHTING_SHADER_H 28 #include "pxr/imaging/hdSt/api.h" 29 #include "pxr/imaging/hdSt/lightingShader.h" 31 #include "pxr/imaging/hd/binding.h" 32 #include "pxr/imaging/hd/version.h" 40 PXR_NAMESPACE_OPEN_SCOPE
45 class HdStRenderBuffer;
47 using HdStSimpleLightingShaderSharedPtr =
48 std::shared_ptr<class HdStSimpleLightingShader>;
49 using HdRenderPassAovBindingVector = std::vector<HdRenderPassAovBinding>;
72 HdSt_ResourceBinder
const &binder)
override;
75 HdSt_ResourceBinder
const &binder)
override;
90 void AddBindings(HdBindingRequestVector *customBindings)
override;
99 HdSt_MaterialParamVector
const&
GetParams()
const override;
107 void SetLightingStateFromOpenGL();
109 void SetLightingState(GlfSimpleLightingContextPtr
const &lightingContext);
111 GlfSimpleLightingContextRefPtr GetLightingContext()
const {
112 return _lightingContext;
125 const HdStTextureHandleSharedPtr &
127 return _domeLightEnvironmentTextureHandle;
141 HdRenderPassAovBindingVector
const& GetShadowAovBindings() {
142 return _shadowAovBindings;
146 SdfPath _GetAovPath(
TfToken const &aov,
size_t shadowIndex)
const;
147 void _ResizeOrCreateBufferForAov(
size_t shadowIndex)
const;
148 void _CleanupAovBindings();
150 GlfSimpleLightingContextRefPtr _lightingContext;
152 std::unique_ptr<class HioGlslfx> _glslfx;
154 TfHashMap<TfToken, HdBindingRequest, TfToken::HashFunctor> _customBuffers;
160 HdStTextureHandleSharedPtr _domeLightEnvironmentTextureHandle;
163 NamedTextureHandleVector _namedTextureHandles;
165 NamedTextureHandleVector _domeLightTextureHandles;
166 NamedTextureHandleVector _shadowTextureHandles;
168 HdSt_MaterialParamVector _lightTextureParams;
172 HdRenderPassAovBindingVector _shadowAovBindings;
173 std::vector<std::unique_ptr<HdStRenderBuffer>> _shadowAovBuffers;
177 PXR_NAMESPACE_CLOSE_SCOPE
179 #endif // PXR_IMAGING_HDST_SIMPLE_LIGHTING_SHADER_H The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Standard pointer typedefs.
HDST_API void UnbindResources(int program, HdSt_ResourceBinder const &binder) override
Unbinds shader-specific resources.
HDST_API void AllocateTextureHandles(HdRenderIndex const &renderIndex)
Allocates texture handles (texture loading happens later during commit) needed for lights.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
HDST_API void BindResources(int program, HdSt_ResourceBinder const &binder) override
Binds shader-specific resources to program XXX: this interface is meant to be used for bridging the G...
HDST_API void RemoveBufferBinding(TfToken const &name)
Remove name from custom binding.
const HdStTextureHandleSharedPtr & GetDomeLightEnvironmentTextureHandle() const
The dome light environment map used as source for the other dome light textures.
A shader that supports simple lighting functionality.
Token for efficient comparison, assignment, and hashing of known strings.
HDST_API void AddBufferBinding(HdBindingRequest const &req)
Add a custom binding request for use when this shader executes.
Stores a 4x4 matrix of double elements.
Adapter class providing data exchange with the client scene graph.
A path value used to locate objects in layers or scenegraphs.
HDST_API ID ComputeHash() const override
HdShader overrides.
A renderpass AOV represents a binding of some output of the rendering process to an output buffer.
HDST_API void SetCamera(GfMatrix4d const &worldToViewMatrix, GfMatrix4d const &projectionMatrix) override
HdStLightingShader overrides.
HDST_API void ClearBufferBindings()
Clear all custom bindings associated with this shader.
The context available in implementations of AddResourcesFromTextures.
HDST_API const HdStTextureHandleSharedPtr & GetTextureHandle(const TfToken &name) const
Get one of the textures that need to be computed from the dome light environment map.
HDST_API std::string GetSource(TfToken const &shaderStageKey) const override
Returns the shader source provided by this shader for shaderStageKey.
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
A lighting shader base class.
BindingRequest allows externally allocated buffers to be bound at render time.
HDST_API NamedTextureHandleVector const & GetNamedTextureHandles() const override
The textures computed from the dome light environment map that the shader needs to bind for the dome ...
HDST_API HdSt_MaterialParamVector const & GetParams() const override
HdStShaderCode overrides.
HDST_API void AddResourcesFromTextures(ResourceContext &ctx) const override
Adds computations to create the dome light textures that are pre-calculated from the environment map ...
HDST_API void AddBindings(HdBindingRequestVector *customBindings) override
Add custom bindings (used by codegen)