Loading...
Searching...
No Matches
freeCameraSceneDelegate.h
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
14#include "pxr/imaging/hd/sceneDelegate.h"
15#include "pxr/base/gf/camera.h"
16#include "pxr/imaging/cameraUtil/conformWindow.h"
17
18PXR_NAMESPACE_OPEN_SCOPE
19
26{
27public:
30 HDX_API
32 SdfPath const &delegateId);
33
34 HDX_API
36
39 const SdfPath &GetCameraId() const {
40 return _cameraId;
41 }
42
44 HDX_API
45 void SetCamera(const GfCamera &camera);
47 HDX_API
48 void SetWindowPolicy(CameraUtilConformWindowPolicy policy);
49
52 HDX_API
53 void SetMatrices(GfMatrix4d const &viewMatrix,
54 GfMatrix4d const &projMatrix);
55
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
67private:
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.
77 CameraUtilConformWindowPolicy _policy;
78};
79
80PXR_NAMESPACE_CLOSE_SCOPE
81
82#endif // PXR_IMAGING_HDX_FREE_CAMERA_SCENE_DELEGATE_H
Object-based representation of a camera.
Definition: camera.h:33
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
Adapter class providing data exchange with the client scene graph.
A simple scene delegate adding a camera prim to the given render index.
HDX_API VtValue GetCameraParamValue(SdfPath const &id, TfToken const &key) override
Returns a single value for a given camera and parameter.
HDX_API GfMatrix4d GetTransform(SdfPath const &id) override
Returns the object space transform, including all parent transforms.
HDX_API void SetCamera(const GfCamera &camera)
Set state of camera from GfCamera.
HDX_API void SetWindowPolicy(CameraUtilConformWindowPolicy policy)
Set window policy of camera.
HDX_API void SetMatrices(GfMatrix4d const &viewMatrix, GfMatrix4d const &projMatrix)
For transition, set camera state from OpenGL-style view and projection matrix.
const SdfPath & GetCameraId() const
Path of added camera (in render index).
HDX_API HdxFreeCameraSceneDelegate(HdRenderIndex *renderIndex, SdfPath const &delegateId)
Constructs delegate and adds camera to render index if cameras are supported by render delegate.
HDX_API void SetClipPlanes(std::vector< GfVec4f > const &clipPlanes)
For transition, set clip planes for camera. GfCamera is preferred.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:90