Newton Dynamics
4.00
ndCharacter.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_CHARACTER_H__
23
#define __ND_CHARACTER_H__
24
25
#include "ndNewtonStdafx.h"
26
#include "ndModel.h"
27
28
class
ndWorld
;
29
class
ndCharacterNode
;
30
class
ndIk6DofEffector
;
31
class
ndCharacterRootNode
;
32
class
ndCharacterSkeleton;
33
class
ndCharacterForwardDynamicNode
;
34
class
ndCharacterInverseDynamicNode
;
35
36
//class ndCharacterCentreOfMassState
37
//{
38
// public:
39
// dVector m_centerOfMass;
40
// dVector m_centerOfMassVeloc;
41
// ndFloat32 m_mass;
42
//};
43
44
class
ndCharacter
:
public
ndModel
45
{
46
public
:
47
class
ndEffetorInfo
48
{
49
public
:
50
ndMatrix
m_bindMatrix;
51
ndCharacterNode
* m_controlNode;
52
ndIk6DofEffector
* m_effector;
53
};
54
55
D_CLASS_REFLECTION(
ndCharacter
);
56
D_NEWTON_API
ndCharacter
();
57
D_NEWTON_API
ndCharacter
(
const
ndLoadSaveBase::ndLoadDescriptor
& desc);
58
D_NEWTON_API
virtual
~
ndCharacter
();
59
60
D_NEWTON_API
ndCharacterRootNode
* CreateRoot(
ndBodyDynamic
*
const
body);
61
D_NEWTON_API
ndCharacterForwardDynamicNode
* CreateForwardDynamicLimb(
const
ndMatrix
& matrixInGlobalSpace,
ndBodyDynamic
*
const
body,
ndCharacterNode
*
const
parent);
62
D_NEWTON_API
ndCharacterInverseDynamicNode
* CreateInverseDynamicLimb(
const
ndMatrix
& matrixInGlobalSpace,
ndBodyDynamic
*
const
body,
ndCharacterNode
*
const
parent);
63
64
ndCharacter
* GetAsCharacter();
65
ndCharacterRootNode
* GetRootNode()
const
;
66
67
D_NEWTON_API
void
AddAttachment(
ndJointBilateralConstraint
*
const
joint);
68
D_NEWTON_API
void
RemoveAttachment(
ndJointBilateralConstraint
*
const
joint);
69
70
D_NEWTON_API
void
CreateKinematicChain(
const
ndMatrix
& globalOrientation,
const
ndCharacterNode
*
const
node);
71
72
//ndCharacterPoseController* GetController() const;
73
//void SetController(ndCharacterPoseController* const controller);
74
//ndCharacterCentreOfMassState CalculateCentreOfMassState() const;
75
//void UpdateGlobalPose(ndWorld* const world, ndFloat32 timestep);
76
//void CalculateLocalPose(ndWorld* const world, ndFloat32 timestep);
77
//D_NEWTON_API ndCharacterSkeleton* CreateSkeleton() const;
78
D_NEWTON_API
void
SetPose();
79
80
protected
:
81
D_NEWTON_API
virtual
void
Debug(
ndConstraintDebugCallback
& context)
const
;
82
D_NEWTON_API
virtual
void
Update(
ndWorld
*
const
world, ndFloat32 timestep);
83
D_NEWTON_API
virtual
void
PostUpdate(
ndWorld
*
const
world, ndFloat32 timestep);
84
D_NEWTON_API
virtual
void
Save(
const
ndLoadSaveBase::ndSaveDescriptor
& desc)
const
;
85
86
ndCharacterRootNode
* m_rootNode;
87
//ndCharacterPoseController* m_controller;
88
ndList<ndEffetorInfo>
m_effectors;
89
ndList<ndJointBilateralConstraint*>
m_extraJointAttachments;
90
};
91
92
inline
ndCharacter
* ndCharacter::GetAsCharacter()
93
{
94
return
this
;
95
}
96
97
//inline ndCharacterPoseController* ndCharacter::GetController() const
98
//{
99
// return m_controller;
100
//}
101
//
102
//inline void ndCharacter::SetController(ndCharacterPoseController* const controller)
103
//{
104
// m_controller = controller;
105
//}
106
107
inline
ndCharacterRootNode
* ndCharacter::GetRootNode()
const
108
{
109
return
m_rootNode;
110
}
111
112
#endif
ndModel
Definition:
ndModel.h:33
ndCharacterNode
Definition:
ndCharacterNode.h:95
ndCharacterRootNode
Definition:
ndCharacterRootNode.h:29
ndCharacter
Definition:
ndCharacter.h:45
ndBodyDynamic
Definition:
ndBodyDynamic.h:43
ndJointBilateralConstraint
Definition:
ndJointBilateralConstraint.h:53
ndConstraintDebugCallback
Definition:
ndConstraint.h:42
ndCharacterInverseDynamicNode
Definition:
ndCharacterInverseDynamicNode.h:29
ndMatrix
Definition:
ndMatrix.h:42
ndList
Definition:
ndList.h:33
ndIk6DofEffector
Definition:
ndIk6DofEffector.h:19
ndCharacterForwardDynamicNode
Definition:
ndCharacterForwardDynamicNode.h:31
ndLoadSaveBase::ndLoadDescriptor
Definition:
ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition:
ndSaveLoadSytem.h:93
ndCharacter::ndEffetorInfo
Definition:
ndCharacter.h:48
ndWorld
Definition:
ndWorld.h:47
newton-dynamics
newton-4.00
sdk
dNewton
dModels
dCharacter
ndCharacter.h
Generated by
1.8.20