1//
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions
4// are met:
5// * Redistributions of source code must retain the above copyright
6// notice, this list of conditions and the following disclaimer.
7// * Redistributions in binary form must reproduce the above copyright
8// notice, this list of conditions and the following disclaimer in the
9// documentation and/or other materials provided with the distribution.
10// * Neither the name of NVIDIA CORPORATION nor the names of its
11// contributors may be used to endorse or promote products derived
12// from this software without specific prior written permission.
13//
14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25//
26// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29
30
31#ifndef PX_COLLECTION_EXT_H
32#define PX_COLLECTION_EXT_H
33/** \addtogroup extensions
34@{
35*/
36
37#include "PxPhysXConfig.h"
38#include "common/PxCollection.h"
39
40#if !PX_DOXYGEN
41namespace physx
42{
43#endif
44
45 class PxCollectionExt
46 {
47 public:
48 /**
49 \brief Removes and releases all object from a collection.
50
51 The Collection itself is not released.
52
53 If the releaseExclusiveShapes flag is not set to true, release() will not be called on exclusive shapes.
54
55 It is assumed that the application holds a reference to each of the objects in the collection, with the exception of objects that are not releasable
56 (PxBase::isReleasable()). In general, objects that violate this assumption need to be removed from the collection prior to calling releaseObjects.
57
58 \note when a shape is created with PxRigidActor::createShape() or PxRigidActorExt::createExclusiveShape(), the only counted reference is held by the actor.
59 If such a shape and its actor are present in the collection, the reference count will be decremented once when the actor is released, and once when the
60 shape is released, resulting in undefined behavior. Shape reference counts can be incremented with PxShape::acquireReference().
61
62 \param[in] collection to remove and release all object from.
63 \param[in] releaseExclusiveShapes if this parameter is set to false, release() will not be called on exclusive shapes.
64 */
65 static void releaseObjects(PxCollection& collection, bool releaseExclusiveShapes = true);
66
67 /**
68 \brief Removes objects of a given type from a collection, potentially adding them to another collection.
69
70 \param[in,out] collection Collection from which objects are removed
71 \param[in] concreteType PxConcreteType of sdk objects that should be removed
72 \param[in,out] to Optional collection to which the removed objects are added
73
74 @see PxCollection, PxConcreteType
75 */
76 static void remove(PxCollection& collection, PxType concreteType, PxCollection* to = NULL);
77
78
79 /**
80 \brief Collects all objects in PxPhysics that are shareable across multiple scenes.
81
82 This function creates a new collection from all objects that are shareable across multiple
83 scenes. Instances of the following types are included: PxConvexMesh, PxTriangleMesh,
84 PxHeightField, PxShape and PxMaterial.
85
86 This is a helper function to ease the creation of collections for serialization.
87
88 \param[in] physics The physics SDK instance from which objects are collected. See #PxPhysics
89 \return Collection to which objects are added. See #PxCollection
90
91 @see PxCollection, PxPhysics
92 */
93 static PxCollection* createCollection(PxPhysics& physics);
94
95 /**
96 \brief Collects all objects from a PxScene.
97
98 This function creates a new collection from all objects that where added to the specified
99 PxScene. Instances of the following types are included: PxActor, PxAggregate,
100 PxArticulation and PxJoint (other PxConstraint types are not included).
101
102 This is a helper function to ease the creation of collections for serialization.
103 The function PxSerialization.complete() can be used to complete the collection with required objects prior to
104 serialization.
105
106 \param[in] scene The PxScene instance from which objects are collected. See #PxScene
107 \return Collection to which objects are added. See #PxCollection
108
109 @see PxCollection, PxScene, PxSerialization.complete()
110 */
111 static PxCollection* createCollection(PxScene& scene);
112 };
113
114#if !PX_DOXYGEN
115} // namespace physx
116#endif
117
118/** @} */
119#endif
120

source code of qtquick3dphysics/src/3rdparty/PhysX/include/extensions/PxCollectionExt.h