HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
distantLight.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 USDLUX_GENERATED_DISTANTLIGHT_H
8 #define USDLUX_GENERATED_DISTANTLIGHT_H
9 
10 /// \file usdLux/distantLight.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdLux/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "pxr/usd/usdLux/tokens.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // DISTANTLIGHT //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdLuxDistantLight
37 ///
38 /// Light emitted from a distant source along the -Z axis.
39 /// Also known as a directional light.
40 ///
42 {
43 public:
44  /// Compile time constant representing what kind of schema this class is.
45  ///
46  /// \sa UsdSchemaKind
48 
49  /// Construct a UsdLuxDistantLight on UsdPrim \p prim .
50  /// Equivalent to UsdLuxDistantLight::Get(prim.GetStage(), prim.GetPath())
51  /// for a \em valid \p prim, but will not immediately throw an error for
52  /// an invalid \p prim
53  explicit UsdLuxDistantLight(const UsdPrim& prim=UsdPrim())
55  {
56  }
57 
58  /// Construct a UsdLuxDistantLight on the prim held by \p schemaObj .
59  /// Should be preferred over UsdLuxDistantLight(schemaObj.GetPrim()),
60  /// as it preserves SchemaBase state.
61  explicit UsdLuxDistantLight(const UsdSchemaBase& schemaObj)
62  : UsdLuxNonboundableLightBase(schemaObj)
63  {
64  }
65 
66  /// Destructor.
68  virtual ~UsdLuxDistantLight();
69 
70  /// Return a vector of names of all pre-declared attributes for this schema
71  /// class and all its ancestor classes. Does not include attributes that
72  /// may be authored by custom/extended methods of the schemas involved.
74  static const TfTokenVector &
75  GetSchemaAttributeNames(bool includeInherited=true);
76 
77  /// Return a UsdLuxDistantLight holding the prim adhering to this
78  /// schema at \p path on \p stage. If no prim exists at \p path on
79  /// \p stage, or if the prim at that path does not adhere to this schema,
80  /// return an invalid schema object. This is shorthand for the following:
81  ///
82  /// \code
83  /// UsdLuxDistantLight(stage->GetPrimAtPath(path));
84  /// \endcode
85  ///
87  static UsdLuxDistantLight
88  Get(const UsdStagePtr &stage, const SdfPath &path);
89 
90  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
91  /// is defined (according to UsdPrim::IsDefined()) on this stage.
92  ///
93  /// If a prim adhering to this schema at \p path is already defined on this
94  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
95  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
96  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
97  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
98  /// current EditTarget for any nonexistent, or existing but not \a Defined
99  /// ancestors.
100  ///
101  /// The given \a path must be an absolute prim path that does not contain
102  /// any variant selections.
103  ///
104  /// If it is impossible to author any of the necessary PrimSpecs, (for
105  /// example, in case \a path cannot map to the current UsdEditTarget's
106  /// namespace) issue an error and return an invalid \a UsdPrim.
107  ///
108  /// Note that this method may return a defined prim whose typeName does not
109  /// specify this schema class, in case a stronger typeName opinion overrides
110  /// the opinion at the current EditTarget.
111  ///
112  USDLUX_API
113  static UsdLuxDistantLight
114  Define(const UsdStagePtr &stage, const SdfPath &path);
115 
116 protected:
117  /// Returns the kind of schema this class belongs to.
118  ///
119  /// \sa UsdSchemaKind
120  USDLUX_API
121  UsdSchemaKind _GetSchemaKind() const override;
122 
123 private:
124  // needs to invoke _GetStaticTfType.
125  friend class UsdSchemaRegistry;
126  USDLUX_API
127  static const TfType &_GetStaticTfType();
128 
129  static bool _IsTypedSchema();
130 
131  // override SchemaBase virtuals.
132  USDLUX_API
133  const TfType &_GetTfType() const override;
134 
135 public:
136  // --------------------------------------------------------------------- //
137  // ANGLE
138  // --------------------------------------------------------------------- //
139  /// Angular diameter of the light in degrees.
140  /// As an example, the Sun is approximately 0.53 degrees as seen from Earth.
141  /// Higher values broaden the light and therefore soften shadow edges.
142  ///
143  /// This value is assumed to be in the range `0 <= angle < 360`, and will
144  /// be clipped to this range. Note that this implies that we can have a
145  /// distant light emitting from more than a hemispherical area of light
146  /// if angle > 180. While this is valid, it is possible that for large
147  /// angles a DomeLight may provide better performance. If angle is 0, the
148  /// DistantLight represents a perfectly parallel light source.
149  ///
150  ///
151  /// | ||
152  /// | -- | -- |
153  /// | Declaration | `float inputs:angle = 0.53` |
154  /// | C++ Type | float |
155  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
156  USDLUX_API
157  UsdAttribute GetAngleAttr() const;
158 
159  /// See GetAngleAttr(), and also
160  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
161  /// If specified, author \p defaultValue as the attribute's default,
162  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
163  /// the default for \p writeSparsely is \c false.
164  USDLUX_API
165  UsdAttribute CreateAngleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
166 
167 public:
168  // ===================================================================== //
169  // Feel free to add custom code below this line, it will be preserved by
170  // the code generator.
171  //
172  // Just remember to:
173  // - Close the class declaration with };
174  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
175  // - Close the include guard with #endif
176  // ===================================================================== //
177  // --(BEGIN CUSTOM CODE)--
178 };
179 
181 
182 #endif
static USDLUX_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
UsdLuxDistantLight(const UsdPrim &prim=UsdPrim())
Definition: distantLight.h:53
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDLUX_API UsdLuxDistantLight Get(const UsdStagePtr &stage, const SdfPath &path)
virtual USDLUX_API ~UsdLuxDistantLight()
Destructor.
UsdLuxDistantLight(const UsdSchemaBase &schemaObj)
Definition: distantLight.h:61
#define USDLUX_API
Definition: api.h:23
static USDLUX_API UsdLuxDistantLight Define(const UsdStagePtr &stage, const SdfPath &path)
Represents a concrete typed schema.
USDLUX_API UsdAttribute GetAngleAttr() const
USDLUX_API UsdAttribute CreateAngleAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDLUX_API UsdSchemaKind _GetSchemaKind() const override
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
Definition: value.h:146
static const UsdSchemaKind schemaKind
Definition: distantLight.h:47