9 #ifndef __GU_VDBPOINTTOOLS_H_HAS_BEEN_INCLUDED__
10 #define __GU_VDBPOINTTOOLS_H_HAS_BEEN_INCLUDED__
40 template<
typename VectorType>
50 : mPositionHandle(detail.getP())
53 , mIndexMap(&detail.getP()->getIndexMap())
55 , mSize(mIndexMap->indexSize())
58 mSize = group->entries();
59 mOffsets.reserve(mSize);
65 mOffsets.push_back(off);
69 getOffset = &GU_VDBPointList::offsetFromGroupMap;
71 getOffset = &GU_VDBPointList::offsetFromIndexCast;
73 getOffset = &GU_VDBPointList::offsetFromGeoMap;
94 size_t size()
const {
return mSize; }
116 return (this->*getOffset)(
n);
144 GA_Offset offsetFromGeoMap(
const size_t n)
const {
148 GA_Offset offsetFromGroupMap(
const size_t n)
const {
152 GA_Offset offsetFromIndexCast(
const size_t n)
const {
159 std::vector<GA_Offset> mOffsets;
170 namespace GU_VDBPointToolsInternal {
172 template<
typename Po
intArrayType>
176 template <
typename LeafT>
179 for (
size_t n = 0,
N = indices.size(); n <
N; ++
n) {
180 indices[
n] =
static_cast<typename LeafT::ValueType::IntType
>(
191 const openvdb::math::Transform& xform)
192 : mPrims(prims.empty() ? nullptr : &prims.front())
194 , mMaskGrid(new openvdb::
MaskGrid(false))
196 mMaskGrid->setTransform(mXForm.copy());
202 , mMaskGrid(new openvdb::
MaskGrid(false))
204 mMaskGrid->setTransform(mXForm.copy());
215 for (
size_t n = range.begin(),
N = range.
end(); n <
N; ++
n) {
228 if (mat.isIdentity() && readlock.isValid() && readlock.getGdp()) {
229 detailtouse = readlock.getGdp();
232 detailtouse = &tmpdetail;
237 mMaskGrid->tree().topologyUnion(grid->tree());
243 openvdb::math::Transform mXForm;
244 openvdb::MaskGrid::Ptr mMaskGrid;
254 primitives.reserve(
size_t(numPacked));
267 primitives.push_back(prim);
293 template<
typename Po
intIndexTreeType,
typename Po
intArrayType>
297 openvdb::tree::LeafManager<PointIndexTreeType> leafnodes(tree);
304 inline openvdb::tools::PointIndexGrid::Ptr
306 const openvdb::math::Transform& xform,
311 return openvdb::tools::createPointIndexGrid<openvdb::tools::PointIndexGrid>(
points, xform);
317 template<
typename Po
intArrayType>
318 inline openvdb::tools::PointIndexGrid::Ptr
321 return openvdb::tools::createPointIndexGrid<openvdb::tools::PointIndexGrid>(
points, xform);
327 template<
typename ParticleArrayType>
328 inline openvdb::tools::ParticleIndexAtlas::Ptr
334 if (particles.hasRadius()) {
335 atlas->construct(particles, minVoxelSize);
344 inline openvdb::MaskGrid::Ptr
346 const openvdb::math::Transform& xform,
350 std::vector<const GA_Primitive*>
packed;
353 if (!packed.empty()) {
355 tbb::parallel_reduce(tbb::blocked_range<size_t>(0, packed.size()), op);
370 inline openvdb::tools::PointIndexGrid::Ptr
372 const openvdb::math::Transform& xform,
378 openvdb::tools::PointIndexGrid::Ptr grid =
379 openvdb::tools::createPointIndexGrid<openvdb::tools::PointIndexGrid>(
points, xform);
387 #endif // GU_VDBPOINTTOOLS_H_HAS_BEEN_INCLUDED
A class to manage an ordered array which has fixed offset handles.
static GA_Size countPackedPrimitives(const GA_Detail &gdp)
Convenience method to return the number of packed primitives.
Space-partitioning acceleration structure for particles, points with radius. Partitions particle indi...
This tool produces a grid where every voxel that contains a point is active. It employs thread-local ...
GLsizei GLenum const void * indices
GLdouble GLdouble GLint GLint const GLdouble * points
Iteration over a range of elements.
void getRadiusFromOffset(const GA_Offset offset, ScalarType &r) const
void getVelocity(size_t n, PosType &v) const
void getFullTransform4(UT_Matrix4D &xform) const override
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Offset offsetFromIndex(size_t n) const
void getRadius(size_t n, ScalarType &r) const
UT_SharedPtr< const GU_VDBPointList > ConstPtr
exint GA_Size
Defines the bit width for index and offset types in GA.
void getPosFromOffset(const GA_Offset offset, PosType &xyz) const
bool isValid() const
Test to see if the attribute reference refers to a valid attribute.
A range of elements in an index-map.
#define GEO_STD_ATTRIB_VELOCITY
SYS_FORCE_INLINE const_iterator end() const
UT_SharedPtr< GU_VDBPointList > Ptr
std::vector< Index > IndexArray
void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
GA_Iterator begin() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
This class provides a way to manage a reference to an attribute permitting Read-Only access...
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_14 uint8_t packed(VULKAN_HPP_NAMESPACE::Format format)
bool unpackWithContext(GU_Detail &dest, GU_PackedContext &context) const
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
SYS_FORCE_INLINE bool isValid() const
void getPos(size_t n, PosType &xyz) const
SYS_FORCE_INLINE bool isTrivialMap() const
const GA_Attribute * findFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name, int min_size=1, int max_size=-1) const
SYS_FORCE_INLINE const GA_Primitive * get(GA_Offset off) const
Houdini point attribute wrapper.
Grid< MaskTree > MaskGrid
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
SYS_FORCE_INLINE GA_Offset offsetFromIndex(GA_Index ordered_index) const
void getVelocityFromOffset(const GA_Offset offset, PosType &v) const
GA_API const UT_StringHolder N
const GA_PrimitiveList & getPrimitiveList() const
GU_ConstDetailHandle getPackedDetail() const
#define GEO_STD_ATTRIB_PSCALE
static Ptr create(const GU_Detail &detail, const GA_PointGroup *group=nullptr)
GU_VDBPointList(const GU_Detail &detail, const GA_PointGroup *group=nullptr)
typename PosType::value_type ScalarType
void OIIO_UTIL_API split(string_view str, std::vector< string_view > &result, string_view sep=string_view(), int maxsplit=-1)
GA_Range getPrimitiveRange(const GA_PrimitiveGroup *group=0) const
Get a range of all primitives in the detail.
static bool isPackedPrimitive(const GA_PrimitiveDefinition &pdef)
const GA_Attribute * getAttribute() const