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;
247 , myTriPoints(
nullptr)
248 , myQuadPoints(
nullptr)
249 , myTetPoints(
nullptr)
250 , myHexPoints(
nullptr)
255 , myOtherPrimStart(0)
258 , myPrimitiveListDataId(GA_INVALID_DATAID)
259 , myPrimData(
nullptr)
260 , myHasSecondary(false)
269 return myPrimData[prim_index].myPrimOff;
272 void clear() noexcept;
295 bool just_edges =
false;
306 bool tet_surface =
false;
317 const float radscale = 1.0
f,
318 const bool force_rebalance=
false,
321 UT_Lock *secondary_lock=
nullptr) noexcept;
327 const
float radius = 0.0
f,
328 const
bool force_rebalance=false) noexcept
330 init(detail, P, options,
GA_ROHandleF(), radius, force_rebalance);
336 if (
index < myOtherPrimStart)
339 OtherPrimType
type = myPrimData[prim_index].myOtherType;
340 return type == OTHERPRIM_NGON_TRI || type == OTHERPRIM_NGON_QUAD;
350 if (
index < myOtherPrimStart)
353 OtherPrimType
type = myPrimData[prim_index].myOtherType;
354 return type == OTHERPRIM_BVHUNIFORM || type == OTHERPRIM_BVHXLATESCALE || type == OTHERPRIM_BVHFULLXFORM;
361 void clearPrimDataAllocations() noexcept;
362 void clearSecondary() noexcept;
365 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
368 const VectorType &inverse_direction,
369 int &max_dir, VectorType &N0, VectorType &N1,
370 float &outer_tmax,
float &outer_tmin, FUNCTOR &hit_info) const noexcept;
371 template<
bool farthest>
373 uint index, const VectorType &origin,
float &max_dist_squared,
377 exint nesting_array_base) const noexcept;
379 VectorType primGeometricNormal(const CommonHitInfo &hit_info) const noexcept;
380 SYS_FORCE_INLINE void primDerivs(const CommonHitInfo &hit_info, VectorType &dP_du, VectorType &dP_dv) const noexcept;
384 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
392 const PrimData &prim_data,
398 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
403 const PrimData &prim_data,
409 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
418 const PrimData &prim_data,
424 template<
bool farthest>
427 const VectorType &origin,
428 const VectorType pos[3],
429 const PrimData &prim_data,
431 float &max_dist_squared,
436 template<
bool farthest>
439 const VectorType &origin,
441 const VectorType pos[4],
442 const PrimData &prim_data,
443 float &max_dist_squared,
448 static
bool hexClosestPoint(
450 const VectorType &origin,
452 const VectorType pos[8],
453 float &max_dist_squared,
456 template<typename V3_ARRAY>
459 const V3_ARRAY &positions,
462 SingleBoxType *prim_box_start,
466 float data_float = 0) noexcept;
468 template<typename V3_ARRAY>
471 const V3_ARRAY &positions,
474 SingleBoxType *prim_box_start,
478 float data_float = 0) noexcept;
483 SingleBoxType &primbox,
485 exint &other_primnum,
487 float w = 0) noexcept;
491 using
BVHBase::SingleHitAndNormalFunctor;
492 using
BVHBase::AllHitsAndNormalsFunctor;
494 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional,typename FUNCTOR>
508 static constexpr
uint NAXES = 2;
510 static constexpr
bool theHasPrimitives =
true;
534 , mySegmentPoints(
nullptr)
539 return myPrimData[prim_index].myPrimOff;
545 mySegmentPoints.reset();
558 PointStyle
points = NO_POINTS;
560 const GA_Range *point_range =
nullptr;
561 const GA_Range *prim_range =
nullptr;
562 bool just_edges =
false;
569 const bool force_rebalance=
false) noexcept;
572 template<
bool farthest,
bool rm_backface,
bool reverse>
577 float &outer_tmax,
float &outer_tmin,
exint &hit_index,
UT_Vector3 &hit_uvw)
const noexcept;
578 template<
bool farthest>
584 exint nesting_array_base)
const noexcept;
585 template<
bool normalize>
588 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
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
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