7#ifndef EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
8#define EXT_RMANPKG_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_CAMERA_H
10#include "hdPrman/api.h"
11#include "hdPrman/cameraContext.h"
12#include "hdPrman/renderParam.h"
14#include "pxr/imaging/hd/camera.h"
15#include "pxr/imaging/hd/renderDelegate.h"
16#include "pxr/imaging/hd/timeSampleArray.h"
17#include "pxr/imaging/hd/types.h"
18#include "pxr/imaging/hd/version.h"
20#include "pxr/usd/sdf/path.h"
30#include <RiTypesHelper.h>
37PXR_NAMESPACE_OPEN_SCOPE
57 std::optional<float> shutterOpenTime;
58 std::optional<float> shutterCloseTime;
59 std::optional<std::array<float, 8>> shutteropening;
81 HdCamera::Projection projection,
82 const RtUString& projectionOverride);
87 HdCamera::Projection projection,
88 const RtUString&& projectionOverride) =
delete;
98 HdDirtyBits *dirtyBits)
override;
104 riley::CameraId GetRileyCameraId()
const;
107 RtUString GetRileyCameraName()
const;
115 HdPrman_RenderParam* param,
116 const HdPrman_CameraContext::ActiveCameraOverlay& overlay);
138 HdPrman_RenderParam* param,
139 const HdPrman_CameraContext::ActiveCameraOverlay& overlay);
145 return _sampleXforms;
149 GetProjectionNode()
const {
150 return _projectionNode;
153#if HD_API_VERSION < 52
154 float GetLensDistortionK1()
const {
155 return _lensDistortionK1;
158 float GetLensDistortionK2()
const {
159 return _lensDistortionK2;
162 const GfVec2f &GetLensDistortionCenter()
const {
163 return _lensDistortionCenter;
166 float GetLensDistortionAnaSq()
const {
167 return _lensDistortionAnaSq;
170 const GfVec2f &GetLensDistortionAsym()
const {
171 return _lensDistortionAsym;
174 float GetLensDistortionScale()
const {
175 return _lensDistortionScale;
213 return _shutterCurve;
220 RtParamList& camParamsOverride,
221 RtParamList& projParams)
const;
223 float GetApertureAngle()
const {
224 return _apertureAngle;
227 float GetApertureDensity()
const {
228 return _apertureDensity;
231 int GetApertureNSides()
const {
232 return _apertureNSides;
235 float GetApertureRoundness()
const {
236 return _apertureRoundness;
239 float GetDofMult()
const {
245 void setFov(RtParamList& projParams)
const;
247 void setScreenWindow(RtParamList& camParams,
bool isPerspective)
const;
254 bool disableDepthOfField,
255 const RtUString& projectionNameOverride,
256 const RtParamList& projectionParamsOverride);
260 void _UpdateClipPlanes(riley::Riley* riley);
264 void _DeleteClipPlanes(riley::Riley* riley);
267 _GetScreenWindow()
const;
273 _ConformScreenWindow(
274 const HdPrman_CameraContext::ActiveCameraOverlay& overlay)
const;
277 _ComputeCameraParams(
const GfRange2d & screenWindow)
const;
281 bool disableDepthOfField,
282 const RtUString & projectionOverride)
const;
285 _ComputePerspectiveNodeParams(
bool disableDepthOfField)
const;
288 _ComputeOrthographicNodeParams()
const;
292#if HD_API_VERSION < 52
293 float _lensDistortionK1;
294 float _lensDistortionK2;
296 float _lensDistortionAnaSq;
298 float _lensDistortionScale;
311 ShutterCurve _shutterCurve;
313 float _apertureAngle;
314 float _apertureDensity;
316 float _apertureRoundness;
321 riley::ShadingNode _projectionNode;
323 riley::CameraId _rileyCameraId;
324 RtUString _rileyCameraName;
325 std::vector<riley::ClippingPlaneId> _rileyClipPlaneIds;
328 mutable std::mutex _rileyCameraMutex;
332PXR_NAMESPACE_CLOSE_SCOPE
Basic type: 2-dimensional floating point range.
Basic type for a vector of 2 float components.
Hydra schema for a camera that pulls the params (see above) during Sync.
A representation for cameras that pulls on camera parameters used by Riley cameras.
static const RtUString & ComputeProjectionShader(HdCamera::Projection projection, const RtUString &&projectionOverride)=delete
projectionOverride may be returned by reference, so binding it to a temporary would dangle.
HDPRMAN_API void RecommitRileyCameraForActive(HdPrman_RenderParam *param, const HdPrman_CameraContext::ActiveCameraOverlay &overlay)
Re-commit this camera's riley camera under the given overlay, and nothing else.
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...
static HDPRMAN_API const RtUString & ComputeProjectionShader(HdCamera::Projection projection, const RtUString &projectionOverride)
The riley projection shader name to use for the given projection.
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.
HDPRMAN_API void UpdateRileyCameraForActive(HdPrman_RenderParam *param, const HdPrman_CameraContext::ActiveCameraOverlay &overlay)
Apply the active camera opinions overlay to this camera's riley camera.
const ShutterCurve & GetShutterCurve() const
Get the shutter curve of the camera.
static HDPRMAN_API const RtUString & ProjectionNodeName()
The riley projection shading-node handle name ("cam_projection").
HDPRMAN_API void Finalize(HdRenderParam *renderParam) override
Finalizes object resources.
HDPRMAN_API void UpdateRileyCameraForInactive(HdPrman_RenderParam *param)
Remove the active camera opinions overlay from this camera's riley camera.
See GetShutterCurve() below for a description of what these values represent.
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.
A map with string keys and VtValue values.
An array of a value sampled over time, in struct-of-arrays layout.