Loading...
Searching...
No Matches
camera.h
1//
2// Copyright 2019 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 EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
25#define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
26
27#include "pxr/pxr.h"
28#include "hdPrman/api.h"
29#include "hdPrman/renderParam.h"
30#include "pxr/imaging/hd/camera.h"
31#include "pxr/imaging/hd/timeSampleArray.h"
32
33#include "pxr/base/vt/array.h"
34
35#include <optional>
36
37PXR_NAMESPACE_OPEN_SCOPE
38
39class HdSceneDelegate;
40
49class HdPrmanCamera final : public HdCamera
50{
51public:
56 {
57 std::optional<float> shutterOpenTime;
58 std::optional<float> shutterCloseTime;
59 std::optional<std::array<float, 8>> shutteropening;
60 };
61
62 HDPRMAN_API
63 HdPrmanCamera(SdfPath const& id);
64
65 HDPRMAN_API
66 ~HdPrmanCamera() override;
67
69 HDPRMAN_API
70 void Sync(HdSceneDelegate *sceneDelegate,
71 HdRenderParam *renderParam,
72 HdDirtyBits *dirtyBits) override;
73
75 HDPRMAN_API
78 return _sampleXforms;
79 }
80
81#if HD_API_VERSION < 52
82 float GetLensDistortionK1() const {
83 return _lensDistortionK1;
84 }
85
86 float GetLensDistortionK2() const {
87 return _lensDistortionK2;
88 }
89
90 const GfVec2f &GetLensDistortionCenter() const {
91 return _lensDistortionCenter;
92 }
93
94 float GetLensDistortionAnaSq() const {
95 return _lensDistortionAnaSq;
96 }
97
98 const GfVec2f &GetLensDistortionAsym() const {
99 return _lensDistortionAsym;
100 }
101
102 float GetLensDistortionScale() const {
103 return _lensDistortionScale;
104 }
105#endif
106
141 return _shutterCurve;
142 }
143
144 float GetApertureAngle() const {
145 return _apertureAngle;
146 }
147
148 float GetApertureDensity() const {
149 return _apertureAngle;
150 }
151
152 float GetApertureNSides() const {
153 return _apertureNSides;
154 }
155
156 float GetApertureRoundness() const {
157 return _apertureRoundness;
158 }
159
160private:
162
163#if HD_API_VERSION < 52
164 float _lensDistortionK1;
165 float _lensDistortionK2;
166 GfVec2f _lensDistortionCenter;
167 float _lensDistortionAnaSq;
168 GfVec2f _lensDistortionAsym;
169 float _lensDistortionScale;
170#endif
171
182 ShutterCurve _shutterCurve;
183
184 float _apertureAngle;
185 float _apertureDensity;
186 int _apertureNSides;
187 float _apertureRoundness;
188};
189
190
191PXR_NAMESPACE_CLOSE_SCOPE
192
193#endif // EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
Basic type for a vector of 2 float components.
Definition: vec2f.h:63
Hydra schema for a camera that pulls the params (see above) during Sync.
Definition: camera.h:104
A representation for cameras that pulls on camera parameters used by Riley cameras.
Definition: camera.h:50
HDPRMAN_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Synchronizes state from the delegate to this object.
HDPRMAN_API HdTimeSampleArray< GfMatrix4d, HDPRMAN_MAX_TIME_SAMPLES > const & GetTimeSampleXforms() const
Returns the time sampled xforms that were queried during Sync.
Definition: camera.h:77
const ShutterCurve & GetShutterCurve() const
Get the shutter curve of the camera.
Definition: camera.h:140
See GetShutterCurve() below for a description of what these values represent.
Definition: camera.h:56
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
An array of a value sampled over time, in struct-of-arrays layout.