RavEngine
Loading...
Searching...
No Matches
ScParticleSystemCore.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_PARTICLESYSTEM_CORE_H
30#define SC_PARTICLESYSTEM_CORE_H
31
32#include "PxParticleSystem.h"
33#include "foundation/PxAssert.h"
34#include "ScActorCore.h"
35#include "ScShapeCore.h"
36#include "PxFiltering.h"
37#include "DyParticleSystem.h"
38#include "ScParticleSystemShapeCore.h"
39
40
41namespace physx
42{
43
44
45 namespace Sc
46 {
47 class ParticleSystemSim;
48 class BodyCore;
49
51 {
52 //= ATTENTION! =====================================================================================
53 // Changing the data layout of this class breaks the binary serialization format. See comments for
54 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
55 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
56 // accordingly.
57 //==================================================================================================
58
59 //---------------------------------------------------------------------------------
60 // Construction, destruction & initialization
61 //---------------------------------------------------------------------------------
62
63 // PX_SERIALIZATION
64 public:
65 ParticleSystemCore(const PxEMPTY) : ActorCore(PxEmpty) {}
66 static void getBinaryMetaData(PxOutputStream& stream);
67 //~PX_SERIALIZATION
70
71 //---------------------------------------------------------------------------------
72 // External API
73 //---------------------------------------------------------------------------------
74
75 PxReal getSleepThreshold() const;
76 void setSleepThreshold(const PxReal v);
77
78 PxReal getRestOffset() const;
79 void setRestOffset(const PxReal v);
80
81 PxReal getContactOffset() const;
82 void setContactOffset(const PxReal v);
83
84 PxReal getParticleContactOffset() const;
85 void setParticleContactOffset(const PxReal v);
86
87 PxReal getSolidRestOffset() const;
88 void setSolidRestOffset(const PxReal v);
89
90 PxReal getFluidRestOffset() const;
91 void setFluidRestOffset(const PxReal v);
92
93 PxReal getMaxDepenetrationVelocity() const;
94 void setMaxDepenetrationVelocity(const PxReal v);
95
96 PxReal getMaxVelocity() const;
97 void setMaxVelocity(const PxReal v);
98
99 PxParticleSystemCallback* getParticleSystemCallback() const;
100 void setParticleSystemCallback(PxParticleSystemCallback* callback);
101
102 PxCustomParticleSystemSolverCallback* getParticleSystemSolverCallback() const;
103 void setParticleSystemSolverCallback(PxCustomParticleSystemSolverCallback* callback);
104
105 PxReal getFluidBoundaryDensityScale() const;
106 void setFluidBoundaryDensityScale(const PxReal v);
107
108 PxU32 getGridSizeX() const;
109 void setGridSizeX(const PxU32 v);
110
111 PxU32 getGridSizeY() const;
112 void setGridSizeY(const PxU32 v);
113
114 PxU32 getGridSizeZ() const;
115 void setGridSizeZ(const PxU32 v);
116
117 PxU16 getSolverIterationCounts() const { return mShapeCore.getLLCore().solverIterationCounts; }
118 void setSolverIterationCounts(PxU16 c);
119
120
121 PxReal getWakeCounter() const;
122 void setWakeCounter(const PxReal v);
123 void setWakeCounterInternal(const PxReal v);
124
125 bool isSleeping() const;
126 void wakeUp(PxReal wakeCounter);
127 void putToSleep();
128
129 PxActor* getPxActor() const;
130
131 // TOFIX
132 void enableCCD(const bool enable);
133
134 PxParticleFlags getFlags() const { return mShapeCore.getLLCore().mFlags; }
135
136 //void setFlags(PxParticleFlags flags) { mShapeCore.getLLCore().mFlags = flags; }
137 void setFlags(PxParticleFlags flags);
138
139 void setWind(const PxVec3& wind) {mShapeCore.getLLCore().mWind = wind;}
140
141 PxVec3 getWind() const { return mShapeCore.getLLCore().mWind; }
142
143 void setSolverType(const PxParticleSolverType::Enum solverType) { mShapeCore.getLLCore().solverType = solverType; }
144 PxParticleSolverType::Enum getSolverType() const { return mShapeCore.getLLCore().solverType; }
145
146#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
147 PxSparseGridParams getSparseGridParams() const { return mShapeCore.getLLCore().sparseGridParams; }
148 void setSparseGridParams(const PxSparseGridParams& params) { mShapeCore.getLLCore().sparseGridParams = params; }
149
150 PxFLIPParams getFLIPParams() const { return mShapeCore.getLLCore().flipParams; }
151 void setFLIPParams(const PxFLIPParams& params) { mShapeCore.getLLCore().flipParams = params; }
152
153 PxMPMParams getMPMParams() const { return mShapeCore.getLLCore().mpmParams; }
154 void setMPMParams(const PxMPMParams& params) { mShapeCore.getLLCore().mpmParams = params; }
155#endif
156
157 void addRigidAttachment(Sc::BodyCore* core);
158
159 void removeRigidAttachment(Sc::BodyCore* core);
160
161 void setPeriodicBoundary(const PxVec3& boundary) { mShapeCore.setPeriodicBoundary(boundary); }
162
163 PxVec3 getPeriodicBoundary() const { return mShapeCore.getPeriodicBoundary(); }
164
165 //---------------------------------------------------------------------------------
166 // Internal API
167 //---------------------------------------------------------------------------------
168 public:
169 ParticleSystemSim* getSim() const;
170
171 PX_FORCE_INLINE const ParticleSystemShapeCore& getShapeCore() const { return mShapeCore; }
172 PX_FORCE_INLINE ParticleSystemShapeCore& getShapeCore() { return mShapeCore; }
173
174 void setDirty(const bool dirty);
175
176 private:
177 //ParticleSystemSim* mSim;
178 ParticleSystemShapeCore mShapeCore;
179
180 };
181
182 } // namespace Sc
183
184}
185
186#endif
PxActor is the base class for the main simulation objects in the physics SDK.
Definition PxActor.h:201
Definition PxCustomParticleSystemSolverCallback.h:51
Output stream class for I/O.
Definition PxIO.h:114
Particle system callback base class to schedule work that should be done before, while or after the p...
Definition PxParticleSystem.h:77
3 Element vector class.
Definition PxVec3.h:50
Definition ScActorCore.h:48
Definition ScBodyCore.h:49
Definition ScParticleSystemCore.h:51
Definition ScParticleSystemShapeCore.h:48
Definition ScParticleSystemSim.h:42
#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
PxEMPTY
Definition Px.h:87
Enum
Definition PxActor.h:121
Enum
Definition PxParticleSolverType.h:53
Parameters to define the sparse grid settings like grid spacing, maximal number of subgrids etc.
Definition PxSparseGridParams.h:46