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

PHY_DynamicTypes.h « common « Physics « gameengine « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ce40001af75dca5c756982e375581cafecb1d89 (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
/*
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.
*/


#ifndef __PHY_DYNAMIC_TYPES
#define __PHY_DYNAMIC_TYPES



struct KX_ClientObjectInfo;
class PHY_Shape;

struct	PHY__Vector3
{
	float	m_vec[4];

	operator const float* () const 
	{ 
		return &m_vec[0];
	}	
	operator float* () 
	{ 
		return &m_vec[0];
	}	
};

struct	PHY__Vector4
{
	float	m_vec[4];
	PHY__Vector4() {}
	void setValue(const float *value)
	{
		m_vec[0] = *value++;
		m_vec[1] = *value++;
		m_vec[2] = *value++;
		m_vec[3] = *value++;
	}
	void setValue(const double *value)
	{
		m_vec[0] = (float)(*value++);
		m_vec[1] = (float)(*value++);
		m_vec[2] = (float)(*value++);
		m_vec[3] = (float)(*value++);
	}

	operator const float* () const 
	{ 
		return &m_vec[0];
	}	
	operator float* () 
	{ 
		return &m_vec[0];
	}	
};

//typedef 	float	PHY__Vector3[4];

enum
{
	PHY_FH_RESPONSE,
	PHY_SENSOR_RESPONSE,	/* Touch Sensors */
	PHY_CAMERA_RESPONSE,	/* Visibility Culling */
	PHY_OBJECT_RESPONSE,	/* Object Dynamic Geometry Response */
	PHY_STATIC_RESPONSE,	/* Static Geometry Response */
	PHY_BROADPH_RESPONSE,	/* broadphase Response */
	
	PHY_NUM_RESPONSE
};

	typedef struct PHY_CollData {
		PHY__Vector3 m_point1;               /* Point in object1 in world coordinates */ 
		PHY__Vector3 m_point2;               /* Point in object2 in world coordinates */
		PHY__Vector3 m_normal;               /* point2 - point1 */ 
	} PHY_CollData;


	typedef bool (*PHY_ResponseCallback)(void *client_data,
										   void *client_object1,
										   void *client_object2,
										   const PHY_CollData *coll_data);
	typedef void (*PHY_CullingCallback)(KX_ClientObjectInfo* info, void* param);


/// PHY_PhysicsType enumerates all possible Physics Entities.
/// It is mainly used to create/add Physics Objects

typedef enum PHY_PhysicsType {
	PHY_CONVEX_RIGIDBODY=16386,
	PHY_CONCAVE_RIGIDBODY=16399,
	PHY_CONVEX_FIXEDBODY=16388,//'collision object'
	PHY_CONCAVE_FIXEDBODY=16401,
	PHY_CONVEX_KINEMATICBODY=16387,// 
	PHY_CONCAVE_KINEMATICBODY=16400,
	PHY_CONVEX_PHANTOMBODY=16398,
	PHY_CONCAVE_PHANTOMBODY=16402
} PHY_PhysicsType;

/// PHY_ConstraintType enumerates all supported Constraint Types
typedef enum PHY_ConstraintType {
	PHY_POINT2POINT_CONSTRAINT=1,
	PHY_LINEHINGE_CONSTRAINT=2,
	PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket
	PHY_CONE_TWIST_CONSTRAINT = 4,
	PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle
	PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked'

} PHY_ConstraintType;

typedef enum PHY_ShapeType {
	PHY_SHAPE_NONE,
	PHY_SHAPE_BOX,
	PHY_SHAPE_SPHERE,
	PHY_SHAPE_CYLINDER,
	PHY_SHAPE_CONE,
	PHY_SHAPE_MESH,
	PHY_SHAPE_POLYTOPE,
	PHY_SHAPE_COMPOUND,
	PHY_SHAPE_PROXY
} PHY_ShapeType;


typedef float	PHY_Vector3[3];

#endif //__PHY_DYNAMIC_TYPES