2012-06-26 15:36:12 -07:00
|
|
|
#ifndef _EPHYSICS_PRIVATE_H
|
|
|
|
#define _EPHYSICS_PRIVATE_H
|
|
|
|
|
|
|
|
#ifdef HAVE_EVIL
|
|
|
|
# include <Evil.h>
|
|
|
|
#endif
|
|
|
|
|
2012-08-22 13:04:39 -07:00
|
|
|
#include <BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h>
|
|
|
|
#include <BulletSoftBody/btDefaultSoftBodySolver.h>
|
|
|
|
#include <BulletSoftBody/btSoftRigidDynamicsWorld.h>
|
|
|
|
#include <BulletSoftBody/btSoftBodyHelpers.h>
|
2012-06-26 15:36:12 -07:00
|
|
|
#include <btBulletDynamicsCommon.h>
|
|
|
|
#include "EPhysics.h"
|
|
|
|
|
|
|
|
#ifdef EPHYSICS_LOG_COLOR
|
|
|
|
#undef EPHYSICS_LOG_COLOR
|
|
|
|
#endif
|
|
|
|
#define EPHYSICS_LOG_COLOR EINA_COLOR_BLUE
|
|
|
|
|
|
|
|
#ifdef ERR
|
|
|
|
# undef ERR
|
|
|
|
#endif
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(_ephysics_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef DBG
|
|
|
|
# undef DBG
|
|
|
|
#endif
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(_ephysics_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef INF
|
|
|
|
# undef INF
|
|
|
|
#endif
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(_ephysics_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef WRN
|
|
|
|
# undef WRN
|
|
|
|
#endif
|
|
|
|
#define WRN(...) EINA_LOG_DOM_WARN(_ephysics_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef CRIT
|
|
|
|
# undef CRIT
|
|
|
|
#endif
|
|
|
|
#define CRIT(...) EINA_LOG_DOM_CRIT(_ephysics_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-07-31 15:24:20 -07:00
|
|
|
#define RAD_TO_DEG 57.29582 /* 2 * pi radians == 360 degree */
|
|
|
|
|
2012-08-10 14:05:13 -07:00
|
|
|
typedef struct _EPhysics_Point EPhysics_Point;
|
|
|
|
|
2012-06-26 15:36:12 -07:00
|
|
|
typedef enum _EPhysics_World_Boundary
|
|
|
|
{
|
|
|
|
EPHYSICS_WORLD_BOUNDARY_TOP,
|
|
|
|
EPHYSICS_WORLD_BOUNDARY_BOTTOM,
|
|
|
|
EPHYSICS_WORLD_BOUNDARY_LEFT,
|
|
|
|
EPHYSICS_WORLD_BOUNDARY_RIGHT,
|
|
|
|
EPHYSICS_WORLD_BOUNDARY_LAST
|
|
|
|
} EPhysics_World_Boundary;
|
|
|
|
|
2012-08-10 14:05:13 -07:00
|
|
|
struct _EPhysics_Point {
|
|
|
|
EINA_INLIST;
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
};
|
|
|
|
|
2012-08-10 14:03:06 -07:00
|
|
|
struct _EPhysics_Body {
|
|
|
|
EINA_INLIST;
|
|
|
|
btCollisionShape *collision_shape;
|
|
|
|
btRigidBody *rigid_body;
|
2012-08-22 13:04:39 -07:00
|
|
|
btSoftBody *soft_body;
|
2012-08-10 14:03:06 -07:00
|
|
|
Evas_Object *evas_obj;
|
|
|
|
EPhysics_World *world;
|
2012-08-10 14:04:08 -07:00
|
|
|
int walking;
|
2012-08-13 15:24:47 -07:00
|
|
|
Evas_Coord w;
|
|
|
|
Evas_Coord h;
|
2012-08-10 14:03:06 -07:00
|
|
|
void *data;
|
|
|
|
Eina_Inlist *callbacks;
|
|
|
|
Eina_List *collision_groups;
|
2012-08-10 14:04:08 -07:00
|
|
|
Eina_List *to_delete;
|
|
|
|
double mass;
|
2012-08-20 15:15:52 -07:00
|
|
|
struct {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
double torque;
|
|
|
|
} force;
|
2012-08-10 14:03:39 -07:00
|
|
|
Eina_Bool active:1;
|
|
|
|
Eina_Bool deleted:1;
|
2012-08-22 13:04:39 -07:00
|
|
|
double distances[4][3];
|
|
|
|
int points_deform[4][3];
|
2012-08-10 14:03:06 -07:00
|
|
|
};
|
|
|
|
|
2012-06-26 15:36:12 -07:00
|
|
|
extern int _ephysics_log_dom;
|
|
|
|
|
2012-08-16 14:35:09 -07:00
|
|
|
/* World */
|
2012-06-26 15:36:12 -07:00
|
|
|
int ephysics_world_init(void);
|
|
|
|
int ephysics_world_shutdown(void);
|
2012-08-10 14:03:39 -07:00
|
|
|
Eina_Bool ephysics_world_body_add(EPhysics_World *world, EPhysics_Body *body);
|
|
|
|
Eina_Bool ephysics_world_body_del(EPhysics_World *world, EPhysics_Body *body);
|
2012-08-22 13:04:39 -07:00
|
|
|
Eina_Bool ephysics_world_soft_body_add(EPhysics_World *world, EPhysics_Body *body);
|
2012-08-16 14:34:44 -07:00
|
|
|
void ephysics_world_constraint_add(EPhysics_World *world, EPhysics_Constraint *constraint, btTypedConstraint *bt_constraint);
|
|
|
|
void ephysics_world_constraint_del(EPhysics_World *world, EPhysics_Constraint *constraint, btTypedConstraint *bt_constraint);
|
2012-06-26 15:36:12 -07:00
|
|
|
void ephysics_body_world_boundaries_resize(EPhysics_World *world);
|
|
|
|
void ephysics_world_boundary_set(EPhysics_World *world, EPhysics_World_Boundary boundary, EPhysics_Body *body);
|
|
|
|
EPhysics_Body *ephysics_world_boundary_get(const EPhysics_World *world, EPhysics_World_Boundary boundary);
|
2012-07-06 07:36:40 -07:00
|
|
|
Eina_Bool ephysics_world_bodies_outside_autodel_get(const EPhysics_World *world);
|
2012-08-22 13:04:39 -07:00
|
|
|
btSoftBodyWorldInfo *ephysics_world_info_get(const EPhysics_World *world);
|
2012-06-26 15:36:12 -07:00
|
|
|
|
2012-08-16 14:35:09 -07:00
|
|
|
/* Body */
|
2012-07-27 07:49:53 -07:00
|
|
|
Eina_Bool ephysics_body_filter_collision(EPhysics_Body *body0, EPhysics_Body *body1);
|
2012-06-26 15:36:12 -07:00
|
|
|
void ephysics_body_evas_object_update_select(EPhysics_Body *body);
|
|
|
|
void ephysics_orphan_body_del(EPhysics_Body *body);
|
2012-07-27 07:49:37 -07:00
|
|
|
void ephysics_body_contact_processed(EPhysics_Body *body, EPhysics_Body *contact_body, btVector3 position);
|
2012-07-06 07:36:40 -07:00
|
|
|
btRigidBody *ephysics_body_rigid_body_get(const EPhysics_Body *body);
|
2012-08-22 13:04:39 -07:00
|
|
|
btSoftBody *ephysics_body_soft_body_get(const EPhysics_Body *body);
|
2012-06-26 15:36:12 -07:00
|
|
|
void ephysics_body_active_set(EPhysics_Body *body, Eina_Bool active);
|
2012-08-16 14:35:04 -07:00
|
|
|
void ephysics_body_recalc(EPhysics_Body *body, double rate);
|
2012-08-20 15:15:52 -07:00
|
|
|
void ephysics_body_forces_apply(EPhysics_Body *body);
|
2012-06-26 15:36:12 -07:00
|
|
|
|
2012-08-16 14:35:09 -07:00
|
|
|
/* Camera */
|
2012-06-26 15:36:12 -07:00
|
|
|
EPhysics_Camera *ephysics_camera_add(EPhysics_World *world);
|
|
|
|
void ephysics_camera_del(EPhysics_Camera *camera);
|
2012-07-27 07:50:36 -07:00
|
|
|
void ephysics_camera_moved_set(EPhysics_Camera *camera, Eina_Bool moved);
|
|
|
|
Eina_Bool ephysics_camera_moved_get(const EPhysics_Camera *camera);
|
2012-08-13 15:24:28 -07:00
|
|
|
void ephysics_camera_target_moved(EPhysics_Camera *camera, EPhysics_Body *body);
|
2012-06-26 15:36:12 -07:00
|
|
|
|
2012-08-16 14:35:09 -07:00
|
|
|
/* Shape */
|
2012-08-10 14:05:13 -07:00
|
|
|
const Eina_Inlist *ephysics_shape_points_get(const EPhysics_Shape *shape);
|
|
|
|
|
2012-08-16 14:35:09 -07:00
|
|
|
/* Constraint */
|
|
|
|
void ephysics_constraint_recalc(EPhysics_Constraint *constraint, double rate);
|
|
|
|
|
2012-06-26 15:36:12 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|