RavEngine
Loading...
Searching...
No Matches
SqPruner.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 SQ_PRUNER_H
30#define SQ_PRUNER_H
31
32#include "foundation/PxBounds3.h"
33#include "foundation/PxUserAllocated.h"
34#include "foundation/PxFlags.h"
35#include "GuPruner.h"
36#include "SqTypedef.h"
37
38namespace physx
39{
40namespace Gu
41{
42 class BVH;
43}
44namespace Sq
45{
46
51{
52 enum Enum
53 {
54 eSTATIC = (1<<0),
55 eDYNAMIC = (1<<1),
56 };
57};
58
62typedef PxFlags<PxCompoundPrunerQueryFlag::Enum,PxU32> PxCompoundPrunerQueryFlags;
63PX_FLAGS_OPERATORS(PxCompoundPrunerQueryFlag::Enum,PxU32)
64
66{
69
70 virtual bool invoke(PxReal& distance, PxU32 primIndex, const Gu::PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) = 0;
71};
72
74{
77
78 virtual bool invoke(PxU32 primIndex, const Gu::PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) = 0;
79};
80
82
87{
88 public:
89 virtual ~CompoundPruner() {}
90
104 virtual bool addCompound(Gu::PrunerHandle* results, const Gu::BVH& bvh, PrunerCompoundId compoundId, const PxTransform& transform, bool isDynamic, const Gu::PrunerPayload* data, const PxTransform* transforms) = 0;
105
110 virtual bool removeCompound(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback* removalCallback) = 0;
111
117 virtual bool updateCompound(PrunerCompoundId compoundId, const PxTransform& transform) = 0;
118
124 virtual void updateObjectAfterManualBoundsUpdates(PrunerCompoundId compoundId, const Gu::PrunerHandle handle) = 0;
125
131 virtual void removeObject(PrunerCompoundId compoundId, const Gu::PrunerHandle handle, Gu::PrunerPayloadRemovalCallback* removalCallback) = 0;
132
142 virtual bool addObject(PrunerCompoundId compoundId, Gu::PrunerHandle& result, const PxBounds3& bounds, const Gu::PrunerPayload userData, const PxTransform& transform) = 0;
143
150 virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const = 0;
151 virtual bool overlap(const Gu::ShapeData& queryVolume, CompoundPrunerOverlapCallback&, PxCompoundPrunerQueryFlags flags) const = 0;
152 virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const = 0;
153
167 virtual const Gu::PrunerPayload& getPayloadData(Gu::PrunerHandle handle, PrunerCompoundId compoundId, Gu::PrunerPayloadData* data) const = 0;
168
174 virtual void preallocate(PxU32 nbEntries) = 0;
175
176 // PT: beware, shape transform
177 virtual bool setTransform(Gu::PrunerHandle handle, PrunerCompoundId compoundId, const PxTransform& transform) = 0;
178
179 // PT: beware, actor transform
180 virtual const PxTransform& getTransform(PrunerCompoundId compoundId) const = 0;
181
182 virtual void visualizeEx(PxRenderOutput& out, PxU32 color, bool drawStatic, bool drawDynamic) const = 0;
183};
184
185}
186}
187
188#endif
Represents a BVH.
Definition GuBVH.h:93
Definition GuPruner.h:63
Definition GuBounds.h:115
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
Definition PxRenderOutput.h:50
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
3 Element vector class.
Definition PxVec3.h:50
Definition SqPruner.h:87
virtual void updateObjectAfterManualBoundsUpdates(PrunerCompoundId compoundId, const Gu::PrunerHandle handle)=0
virtual bool updateCompound(PrunerCompoundId compoundId, const PxTransform &transform)=0
virtual bool raycast(const PxVec3 &origin, const PxVec3 &unitDir, PxReal &inOutDistance, CompoundPrunerRaycastCallback &, PxCompoundPrunerQueryFlags flags) const =0
virtual const Gu::PrunerPayload & getPayloadData(Gu::PrunerHandle handle, PrunerCompoundId compoundId, Gu::PrunerPayloadData *data) const =0
Retrieves the object's payload and data associated with the handle.
virtual void preallocate(PxU32 nbEntries)=0
Preallocate space.
virtual bool addCompound(Gu::PrunerHandle *results, const Gu::BVH &bvh, PrunerCompoundId compoundId, const PxTransform &transform, bool isDynamic, const Gu::PrunerPayload *data, const PxTransform *transforms)=0
Adds compound to the pruner.
virtual bool removeCompound(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback *removalCallback)=0
virtual void removeObject(PrunerCompoundId compoundId, const Gu::PrunerHandle handle, Gu::PrunerPayloadRemovalCallback *removalCallback)=0
virtual bool addObject(PrunerCompoundId compoundId, Gu::PrunerHandle &result, const PxBounds3 &bounds, const Gu::PrunerPayload userData, const PxTransform &transform)=0
Adds object to the pruner.
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition GuPrunerPayload.h:55
Definition GuPrunerPayload.h:63
Definition GuPrunerPayload.h:43
Compound-pruner-specific flags for scene queries.
Definition SqPruner.h:51
Enum
Definition SqPruner.h:53
@ eSTATIC
Traverse static compounds.
Definition SqPruner.h:54
@ eDYNAMIC
Traverse dynamic compounds.
Definition SqPruner.h:55