RavEngine
Loading...
Searching...
No Matches
DyContactPrep.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 DY_CONTACT_PREP_H
30#define DY_CONTACT_PREP_H
31
32#include "DySolverConstraintDesc.h"
33#include "PxSceneDesc.h"
34#include "DySolverContact4.h"
35
36namespace physx
37{
38
39struct PxcNpWorkUnit;
40class PxsConstraintBlockManager;
41class PxcConstraintBlockStream;
42struct PxsContactManagerOutput;
43class FrictionPatchStreamPair;
44struct PxSolverBody;
45struct PxSolverBodyData;
46struct PxSolverConstraintDesc;
47class PxsContactManager;
48
49namespace Dy
50{
51 class ThreadContext;
52 struct CorrelationBuffer;
53
54#define CREATE_FINALIZE_SOLVER_CONTACT_METHOD_ARGS \
55 PxSolverContactDesc& contactDesc, \
56 PxsContactManagerOutput& output, \
57 ThreadContext& threadContext, \
58 const PxReal invDtF32, \
59 const PxReal dtF32, \
60 PxReal bounceThresholdF32, \
61 PxReal frictionOffsetThreshold, \
62 PxReal correlationDistance, \
63 PxConstraintAllocator& constraintAllocator, \
64 Cm::SpatialVectorF* Z
65
66#define CREATE_FINALIZE_SOVLER_CONTACT_METHOD_ARGS_4 \
67 PxsContactManagerOutput** outputs, \
68 ThreadContext& threadContext, \
69 PxSolverContactDesc* blockDescs, \
70 const PxReal invDtF32, \
71 const PxReal dtF32, \
72 PxReal bounceThresholdF32, \
73 PxReal frictionThresholdF32, \
74 PxReal correlationDistanceF32, \
75 PxConstraintAllocator& constraintAllocator
76
77
82typedef bool (*PxcCreateFinalizeSolverContactMethod)(CREATE_FINALIZE_SOLVER_CONTACT_METHOD_ARGS);
83
84extern PxcCreateFinalizeSolverContactMethod createFinalizeMethods[3];
85
86typedef SolverConstraintPrepState::Enum (*PxcCreateFinalizeSolverContactMethod4)(CREATE_FINALIZE_SOVLER_CONTACT_METHOD_ARGS_4);
87
88extern PxcCreateFinalizeSolverContactMethod4 createFinalizeMethods4[3];
89
90
91bool createFinalizeSolverContacts( PxSolverContactDesc& contactDesc,
92 PxsContactManagerOutput& output,
93 ThreadContext& threadContext,
94 const PxReal invDtF32,
95 const PxReal dtF32,
96 PxReal bounceThresholdF32,
97 PxReal frictionOffsetThreshold,
98 PxReal correlationDistance,
99 PxConstraintAllocator& constraintAllocator,
101
102bool createFinalizeSolverContacts( PxSolverContactDesc& contactDesc,
104 const PxReal invDtF32,
105 const PxReal dtF32,
106 PxReal bounceThresholdF32,
107 PxReal frictionOffsetThreshold,
108 PxReal correlationDistance,
109 PxConstraintAllocator& constraintAllocator,
111
112SolverConstraintPrepState::Enum createFinalizeSolverContacts4( PxsContactManagerOutput** outputs,
113 ThreadContext& threadContext,
114 PxSolverContactDesc* blockDescs,
115 const PxReal invDtF32,
116 const PxReal dtF32,
117 PxReal bounceThresholdF32,
118 PxReal frictionOffsetThreshold,
119 PxReal correlationDistance,
120 PxConstraintAllocator& constraintAllocator);
121
122SolverConstraintPrepState::Enum createFinalizeSolverContacts4( Dy::CorrelationBuffer& c,
123 PxSolverContactDesc* blockDescs,
124 const PxReal invDtF32,
125 const PxReal dtF32,
126 PxReal bounceThresholdF32,
127 PxReal frictionOffsetThreshold,
128 PxReal correlationDistance,
129 PxConstraintAllocator& constraintAllocator);
130
131
132
133bool createFinalizeSolverContactsCoulomb1D(PxSolverContactDesc& contactDesc,
134 PxsContactManagerOutput& output,
135 ThreadContext& threadContext,
136 const PxReal invDtF32,
137 const PxReal dtF32,
138 PxReal bounceThresholdF32,
139 PxReal frictionOffsetThreshold,
140 PxReal correlationDistance,
141 PxConstraintAllocator& constraintAllocator,
143
144bool createFinalizeSolverContactsCoulomb2D(PxSolverContactDesc& contactDesc,
145 PxsContactManagerOutput& output,
146 ThreadContext& threadContext,
147 const PxReal invDtF32,
148 const PxReal dtF32,
149 PxReal bounceThresholdF32,
150 PxReal frictionOffsetThreshold,
151 PxReal correlationDistance,
152 PxConstraintAllocator& constraintAllocator,
154
155
156SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb1D( PxsContactManagerOutput** outputs,
157 ThreadContext& threadContext,
158 PxSolverContactDesc* blockDescs,
159 const PxReal invDtF32,
160 const PxReal dtF32,
161 PxReal bounceThresholdF32,
162 PxReal frictionOffsetThreshold,
163 PxReal correlationDistance,
164 PxConstraintAllocator& constraintAllocator);
165
166SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb2D(PxsContactManagerOutput** outputs,
167 ThreadContext& threadContext,
168 PxSolverContactDesc* blockDescs,
169 const PxReal invDtF32,
170 const PxReal dtF32,
171 PxReal bounceThresholdF32,
172 PxReal frictionOffsetThreshold,
173 PxReal correlationDistance,
174 PxConstraintAllocator& constraintAllocator);
175
176
177PxU32 getContactManagerConstraintDesc(const PxsContactManagerOutput& cmOutput, const PxsContactManager& cm, PxSolverConstraintDesc& desc);
178
180{
181 PxsConstraintBlockManager& mConstraintBlockManager;
182 PxcConstraintBlockStream& mConstraintBlockStream;
183 FrictionPatchStreamPair& mFrictionPatchStreamPair;
184 PxU32& mTotalConstraintByteSize;
185public:
186
187 BlockAllocator(PxsConstraintBlockManager& constraintBlockManager, PxcConstraintBlockStream& constraintBlockStream, FrictionPatchStreamPair& frictionPatchStreamPair,
188 PxU32& totalConstraintByteSize) :
189 mConstraintBlockManager(constraintBlockManager), mConstraintBlockStream(constraintBlockStream), mFrictionPatchStreamPair(frictionPatchStreamPair),
190 mTotalConstraintByteSize(totalConstraintByteSize)
191 {
192 }
193
194 virtual PxU8* reserveConstraintData(const PxU32 size);
195
196 virtual PxU8* reserveFrictionData(const PxU32 size);
197
198 virtual PxU8* findInputPatches(PxU8* frictionCookie)
199 {
200 return frictionCookie;
201 }
202
203 PX_NOCOPY(BlockAllocator)
204
205};
206
207}
208
209}
210
211#endif
Definition DyContactPrep.h:180
virtual PxU8 * reserveConstraintData(const PxU32 size)
Allocates constraint data. It is the application's responsibility to release this memory after PxSolv...
Definition DyDynamics.cpp:2909
virtual PxU8 * reserveFrictionData(const PxU32 size)
Allocates friction data. Friction data can be retained by the application for a given pair and provid...
Definition DyDynamics.cpp:2915
Definition DyThreadContext.h:65
Definition DyFrictionPatchStreamPair.h:57
Definition PxSolverDefs.h:227
Definition PxcConstraintBlockStream.h:60
Definition PxcConstraintBlockStream.h:40
Definition PxsContactManager.h:77
bool(* PxcCreateFinalizeSolverContactMethod)(CREATE_FINALIZE_SOLVER_CONTACT_METHOD_ARGS)
Definition DyContactPrep.h:82
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition CmSpatialVector.h:134
Definition DyCorrelationBuffer.h:51
Constraint descriptor used inside the solver.
Definition PxSolverDefs.h:108
Data structure used for preparing constraints before solving them.
Definition PxSolverDefs.h:198