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;
337 bool use_packed_visibility =
false;
348 const float radscale = 1.0
f,
349 const bool force_rebalance=
false,
352 UT_Lock *secondary_lock=
nullptr) noexcept;
358 const
float radius = 0.0
f,
359 const
bool force_rebalance=false) noexcept
361 init(detail, P, options,
GA_ROHandleF(), radius, force_rebalance);
367 if (
index < myOtherPrimStart)
370 OtherPrimType
type = myPrimData[prim_index].myOtherType;
371 return type == OTHERPRIM_NGON_TRI || type == OTHERPRIM_NGON_QUAD;
381 if (
index < myOtherPrimStart)
384 OtherPrimType
type = myPrimData[prim_index].myOtherType;
385 return type == OTHERPRIM_BVHUNIFORM || type == OTHERPRIM_BVHXLATESCALE || type == OTHERPRIM_BVHFULLXFORM;
392 void clearPrimDataAllocations() noexcept;
393 void clearSecondary() noexcept;
396 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
399 const VectorType &inverse_direction,
400 int &max_dir, VectorType &N0, VectorType &N1,
401 float &outer_tmax,
float &outer_tmin, FUNCTOR &hit_info) const noexcept;
402 template<
bool farthest>
404 uint index, const VectorType &origin,
float &max_dist_squared,
408 exint nesting_array_base) const noexcept;
410 VectorType primGeometricNormal(const CommonHitInfo &hit_info) const noexcept;
411 SYS_FORCE_INLINE void primDerivs(const CommonHitInfo &hit_info, VectorType &dP_du, VectorType &dP_dv) const noexcept;
415 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
423 const PrimData &prim_data,
429 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional=false,typename FUNCTOR>
434 const PrimData &prim_data,
440 template<
bool farthest,
bool rm_backface,
bool reverse,typename FUNCTOR>
449 const PrimData &prim_data,
455 template<
bool farthest>
458 const VectorType &origin,
459 const VectorType pos[3],
460 const PrimData &prim_data,
462 float &max_dist_squared,
467 template<
bool farthest>
470 const VectorType &origin,
472 const VectorType pos[4],
473 const PrimData &prim_data,
474 float &max_dist_squared,
479 static
bool hexClosestPoint(
481 const VectorType &origin,
483 const VectorType pos[8],
484 float &max_dist_squared,
487 template<typename V3_ARRAY>
490 const V3_ARRAY &positions,
493 SingleBoxType *prim_box_start,
497 float data_float = 0) noexcept;
499 template<typename V3_ARRAY>
502 const V3_ARRAY &positions,
505 SingleBoxType *prim_box_start,
509 float data_float = 0) noexcept;
514 SingleBoxType &primbox,
516 exint &other_primnum,
518 float w = 0) noexcept;
522 using
BVHBase::SingleHitAndNormalFunctor;
523 using
BVHBase::AllHitsAndNormalsFunctor;
525 template<
bool farthest,
bool rm_backface,
bool reverse,
bool bidirectional,typename FUNCTOR>
539 static constexpr
uint NAXES = 2;
541 static constexpr
bool theHasPrimitives =
true;
565 , mySegmentPoints(
nullptr)
570 return myPrimData[prim_index].myPrimOff;
576 mySegmentPoints.reset();
589 PointStyle
points = NO_POINTS;
591 const GA_Range *point_range =
nullptr;
592 const GA_Range *prim_range =
nullptr;
593 bool just_edges =
false;
600 const bool force_rebalance=
false) noexcept;
603 template<
bool farthest,
bool rm_backface,
bool reverse>
608 float &outer_tmax,
float &outer_tmin,
exint &hit_index,
UT_Vector3 &hit_uvw)
const noexcept;
609 template<
bool farthest>
615 exint nesting_array_base)
const noexcept;
616 template<
bool normalize>
619 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)
GLsizei const GLfloat * value
PUGI__FN 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
GLint GLint GLsizei GLint GLenum GLenum type
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)