HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointMask.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 /// @file points/PointMask.h
5 ///
6 /// @author Dan Bailey
7 ///
8 /// @brief Methods for extracting masks from VDB Point grids.
9 
10 #ifndef OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
11 #define OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
12 
13 #include <openvdb/openvdb.h>
14 #include <openvdb/tools/ValueTransformer.h> // valxform::SumOp
15 
16 #include "PointDataGrid.h"
17 #include "IndexFilter.h"
18 
19 #include <tbb/combinable.h>
20 
21 #include <type_traits>
22 #include <vector>
23 
24 namespace openvdb {
26 namespace OPENVDB_VERSION_NAME {
27 namespace points {
28 
29 /// @brief Extract a Mask Tree from a Point Data Tree
30 /// @param tree the PointDataTree to extract the mask from.
31 /// @param filter an optional index filter
32 /// @param threaded enable or disable threading (threading is enabled by default)
33 template <typename PointDataTreeT,
34  typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type,
35  typename FilterT = NullFilter>
38 convertPointsToMask(const PointDataTreeT& tree,
39  const FilterT& filter = NullFilter(),
40  bool threaded = true);
41 
42 /// @brief Extract a Mask Grid from a Point Data Grid
43 /// @param grid the PointDataGrid to extract the mask from.
44 /// @param filter an optional index filter
45 /// @param threaded enable or disable threading (threading is enabled by default)
46 /// @note this method is only available for Bool Grids and Mask Grids
47 template <typename PointDataGridT,
48  typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type,
49  typename FilterT = NullFilter>
52 convertPointsToMask(const PointDataGridT& grid,
53  const FilterT& filter = NullFilter(),
54  bool threaded = true);
55 
56 /// @brief Extract a Mask Grid from a Point Data Grid using a new transform
57 /// @param grid the PointDataGrid to extract the mask from.
58 /// @param transform target transform for the mask.
59 /// @param filter an optional index filter
60 /// @param threaded enable or disable threading (threading is enabled by default)
61 /// @note this method is only available for Bool Grids and Mask Grids
62 template <typename PointDataGridT,
63  typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type,
64  typename FilterT = NullFilter>
66  typename MaskT::Ptr>::type
67 convertPointsToMask(const PointDataGridT& grid,
68  const openvdb::math::Transform& transform,
69  const FilterT& filter = NullFilter(),
70  bool threaded = true);
71 
72 /// @brief No-op deformer (adheres to the deformer interface documented in PointMove.h)
74 {
75  template <typename LeafT>
76  void reset(LeafT&, size_t /*idx*/ = 0) { }
77 
78  template <typename IterT>
79  void apply(Vec3d&, IterT&) const { }
80 };
81 
82 /// @brief Deformer Traits for optionally configuring deformers to be applied
83 /// in index-space. The default is world-space.
84 template <typename DeformerT>
86 {
87  static const bool IndexSpace = false;
88 };
89 
90 } // namespace points
91 } // namespace OPENVDB_VERSION_NAME
92 } // namespace openvdb
93 
94 #include "impl/PointMaskImpl.h"
95 
96 #endif // OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:239
Index filters primarily designed to be used with a FilterIndexIter.
Deformer Traits for optionally configuring deformers to be applied in index-space. The default is world-space.
Definition: PointMask.h:85
GA_API const UT_StringHolder transform
No-op deformer (adheres to the deformer interface documented in PointMove.h)
Definition: PointMask.h:73
std::enable_if< std::is_base_of< TreeBase, PointDataTreeT >::value &&std::is_same< typename MaskTreeT::ValueType, bool >::value, typename MaskTreeT::Ptr >::type convertPointsToMask(const PointDataTreeT &tree, const FilterT &filter, bool threaded)
Extract a Mask Tree from a Point Data Tree.
type
Definition: core.h:1059
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:119
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297