30 template<u
int NAXES,
typename SUBCLASS>
37 static constexpr
uint NAXES = 3;
39 static constexpr
bool theHasPrimitives =
true;
40 static constexpr
bool theReordersPositions =
false;
42 enum OtherPrimType :
uint
44 OTHERPRIM_BVHXLATESCALE,
46 OTHERPRIM_BVHFULLXFORM,
47 OTHERPRIM_RAYPRIMINFO,
48 OTHERPRIM_HEIGHTFIELD,
61 position = position/inverse_scale +
translate;
65 position = (position -
translate)*inverse_scale;
77 vector /= inverse_scale;
81 return t/inverse_scale;
85 return t*inverse_scale;
88 struct UniformTransform
120 vector =
rotation.rotateInverse(vector);
163 void *myOtherTransform;
174 OtherPrimType myOtherType;
261 , myTriPoints(
nullptr)
262 , myQuadPoints(
nullptr)
263 , myTetPoints(
nullptr)
264 , myHexPoints(
nullptr)
269 , myOtherPrimStart(0)
272 , myPrimitiveListDataId(GA_INVALID_DATAID)
273 , myPrimData(
nullptr)
274 , myHasSecondary(false)
283 return myPrimData[prim_index].myPrimOff;
286 void clear() noexcept;
322 bool just_edges =
false;
333 bool tet_surface =
false;
344 const float radscale = 1.0
f,
345 const bool force_rebalance=
false,
348 UT_Lock *secondary_lock=
nullptr) noexcept;
354 const
float radius = 0.0
f,
355 const
bool force_rebalance=false) noexcept
357 init(detail, P, options,
GA_ROHandleF(), radius, force_rebalance);
363 if (
index < myOtherPrimStart)
366 OtherPrimType
type = myPrimData[prim_index].myOtherType;
367 return type == OTHERPRIM_NGON_TRI || type == OTHERPRIM_NGON_QUAD;
377 if (
index < myOtherPrimStart)
380 OtherPrimType
type = myPrimData[prim_index].myOtherType;
381 return type == OTHERPRIM_BVHUNIFORM || type == OTHERPRIM_BVHXLATESCALE || type == OTHERPRIM_BVHFULLXFORM;
388 void clearPrimDataAllocations() noexcept;
389 void clearSecondary() noexcept;
392 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
395 const VectorType &inverse_direction,
396 int &max_dir, VectorType &N0, VectorType &N1,
397 float &outer_tmax,
float &outer_tmin, FUNCTOR &hit_info) const noexcept;
398 template<
bool farthest>
400 uint index, const VectorType &origin,
float &max_dist_squared,
404 exint nesting_array_base) const noexcept;
406 VectorType primGeometricNormal(const CommonHitInfo &hit_info) const noexcept;
407 SYS_FORCE_INLINE void primDerivs(const CommonHitInfo &hit_info, VectorType &dP_du, VectorType &dP_dv) const noexcept;
411 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
419 const PrimData &prim_data,
425 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
430 const PrimData &prim_data,
436 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
445 const PrimData &prim_data,
451 template<
bool farthest>
454 const VectorType &origin,
455 const VectorType pos[3],
456 const PrimData &prim_data,
458 float &max_dist_squared,
463 template<
bool farthest>
466 const VectorType &origin,
468 const VectorType pos[4],
469 const PrimData &prim_data,
470 float &max_dist_squared,
475 static
bool hexClosestPoint(
477 const VectorType &origin,
479 const VectorType pos[8],
480 float &max_dist_squared,
483 template<typename V3_ARRAY>
486 const V3_ARRAY &positions,
489 SingleBoxType *prim_box_start,
493 float data_float = 0) noexcept;
495 template<typename V3_ARRAY>
498 const V3_ARRAY &positions,
501 SingleBoxType *prim_box_start,
505 float data_float = 0) noexcept;
510 SingleBoxType &primbox,
512 exint &other_primnum,
514 float w = 0) noexcept;
518 using
BVHBase::SingleHitAndNormalFunctor;
519 using
BVHBase::AllHitsAndNormalsFunctor;
521 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional,typename FUNCTOR>
535 static constexpr
uint NAXES = 2;
537 static constexpr
bool theHasPrimitives =
true;
561 , mySegmentPoints(
nullptr)
566 return myPrimData[prim_index].myPrimOff;
572 mySegmentPoints.reset();
585 PointStyle
points = NO_POINTS;
587 const GA_Range *point_range =
nullptr;
588 const GA_Range *prim_range =
nullptr;
589 bool just_edges =
false;
596 const bool force_rebalance=
false) noexcept;
599 template<
bool farthest,
bool rm_backface,
bool reverse>
604 float &outer_tmax,
float &outer_tmin,
exint &hit_index,
UT_Vector3 &hit_uvw)
const noexcept;
605 template<
bool farthest>
611 exint nesting_array_base)
const noexcept;
612 template<
bool normalize>
615 template<GA_AttributeOwner owner,
typename T,
typename DEST_T>
GLdouble GLdouble GLint GLint const GLdouble * points
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
GA_DataId topologyId() const
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
void reverse(I begin, I end)
#define GA_INVALID_DATAID
exint GA_Size
Defines the bit width for index and offset types in GA.
SYS_FORCE_INLINE bool isPacked(exint index) const noexcept
SYS_FORCE_INLINE bool isNGon(exint index) const noexcept
A range of elements in an index-map.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GA_API const UT_StringHolder scale
GA_ROHandleT< fpreal32 > GA_ROHandleF
SYS_FORCE_INLINE GA_Offset primitiveOffset(exint prim_index) const noexcept
DataIdCombo prim_range_data_ids
SIM_API const UT_StringHolder rotation
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
SYS_FORCE_INLINE ~BVH() noexcept
typename SYS_SelectType< UT_Vector2, UT_Vector3, NAXES==3 >::type VectorType
SIM_API const UT_StringHolder position
SYS_FORCE_INLINE BVH() noexcept
GA_API const UT_StringHolder pscale
Container class for all geometry.
GLubyte GLubyte GLubyte GLubyte w
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > normalize() noexcept
GA_DataId primlistId() const
const DataIdCombo & primRangeIds() const
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept