HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
settingsBase.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 USDRENDER_GENERATED_SETTINGSBASE_H
25 #define USDRENDER_GENERATED_SETTINGSBASE_H
26 
27 /// \file usdRender/settingsBase.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdRender/api.h"
31 #include "pxr/usd/usd/typed.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.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 // RENDERSETTINGSBASE //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdRenderSettingsBase
54 ///
55 /// Abstract base class that defines render settings that
56 /// can be specified on either a RenderSettings prim or a RenderProduct
57 /// prim.
58 ///
59 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
60 /// that are text/tokens, the actual token is published and defined in \ref UsdRenderTokens.
61 /// So to set an attribute to the value "rightHanded", use UsdRenderTokens->rightHanded
62 /// as the value.
63 ///
65 {
66 public:
67  /// Compile time constant representing what kind of schema this class is.
68  ///
69  /// \sa UsdSchemaKind
71 
72  /// Construct a UsdRenderSettingsBase on UsdPrim \p prim .
73  /// Equivalent to UsdRenderSettingsBase::Get(prim.GetStage(), prim.GetPath())
74  /// for a \em valid \p prim, but will not immediately throw an error for
75  /// an invalid \p prim
76  explicit UsdRenderSettingsBase(const UsdPrim& prim=UsdPrim())
77  : UsdTyped(prim)
78  {
79  }
80 
81  /// Construct a UsdRenderSettingsBase on the prim held by \p schemaObj .
82  /// Should be preferred over UsdRenderSettingsBase(schemaObj.GetPrim()),
83  /// as it preserves SchemaBase state.
84  explicit UsdRenderSettingsBase(const UsdSchemaBase& schemaObj)
85  : UsdTyped(schemaObj)
86  {
87  }
88 
89  /// Destructor.
91  virtual ~UsdRenderSettingsBase();
92 
93  /// Return a vector of names of all pre-declared attributes for this schema
94  /// class and all its ancestor classes. Does not include attributes that
95  /// may be authored by custom/extended methods of the schemas involved.
97  static const TfTokenVector &
98  GetSchemaAttributeNames(bool includeInherited=true);
99 
100  /// Return a UsdRenderSettingsBase holding the prim adhering to this
101  /// schema at \p path on \p stage. If no prim exists at \p path on
102  /// \p stage, or if the prim at that path does not adhere to this schema,
103  /// return an invalid schema object. This is shorthand for the following:
104  ///
105  /// \code
106  /// UsdRenderSettingsBase(stage->GetPrimAtPath(path));
107  /// \endcode
108  ///
110  static UsdRenderSettingsBase
111  Get(const UsdStagePtr &stage, const SdfPath &path);
112 
113 
114 protected:
115  /// Returns the kind of schema this class belongs to.
116  ///
117  /// \sa UsdSchemaKind
119  UsdSchemaKind _GetSchemaKind() const override;
120 
121 private:
122  // needs to invoke _GetStaticTfType.
123  friend class UsdSchemaRegistry;
125  static const TfType &_GetStaticTfType();
126 
127  static bool _IsTypedSchema();
128 
129  // override SchemaBase virtuals.
131  const TfType &_GetTfType() const override;
132 
133 public:
134  // --------------------------------------------------------------------- //
135  // RESOLUTION
136  // --------------------------------------------------------------------- //
137  /// The image pixel resolution, corresponding to the
138  /// camera's screen window.
139  ///
140  /// | ||
141  /// | -- | -- |
142  /// | Declaration | `uniform int2 resolution = (2048, 1080)` |
143  /// | C++ Type | GfVec2i |
144  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int2 |
145  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
148 
149  /// See GetResolutionAttr(), and also
150  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
151  /// If specified, author \p defaultValue as the attribute's default,
152  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
153  /// the default for \p writeSparsely is \c false.
155  UsdAttribute CreateResolutionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
156 
157 public:
158  // --------------------------------------------------------------------- //
159  // PIXELASPECTRATIO
160  // --------------------------------------------------------------------- //
161  /// The aspect ratio (width/height) of image pixels..
162  /// The default ratio 1.0 indicates square pixels.
163  ///
164  /// | ||
165  /// | -- | -- |
166  /// | Declaration | `uniform float pixelAspectRatio = 1` |
167  /// | C++ Type | float |
168  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
169  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
172 
173  /// See GetPixelAspectRatioAttr(), and also
174  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
175  /// If specified, author \p defaultValue as the attribute's default,
176  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
177  /// the default for \p writeSparsely is \c false.
179  UsdAttribute CreatePixelAspectRatioAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
180 
181 public:
182  // --------------------------------------------------------------------- //
183  // ASPECTRATIOCONFORMPOLICY
184  // --------------------------------------------------------------------- //
185  /// Indicates the policy to use to resolve an aspect
186  /// ratio mismatch between the camera aperture and image settings.
187  ///
188  /// This policy allows a standard render setting to do something
189  /// reasonable given varying camera inputs.
190  ///
191  /// The camera aperture aspect ratio is determined by the
192  /// aperture atributes on the UsdGeomCamera.
193  ///
194  /// The image aspect ratio is determined by the resolution and
195  /// pixelAspectRatio attributes in the render settings.
196  ///
197  /// - "expandAperture": if necessary, expand the aperture to
198  /// fit the image, exposing additional scene content
199  /// - "cropAperture": if necessary, crop the aperture to fit
200  /// the image, cropping scene content
201  /// - "adjustApertureWidth": if necessary, adjust aperture width
202  /// to make its aspect ratio match the image
203  /// - "adjustApertureHeight": if necessary, adjust aperture height
204  /// to make its aspect ratio match the image
205  /// - "adjustPixelAspectRatio": compute pixelAspectRatio to
206  /// make the image exactly cover the aperture; disregards
207  /// existing attribute value of pixelAspectRatio
208  ///
209  ///
210  /// | ||
211  /// | -- | -- |
212  /// | Declaration | `uniform token aspectRatioConformPolicy = "expandAperture"` |
213  /// | C++ Type | TfToken |
214  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
215  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
216  /// | \ref UsdRenderTokens "Allowed Values" | expandAperture, cropAperture, adjustApertureWidth, adjustApertureHeight, adjustPixelAspectRatio |
219 
220  /// See GetAspectRatioConformPolicyAttr(), and also
221  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
222  /// If specified, author \p defaultValue as the attribute's default,
223  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
224  /// the default for \p writeSparsely is \c false.
226  UsdAttribute CreateAspectRatioConformPolicyAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
227 
228 public:
229  // --------------------------------------------------------------------- //
230  // DATAWINDOWNDC
231  // --------------------------------------------------------------------- //
232  /// dataWindowNDC specifies the axis-aligned rectangular
233  /// region in the adjusted aperture window within which the renderer
234  /// should produce data.
235  ///
236  /// It is specified as (xmin, ymin, xmax, ymax) in normalized
237  /// device coordinates, where the range 0 to 1 corresponds to the
238  /// aperture. (0,0) corresponds to the bottom-left
239  /// corner and (1,1) corresponds to the upper-right corner.
240  ///
241  /// Specifying a window outside the unit square will produce
242  /// overscan data. Specifying a window that does not cover the unit
243  /// square will produce a cropped render.
244  ///
245  /// A pixel is included in the rendered result if the pixel
246  /// center is contained by the data window. This is consistent
247  /// with standard rules used by polygon rasterization engines.
248  /// \ref UsdRenderRasterization
249  ///
250  /// The data window is expressed in NDC so that cropping and
251  /// overscan may be resolution independent. In interactive
252  /// workflows, incremental cropping and resolution adjustment
253  /// may be intermixed to isolate and examine parts of the scene.
254  /// In compositing workflows, overscan may be used to support
255  /// image post-processing kernels, and reduced-resolution proxy
256  /// renders may be used for faster iteration.
257  ///
258  /// The dataWindow:ndc coordinate system references the
259  /// aperture after any adjustments required by
260  /// aspectRatioConformPolicy.
261  ///
262  ///
263  /// | ||
264  /// | -- | -- |
265  /// | Declaration | `uniform float4 dataWindowNDC = (0, 0, 1, 1)` |
266  /// | C++ Type | GfVec4f |
267  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float4 |
268  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
271 
272  /// See GetDataWindowNDCAttr(), and also
273  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
274  /// If specified, author \p defaultValue as the attribute's default,
275  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
276  /// the default for \p writeSparsely is \c false.
278  UsdAttribute CreateDataWindowNDCAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
279 
280 public:
281  // --------------------------------------------------------------------- //
282  // INSTANTANEOUSSHUTTER
283  // --------------------------------------------------------------------- //
284  /// Deprecated - use disableMotionBlur instead. Override
285  /// the targeted _camera_'s _shutterClose_ to be equal to the
286  /// value of its _shutterOpen_, to produce a zero-width shutter
287  /// interval. This gives us a convenient way to disable motion
288  /// blur.
289  ///
290  /// | ||
291  /// | -- | -- |
292  /// | Declaration | `uniform bool instantaneousShutter = 0` |
293  /// | C++ Type | bool |
294  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
295  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
298 
299  /// See GetInstantaneousShutterAttr(), and also
300  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
301  /// If specified, author \p defaultValue as the attribute's default,
302  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
303  /// the default for \p writeSparsely is \c false.
305  UsdAttribute CreateInstantaneousShutterAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
306 
307 public:
308  // --------------------------------------------------------------------- //
309  // DISABLEMOTIONBLUR
310  // --------------------------------------------------------------------- //
311  /// Disable all motion blur by setting the shutter interval
312  /// of the targeted camera to [0,0] - that is, take only one sample,
313  /// namely at the current time code.
314  ///
315  /// | ||
316  /// | -- | -- |
317  /// | Declaration | `uniform bool disableMotionBlur = 0` |
318  /// | C++ Type | bool |
319  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
320  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
323 
324  /// See GetDisableMotionBlurAttr(), and also
325  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
326  /// If specified, author \p defaultValue as the attribute's default,
327  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
328  /// the default for \p writeSparsely is \c false.
330  UsdAttribute CreateDisableMotionBlurAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
331 
332 public:
333  // --------------------------------------------------------------------- //
334  // CAMERA
335  // --------------------------------------------------------------------- //
336  /// The _camera_ relationship specifies the primary
337  /// camera to use in a render. It must target a UsdGeomCamera.
338  ///
341 
342  /// See GetCameraRel(), and also
343  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
346 
347 public:
348  // ===================================================================== //
349  // Feel free to add custom code below this line, it will be preserved by
350  // the code generator.
351  //
352  // Just remember to:
353  // - Close the class declaration with };
354  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
355  // - Close the include guard with #endif
356  // ===================================================================== //
357  // --(BEGIN CUSTOM CODE)--
358 };
359 
361 
362 #endif
#define USDRENDER_API
Definition: api.h:40
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDRENDER_API UsdRelationship CreateCameraRel() const
USDRENDER_API UsdAttribute CreateAspectRatioConformPolicyAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdAttribute GetDisableMotionBlurAttr() const
UsdSchemaKind
Definition: common.h:127
USDRENDER_API UsdAttribute GetAspectRatioConformPolicyAttr() const
USDRENDER_API UsdAttribute GetDataWindowNDCAttr() const
static USDRENDER_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDRENDER_API UsdRelationship GetCameraRel() const
static USDRENDER_API UsdRenderSettingsBase Get(const UsdStagePtr &stage, const SdfPath &path)
Definition: prim.h:132
USDRENDER_API UsdAttribute CreateInstantaneousShutterAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: typed.h:47
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDRENDER_API UsdAttribute CreatePixelAspectRatioAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: path.h:290
USDRENDER_API UsdSchemaKind _GetSchemaKind() const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
USDRENDER_API UsdAttribute GetPixelAspectRatioAttr() const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Represents a non-concrete typed schema.
Definition: type.h:64
USDRENDER_API UsdAttribute CreateResolutionAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdAttribute GetResolutionAttr() const
USDRENDER_API UsdAttribute CreateDataWindowNDCAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdAttribute GetInstantaneousShutterAttr() const
USDRENDER_API UsdAttribute CreateDisableMotionBlurAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdRenderSettingsBase(const UsdPrim &prim=UsdPrim())
Definition: settingsBase.h:76
virtual USDRENDER_API ~UsdRenderSettingsBase()
Destructor.
Definition: value.h:166
static const UsdSchemaKind schemaKind
Definition: settingsBase.h:70
UsdRenderSettingsBase(const UsdSchemaBase &schemaObj)
Definition: settingsBase.h:84