HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lightAPI.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef USDRI_GENERATED_LIGHTAPI_H
25 #define USDRI_GENERATED_LIGHTAPI_H
26 
27 /// \file usdRi/lightAPI.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdRi/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdRi/tokens.h"
35 
36 #include "pxr/base/vt/value.h"
37 
38 #include "pxr/base/gf/vec3d.h"
39 #include "pxr/base/gf/vec3f.h"
40 #include "pxr/base/gf/matrix4d.h"
41 
42 #include "pxr/base/tf/token.h"
43 #include "pxr/base/tf/type.h"
44 
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // RILIGHTAPI //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdRiLightAPI
54 ///
55 ///
56 /// \deprecated RenderMan-specific light settings will move to a
57 /// new schema in a future release.
58 ///
59 /// RiLightAPI is an API schema that provides an interface
60 /// to add Renderman-specific attributes to lights.
61 ///
63 {
64 public:
65  /// Compile time constant representing what kind of schema this class is.
66  ///
67  /// \sa UsdSchemaKind
69 
70  /// Construct a UsdRiLightAPI on UsdPrim \p prim .
71  /// Equivalent to UsdRiLightAPI::Get(prim.GetStage(), prim.GetPath())
72  /// for a \em valid \p prim, but will not immediately throw an error for
73  /// an invalid \p prim
74  explicit UsdRiLightAPI(const UsdPrim& prim=UsdPrim())
75  : UsdAPISchemaBase(prim)
76  {
77  }
78 
79  /// Construct a UsdRiLightAPI on the prim held by \p schemaObj .
80  /// Should be preferred over UsdRiLightAPI(schemaObj.GetPrim()),
81  /// as it preserves SchemaBase state.
82  explicit UsdRiLightAPI(const UsdSchemaBase& schemaObj)
83  : UsdAPISchemaBase(schemaObj)
84  {
85  }
86 
87  /// Destructor.
88  USDRI_API
89  virtual ~UsdRiLightAPI();
90 
91  /// Return a vector of names of all pre-declared attributes for this schema
92  /// class and all its ancestor classes. Does not include attributes that
93  /// may be authored by custom/extended methods of the schemas involved.
94  USDRI_API
95  static const TfTokenVector &
96  GetSchemaAttributeNames(bool includeInherited=true);
97 
98  /// Return a UsdRiLightAPI holding the prim adhering to this
99  /// schema at \p path on \p stage. If no prim exists at \p path on
100  /// \p stage, or if the prim at that path does not adhere to this schema,
101  /// return an invalid schema object. This is shorthand for the following:
102  ///
103  /// \code
104  /// UsdRiLightAPI(stage->GetPrimAtPath(path));
105  /// \endcode
106  ///
107  USDRI_API
108  static UsdRiLightAPI
109  Get(const UsdStagePtr &stage, const SdfPath &path);
110 
111 
112  /// Returns true if this <b>single-apply</b> API schema can be applied to
113  /// the given \p prim. If this schema can not be a applied to the prim,
114  /// this returns false and, if provided, populates \p whyNot with the
115  /// reason it can not be applied.
116  ///
117  /// Note that if CanApply returns false, that does not necessarily imply
118  /// that calling Apply will fail. Callers are expected to call CanApply
119  /// before calling Apply if they want to ensure that it is valid to
120  /// apply a schema.
121  ///
122  /// \sa UsdPrim::GetAppliedSchemas()
123  /// \sa UsdPrim::HasAPI()
124  /// \sa UsdPrim::CanApplyAPI()
125  /// \sa UsdPrim::ApplyAPI()
126  /// \sa UsdPrim::RemoveAPI()
127  ///
128  USDRI_API
129  static bool
130  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
131 
132  /// Applies this <b>single-apply</b> API schema to the given \p prim.
133  /// This information is stored by adding "RiLightAPI" to the
134  /// token-valued, listOp metadata \em apiSchemas on the prim.
135  ///
136  /// \return A valid UsdRiLightAPI object is returned upon success.
137  /// An invalid (or empty) UsdRiLightAPI object is returned upon
138  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
139  /// resulting in failure.
140  ///
141  /// \sa UsdPrim::GetAppliedSchemas()
142  /// \sa UsdPrim::HasAPI()
143  /// \sa UsdPrim::CanApplyAPI()
144  /// \sa UsdPrim::ApplyAPI()
145  /// \sa UsdPrim::RemoveAPI()
146  ///
147  USDRI_API
148  static UsdRiLightAPI
149  Apply(const UsdPrim &prim);
150 
151 protected:
152  /// Returns the kind of schema this class belongs to.
153  ///
154  /// \sa UsdSchemaKind
155  USDRI_API
156  UsdSchemaKind _GetSchemaKind() const override;
157 
158 private:
159  // needs to invoke _GetStaticTfType.
160  friend class UsdSchemaRegistry;
161  USDRI_API
162  static const TfType &_GetStaticTfType();
163 
164  static bool _IsTypedSchema();
165 
166  // override SchemaBase virtuals.
167  USDRI_API
168  const TfType &_GetTfType() const override;
169 
170 public:
171  // --------------------------------------------------------------------- //
172  // RISAMPLINGFIXEDSAMPLECOUNT
173  // --------------------------------------------------------------------- //
174  /// Specifies an override of the number of light samples to be
175  /// taken for this light source. If set to something other than zero,
176  /// it will override the sampling performed by the integrator and can
177  /// result in a performance impact. For scenes that have lots of lights,
178  /// resulting in some lights that are under-sampled, you may want to set
179  /// it to non-zero.
180  ///
181  /// | ||
182  /// | -- | -- |
183  /// | Declaration | `int ri:sampling:fixedSampleCount` |
184  /// | C++ Type | int |
185  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
186  USDRI_API
188 
189  /// See GetRiSamplingFixedSampleCountAttr(), and also
190  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
191  /// If specified, author \p defaultValue as the attribute's default,
192  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
193  /// the default for \p writeSparsely is \c false.
194  USDRI_API
195  UsdAttribute CreateRiSamplingFixedSampleCountAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
196 
197 public:
198  // --------------------------------------------------------------------- //
199  // RISAMPLINGIMPORTANCEMULTIPLIER
200  // --------------------------------------------------------------------- //
201  /// Importance of this light for noise control.
202  ///
203  /// | ||
204  /// | -- | -- |
205  /// | Declaration | `float ri:sampling:importanceMultiplier = 1` |
206  /// | C++ Type | float |
207  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
208  USDRI_API
210 
211  /// See GetRiSamplingImportanceMultiplierAttr(), and also
212  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
213  /// If specified, author \p defaultValue as the attribute's default,
214  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
215  /// the default for \p writeSparsely is \c false.
216  USDRI_API
217  UsdAttribute CreateRiSamplingImportanceMultiplierAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
218 
219 public:
220  // --------------------------------------------------------------------- //
221  // RIINTENSITYNEARDIST
222  // --------------------------------------------------------------------- //
223  /// Near distance between the point being illuminated and the
224  /// light at which the sample doesn't get brighter. This may help you
225  /// avoid hot spots and sampling issues where a light is near a
226  /// surface.
227  ///
228  /// | ||
229  /// | -- | -- |
230  /// | Declaration | `float ri:intensityNearDist` |
231  /// | C++ Type | float |
232  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
233  USDRI_API
235 
236  /// See GetRiIntensityNearDistAttr(), and also
237  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
238  /// If specified, author \p defaultValue as the attribute's default,
239  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
240  /// the default for \p writeSparsely is \c false.
241  USDRI_API
242  UsdAttribute CreateRiIntensityNearDistAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
243 
244 public:
245  // --------------------------------------------------------------------- //
246  // RILIGHTGROUP
247  // --------------------------------------------------------------------- //
248  /// Specify the light group name used for light group LPEs.
249  /// This is useful to generate per-light AOVs for later adjustment
250  /// in compositing.
251  ///
252  /// | ||
253  /// | -- | -- |
254  /// | Declaration | `string ri:lightGroup` |
255  /// | C++ Type | std::string |
256  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
257  USDRI_API
259 
260  /// See GetRiLightGroupAttr(), and also
261  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
262  /// If specified, author \p defaultValue as the attribute's default,
263  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
264  /// the default for \p writeSparsely is \c false.
265  USDRI_API
266  UsdAttribute CreateRiLightGroupAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
267 
268 public:
269  // --------------------------------------------------------------------- //
270  // RISHADOWTHINSHADOW
271  // --------------------------------------------------------------------- //
272  /// Enable thin shadow and disable refraction caustics for this
273  /// light. This parameter will ignored if Trace Light Paths is
274  /// enabled. This is a non-physical control that creates "fake"
275  /// colored shadows for transmissive objects without needing to
276  /// generate photons for caustics.
277  ///
278  /// | ||
279  /// | -- | -- |
280  /// | Declaration | `bool ri:shadow:thinShadow` |
281  /// | C++ Type | bool |
282  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
283  USDRI_API
285 
286  /// See GetRiShadowThinShadowAttr(), and also
287  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
288  /// If specified, author \p defaultValue as the attribute's default,
289  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
290  /// the default for \p writeSparsely is \c false.
291  USDRI_API
292  UsdAttribute CreateRiShadowThinShadowAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
293 
294 public:
295  // --------------------------------------------------------------------- //
296  // RITRACELIGHTPATHS
297  // --------------------------------------------------------------------- //
298  /// Enable light and photon tracing from this light. This
299  /// value enforces a physically-based light and as a side-effect
300  /// disables the above Shadows controls. Users may use this feature
301  /// to selectively decide which lights emit photons when using the
302  /// PxrVCM or PxrUPBP Integrators.
303  ///
304  /// | ||
305  /// | -- | -- |
306  /// | Declaration | `bool ri:trace:lightPaths` |
307  /// | C++ Type | bool |
308  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
309  USDRI_API
311 
312  /// See GetRiTraceLightPathsAttr(), and also
313  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
314  /// If specified, author \p defaultValue as the attribute's default,
315  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
316  /// the default for \p writeSparsely is \c false.
317  USDRI_API
318  UsdAttribute CreateRiTraceLightPathsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
319 
320 public:
321  // ===================================================================== //
322  // Feel free to add custom code below this line, it will be preserved by
323  // the code generator.
324  //
325  // Just remember to:
326  // - Close the class declaration with };
327  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
328  // - Close the include guard with #endif
329  // ===================================================================== //
330  // --(BEGIN CUSTOM CODE)--
331 };
332 
334 
335 #endif
USDRI_API UsdAttribute GetRiSamplingFixedSampleCountAttr() const
USDRI_API UsdAttribute CreateRiShadowThinShadowAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
USDRI_API UsdSchemaKind _GetSchemaKind() const override
USDRI_API UsdAttribute GetRiSamplingImportanceMultiplierAttr() const
UsdRiLightAPI(const UsdSchemaBase &schemaObj)
Definition: lightAPI.h:82
USDRI_API UsdAttribute GetRiTraceLightPathsAttr() const
UsdSchemaKind
Definition: common.h:127
USDRI_API UsdAttribute CreateRiSamplingImportanceMultiplierAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Single Apply API schema.
USDRI_API UsdAttribute GetRiShadowThinShadowAttr() const
static USDRI_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
static USDRI_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
static const UsdSchemaKind schemaKind
Definition: lightAPI.h:68
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDRI_API UsdAttribute GetRiLightGroupAttr() const
UsdRiLightAPI(const UsdPrim &prim=UsdPrim())
Definition: lightAPI.h:74
#define USDRI_API
Definition: api.h:40
Definition: path.h:288
static USDRI_API UsdRiLightAPI Apply(const UsdPrim &prim)
USDRI_API UsdAttribute CreateRiIntensityNearDistAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDRI_API UsdRiLightAPI Get(const UsdStagePtr &stage, const SdfPath &path)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
USDRI_API UsdAttribute CreateRiTraceLightPathsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRI_API UsdAttribute CreateRiSamplingFixedSampleCountAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
USDRI_API UsdAttribute CreateRiLightGroupAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual USDRI_API ~UsdRiLightAPI()
Destructor.
USDRI_API UsdAttribute GetRiIntensityNearDistAttr() const
Definition: value.h:168