-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfvpInformationInterface.h
105 lines (86 loc) · 4.17 KB
/
fvpInformationInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
// Copyright 2023 Autodesk, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef FLOW_VIEWPORT_API_INFORMATION_INTERFACE_H
#define FLOW_VIEWPORT_API_INFORMATION_INTERFACE_H
//Local headers
#include "flowViewport/api.h"
//Hydra headers
#include <pxr/imaging/hd/sceneIndex.h>
namespace FVP_NS_DEF
{
class InformationClient;//Predeclaration
/*!\class InformationInterface
\brief : interface for a customer to register a callbacks InformationClient to get Hydra viewports information.
* To get an instance of the InformationInterface class, please use :
* Fvp::InformationInterface& informationInterface = Fvp::InformationInterface::Get();
*/
class InformationInterface
{
public:
///Interface accessor
static FVP_API InformationInterface& Get();
///Struct used to store information about a Hydra viewport from the DCC
struct ViewportInformation
{
/// Constructor
ViewportInformation(const std::string& viewportId, const std::string& cameraName)
: _viewportId(viewportId), _cameraName(cameraName) {}
///_viewportId is a Hydra viewport string identifier which is unique for all hydra viewports during a session
std::string _viewportId;
///_cameraName is the name of the camera/viewport when the viewport was created, it is not updated if the camera's name has changed.
std::string _cameraName;
///_rendererName is the Hydra viewport renderer name (example : "GL" for Storm or "Arnold" for the Arnold render delegate)
std::string _rendererName;
ViewportInformation& operator = (const ViewportInformation& other){
_viewportId = other._viewportId;
_cameraName = other._cameraName;
_rendererName = other._rendererName;
return *this;
}
bool operator ==(const ViewportInformation& other)const{
return _viewportId == other._viewportId &&
_cameraName == other._cameraName &&
_rendererName == other._rendererName;
}
bool operator <(const ViewportInformation& other) const{ //to be used in std::set
auto a = {_viewportId, _cameraName, _rendererName};
auto b = {other._viewportId, other._cameraName, other._rendererName};
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
}
};
///Set of InformationInterface::ViewportInformation
typedef std::set<InformationInterface::ViewportInformation> ViewportInformationSet;
/**
* @brief Register a set of callbacks through an InformationClient instance
*
* @param[in] client is the InformationClient.
*/
virtual void RegisterInformationClient(const std::shared_ptr<InformationClient>& client) = 0;
/**
* @brief Unregister an InformationClient instance
*
* @param[in] client is the InformationClient.
*/
virtual void UnregisterInformationClient(const std::shared_ptr<InformationClient>& client)= 0;
/**
* @brief Get the Hydra viewports information.
*
* @param[out] outAllHydraViewportInformation is a set of ViewportInformation to have information about each Hydra viewport in use in the current DCC.
*/
virtual void GetViewportsInformation(ViewportInformationSet& outAllHydraViewportInformation)const = 0;
};
}//end of namespace
#endif //FLOW_VIEWPORT_API_INFORMATION_INTERFACE_H