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_LIGHT_H
8 #define PXR_IMAGING_HD_LIGHT_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
13 #include "pxr/imaging/hd/sprim.h"
14 
16 
17 #include <vector>
18 
20 
21 #define HD_LIGHT_TOKENS \
22  (angle) \
23  (color) \
24  (colorTemperature) \
25  (enableColorTemperature) \
26  (domeOffset) \
27  (exposure) \
28  (height) \
29  (intensity) \
30  (radius) \
31  (length) \
32  ((textureFile, "texture:file")) \
33  ((textureFormat, "texture:format")) \
34  (width) \
35  (ambient) \
36  (diffuse) \
37  (specular) \
38  (normalize) \
39  (hasShadow) \
40  ((shapingFocus, "shaping:focus")) \
41  ((shapingFocusTint, "shaping:focusTint")) \
42  ((shapingConeAngle, "shaping:cone:angle")) \
43  ((shapingConeSoftness, "shaping:cone:softness")) \
44  ((shapingIesFile, "shaping:ies:file")) \
45  ((shapingIesAngleScale, "shaping:ies:angleScale")) \
46  ((shapingIesNormalize, "shaping:ies:normalize")) \
47  ((shadowEnable, "shadow:enable")) \
48  ((shadowColor, "shadow:color")) \
49  ((shadowDistance, "shadow:distance")) \
50  ((shadowFalloff, "shadow:falloff")) \
51  ((shadowFalloffGamma, "shadow:falloffGamma")) \
52  \
53  (params) \
54  (shadowCollection) \
55  (shadowParams)
56 
58 
59 class HdSceneDelegate;
60 using HdLightPtrConstVector = std::vector<class HdLight const *>;
61 
62 /// \class HdLight
63 ///
64 /// A light model, used in conjunction with HdRenderPass.
65 ///
66 class HdLight : public HdSprim
67 {
68 public:
69  HD_API
70  HdLight(SdfPath const & id);
71  HD_API
72  ~HdLight() override;
73 
74  // Change tracking for HdLight
76  Clean = 0,
77  DirtyTransform = 1 << 0,
78  // Note: Because DirtyVisibility wasn't added, DirtyParams does double
79  // duty for params and visibility.
80  DirtyParams = 1 << 1,
82  DirtyCollection = 1 << 3,
83  DirtyResource = 1 << 4,
84 
85  // XXX: This flag is important for instanced lights, and must have
86  // the same value as it does for Rprims
87  DirtyInstancer = 1 << 16,
94  };
95 
96  HD_API
97  static std::string StringifyDirtyBits(HdDirtyBits dirtyBits);
98 
99  /// Returns the identifier of the instancer (if any) for this Sprim. If this
100  /// Sprim is not instanced, an empty SdfPath will be returned.
101  const SdfPath& GetInstancerId() const { return _instancerId; }
102 
103  HD_API
104  void _UpdateInstancer(
105  HdSceneDelegate* sceneDelegate,
106  HdDirtyBits* dirtyBits);
107 
108 private:
109  SdfPath _instancerId;
110 };
111 
113 
114 #endif // PXR_IMAGING_HD_LIGHT_H
static HD_API std::string StringifyDirtyBits(HdDirtyBits dirtyBits)
uint32_t HdDirtyBits
Definition: types.h:143
#define HD_API
Definition: api.h:23
HD_API void _UpdateInstancer(HdSceneDelegate *sceneDelegate, HdDirtyBits *dirtyBits)
DirtyBits
Definition: light.h:75
const SdfPath & GetInstancerId() const
Definition: light.h:101
Definition: path.h:273
Definition: sprim.h:34
#define HD_LIGHT_TOKENS
Definition: light.h:21
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API ~HdLight() override
TF_DECLARE_PUBLIC_TOKENS(HdLightTokens, HD_API, HD_LIGHT_TOKENS)
std::vector< class HdLight const * > HdLightPtrConstVector
Definition: light.h:60
HD_API HdLight(SdfPath const &id)
Definition: light.h:66