27#ifndef EXT_TET_CPU_BVH_H
28#define EXT_TET_CPU_BVH_H
30#include "foundation/PxArray.h"
32#include "foundation/PxBounds3.h"
35#include "GuAABBTree.h"
36#include "GuAABBTreeNode.h"
37#include "GuAABBTreeBounds.h"
38#include "GuAABBTreeQuery.h"
39#include "GuTriangle.h"
46 using Triangle = Gu::IndexedTriangleT<PxI32>;
53 return ((PxU64(a)) << 32) | (PxU64(b));
55 return ((PxU64(b)) << 32) | (PxU64(a));
58 void buildTree(
const PxU32* triangles,
const PxU32 numTriangles,
const Vec3* points, PxArray<Gu::BVHNode>& tree, PxF32 enlargement = 1e-4f);
61 PX_FORCE_INLINE void buildTree(
const PxArray<Triangle>& triangles,
const PxArray<Vec3>& points, PxArray<Gu::BVHNode>& tree, PxF32 enlargement = 1e-4f)
63 buildTree(
reinterpret_cast<const PxU32*
>(triangles.begin()), triangles.size(), points.begin(), tree, enlargement);
67 void traverseBVH(
const PxArray<Gu::BVHNode>& nodes, T& traversalController, PxI32 rootNodeIndex = 0)
69 traverseBVH(nodes.begin(), traversalController, rootNodeIndex);
83 box(box_), candidateTriangleIndices(candidateTriangleIndices_)
89 candidateTriangleIndices.
clear();
92 Gu::TraversalControl::Enum analyze(
const Gu::BVHNode& node, PxI32)
96 candidateTriangleIndices.
pushBack(node.getPrimitiveIndex());
97 return Gu::TraversalControl::eDontGoDeeper;
101 return Gu::TraversalControl::eGoDeeper;
102 return Gu::TraversalControl::eDontGoDeeper;
Definition ExtUtilities.h:73
PX_INLINE void clear()
Definition PxArray.h:250
PX_FORCE_INLINE T & pushBack(const T &a)
Definition PxArray.h:296
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects(const PxBounds3 &b) const
indicates whether the intersection of this and b is empty or not.
Definition PxBounds3.h:357
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 empty()
Return empty bounds.
Definition PxBounds3.h:284
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition SnippetImmediateMode.cpp:303
Definition GuAABBTreeNode.h:44