Loading...
Searching...
No Matches
flattenedDataSourceProvider.h
1//
2// Copyright 2023 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_HD_FLATTENED_DATA_SOURCE_PROVIDER_H
8#define PXR_IMAGING_HD_FLATTENED_DATA_SOURCE_PROVIDER_H
9
10#include "pxr/imaging/hd/api.h"
11
12#include "pxr/imaging/hd/dataSource.h"
13#include "pxr/imaging/hd/retainedDataSource.h"
14#include "pxr/usd/sdf/path.h"
15
16PXR_NAMESPACE_OPEN_SCOPE
17
19using HdFlattenedDataSourceProviderSharedPtr =
20 std::shared_ptr<class HdFlattenedDataSourceProvider>;
21
28class HdFlattenedDataSourceProvider
29{
30public:
31 class Context
32 {
33 public:
34 Context(
35 const HdSceneIndexBase &flatteningSceneIndex,
36 const SdfPath &primPath,
37 const TfToken &name,
38 const HdContainerDataSourceHandle &inputPrimDataSource)
39 : _flatteningSceneIndex(flatteningSceneIndex)
40 , _primPath(primPath)
41 , _name(name)
42 , _inputPrimDataSource(inputPrimDataSource)
43 {
44 }
45
46 // Returns data source of input scene index which is in
47 // the prim container data source.
48 HD_API
49 HdContainerDataSourceHandle GetInputDataSource() const;
50 // Returns flattened data source which is in the flattened
51 // container data source of the parent prim.
52 HD_API
53 HdContainerDataSourceHandle GetFlattenedDataSourceFromParentPrim() const;
54
55 private:
56 const HdSceneIndexBase &_flatteningSceneIndex;
57 const SdfPath &_primPath;
58 const TfToken &_name;
59 const HdContainerDataSourceHandle &_inputPrimDataSource;
60 };
61
62 HD_API
63 virtual ~HdFlattenedDataSourceProvider();
64
66 virtual HdContainerDataSourceHandle GetFlattenedDataSource(
67 const Context &ctx) const = 0;
68
91 virtual void ComputeDirtyLocatorsForDescendants(
92 HdDataSourceLocatorSet * locators) const = 0;
93};
94
95namespace HdMakeDataSourceContainingFlattenedDataSourceProvider
96{
97
98template<typename T>
100Make()
101{
102 using DataSource =
104 return DataSource::New(std::make_shared<T>());
105}
106
107}
108
109PXR_NAMESPACE_CLOSE_SCOPE
110
111#endif
Represents a set of data source locators closed under descendancy.
Similar to HdRetainedSampledDataSource but provides strongly typed semantics.
Abstract interface to scene data.
Definition: sceneIndex.h:48
A datasource representing a concretely-typed sampled value.
Definition: dataSource.h:193
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