Loading...
Searching...
No Matches
camera.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
8#define EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
9
10#include "pxr/pxr.h"
11#include "hdPrman/api.h"
12#include "hdPrman/renderParam.h"
13#include "pxr/imaging/hd/camera.h"
14#include "pxr/imaging/hd/timeSampleArray.h"
15
16#include "pxr/base/vt/array.h"
17
18#include <optional>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22class HdSceneDelegate;
23
32class HdPrmanCamera final : public HdCamera
33{
34public:
39 {
40 std::optional<float> shutterOpenTime;
41 std::optional<float> shutterCloseTime;
42 std::optional<std::array<float, 8>> shutteropening;
43 };
44
45 HDPRMAN_API
46 HdPrmanCamera(SdfPath const& id);
47
48 HDPRMAN_API
49 ~HdPrmanCamera() override;
50
52 HDPRMAN_API
53 void Sync(HdSceneDelegate *sceneDelegate,
54 HdRenderParam *renderParam,
55 HdDirtyBits *dirtyBits) override;
56
58 HDPRMAN_API
61 return _sampleXforms;
62 }
63
64#if HD_API_VERSION < 52
65 float GetLensDistortionK1() const {
66 return _lensDistortionK1;
67 }
68
69 float GetLensDistortionK2() const {
70 return _lensDistortionK2;
71 }
72
73 const GfVec2f &GetLensDistortionCenter() const {
74 return _lensDistortionCenter;
75 }
76
77 float GetLensDistortionAnaSq() const {
78 return _lensDistortionAnaSq;
79 }
80
81 const GfVec2f &GetLensDistortionAsym() const {
82 return _lensDistortionAsym;
83 }
84
85 float GetLensDistortionScale() const {
86 return _lensDistortionScale;
87 }
88#endif
89
124 return _shutterCurve;
125 }
126
129 HDPRMAN_API
130 void SetRileyCameraParams(RtParamList& camParams,
131 RtParamList& camParamsOverride,
132 RtParamList& projParams) const;
133
134 float GetApertureAngle() const {
135 return _apertureAngle;
136 }
137
138 float GetApertureDensity() const {
139 return _apertureDensity;
140 }
141
142 float GetApertureNSides() const {
143 return _apertureNSides;
144 }
145
146 float GetApertureRoundness() const {
147 return _apertureRoundness;
148 }
149
150 float GetDofMult() const {
151 return _dofMult;
152 }
153
154private:
155
156 void setFov(RtParamList& projParams) const;
157
158 void setScreenWindow(RtParamList& camParams, bool isPerspective) const;
159
161
162#if HD_API_VERSION < 52
163 float _lensDistortionK1;
164 float _lensDistortionK2;
165 GfVec2f _lensDistortionCenter;
166 float _lensDistortionAnaSq;
167 GfVec2f _lensDistortionAsym;
168 float _lensDistortionScale;
169#endif
170
181 ShutterCurve _shutterCurve;
182
183 float _apertureAngle;
184 float _apertureDensity;
185 int _apertureNSides;
186 float _apertureRoundness;
187 float _dofMult;
188
189 VtDictionary _params;
190};
191
192
193PXR_NAMESPACE_CLOSE_SCOPE
194
195#endif // EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
Basic type for a vector of 2 float components.
Definition: vec2f.h:46
Hydra schema for a camera that pulls the params (see above) during Sync.
Definition: camera.h:92
A representation for cameras that pulls on camera parameters used by Riley cameras.
Definition: camera.h:33
HDPRMAN_API void SetRileyCameraParams(RtParamList &camParams, RtParamList &camParamsOverride, RtParamList &projParams) const
Sets the camera and projection shader parameters as expected by Riley from the USD physical camera pa...
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:60
const ShutterCurve & GetShutterCurve() const
Get the shutter curve of the camera.
Definition: camera.h:123
See GetShutterCurve() below for a description of what these values represent.
Definition: camera.h:39
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:274
A map with string keys and VtValue values.
Definition: dictionary.h:43
An array of a value sampled over time, in struct-of-arrays layout.