Main Page
Class Hierarchy
Compound List
Compound Members
Include
PxContactModifyCallback.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3
*
4
* NVIDIA CORPORATION and its licensors retain all intellectual property
5
* and proprietary rights in and to this software, related documentation
6
* and any modifications thereto. Any use, reproduction, disclosure or
7
* distribution of this software and related documentation without an express
8
* license agreement from NVIDIA CORPORATION is strictly prohibited.
9
*/
10
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14
#ifndef PX_CONTACT_MODIFY_CALLBACK
15
#define PX_CONTACT_MODIFY_CALLBACK
16
20
#include "
PxPhysXConfig.h
"
21
#include "
PxShape.h
"
22
#include "
PxContact.h
"
23
#include "
foundation/PxTransform.h
"
24
25
26
#ifndef PX_DOXYGEN
27
namespace
physx
28
{
29
#endif
30
31
class
PxShape
;
32
45
class
PxContactSet
46
{
47
public
:
55
PX_FORCE_INLINE
const
PxVec3
&
getPoint
(
PxU32
i)
const
{
return
mContacts[i].contact; }
56
62
PX_FORCE_INLINE
void
setPoint(
PxU32
i,
const
PxVec3
& p)
63
{
64
mContacts[i].contact = p;
65
}
66
74
PX_FORCE_INLINE
const
PxVec3
&
getNormal
(
PxU32
i)
const
{
return
mContacts[i].normal; }
75
84
PX_FORCE_INLINE
void
setNormal(
PxU32
i,
const
PxVec3
& n)
85
{
86
mContacts[i].normal = n;
87
}
88
96
PX_FORCE_INLINE
PxReal
getSeparation
(
PxU32
i)
const
{
return
mContacts[i].separation; }
97
103
PX_FORCE_INLINE
void
setSeparation(
PxU32
i,
PxReal
s)
104
{
105
mContacts[i].separation = s;
106
}
107
114
PX_FORCE_INLINE
const
PxVec3
&
getTargetVelocity
(
PxU32
i)
const
{
return
mContacts[i].targetVel; }
115
130
PX_FORCE_INLINE
void
setTargetVelocity(
PxU32
i,
const
PxVec3
& v)
131
{
132
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
133
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
134
header->
flags
|=
PxContactHeader::eHAS_TARGET_VELOCITY
;
135
mContacts[i].targetVel = v;
136
}
137
143
PX_FORCE_INLINE
PxU32
getInternalFaceIndex0
(
PxU32
i) {
return
mContacts[i].internalFaceIndex0; }
144
150
PX_FORCE_INLINE
PxU32
getInternalFaceIndex1
(
PxU32
i) {
return
mContacts[i].internalFaceIndex1; }
151
160
PX_FORCE_INLINE
PxReal
getMaxImpulse
(
PxU32
i)
const
{
return
mContacts[i].maxImpulse; }
161
170
PX_FORCE_INLINE
void
setMaxImpulse(
PxU32
i,
PxReal
s)
171
{
172
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
173
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
174
header->
flags
|=
PxContactHeader::eHAS_MAX_IMPULSE
;
175
mContacts[i].maxImpulse = s;
176
}
177
183
PX_FORCE_INLINE
void
ignore
(
PxU32
i) { mContacts[i].maxImpulse = 0.f; }
184
188
PX_FORCE_INLINE
PxU32
size
()
const
{
return
mCount; }
189
195
PX_FORCE_INLINE
PxReal
getInvMassScale0()
const
196
{
197
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
198
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
199
return
header->
invMassScale0
;
200
}
201
207
PX_FORCE_INLINE
PxReal
getInvMassScale1()
const
208
{
209
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
210
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
211
return
header->
invMassScale1
;
212
}
213
219
PX_FORCE_INLINE
PxReal
getInvInertiaScale0()
const
220
{
221
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
222
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
223
return
header->
invInertiaScale0
;
224
}
225
231
PX_FORCE_INLINE
PxReal
getInvInertiaScale1()
const
232
{
233
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
234
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
235
return
header->
invInertiaScale1
;
236
}
237
244
PX_FORCE_INLINE
void
setInvMassScale0(
const
PxReal
scale)
245
{
246
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
247
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
248
header->
invMassScale0
= scale;
249
header->
flags
|=
PxContactHeader::eHAS_MODIFIED_MASS_RATIOS
;
250
}
251
258
PX_FORCE_INLINE
void
setInvMassScale1(
const
PxReal
scale)
259
{
260
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
261
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
262
header->
invMassScale1
= scale;
263
header->
flags
|=
PxContactHeader::eHAS_MODIFIED_MASS_RATIOS
;
264
}
265
272
PX_FORCE_INLINE
void
setInvInertiaScale0(
const
PxReal
scale)
273
{
274
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
275
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
276
header->
invInertiaScale0
= scale;
277
header->
flags
|=
PxContactHeader::eHAS_MODIFIED_MASS_RATIOS
;
278
}
279
286
PX_FORCE_INLINE
void
setInvInertiaScale1(
const
PxReal
scale)
287
{
288
const
size_t
headerOffset =
sizeof
(
PxModifyContactHeader
) +
sizeof
(
PxContactPatchBase
);
289
PxModifyContactHeader
* header =
reinterpret_cast<
PxModifyContactHeader
*
>
(
reinterpret_cast<
PxU8
*
>
(mContacts) - headerOffset);
290
header->
invInertiaScale1
= scale;
291
header->
flags
|=
PxContactHeader::eHAS_MODIFIED_MASS_RATIOS
;
292
}
293
294
protected
:
295
PxU32
mCount
;
296
PxModifiableContact
*
mContacts
;
297
};
298
299
300
307
class
PxContactModifyPair
308
{
309
public
:
310
317
const
PxRigidActor
* actor[2];
324
const
PxShape
* shape[2];
325
334
PxTransform
transform[2];
335
340
PxContactSet
contacts
;
341
};
342
343
362
class
PxContactModifyCallback
363
{
364
public
:
365
376
virtual
void
onContactModify(
PxContactModifyPair
*
const
pairs,
PxU32
count) = 0;
377
378
protected
:
379
virtual
~PxContactModifyCallback
(){}
380
};
381
400
class
PxCCDContactModifyCallback
401
{
402
public
:
403
414
virtual
void
onCCDContactModify(
PxContactModifyPair
*
const
pairs,
PxU32
count) = 0;
415
416
protected
:
417
virtual
~PxCCDContactModifyCallback
(){}
418
};
419
420
421
#ifndef PX_DOXYGEN
422
}
// namespace physx
423
#endif
424
426
#endif
Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.
www.nvidia.com