7#ifndef PXR_IMAGING_HDST_SIMPLE_LIGHTING_SHADER_H
8#define PXR_IMAGING_HDST_SIMPLE_LIGHTING_SHADER_H
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/binding.h"
13#include "pxr/imaging/hdSt/lightingShader.h"
15#include "pxr/imaging/hd/version.h"
22PXR_NAMESPACE_OPEN_SCOPE
27class HdStRenderBuffer;
29using HdStSimpleLightingShaderSharedPtr =
30 std::shared_ptr<class HdStSimpleLightingShader>;
31using HdRenderPassAovBindingVector = std::vector<HdRenderPassAovBinding>;
52 HdSt_ResourceBinder
const &binder)
override;
55 HdSt_ResourceBinder
const &binder)
override;
70 void AddBindings(HdStBindingRequestVector *customBindings)
override;
79 HdSt_MaterialParamVector
const&
GetParams()
const override;
87 GlfSimpleLightingContextRefPtr GetLightingContext()
const {
88 return _lightingContext;
103 const HdStTextureHandleSharedPtr &
105 return _domeLightEnvironmentTextureHandle;
122 const HdStTextureHandleSharedPtr &
125 HdRenderPassAovBindingVector
const& GetShadowAovBindings() {
126 return _shadowAovBindings;
130 void SetDomeLightCubemapTargetMemory(
unsigned int targetMemoryMB);
133 void SetMaxLights(uint32_t maxLights);
137 uint32_t GetMaxShadows()
const {
142 void _AllocateShadowTextures(
145 void _CleanupAovBindings();
147 GlfSimpleLightingContextRefPtr _lightingContext;
148 std::unique_ptr<class HioGlslfx> _glslfx;
151 std::map<TfToken, HdStBindingRequest> _customBuffers;
157 HdStTextureHandleSharedPtr _domeLightEnvironmentTextureHandle;
160 NamedTextureHandleVector _namedTextureHandles;
162 NamedTextureHandleVector _domeLightTextureHandles;
165 unsigned int _domeLightCubemapTargetMemoryMB;
167 NamedTextureHandle _shadowTextureHandle;
169 HdSt_MaterialParamVector _lightTextureParams;
173 HdRenderPassAovBindingVector _shadowAovBindings;
175 std::vector<HdStPooledRenderBufferUniquePtr> _shadowBuffers;
177 HdStPooledRenderBufferUniquePtr _shadowBufferFallback;
180 uint32_t _maxShadows;
184PXR_NAMESPACE_CLOSE_SCOPE
Stores a 4x4 matrix of double elements.
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
BindingRequest allows externally allocated buffers to be bound at render time.
A lighting shader base class.
A central registry of all GPU resources.
The context available in implementations of AddResourcesFromTextures.
A shader that supports simple lighting functionality.
HDST_API void RemoveBufferBinding(TfToken const &name)
Remove name from custom binding.
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 void AddBufferBinding(HdStBindingRequest const &req)
Add a custom binding request for use when this shader executes.
HDST_API void AddBindings(HdStBindingRequestVector *customBindings) override
Add custom bindings (used by codegen)
HDST_API void ClearBufferBindings()
Clear all custom bindings associated with this shader.
HDST_API void AllocateTextureHandles(HdRenderIndex const &renderIndex, const SdfPath &graphPath)
Allocates texture handles (texture loading happens later during commit) needed for lights.
const HdStTextureHandleSharedPtr & GetDomeLightEnvironmentTextureHandle() const
The dome light environment map used as source for the other dome light textures.
HDST_API const HdStTextureHandleSharedPtr & GetDomeLightEnvironmentCubemapTextureHandle() const
The dome light environment cubemap texture generated from the latlong dome light texture.
HDST_API std::string GetSource(TfToken const &shaderStageKey) const override
Returns the shader source provided by this shader for shaderStageKey.
HDST_API ID ComputeHash() const override
HdShader 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 UnbindResources(int program, HdSt_ResourceBinder const &binder) override
Unbinds shader-specific resources.
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 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 void SetCamera(GfMatrix4d const &worldToViewMatrix, GfMatrix4d const &projectionMatrix) override
HdStLightingShader overrides.
HDST_API HdSt_MaterialParamVector const & GetParams() const override
HdStShaderCode overrides.
Hydra Graphics Interface.
A path value used to locate objects in layers or scenegraphs.
Token for efficient comparison, assignment, and hashing of known strings.
A renderpass AOV represents a binding of some output of the rendering process to an output buffer.