-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfvpDataProducerSceneIndexInterface.h
95 lines (86 loc) · 5.61 KB
/
fvpDataProducerSceneIndexInterface.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
//
// 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_DATA_PRODUCER_SCENE_INDEX_INTERFACE_H
#define FLOW_VIEWPORT_API_DATA_PRODUCER_SCENE_INDEX_INTERFACE_H
//Local headers
#include "flowViewport/api.h"
#include "flowViewport/API/fvpViewportAPITokens.h"
//Hydra headers
#include <pxr/imaging/hd/sceneIndex.h>
namespace FVP_NS_DEF
{
/**
* Interface to manage data producer scene indices in a Hydra viewport. A data producer scene index is a scene index that adds primitives to the current rendering.
* These new primitives are created without the need of a DCC object or a USD stage.
* To get an instance of the DataProducerSceneIndexInterface class, please use :
* Fvp::DataProducerSceneIndexInterface& dataProducerSceneIndexInterface = Fvp::DataProducerSceneIndexInterface::get();
*/
class DataProducerSceneIndexInterface
{
public:
/// Interface accessor
static FVP_API DataProducerSceneIndexInterface& get();
/**
* @brief Adds a custom data producer scene index.
*
* Adds a custom data producer scene index and associate it to be used in the same rendering as the hydra viewport whose identifier is hydraViewportId
* (or all hydra viewports if hydraViewportId is PXR_NS::FvpViewportAPITokens->allViewports).
* Basically, we merge this scene index with the others scene indices from the viewport which are the usd stages, the DCC native
* data and any others custom data producer scene indices like this one.
*
* @param[in] customDataProducerSceneIndex is the custom scene index to add.
*
* @param[in] preFix is the prefix you want to add to your data producer scene index primitives.
* If you don't want any prefix, pass SdfPath::AbsoluteRootPath() to this parameter.
*
* @param[in] dccNode is a MObject* from a DAG node for Maya, if you provide the pointer value, then we automatically track some events such as transform
* or visibility updated and we hide automatically the primitives from the data producer scene index.
* If it is a nullptr, we won't do anything if the node's attributes changes.
* Basically, this is a way for you to set the DCC node as a parent node for all your primitives from the scene index.
*
* @param[in] hydraViewportId is a Hydra viewport string identifier to which customDataProducerSceneIndex needs to be associated to.
* Set it to PXR_NS::FvpViewportAPITokens->allViewports to add this data producer scene index to all viewports.
* To retrieve a specific hydra viewport identifier, please use the InformationInterface class.
*
* @param[in] rendererNames : are the Hydra renderer names to which this scene index should be added.
* This is only used when hydraViewportId is set to PXR_NS::FvpViewportAPITokens->allViewports, meaning you want to add this scene index to all viewports
* that are using these renderers.
* To apply to multiple renderers, use a separator such as ",". E.g : "GL, Arnold". We are actually looking for the render delegate's name in this string.
* Set this parameter to PXR_NS::FvpViewportAPITokens->allRenderers to add your scene index to all viewports whatever their renderer is.
*
* @return true if the operation succeeded, false otherwise.
*/
virtual bool addDataProducerSceneIndex(const PXR_NS::HdSceneIndexBaseRefPtr& customDataProducerSceneIndex,
const PXR_NS::SdfPath& preFix,
void* dccNode = nullptr,
const std::string& hydraViewportId = PXR_NS::FvpViewportAPITokens->allViewports,
const std::string& rendererNames = PXR_NS::FvpViewportAPITokens->allRenderers
) = 0;
/**
* @brief Removes a custom data producer scene index.
*
* Removes a custom data producer scene index, this scene index will not participate any more to the rendering of the given viewport(s).
*
* @param[in] customDataProducerSceneIndex is the custom scene index to remove.
*
* @param[in] hydraViewportId is the hydra viewport string identifier to which customDataProducerSceneIndex was associated to.
*/
virtual void removeViewportDataProducerSceneIndex(const PXR_NS::HdSceneIndexBaseRefPtr& customDataProducerSceneIndex,
const std::string& hydraViewportId = PXR_NS::FvpViewportAPITokens->allViewports
) = 0;
};
}//end of namespace FVP_NS_DEF
#endif //FLOW_VIEWPORT_API_DATA_PRODUCER_SCENE_INDEX_INTERFACE_H