HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointMove.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 /// @author Dan Bailey
5 ///
6 /// @file PointMove.h
7 ///
8 /// @brief Ability to move VDB Points using a custom deformer.
9 ///
10 /// Deformers used when moving points are in world space by default and must adhere
11 /// to the interface described in the example below:
12 /// @code
13 /// struct MyDeformer
14 /// {
15 /// // A reset is performed on each leaf in turn before the points in that leaf are
16 /// // deformed. A leaf and leaf index (standard leaf traversal order) are supplied as
17 /// // the arguments, which matches the functor interface for LeafManager::foreach().
18 /// template <typename LeafNoteType>
19 /// void reset(LeafNoteType& leaf, size_t idx);
20 ///
21 /// // Evaluate the deformer and modify the given position to generate the deformed
22 /// // position. An index iterator is supplied as the argument to allow querying the
23 /// // point offset or containing voxel coordinate.
24 /// template <typename IndexIterT>
25 /// void apply(Vec3d& position, const IndexIterT& iter) const;
26 /// };
27 /// @endcode
28 ///
29 /// @note The DeformerTraits struct (defined in PointMask.h) can be used to configure
30 /// a deformer to evaluate in index space.
31 
32 #ifndef OPENVDB_POINTS_POINT_MOVE_HAS_BEEN_INCLUDED
33 #define OPENVDB_POINTS_POINT_MOVE_HAS_BEEN_INCLUDED
34 
35 #include <openvdb/openvdb.h>
36 
37 #include "PointDataGrid.h"
38 #include "PointMask.h"
39 
40 #include <tbb/concurrent_vector.h>
41 
42 #include <algorithm>
43 #include <iterator> // for std::begin(), std::end()
44 #include <map>
45 #include <numeric> // for std::iota()
46 #include <tuple>
47 #include <unordered_map>
48 #include <vector>
49 
50 namespace openvdb {
52 namespace OPENVDB_VERSION_NAME {
53 namespace points {
54 
55 // dummy object for future use
56 namespace future { struct Advect { }; }
57 
58 /// @brief Move points in a PointDataGrid using a custom deformer
59 /// @param points the PointDataGrid containing the points to be moved.
60 /// @param deformer a custom deformer that defines how to move the points.
61 /// @param filter an optional index filter
62 /// @param objectNotInUse for future use, this object is currently ignored
63 /// @param threaded enable or disable threading (threading is enabled by default)
64 template <typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>
65 inline void movePoints(PointDataGridT& points,
66  DeformerT& deformer,
67  const FilterT& filter = NullFilter(),
68  future::Advect* objectNotInUse = nullptr,
69  bool threaded = true);
70 
71 
72 /// @brief Move points in a PointDataGrid using a custom deformer and a new transform
73 /// @param points the PointDataGrid containing the points to be moved.
74 /// @param transform target transform to use for the resulting points.
75 /// @param deformer a custom deformer that defines how to move the points.
76 /// @param filter an optional index filter
77 /// @param objectNotInUse for future use, this object is currently ignored
78 /// @param threaded enable or disable threading (threading is enabled by default)
79 template <typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>
80 inline void movePoints(PointDataGridT& points,
82  DeformerT& deformer,
83  const FilterT& filter = NullFilter(),
84  future::Advect* objectNotInUse = nullptr,
85  bool threaded = true);
86 
87 } // namespace points
88 } // namespace OPENVDB_VERSION_NAME
89 } // namespace openvdb
90 
91 #include "impl/PointMoveImpl.h"
92 
93 #endif // OPENVDB_POINTS_POINT_MOVE_HAS_BEEN_INCLUDED
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:239
A no-op filter that can be used when iterating over all indices.
Definition: IndexIterator.h:50
void movePoints(PointDataGridT &points, const math::Transform &transform, DeformerT &deformer, const FilterT &filter, future::Advect *objectNotInUse, bool threaded)
Move points in a PointDataGrid using a custom deformer and a new transform.
GA_API const UT_StringHolder transform
Methods for extracting masks from VDB Point grids.
#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