Loading...
Searching...
No Matches
materialPrimvarTransferSceneIndex.h
1//
2// Copyright 2022 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_IMAGING_HDSI_MATERIAL_PRIMVAR_TRANSFER_SCENE_INDEX_H
7#define PXR_IMAGING_HDSI_MATERIAL_PRIMVAR_TRANSFER_SCENE_INDEX_H
8
9#include "pxr/imaging/hdsi/api.h"
10#include "pxr/imaging/hd/filteringSceneIndex.h"
11
12#include "pxr/pxr.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
17
38{
39public:
40 // Type signature for function used to compose a single primvar
41 // using the primvars from geometry and a bound material.
42 // The first argument is the container data source for the
43 // geometry primvars, the second is the container data source
44 // for the material primvars, and the third is the primvar name.
45 // Note that this composes just the single named primvar,
46 // returning a data source for that primvar.
47 using ComposeFn = std::function<
48 HdDataSourceBaseHandle(
49 HdContainerDataSourceHandle const&,
50 HdContainerDataSourceHandle const&,
51 TfToken const&)>;
52
53 // The default compose function used if none is provided.
54 HDSI_API
55 static HdDataSourceBaseHandle
56 DefaultComposeFn(
57 HdContainerDataSourceHandle const& dsStrong,
58 HdContainerDataSourceHandle const& dsWeak,
59 const TfToken& name);
60
61 HDSI_API
62 static HdsiMaterialPrimvarTransferSceneIndexRefPtr
63 New(const HdSceneIndexBaseRefPtr& inputSceneIndex,
64 const ComposeFn& composeFn = ComposeFn());
65
66public: // HdSceneIndex overrides
67 HDSI_API
68 HdSceneIndexPrim GetPrim(const SdfPath& primPath) const override;
69
70 HDSI_API
71 SdfPathVector GetChildPrimPaths(const SdfPath& primPath) const override;
72
73protected: // HdSingleInputFilteringSceneIndexBase overrides
74 void _PrimsAdded(
75 const HdSceneIndexBase& sender,
76 const HdSceneIndexObserver::AddedPrimEntries& entries) override;
77 void _PrimsRemoved(
78 const HdSceneIndexBase& sender,
79 const HdSceneIndexObserver::RemovedPrimEntries& entries) override;
80 void _PrimsDirtied(
81 const HdSceneIndexBase& sender,
82 const HdSceneIndexObserver::DirtiedPrimEntries& entries) override;
83
84private:
86 const HdSceneIndexBaseRefPtr& inputSceneIndex,
87 const ComposeFn& composeFn);
89
90 const ComposeFn _composeFn;
91};
92
93PXR_NAMESPACE_CLOSE_SCOPE
94
95#endif
Abstract interface to scene data.
Definition: sceneIndex.h:54
An abstract base class for a filtering scene index that observes a single input scene index.
Transfers primvars present on the locally bound material.
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
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
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35