Newton Dynamics  4.00
ndBodyNotify.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_BODY_NOTIFY_H__
23 #define __ND_BODY_NOTIFY_H__
24 
25 #include "ndCollisionStdafx.h"
26 
27 class ndBody;
28 
29 D_MSV_NEWTON_ALIGN_32
30 class ndBodyNotify : public ndContainersFreeListAlloc<ndBodyNotify>
31 {
32  public:
33  D_CLASS_REFLECTION(ndBodyNotify);
34  D_COLLISION_API ndBodyNotify(const ndVector& defaultGravity);
35  D_COLLISION_API ndBodyNotify(const ndLoadSaveBase::ndLoadDescriptor& desc);
36 
37  D_COLLISION_API virtual ~ndBodyNotify();
38 
39  D_COLLISION_API ndBody* GetBody();
40  D_COLLISION_API const ndBody* GetBody() const;
41  D_COLLISION_API virtual void* GetUserData() const;
42 
43  D_COLLISION_API ndVector GetGravity() const;
44  D_COLLISION_API void SetGravity(const ndVector& defaultGravity);
45 
46  D_COLLISION_API virtual void OnTransform(ndInt32 threadIndex, const ndMatrix& matrix);
47  D_COLLISION_API virtual void OnApplyExternalForce(ndInt32 threadIndex, ndFloat32 timestep);
48 
49  D_COLLISION_API virtual void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
50 
51  private:
52  ndVector m_defaultGravity;
53  ndBody* m_body;
54  friend class ndBody;
55 } D_GCC_NEWTON_ALIGN_32;
56 
57 #endif
58 
ndBodyNotify
Definition: ndBodyNotify.h:31
ndBody
Definition: ndBody.h:43
ndMatrix
Definition: ndMatrix.h:42
ndContainersFreeListAlloc
Definition: ndContainersAlloc.h:60
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93
ndVector
Definition: ndVectorArmNeon.h:41