HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cameraSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 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 ////////////////////////////////////////////////////////////////////////
25 // This file is generated by a script. Do not edit directly. Edit the
26 // schema.template.h file to make changes.
27 
28 #ifndef PXR_IMAGING_HD_CAMERA_SCHEMA_H
29 #define PXR_IMAGING_HD_CAMERA_SCHEMA_H
30 
31 #include "pxr/imaging/hd/api.h"
32 
33 #include "pxr/imaging/hd/schema.h"
34 
36 
37 //-----------------------------------------------------------------------------
38 
39 #define HDCAMERA_SCHEMA_TOKENS \
40  (camera) \
41  (projection) \
42  (horizontalAperture) \
43  (verticalAperture) \
44  (horizontalApertureOffset) \
45  (verticalApertureOffset) \
46  (focalLength) \
47  (clippingRange) \
48  (perspective) \
49  (orthographic) \
50 
51 TF_DECLARE_PUBLIC_TOKENS(HdCameraSchemaTokens, HD_API,
53 
54 //-----------------------------------------------------------------------------
55 
56 class HdCameraSchema : public HdSchema
57 {
58 public:
59  HdCameraSchema(HdContainerDataSourceHandle container)
60  : HdSchema(container) {}
61 
62  //ACCESSORS
63 
64  HD_API
66  HD_API
68  HD_API
70  HD_API
72  HD_API
74  HD_API
76  HD_API
78 
79  // RETRIEVING AND CONSTRUCTING
80 
81  /// Builds a container data source which includes the provided child data
82  /// sources. Parameters with nullptr values are excluded. This is a
83  /// low-level interface. For cases in which it's desired to define
84  /// the container with a sparse set of child fields, the Builder class
85  /// is often more convenient and readable.
86  HD_API
87  static HdContainerDataSourceHandle
89  const HdTokenDataSourceHandle &projection,
90  const HdFloatDataSourceHandle &horizontalAperture,
91  const HdFloatDataSourceHandle &verticalAperture,
92  const HdFloatDataSourceHandle &horizontalApertureOffset,
93  const HdFloatDataSourceHandle &verticalApertureOffset,
94  const HdFloatDataSourceHandle &focalLength,
95  const HdVec2fDataSourceHandle &clippingRange
96  );
97 
98  /// \class HdCameraSchema::Builder
99  ///
100  /// Utility class for setting sparse sets of child data source fields to be
101  /// filled as arguments into BuildRetained. Because all setter methods
102  /// return a reference to the instance, this can be used in the "builder
103  /// pattern" form.
104  class Builder
105  {
106  public:
107  HD_API
109  const HdTokenDataSourceHandle &projection);
110  HD_API
112  const HdFloatDataSourceHandle &horizontalAperture);
113  HD_API
115  const HdFloatDataSourceHandle &verticalAperture);
116  HD_API
118  const HdFloatDataSourceHandle &horizontalApertureOffset);
119  HD_API
121  const HdFloatDataSourceHandle &verticalApertureOffset);
122  HD_API
124  const HdFloatDataSourceHandle &focalLength);
125  HD_API
127  const HdVec2fDataSourceHandle &clippingRange);
128 
129  /// Returns a container data source containing the members set thus far.
130  HD_API
131  HdContainerDataSourceHandle Build();
132 
133  private:
134  HdTokenDataSourceHandle _projection;
135  HdFloatDataSourceHandle _horizontalAperture;
136  HdFloatDataSourceHandle _verticalAperture;
137  HdFloatDataSourceHandle _horizontalApertureOffset;
138  HdFloatDataSourceHandle _verticalApertureOffset;
139  HdFloatDataSourceHandle _focalLength;
140  HdVec2fDataSourceHandle _clippingRange;
141  };
142 
143  /// Retrieves a container data source with the schema's default name token
144  /// "camera" from the parent container and constructs a
145  /// HdCameraSchema instance.
146  /// Because the requested container data source may not exist, the result
147  /// should be checked with IsDefined() or a bool comparison before use.
148  HD_API
150  const HdContainerDataSourceHandle &fromParentContainer);
151 
152  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
153  /// where the container representing this schema is found by default.
154  HD_API
155  static const HdDataSourceLocator &GetDefaultLocator();
156 
157  /// Returns token data source for use as projection value.
158  /// Values of...
159  /// - HdCameraSchemaTokens->perspective
160  /// - HdCameraSchemaTokens->orthographic
161  /// ...will be stored statically and reused for future calls.
162  HD_API
164  const TfToken &projection);
165 
166 };
167 
169 
170 #endif
HD_API HdFloatDataSourceHandle GetHorizontalAperture()
HdFloatDataSource::Handle HdFloatDataSourceHandle
static HD_API HdTokenDataSourceHandle BuildProjectionDataSource(const TfToken &projection)
static HD_API HdContainerDataSourceHandle BuildRetained(const HdTokenDataSourceHandle &projection, const HdFloatDataSourceHandle &horizontalAperture, const HdFloatDataSourceHandle &verticalAperture, const HdFloatDataSourceHandle &horizontalApertureOffset, const HdFloatDataSourceHandle &verticalApertureOffset, const HdFloatDataSourceHandle &focalLength, const HdVec2fDataSourceHandle &clippingRange)
#define HD_API
Definition: api.h:40
HD_API HdVec2fDataSourceHandle GetClippingRange()
HD_API HdFloatDataSourceHandle GetVerticalApertureOffset()
static HD_API const HdDataSourceLocator & GetDefaultLocator()
Definition: token.h:87
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HD_API Builder & SetProjection(const HdTokenDataSourceHandle &projection)
HD_API Builder & SetFocalLength(const HdFloatDataSourceHandle &focalLength)
HdVec2fDataSource::Handle HdVec2fDataSourceHandle
HdCameraSchema(HdContainerDataSourceHandle container)
Definition: cameraSchema.h:59
static HD_API HdCameraSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
HD_API Builder & SetClippingRange(const HdVec2fDataSourceHandle &clippingRange)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
TF_DECLARE_PUBLIC_TOKENS(HdCameraSchemaTokens, HD_API, HDCAMERA_SCHEMA_TOKENS)
HD_API Builder & SetVerticalApertureOffset(const HdFloatDataSourceHandle &verticalApertureOffset)
HD_API HdTokenDataSourceHandle GetProjection()
HD_API HdFloatDataSourceHandle GetVerticalAperture()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
HD_API HdFloatDataSourceHandle GetFocalLength()
#define HDCAMERA_SCHEMA_TOKENS
Definition: cameraSchema.h:39
HD_API Builder & SetVerticalAperture(const HdFloatDataSourceHandle &verticalAperture)
HdTokenDataSource::Handle HdTokenDataSourceHandle
HD_API Builder & SetHorizontalApertureOffset(const HdFloatDataSourceHandle &horizontalApertureOffset)
HD_API Builder & SetHorizontalAperture(const HdFloatDataSourceHandle &horizontalAperture)
HD_API HdFloatDataSourceHandle GetHorizontalApertureOffset()