56 HdDirtyBits *dirtyBits)
58 if (*dirtyBits == DirtyBits::Clean) {
62 const SdfPath &
id = GetId();
63 const HdSceneIndexPrim prim =
GetPrim(sceneDelegate,
id);
64 const HdContainerDataSourceHandle &primDs = prim.dataSource;
66 HdCameraSchema cameraSchema = HdCameraSchema::GetFromParent(primDs);
67 HdContainerDataSourceHandle cameraDs = cameraSchema.GetContainer();
71 float shutterOpen = 0.0f;
72 float shutterClose = 0.0f;
73 if (
auto ds = cameraSchema.GetShutterOpen()) {
74 shutterOpen =
float(ds->GetTypedValue(0.0f));
76 if (
auto ds = cameraSchema.GetShutterClose()) {
77 shutterClose =
float(ds->GetTypedValue(0.0f));
80 if (*dirtyBits & DirtyBits::DirtyTransform) {
81 HdXformSchema xformSchema = HdXformSchema::GetFromParent(primDs);
82 if (
auto matrixDs = xformSchema.GetMatrix()) {
84 bool transform_found =
false;
85 for (
size_t i = 0; i < _transformSamples.count; ++i) {
86 if (_transformSamples.times[i] == 0.0f) {
87 _transform = _transformSamples.values[i];
88 _data.SetTransform(_transform);
89 transform_found =
true;
93 if (!transform_found && _transformSamples.count) {
94 _transform = _transformSamples.values[0];
95 _data.SetTransform(_transform);
100 if (*dirtyBits & DirtyBits::DirtyWindowPolicy) {
105 if (*dirtyBits & DirtyBits::DirtyClipPlanes) {
106 if (
auto ds = cameraSchema.GetClippingPlanes()) {
107 const VtArray<GfVec4d> clipPlanes = ds->GetTypedValue(0.0f);
108 _clipPlanes.assign(clipPlanes.cbegin(), clipPlanes.cend());
112 if (*dirtyBits & DirtyBits::DirtyParams) {
113 if (
auto ds = cameraSchema.GetProjection()) {
114 const TfToken projection = ds->GetTypedValue(0.0f);
115 _projection = (projection == HdCameraSchemaTokens->orthographic) ? Orthographic :
117 _data.SetProjection(_projection != Orthographic ? GfCamera::Perspective :
118 GfCamera::Orthographic);
121 if (
auto ds = cameraSchema.GetHorizontalAperture()) {
122 const float horizontalAperture = ds->GetTypedValue(0.0f);
123 _horizontalAperture = horizontalAperture;
124 _data.SetHorizontalAperture(horizontalAperture / GfCamera::APERTURE_UNIT);
127 if (
auto ds = cameraSchema.GetVerticalAperture()) {
128 const float verticalAperture = ds->GetTypedValue(0.0f);
129 _verticalAperture = verticalAperture;
130 _data.SetVerticalAperture(verticalAperture / GfCamera::APERTURE_UNIT);
133 if (
auto ds = cameraSchema.GetHorizontalApertureOffset()) {
134 const float horizontalApertureOffset = ds->GetTypedValue(0.0f);
135 _horizontalApertureOffset = horizontalApertureOffset;
136 _data.SetHorizontalApertureOffset(horizontalApertureOffset / GfCamera::APERTURE_UNIT);
139 if (
auto ds = cameraSchema.GetVerticalApertureOffset()) {
140 const float verticalApertureOffset = ds->GetTypedValue(0.0f);
141 _verticalApertureOffset = verticalApertureOffset;
142 _data.SetVerticalApertureOffset(verticalApertureOffset / GfCamera::APERTURE_UNIT);
145 if (
auto ds = cameraSchema.GetFocalLength()) {
146 const float focalLength = ds->GetTypedValue(0.0f);
147 _focalLength = focalLength;
148 _data.SetFocalLength(focalLength / GfCamera::FOCAL_LENGTH_UNIT);
151 if (
auto ds = cameraSchema.GetClippingRange()) {
152 const GfVec2f range = ds->GetTypedValue(0.0f);
153 const GfRange1f clippingRange(range[0], range[1]);
154 _clippingRange = clippingRange;
155 _data.SetClippingRange(clippingRange);
158 if (
auto ds = cameraSchema.GetFStop()) {
159 const float fStop = ds->GetTypedValue(0.0f);
161 _data.SetFStop(fStop);
164 if (
auto ds = cameraSchema.GetFocusDistance()) {
165 const float focusDistance = ds->GetTypedValue(0.0f);
166 _focusDistance = focusDistance;
167 _data.SetFocusDistance(focusDistance);
171 *dirtyBits = DirtyBits::Clean;