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: Apache-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 #include <openvdb/util/Assert.h>
16 
17 #include "PointDataGrid.h"
18 #include "IndexFilter.h"
19 
20 #include <tbb/combinable.h>
21 
22 #include <type_traits>
23 #include <vector>
24 
25 namespace openvdb {
27 namespace OPENVDB_VERSION_NAME {
28 namespace points {
29 
30 /// @brief Extract a Mask Tree from a Point Data Tree
31 /// @param tree the PointDataTree to extract the mask from.
32 /// @param filter an optional index filter
33 /// @param threaded enable or disable threading (threading is enabled by default)
34 template <typename PointDataTreeT,
35  typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type,
36  typename FilterT = NullFilter>
39 convertPointsToMask(const PointDataTreeT& tree,
40  const FilterT& filter = NullFilter(),
41  bool threaded = true);
42 
43 /// @brief Extract a Mask Grid from a Point Data Grid
44 /// @param grid the PointDataGrid to extract the mask from.
45 /// @param filter an optional index filter
46 /// @param threaded enable or disable threading (threading is enabled by default)
47 /// @note this method is only available for Bool Grids and Mask Grids
48 template <typename PointDataGridT,
49  typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type,
50  typename FilterT = NullFilter>
53 convertPointsToMask(const PointDataGridT& grid,
54  const FilterT& filter = NullFilter(),
55  bool threaded = true);
56 
57 /// @brief Extract a Mask Grid from a Point Data Grid using a new transform
58 /// @param grid the PointDataGrid to extract the mask from.
59 /// @param transform target transform for the mask.
60 /// @param filter an optional index filter
61 /// @param threaded enable or disable threading (threading is enabled by default)
62 /// @note this method is only available for Bool Grids and Mask Grids
63 template <typename PointDataGridT,
64  typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type,
65  typename FilterT = NullFilter>
67  typename MaskT::Ptr>::type
68 convertPointsToMask(const PointDataGridT& grid,
69  const openvdb::math::Transform& transform,
70  const FilterT& filter = NullFilter(),
71  bool threaded = true);
72 
73 /// @brief No-op deformer (adheres to the deformer interface documented in PointMove.h)
75 {
76  template <typename LeafT>
77  void reset(LeafT&, size_t /*idx*/ = 0) { }
78 
79  template <typename IterT>
80  void apply(Vec3d&, IterT&) const { }
81 };
82 
83 /// @brief Deformer Traits for optionally configuring deformers to be applied
84 /// in index-space. The default is world-space.
85 template <typename DeformerT>
87 {
88  static const bool IndexSpace = false;
89 };
90 
91 } // namespace points
92 } // namespace OPENVDB_VERSION_NAME
93 } // namespace openvdb
94 
95 #include "impl/PointMaskImpl.h"
96 
97 #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:245
Index filters primarily designed to be used with a FilterIndexIter.
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
Deformer Traits for optionally configuring deformers to be applied in index-space. The default is world-space.
Definition: PointMask.h:86
GA_API const UT_StringHolder transform
No-op deformer (adheres to the deformer interface documented in PointMove.h)
Definition: PointMask.h:74
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.
#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