RavEngine
Loading...
Searching...
No Matches
ScPhysics.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 SC_PHYSICS_H
30#define SC_PHYSICS_H
31
32#include "PxPhysics.h"
33#include "PxScene.h"
34#include "foundation/PxUserAllocated.h"
35#include "foundation/PxBasicTemplates.h"
36#include "PxActor.h"
37
38namespace physx
39{
40
41class PxMaterial;
42class PxTolerancesScale;
43struct PxvOffsetTable;
44
45#if PX_SUPPORT_GPU_PHYSX
46class PxPhysXGpu;
47#endif
48
49namespace Sc
50{
51 class Scene;
52 class StaticCore;
53 class RigidCore;
54 class BodyCore;
55 class ArticulationCore;
56 class ArticulationJointCore;
57 class ConstraintCore;
58 class ShapeCore;
59
61 {
63
64 PX_FORCE_INLINE PxShape* convertScShape2Px(ShapeCore* sc) const { return PxPointerOffset<PxShape*>(sc, scShape2Px); }
65 PX_FORCE_INLINE const PxShape* convertScShape2Px(const ShapeCore* sc) const { return PxPointerOffset<const PxShape*>(sc, scShape2Px); }
66
67 PX_FORCE_INLINE PxConstraint* convertScConstraint2Px(ConstraintCore* sc) const { return PxPointerOffset<PxConstraint*>(sc, scConstraint2Px); }
68 PX_FORCE_INLINE const PxConstraint* convertScConstraint2Px(const ConstraintCore* sc) const { return PxPointerOffset<const PxConstraint*>(sc, scConstraint2Px); }
69
70 PX_FORCE_INLINE PxArticulationReducedCoordinate* convertScArticulation2Px(ArticulationCore* sc) const
71 {
72 return PxPointerOffset<PxArticulationReducedCoordinate*>(sc, scArticulationRC2Px);
73 }
74
75 PX_FORCE_INLINE const PxArticulationReducedCoordinate* convertScArticulation2Px(const ArticulationCore* sc) const
76 {
77 return PxPointerOffset<const PxArticulationReducedCoordinate*>(sc, scArticulationRC2Px);
78 }
79
80 PX_FORCE_INLINE PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(ArticulationJointCore* sc) const
81 {
82 return PxPointerOffset<PxArticulationJointReducedCoordinate*>(sc, scArticulationJointRC2Px);
83 }
84
85 PX_FORCE_INLINE const PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(const ArticulationJointCore* sc) const
86 {
87 return PxPointerOffset<const PxArticulationJointReducedCoordinate*>(sc, scArticulationJointRC2Px);
88 }
89
90 ptrdiff_t scRigidStatic2PxActor;
91 ptrdiff_t scRigidDynamic2PxActor;
92 ptrdiff_t scArticulationLink2PxActor;
93 ptrdiff_t scSoftBody2PxActor;
94 ptrdiff_t scPBDParticleSystem2PxActor;
95 ptrdiff_t scFLIPParticleSystem2PxActor;
96 ptrdiff_t scMPMParticleSystem2PxActor;
97 ptrdiff_t scCustomParticleSystem2PxActor;
98 ptrdiff_t scHairSystem2PxActor;
99 ptrdiff_t scShape2Px;
100 ptrdiff_t scArticulationRC2Px;
101 ptrdiff_t scArticulationJointRC2Px;
102 ptrdiff_t scConstraint2Px;
103
104 ptrdiff_t scCore2PxActor[PxActorType::eACTOR_COUNT];
105 };
106 extern OffsetTable gOffsetTable;
107
109 {
110 public:
111 PX_FORCE_INLINE static Physics& getInstance() { return *mInstance; }
112
113 Physics(const PxTolerancesScale&, const PxvOffsetTable& pxvOffsetTable);
114 ~Physics();
115
116 PX_FORCE_INLINE const PxTolerancesScale& getTolerancesScale() const { return mScale; }
117
118 private:
119 PxTolerancesScale mScale;
120 static Physics* mInstance;
121
122 public:
123 static const PxReal sWakeCounterOnCreation;
124 };
125
126} // namespace Sc
127
128}
129
130#endif
A joint between two links in an articulation.
Definition PxArticulationJointReducedCoordinate.h:49
A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver....
Definition PxArticulationReducedCoordinate.h:448
A plugin class for implementing constraints.
Definition PxConstraint.h:100
Abstract class for collision shapes.
Definition PxShape.h:146
Class to define the scale at which simulation runs. Most simulation tolerances are calculated in term...
Definition PxTolerancesScale.h:53
Definition PxUserAllocated.h:43
Definition ScArticulationCore.h:52
Definition ScArticulationJointCore.h:55
Definition ScConstraintCore.h:43
Definition ScPhysics.h:109
Definition ScShapeCore.h:46
#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
@ eACTOR_COUNT
internal use only!
Definition PxActor.h:188
Definition PxvGlobals.h:66
Definition ScPhysics.h:61