HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
boundableComputeExtent.h
Go to the documentation of this file.
1 //
2 // Copyright 2017 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_USD_USD_GEOM_BOUNDABLE_COMPUTE_EXTENT_H
8 #define PXR_USD_USD_GEOM_BOUNDABLE_COMPUTE_EXTENT_H
9 
10 /// \file usdGeom/boundableComputeExtent.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdGeom/api.h"
14 
15 #include "pxr/base/gf/vec3f.h"
16 #include "pxr/base/vt/array.h"
17 
18 #include "pxr/base/tf/type.h"
19 
21 
22 class UsdGeomBoundable;
23 class UsdTimeCode;
24 
25 /// Function registered with #UsdGeomRegisterComputeExtentFunction for
26 /// computing extents for a Boundable prim at the given time and filling
27 /// the given VtVec3fArray with the result. If an optional transform matrix is
28 /// supplied, the extent is computed as if the object was first transformed by
29 /// the matrix. If the transform matrix is nullptr, the extent is computed as if
30 /// the identity matrix was passed.
31 ///
32 /// The Boundable is guaranteed to be convertible to the prim type this
33 /// function was registered with. The function must be thread-safe.
34 /// It should return true on success, false on failure.
36  const UsdTimeCode&,
37  const GfMatrix4d*,
38  VtVec3fArray*);
39 
40 /// Registers \p fn as the function to use for computing extents for Boundable
41 /// prims of type \p PrimType by UsdGeomBoundable::ComputeExtentFromPlugins.
42 /// \p PrimType must derive from UsdGeomBoundable.
43 ///
44 /// Plugins should generally call this function in a TF_REGISTRY_FUNCTION.
45 /// For example:
46 ///
47 /// \code
48 /// TF_REGISTRY_FUNCTION(UsdGeomBoundable)
49 /// {
50 /// UsdGeomRegisterComputeExtentFunction<MyPrim>(MyComputeExtentFunction);
51 /// }
52 /// \endcode
53 ///
54 /// Plugins must also note that this function is implemented for a prim type
55 /// in that type's schema definition. For example:
56 ///
57 /// \code
58 /// class "MyPrim" (
59 /// ...
60 /// customData = {
61 /// dictionary extraPlugInfo = {
62 /// bool implementsComputeExtent = true
63 /// }
64 /// }
65 /// ...
66 /// )
67 /// { ... }
68 /// \endcode
69 ///
70 /// This allows the plugin system to discover this function dynamically
71 /// and load the plugin if needed.
72 template <class PrimType>
73 inline void
76 {
77  static_assert(
79  "Prim type must derive from UsdGeomBoundable");
80 
81  UsdGeomRegisterComputeExtentFunction(TfType::Find<PrimType>(), fn);
82 }
83 
84 /// \overload
86 void
88  const TfType& boundableType,
90 
92 
93 #endif // PXR_USD_USD_GEOM_BOUNDABLE_COMPUTE_EXTENT_H
GLsizei const GLfloat * value
Definition: glcorearb.h:824
OutGridT const XformOp bool bool
void UsdGeomRegisterComputeExtentFunction(const UsdGeomComputeExtentFunction &fn)
bool(*)(const UsdGeomBoundable &, const UsdTimeCode &, const GfMatrix4d *, VtVec3fArray *) UsdGeomComputeExtentFunction
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
#define USDGEOM_API
Definition: api.h:23