RavEngine
Loading...
Searching...
No Matches
GuSqInternal.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef GU_SQ_INTERNAL_H
30#define GU_SQ_INTERNAL_H
31
32#include "foundation/PxSimpleTypes.h"
33#include "common/PxPhysXCommonConfig.h"
34
35#define SQ_DEBUG_VIZ_STATIC_COLOR PxU32(PxDebugColor::eARGB_BLUE)
36#define SQ_DEBUG_VIZ_DYNAMIC_COLOR PxU32(PxDebugColor::eARGB_RED)
37#define SQ_DEBUG_VIZ_STATIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKBLUE)
38#define SQ_DEBUG_VIZ_DYNAMIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKRED)
39#define SQ_DEBUG_VIZ_COMPOUND_COLOR PxU32(PxDebugColor::eARGB_MAGENTA)
40
41namespace physx
42{
43 class PxRenderOutput;
44 class PxBounds3;
45
46 namespace Gu
47 {
48 class BVH;
49 class AABBTree;
50 class IncrementalAABBTree;
51 class IncrementalAABBTreeNode;
52 }
53
55 {
56 public:
58 virtual ~DebugVizCallback() {}
59 virtual bool visualizeNode(const physx::Gu::IncrementalAABBTreeNode& node, const physx::PxBounds3& bounds) = 0;
60 };
61}
62
63 PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::BVH* tree);
64 PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::AABBTree* tree);
65 PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::IncrementalAABBTree* tree, physx::DebugVizCallback* cb=NULL);
66
67 // PT: macros to try limiting the code duplication in headers. Mostly it just redefines the
68 // SqPruner API in implementation classes, and you shouldn't have to worry about it.
69 // Note that this assumes pool-based pruners with an mPool class member (for now).
70
71#define DECLARE_BASE_PRUNER_API \
72 virtual void shiftOrigin(const PxVec3& shift); \
73 virtual void visualize(PxRenderOutput& out, PxU32 primaryColor, PxU32 secondaryColor) const;
74
75#define DECLARE_PRUNER_API_COMMON \
76 virtual bool addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count, bool hasPruningStructure); \
77 virtual void removeObjects(const PrunerHandle* handles, PxU32 count, PrunerPayloadRemovalCallback* removalCallback); \
78 virtual void updateObjects(const PrunerHandle* handles, PxU32 count, float inflation, const PxU32* boundsIndices, const PxBounds3* newBounds, const PxTransform32* newTransforms); \
79 virtual void purge(); \
80 virtual void commit(); \
81 virtual void merge(const void* mergeParams); \
82 virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, Gu::PrunerRaycastCallback&) const; \
83 virtual bool overlap(const Gu::ShapeData& queryVolume, Gu::PrunerOverlapCallback&) const; \
84 virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, Gu::PrunerRaycastCallback&) const; \
85 virtual const PrunerPayload& getPayloadData(PrunerHandle handle, PrunerPayloadData* data) const { return mPool.getPayloadData(handle, data); } \
86 virtual void preallocate(PxU32 entries) { mPool.preallocate(entries); } \
87 virtual bool setTransform(PrunerHandle handle, const PxTransform& transform) { return mPool.setTransform(handle, transform); } \
88 virtual void getGlobalBounds(PxBounds3&) const;
89
90#endif
Definition GuSqInternal.h:55
AABB-tree, N primitives/leaf.
Definition GuAABBTree.h:290
Represents a BVH.
Definition GuBVH.h:93
Definition GuIncrementalAABBTree.h:68
Definition GuIncrementalAABBTree.h:131
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
Definition PxRenderOutput.h:50
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39