Loading...
Searching...
No Matches
domeLightComputations.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_ST_DOME_LIGHT_COMPUTATIONS_H
8#define PXR_IMAGING_HD_ST_DOME_LIGHT_COMPUTATIONS_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/computation.h"
13
14#include "pxr/base/gf/vec3i.h"
15#include "pxr/base/tf/token.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
22
23using HdStSimpleLightingShaderPtr =
24 std::weak_ptr<class HdStSimpleLightingShader>;
25
36class HdSt_DomeLightComputationGPU : public HdStComputation
37{
38public:
40 HDST_API
41 HdSt_DomeLightComputationGPU(
42 // Name of computation shader to use, also used as texture name.
43 const TfToken & shaderToken,
44 // Whether to use the dome light cubemap texture or the dome light
45 // latlong texture as the input for the computation.
46 bool useCubemapAsSourceTexture,
47 // Lighting shader for accessing any referenced textures.
48 HdStSimpleLightingShaderPtr const &lightingShader,
49 // Number of mip levels.
50 unsigned int numLevels = 1,
51 // Level to be filled (0 means also to allocate texture).
52 unsigned int level = 0,
53 // Roughness associated with the texture level.
54 float roughness = -1.0);
55
56 HDST_API
57 void GetBufferSpecs(HdBufferSpecVector *specs) const override {}
58
59 HDST_API
60 void Execute(HdBufferArrayRangeSharedPtr const &range,
61 HdResourceRegistry *resourceRegistry) override;
62
66 int GetNumOutputElements() const override { return 0; }
67
68private:
69 const TfToken _shaderToken;
70 const bool _useCubemapAsSourceTexture;
71 const HdStSimpleLightingShaderPtr _lightingShader;
72 const unsigned int _numLevels;
73 const unsigned int _level;
74 const float _roughness;
75};
76
82class HdSt_DomeLightMipmapComputationGPU : public HdStComputation
83{
84public:
85 HDST_API
86 HdSt_DomeLightMipmapComputationGPU(
87 // Lighting shader for accessing textures.
88 HdStSimpleLightingShaderPtr const &lightingShader);
89
90 HDST_API
91 void GetBufferSpecs(HdBufferSpecVector *specs) const override {}
92
93 HDST_API
94 void Execute(HdBufferArrayRangeSharedPtr const &range,
95 HdResourceRegistry *resourceRegistry) override;
96
97 int GetNumOutputElements() const override { return 0; }
98
99private:
100 const HdStSimpleLightingShaderPtr _lightingShader;
101};
102
105HDST_API
106GfVec3i HdSt_ComputeDomeLightCubemapDimensions(
107 const GfVec3i& srcDim);
108
109PXR_NAMESPACE_CLOSE_SCOPE
110
111#endif // PXR_IMAGING_HD_ST_DOME_LIGHT_COMPUTATIONS_H
Basic type for a vector of 3 int components.
Definition: vec3i.h:44
A central registry for resources.
An interface class for GPU computation.
Definition: computation.h:36
virtual void Execute(HdBufferArrayRangeSharedPtr const &range, HdResourceRegistry *resourceRegistry)=0
Execute computation.
virtual void GetBufferSpecs(HdBufferSpecVector *specs) const =0
Add the buffer spec for this computation into given bufferspec vector.
virtual int GetNumOutputElements() const =0
Returns the size of its destination buffer (located by range argument of Execute()).
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...