HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
light.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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_LIGHT_H
8 #define PXR_IMAGING_HD_ST_LIGHT_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdSt/api.h"
12 #include "pxr/imaging/hd/version.h"
13 #include "pxr/imaging/hd/light.h"
14 
16 
17 #include "pxr/base/vt/value.h"
18 
20 
21 /// \class HdStLight
22 ///
23 /// A light model for use in Storm.
24 /// Note: This class simply stores the light parameters and relies on an
25 /// external task (HdxSimpleLightTask) to upload them to the GPU.
26 ///
27 class HdStLight final : public HdLight {
28 public:
29  HDST_API
30  HdStLight(SdfPath const & id, TfToken const &lightType);
31  HDST_API
32  ~HdStLight() override;
33 
34  /// Synchronizes state from the delegate to this object.
35  HDST_API
36  void Sync(HdSceneDelegate *sceneDelegate,
37  HdRenderParam *renderParam,
38  HdDirtyBits *dirtyBits) override;
39 
40  /// Finalizes object resources. This function might not delete resources,
41  /// but it should deal with resource ownership so that the sprim is
42  /// deletable.
43  HDST_API
44  void Finalize(HdRenderParam *renderParam) override;
45 
46  /// Accessor for tasks to get the parameters cached in this object.
47  HDST_API
48  VtValue Get(TfToken const &token) const;
49 
50  /// Returns the minimal set of dirty bits to place in the
51  /// change tracker for use in the first sync of this prim.
52  /// Typically this would be all dirty bits.
53  HDST_API
54  HdDirtyBits GetInitialDirtyBitsMask() const override;
55 
56 private:
57  // Converts area lights (sphere lights and distant lights) into
58  // glfSimpleLights and inserts them in the dictionary so
59  // SimpleLightTask can use them later on as if they were regular lights.
60  GlfSimpleLight _ApproximateAreaLight(SdfPath const &id,
61  HdSceneDelegate *sceneDelegate);
62 
63  // Collects data such as the environment map texture path for a
64  // dome light. The lighting shader is responsible for pre-calculating
65  // the different textures needed for IBL.
66  GlfSimpleLight _PrepareDomeLight(SdfPath const &id,
67  HdSceneDelegate *sceneDelegate);
68 
69  GlfSimpleLight _PrepareSimpleLight(SdfPath const &id,
70  HdSceneDelegate *sceneDelegate);
71 
72 private:
73  // Stores the internal light type of this light.
74  TfToken _lightType;
75 
76  // Cached states.
78 };
79 
80 
82 
83 #endif // PXR_IMAGING_HD_ST_LIGHT_H
HDST_API HdStLight(SdfPath const &id, TfToken const &lightType)
HDST_API void Finalize(HdRenderParam *renderParam) override
uint32_t HdDirtyBits
Definition: types.h:143
Definition: token.h:70
HDST_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
HDST_API ~HdStLight() override
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define HDST_API
Definition: api.h:23
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDST_API VtValue Get(TfToken const &token) const
Accessor for tasks to get the parameters cached in this object.
Definition: value.h:146
Definition: light.h:66