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 <Riley.h>
17
18#include "pxr/base/vt/array.h"
19
20#include <optional>
21
22PXR_NAMESPACE_OPEN_SCOPE
23
24class HdSceneDelegate;
25
34class HdPrmanCamera final : public HdCamera
35{
36public:
41 {
42 std::optional<float> shutterOpenTime;
43 std::optional<float> shutterCloseTime;
44 std::optional<std::array<float, 8>> shutteropening;
45 };
46
47 HDPRMAN_API
48 HdPrmanCamera(SdfPath const& id);
49
50 HDPRMAN_API
51 ~HdPrmanCamera() override;
52
54 HDPRMAN_API
55 void Sync(HdSceneDelegate *sceneDelegate,
56 HdRenderParam *renderParam,
57 HdDirtyBits *dirtyBits) override;
58
60 HDPRMAN_API
63 return _sampleXforms;
64 }
65
66 riley::ShadingNode
67 GetProjectionNode() const {
68 return _projectionNode;
69 }
70
71#if HD_API_VERSION < 52
72 float GetLensDistortionK1() const {
73 return _lensDistortionK1;
74 }
75
76 float GetLensDistortionK2() const {
77 return _lensDistortionK2;
78 }
79
80 const GfVec2f &GetLensDistortionCenter() const {
81 return _lensDistortionCenter;
82 }
83
84 float GetLensDistortionAnaSq() const {
85 return _lensDistortionAnaSq;
86 }
87
88 const GfVec2f &GetLensDistortionAsym() const {
89 return _lensDistortionAsym;
90 }
91
92 float GetLensDistortionScale() const {
93 return _lensDistortionScale;
94 }
95#endif
96
131 return _shutterCurve;
132 }
133
136 HDPRMAN_API
137 void SetRileyCameraParams(RtParamList& camParams,
138 RtParamList& camParamsOverride,
139 RtParamList& projParams) const;
140
141 float GetApertureAngle() const {
142 return _apertureAngle;
143 }
144
145 float GetApertureDensity() const {
146 return _apertureDensity;
147 }
148
149 float GetApertureNSides() const {
150 return _apertureNSides;
151 }
152
153 float GetApertureRoundness() const {
154 return _apertureRoundness;
155 }
156
157 float GetDofMult() const {
158 return _dofMult;
159 }
160
161private:
162
163 void setFov(RtParamList& projParams) const;
164
165 void setScreenWindow(RtParamList& camParams, bool isPerspective) const;
166
168
169#if HD_API_VERSION < 52
170 float _lensDistortionK1;
171 float _lensDistortionK2;
172 GfVec2f _lensDistortionCenter;
173 float _lensDistortionAnaSq;
174 GfVec2f _lensDistortionAsym;
175 float _lensDistortionScale;
176#endif
177
188 ShutterCurve _shutterCurve;
189
190 float _apertureAngle;
191 float _apertureDensity;
192 int _apertureNSides;
193 float _apertureRoundness;
194 float _dofMult;
195
196 VtDictionary _params;
197
198 riley::ShadingNode _projectionNode;
199};
200
201
202PXR_NAMESPACE_CLOSE_SCOPE
203
204#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:35
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:62
const ShutterCurve & GetShutterCurve() const
Get the shutter curve of the camera.
Definition: camera.h:130
See GetShutterCurve() below for a description of what these values represent.
Definition: camera.h:41
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:52
An array of a value sampled over time, in struct-of-arrays layout.