Welcome to mirror list, hosted at ThFree Co, Russian Federation.

btOdeTypedJoint.h « ConstraintSolver « BulletDynamics « src « bullet2 « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a2affda382d5c68ecad1e82099c0d5a110700d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/

This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
2007-09-09
Added support for typed joints by Francisco Le?n
email: projectileman@yahoo.com
http://gimpact.sf.net
*/

#ifndef TYPED_JOINT_H
#define TYPED_JOINT_H

#include "btOdeJoint.h"
#include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"
#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"
#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"

struct btOdeSolverBody;

class btOdeTypedJoint : public btOdeJoint
{
public:
	btTypedConstraint * m_constraint;
	int		m_index;
	bool	m_swapBodies;
	btOdeSolverBody* m_body0;
	btOdeSolverBody* m_body1;

	btOdeTypedJoint(){}
	btOdeTypedJoint(
		btTypedConstraint * constraint,
		int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1):
			m_constraint(constraint),
			m_index(index),
			m_swapBodies(swap),
			m_body0(body0),
			m_body1(body1)
	{
	}

	virtual void GetInfo1(Info1 *info);
	virtual void GetInfo2(Info2 *info);
};



class OdeP2PJoint : public btOdeTypedJoint
{
protected:
	inline btPoint2PointConstraint * getP2PConstraint()
	{
		return static_cast<btPoint2PointConstraint * >(m_constraint);
	}
public:

	OdeP2PJoint() {};

	OdeP2PJoint(btTypedConstraint* constraint,int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1);

	//btOdeJoint interface for solver

	virtual void GetInfo1(Info1 *info);

	virtual void GetInfo2(Info2 *info);
};


class OdeD6Joint : public btOdeTypedJoint
{
protected:
	inline btGeneric6DofConstraint * getD6Constraint()
	{
		return static_cast<btGeneric6DofConstraint * >(m_constraint);
	}

	int setLinearLimits(Info2 *info);
	int setAngularLimits(Info2 *info, int row_offset);

public:

	OdeD6Joint() {};

	OdeD6Joint(btTypedConstraint* constraint,int index,bool swap,btOdeSolverBody* body0,btOdeSolverBody* body1);

	//btOdeJoint interface for solver

	virtual void GetInfo1(Info1 *info);

	virtual void GetInfo2(Info2 *info);
};

//! retrieves the constraint info from a btRotationalLimitMotor object
/*! \pre testLimitValue must be called on limot*/
int bt_get_limit_motor_info2(
	btRotationalLimitMotor * limot,
	btRigidBody * body0, btRigidBody * body1,
	btOdeJoint::Info2 *info, int row, btVector3& ax1, int rotational);

/*
OdeSliderJoint
Ported from ODE by Roman Ponomarev (rponom@gmail.com)
April 24, 2008
*/
class OdeSliderJoint : public btOdeTypedJoint
{
protected:
	inline btSliderConstraint * getSliderConstraint()
	{
		return static_cast<btSliderConstraint * >(m_constraint);
	}
public:

	OdeSliderJoint() {};

	OdeSliderJoint(btTypedConstraint* constraint,int index,bool swap, btOdeSolverBody* body0, btOdeSolverBody* body1);

	//BU_Joint interface for solver

	virtual void GetInfo1(Info1 *info);

	virtual void GetInfo2(Info2 *info);
};




#endif //CONTACT_JOINT_H