HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pinnedCurveExpandingSceneIndex.h
Go to the documentation of this file.
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 //
7 #ifndef PXR_IMAGING_HDSI_PINNED_CURVE_EXPANDING_SCENE_INDEX_H
8 #define PXR_IMAGING_HDSI_PINNED_CURVE_EXPANDING_SCENE_INDEX_H
9 
10 #include "pxr/imaging/hdsi/api.h"
12 
14 
16 
17 /// \class HdsiPinnedCurveExpandingSceneIndex
18 ///
19 /// Pinned curves are a special case of non-periodic cubic curves (relevant only
20 /// for BSpline and CatmullRom basis) where the authored intent is for each
21 /// curve to begin and end at its first and last control points respectively.
22 /// This is done by setting the 'wrap' mode on the topology to 'pinned'.
23 ///
24 /// Renderers that don't provide built-in support for pinned curves can use this
25 /// scene index to "expand" or "unpack" the authored data. This involves the
26 /// following:
27 /// - Adding "phantom" points at the ends of each curve. For BSpline basis, each
28 /// end point is repeated twice (so we have 3 consecutive identical points on
29 /// each end) while for CatmullRom basis, each end point is repeated once.
30 /// The topology is modified to reflect this.
31 ///
32 /// - Expanding vertex primvars to account for the additional control points and
33 /// varying primvars to account for the additional segments.
34 ///
35 /// \note This scene index does not convert indexed curves (i.e., with authored
36 /// curve indices) into non-indexed curves.
37 ///
40 {
41 public:
42  HDSI_API
43  static HdsiPinnedCurveExpandingSceneIndexRefPtr
44  New(const HdSceneIndexBaseRefPtr &inputSceneIndex);
45 
46  HDSI_API
47  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override final;
48 
49  HDSI_API
50  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override final;
51 
52 protected:
53  HDSI_API
54  void _PrimsAdded(
55  const HdSceneIndexBase &sender,
56  const HdSceneIndexObserver::AddedPrimEntries &entries) override final;
57 
58  HDSI_API
59  void _PrimsRemoved(
60  const HdSceneIndexBase &sender,
61  const HdSceneIndexObserver::RemovedPrimEntries &entries) override final;
62 
63  HDSI_API
64  void _PrimsDirtied(
65  const HdSceneIndexBase &sender,
66  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override final;
67 
68  HDSI_API
70  const HdSceneIndexBaseRefPtr &inputSceneIndex);
71 
72 };
73 
75 
76 #endif //PXR_IMAGING_HDSI_PINNED_CURVE_EXPANDING_SCENE_INDEX_H
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const overridefinal
HDSI_API void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) overridefinal
HDSI_API HdsiPinnedCurveExpandingSceneIndex(const HdSceneIndexBaseRefPtr &inputSceneIndex)
std::vector< class SdfPath > SdfPathVector
HDSI_API void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) overridefinal
static HDSI_API HdsiPinnedCurveExpandingSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputSceneIndex)
HDSI_API void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) overridefinal
Definition: path.h:273
#define HDSI_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(HdsiPinnedCurveExpandingSceneIndex)
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const overridefinal