My Project: dynamics.mod/NewtonDynamics/source/physics/dgBodyMasterList.h Source File

My Project

dgBodyMasterList.h
Go to the documentation of this file.
1 /* Copyright (c) <2003-2011> <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 #if !defined(AFX_DGBODYMASTER_LIST_35290_35290_A510_A865B2CC0789_H)
23 #define AFX_DGBODYMASTER_LIST_35290_35290_A510_A865B2CC0789_H
24
25
26 class dgBody;
27 class dgConstraint;
28
29 class dgBodyMasterListCell
30 {
31 public:
32 dgConstraint* m_joint;
33 dgBody* m_bodyNode;
34 };
35
36 class dgBodyMasterListRow: public dgList<dgBodyMasterListCell>
37 {
38 public:
39 dgBodyMasterListRow ();
40 ~dgBodyMasterListRow ();
41
42 dgBody* GetBody() const { return m_body;}
43
44 void RemoveAllJoints ();
45 dgListNode* AddContactJoint (dgConstraint* const joint, dgBody* const body);
46 dgListNode* AddBilateralJoint (dgConstraint* const joint, dgBody* const body);
47
48
49 void SortList();
50
51 private:
52 dgBody* m_body;
53
54 friend class dgBodyMasterList;
55 };
56
57 class dgBodyMasterList: public dgList<dgBodyMasterListRow>
58 {
59 public:
60 dgBodyMasterList (dgMemoryAllocator* const allocator);
61 ~dgBodyMasterList ();
62
63 void AddBody (dgBody* const body);
64 void RemoveBody (dgBody* const body);
65 void RemoveConstraint (dgConstraint* const constraint);
66 void AttachConstraint (dgConstraint* const constraint, dgBody* const body0, dgBody* const body1);
67
68 dgBodyMasterListRow::dgListNode* FindConstraintLink (const dgBody* const body0, const dgBody* const body1) const;
69 dgBodyMasterListRow::dgListNode* FindConstraintLinkNext (const dgBodyMasterListRow::dgListNode* const me, const dgBody* const body) const;
70 dgUnsigned32 MakeSortMask(const dgBody* const body) const;
71 void SortMasterList();
72
73 public:
74 dgTree<int, dgBody*> m_disableBodies;
75 dgInt32 m_deformableCount;
76 dgUnsigned32 m_constraintCount;
77
78 };
79
80 #endif
dgList< dgBodyMasterListCell >::dgListNode
friend class dgListNode
Definition: dgList.h:249
dgBodyMasterList
Definition: dgBodyMasterList.h:57
dgBody
Definition: dgBody.h:44
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgBodyMasterListCell::m_bodyNode
dgBody * m_bodyNode
Definition: dgBodyMasterList.h:33
dgList
Definition: dgList.h:33
dgTree
Definition: dgTree.h:88
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgBodyMasterListCell::m_joint
dgConstraint * m_joint
Definition: dgBodyMasterList.h:32
dgBodyMasterList::m_disableBodies
dgTree< int, dgBody * > m_disableBodies
Definition: dgBodyMasterList.h:74
dgBodyMasterListRow
Definition: dgBodyMasterList.h:36
dgBodyMasterListRow::GetBody
dgBody * GetBody() const
Definition: dgBodyMasterList.h:42
dgMemoryAllocator
Definition: dgMemory.h:73
dgBodyMasterList::m_constraintCount
dgUnsigned32 m_constraintCount
Definition: dgBodyMasterList.h:76
dgBodyMasterList::m_deformableCount
dgInt32 m_deformableCount
Definition: dgBodyMasterList.h:75
dgBodyMasterListCell
Definition: dgBodyMasterList.h:29
dgConstraint
Definition: dgConstraint.h:140