Newton Dynamics
4.00
ndContactNotify.h
1
/* Copyright (c) <2003-2022> <Julio Jerez, Newton Game Dynamics>
2
*
3
* This software is provided 'as-is', without any express or implied
4
* warranty. In no event will the authors be held liable for any damages
5
* arising from the use of this software.
6
*
7
* Permission is granted to anyone to use this software for any purpose,
8
* including commercial applications, and to alter it and redistribute it
9
* freely, subject to the following restrictions:
10
*
11
* 1. The origin of this software must not be misrepresented; you must not
12
* claim that you wrote the original software. If you use this software
13
* in a product, an acknowledgment in the product documentation would be
14
* appreciated but is not required.
15
*
16
* 2. Altered source versions must be plainly marked as such, and must not be
17
* misrepresented as being the original software.
18
*
19
* 3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
#ifndef __ND_CONTACT_NOTIFY_H__
23
#define __ND_CONTACT_NOTIFY_H__
24
25
#include "ndCollisionStdafx.h"
26
#include "ndContactOptions.h"
27
28
class
ndScene
;
29
class
ndContact
;
30
class
ndShapeInstance
;
31
32
class
ndMaterial
:
public
ndContainersFreeListAlloc
<ndMaterial>
33
{
34
public
:
35
ndMaterial
()
36
:
ndContainersFreeListAlloc<ndMaterial>
()
37
{
38
m_restitution = ndFloat32(0.4f);
39
m_staticFriction0 = ndFloat32(0.8f);
40
m_staticFriction1 = ndFloat32(0.8f);
41
m_dynamicFriction0 = ndFloat32(0.4f);
42
m_dynamicFriction1 = ndFloat32(0.4f);
43
m_skinMargin = ndFloat32 (0.0f);
44
m_softness = ndFloat32(0.1f);
45
m_flags = m_collisionEnable | m_friction0Enable | m_friction1Enable;
46
m_userFlags = 0;
47
}
48
49
ndFloat32 m_restitution;
50
ndFloat32 m_staticFriction0;
51
ndFloat32 m_staticFriction1;
52
ndFloat32 m_dynamicFriction0;
53
ndFloat32 m_dynamicFriction1;
54
ndFloat32 m_skinMargin;
55
ndFloat32 m_softness;
56
ndUnsigned32 m_flags;
57
ndUnsigned32 m_userFlags;
58
};
59
60
D_MSV_NEWTON_ALIGN_32
61
class
ndContactNotify
:
public
ndClassAlloc
62
{
63
public
:
64
ndContactNotify
()
65
:
ndClassAlloc
()
66
,m_scene(
nullptr
)
67
{
68
}
69
70
virtual
~
ndContactNotify
()
71
{
72
}
73
74
virtual
void
OnBodyAdded(
ndBodyKinematic
*
const
)
const
75
{
76
}
77
78
virtual
void
OnBodyRemoved(
ndBodyKinematic
*
const
)
const
79
{
80
}
81
82
virtual
ndMaterial
* GetMaterial(
const
ndContact
*
const
,
const
ndShapeInstance
&,
const
ndShapeInstance
&)
const
83
{
84
return
(
ndMaterial
*)&m_default;
85
}
86
87
//bool OnCompoundSubShapeOverlap(const ndContact* const contact, ndFloat32 timestep, const ndShapeInstance* const subShapeA, const ndShapeInstance* const subShapeB);
88
virtual
bool
OnCompoundSubShapeOverlap(
const
ndContact
*
const
, ndFloat32,
const
ndShapeInstance
*
const
,
const
ndShapeInstance
*
const
)
89
{
90
return
true
;
91
}
92
93
//virtual bool OnAabbOverlap(const ndContact* const contact, ndFloat32 timestep)
94
virtual
bool
OnAabbOverlap(
const
ndContact
*
const
, ndFloat32)
95
{
96
return
true
;
97
}
98
99
virtual
void
OnContactCallback(
const
ndContact
*
const
, ndFloat32)
100
{
101
}
102
103
protected
:
104
ndMaterial
m_default;
105
ndScene
* m_scene;
106
friend
class
ndScene
;
107
} D_GCC_NEWTON_ALIGN_32;
108
109
#endif
ndClassAlloc
Base class for providing memory allocation for all other engine classes.
Definition:
ndClassAlloc.h:30
ndScene
Definition:
ndScene.h:59
ndContactNotify
Definition:
ndContactNotify.h:62
ndContact
Definition:
ndContact.h:97
ndBodyKinematic
Definition:
ndBodyKinematic.h:40
ndContainersFreeListAlloc
Definition:
ndContainersAlloc.h:60
ndClassAlloc::ndClassAlloc
ndClassAlloc()
Empty default constructor.
Definition:
ndClassAlloc.h:33
ndShapeInstance
Definition:
ndShapeInstance.h:62
ndMaterial
Definition:
ndContactNotify.h:33
newton-dynamics
newton-4.00
sdk
dCollision
ndContactNotify.h
Generated by
1.8.20