HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
freeCameraSceneDelegate.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HDX_FREE_CAMERA_SCENE_DELEGATE_H
8 #define PXR_IMAGING_HDX_FREE_CAMERA_SCENE_DELEGATE_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/imaging/hdx/api.h"
13 
15 #include "pxr/base/gf/camera.h"
17 
19 
20 /// \class HdxFreeCameraSceneDelegate
21 ///
22 /// A simple scene delegate adding a camera prim to the given
23 /// render index.
24 ///
26 {
27 public:
28  /// Constructs delegate and adds camera to render index if
29  /// cameras are supported by render delegate.
30  HDX_API
32  SdfPath const &delegateId);
33 
34  HDX_API
35  ~HdxFreeCameraSceneDelegate() override;
36 
37  /// Path of added camera (in render index). Empty if cameras are not
38  /// supported by render delegate.
39  const SdfPath &GetCameraId() const {
40  return _cameraId;
41  }
42 
43  /// Set state of camera from GfCamera.
44  HDX_API
45  void SetCamera(const GfCamera &camera);
46  /// Set window policy of camera.
47  HDX_API
49 
50  /// For transition, set camera state from OpenGL-style
51  /// view and projection matrix. GfCamera is preferred.
52  HDX_API
53  void SetMatrices(GfMatrix4d const &viewMatrix,
54  GfMatrix4d const &projMatrix);
55 
56  /// For transition, set clip planes for camera. GfCamera is preferred.
57  HDX_API
58  void SetClipPlanes(std::vector<GfVec4f> const &clipPlanes);
59 
60  // HdSceneDelegate interface
61  HDX_API
62  GfMatrix4d GetTransform(SdfPath const &id) override;
63  HDX_API
65  TfToken const &key) override;
66 
67 private:
68  // Mark camera dirty in render index.
69  void _MarkDirty(HdDirtyBits bits);
70 
71  // Path of camera in render index.
72  const SdfPath _cameraId;
73 
74  // State of camera
75  GfCamera _camera;
76  // Window policy of camera.
78 };
79 
81 
82 #endif // PXR_IMAGING_HDX_FREE_CAMERA_SCENE_DELEGATE_H
HDX_API ~HdxFreeCameraSceneDelegate() override
const SdfPath & GetCameraId() const
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
Object-based representation of a camera.
Definition: camera.h:32
uint32_t HdDirtyBits
Definition: types.h:143
#define HDX_API
Definition: api.h:23
Definition: token.h:70
HDX_API void SetClipPlanes(std::vector< GfVec4f > const &clipPlanes)
For transition, set clip planes for camera. GfCamera is preferred.
HDX_API void SetCamera(const GfCamera &camera)
Set state of camera from GfCamera.
HDX_API GfMatrix4d GetTransform(SdfPath const &id) override
Returns the object space transform, including all parent transforms.
Definition: path.h:273
HDX_API void SetMatrices(GfMatrix4d const &viewMatrix, GfMatrix4d const &projMatrix)
HDX_API VtValue GetCameraParamValue(SdfPath const &id, TfToken const &key) override
CameraUtilConformWindowPolicy
Definition: conformWindow.h:27
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HDX_API void SetWindowPolicy(CameraUtilConformWindowPolicy policy)
Set window policy of camera.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: value.h:146
HDX_API HdxFreeCameraSceneDelegate(HdRenderIndex *renderIndex, SdfPath const &delegateId)