summaryrefslogtreecommitdiff
path: root/servers/physics/physics_server_sw.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics/physics_server_sw.h')
-rw-r--r--servers/physics/physics_server_sw.h135
1 files changed, 64 insertions, 71 deletions
diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h
index 6e20474350..cb5a339ee8 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics/physics_server_sw.h
@@ -29,19 +29,17 @@
#ifndef PHYSICS_SERVER_SW
#define PHYSICS_SERVER_SW
-
+#include "joints_sw.h"
#include "servers/physics_server.h"
#include "shape_sw.h"
#include "space_sw.h"
#include "step_sw.h"
-#include "joints_sw.h"
-
class PhysicsServerSW : public PhysicsServer {
- GDCLASS( PhysicsServerSW, PhysicsServer );
+ GDCLASS(PhysicsServerSW, PhysicsServer);
-friend class PhysicsDirectSpaceStateSW;
+ friend class PhysicsDirectSpaceStateSW;
bool active;
int iterations;
bool doing_sync;
@@ -52,7 +50,7 @@ friend class PhysicsDirectSpaceStateSW;
int collision_pairs;
StepSW *stepper;
- Set<const SpaceSW*> active_spaces;
+ Set<const SpaceSW *> active_spaces;
PhysicsDirectBodyStateSW *direct_state;
@@ -64,7 +62,6 @@ friend class PhysicsDirectSpaceStateSW;
//void _clear_query(QuerySW *p_query);
public:
-
struct CollCbkData {
int max;
@@ -72,10 +69,10 @@ public:
Vector3 *ptr;
};
- static void _shape_col_cbk(const Vector3& p_point_A,const Vector3& p_point_B,void *p_userdata);
+ static void _shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata);
virtual RID shape_create(ShapeType p_shape);
- virtual void shape_set_data(RID p_shape, const Variant& p_data);
+ virtual void shape_set_data(RID p_shape, const Variant &p_data);
virtual void shape_set_custom_solver_bias(RID p_shape, real_t p_bias);
virtual ShapeType shape_get_type(RID p_shape) const;
@@ -85,16 +82,16 @@ public:
/* SPACE API */
virtual RID space_create();
- virtual void space_set_active(RID p_space,bool p_active);
+ virtual void space_set_active(RID p_space, bool p_active);
virtual bool space_is_active(RID p_space) const;
- virtual void space_set_param(RID p_space,SpaceParameter p_param, real_t p_value);
- virtual real_t space_get_param(RID p_space,SpaceParameter p_param) const;
+ virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value);
+ virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const;
// this function only works on fixed process, errors and returns null otherwise
- virtual PhysicsDirectSpaceState* space_get_direct_state(RID p_space);
+ virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space);
- virtual void space_set_debug_contacts(RID p_space,int p_max_contacts);
+ virtual void space_set_debug_contacts(RID p_space, int p_max_contacts);
virtual Vector<Vector3> space_get_contacts(RID p_space) const;
virtual int space_get_contact_count(RID p_space) const;
@@ -108,9 +105,9 @@ public:
virtual void area_set_space(RID p_area, RID p_space);
virtual RID area_get_space(RID p_area) const;
- virtual void area_add_shape(RID p_area, RID p_shape, const Transform& p_transform=Transform());
- virtual void area_set_shape(RID p_area, int p_shape_idx,RID p_shape);
- virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform& p_transform);
+ virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform());
+ virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape);
+ virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform);
virtual int area_get_shape_count(RID p_area) const;
virtual RID area_get_shape(RID p_area, int p_shape_idx) const;
@@ -119,31 +116,30 @@ public:
virtual void area_remove_shape(RID p_area, int p_shape_idx);
virtual void area_clear_shapes(RID p_area);
- virtual void area_attach_object_instance_ID(RID p_area,ObjectID p_ID);
+ virtual void area_attach_object_instance_ID(RID p_area, ObjectID p_ID);
virtual ObjectID area_get_object_instance_ID(RID p_area) const;
- virtual void area_set_param(RID p_area,AreaParameter p_param,const Variant& p_value);
- virtual void area_set_transform(RID p_area, const Transform& p_transform);
+ virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value);
+ virtual void area_set_transform(RID p_area, const Transform &p_transform);
- virtual Variant area_get_param(RID p_parea,AreaParameter p_param) const;
+ virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const;
virtual Transform area_get_transform(RID p_area) const;
- virtual void area_set_ray_pickable(RID p_area,bool p_enable);
+ virtual void area_set_ray_pickable(RID p_area, bool p_enable);
virtual bool area_is_ray_pickable(RID p_area) const;
- virtual void area_set_collision_mask(RID p_area,uint32_t p_mask);
- virtual void area_set_layer_mask(RID p_area,uint32_t p_mask);
+ virtual void area_set_collision_mask(RID p_area, uint32_t p_mask);
+ virtual void area_set_layer_mask(RID p_area, uint32_t p_mask);
- virtual void area_set_monitorable(RID p_area,bool p_monitorable);
-
- virtual void area_set_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method);
- virtual void area_set_area_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method);
+ virtual void area_set_monitorable(RID p_area, bool p_monitorable);
+ virtual void area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method);
+ virtual void area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method);
/* BODY API */
// create a body of a given type
- virtual RID body_create(BodyMode p_mode=BODY_MODE_RIGID,bool p_init_sleeping=false);
+ virtual RID body_create(BodyMode p_mode = BODY_MODE_RIGID, bool p_init_sleeping = false);
virtual void body_set_space(RID p_body, RID p_space);
virtual RID body_get_space(RID p_body) const;
@@ -151,24 +147,24 @@ public:
virtual void body_set_mode(RID p_body, BodyMode p_mode);
virtual BodyMode body_get_mode(RID p_body) const;
- virtual void body_add_shape(RID p_body, RID p_shape, const Transform& p_transform=Transform());
- virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape);
- virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform& p_transform);
+ virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform());
+ virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape);
+ virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform);
virtual int body_get_shape_count(RID p_body) const;
virtual RID body_get_shape(RID p_body, int p_shape_idx) const;
virtual Transform body_get_shape_transform(RID p_body, int p_shape_idx) const;
- virtual void body_set_shape_as_trigger(RID p_body, int p_shape_idx,bool p_enable);
+ virtual void body_set_shape_as_trigger(RID p_body, int p_shape_idx, bool p_enable);
virtual bool body_is_shape_set_as_trigger(RID p_body, int p_shape_idx) const;
virtual void body_remove_shape(RID p_body, int p_shape_idx);
virtual void body_clear_shapes(RID p_body);
- virtual void body_attach_object_instance_ID(RID p_body,uint32_t p_ID);
+ virtual void body_attach_object_instance_ID(RID p_body, uint32_t p_ID);
virtual uint32_t body_get_object_instance_ID(RID p_body) const;
- virtual void body_set_enable_continuous_collision_detection(RID p_body,bool p_enable);
+ virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable);
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const;
virtual void body_set_layer_mask(RID p_body, uint32_t p_mask);
@@ -183,20 +179,20 @@ public:
virtual void body_set_param(RID p_body, BodyParameter p_param, real_t p_value);
virtual real_t body_get_param(RID p_body, BodyParameter p_param) const;
- virtual void body_set_state(RID p_body, BodyState p_state, const Variant& p_variant);
+ virtual void body_set_state(RID p_body, BodyState p_state, const Variant &p_variant);
virtual Variant body_get_state(RID p_body, BodyState p_state) const;
- virtual void body_set_applied_force(RID p_body, const Vector3& p_force);
+ virtual void body_set_applied_force(RID p_body, const Vector3 &p_force);
virtual Vector3 body_get_applied_force(RID p_body) const;
- virtual void body_set_applied_torque(RID p_body, const Vector3& p_torque);
+ virtual void body_set_applied_torque(RID p_body, const Vector3 &p_torque);
virtual Vector3 body_get_applied_torque(RID p_body) const;
- virtual void body_apply_impulse(RID p_body, const Vector3& p_pos, const Vector3& p_impulse);
- virtual void body_apply_torque_impulse(RID p_body, const Vector3& p_impulse);
- virtual void body_set_axis_velocity(RID p_body, const Vector3& p_axis_velocity);
+ virtual void body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse);
+ virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
+ virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
- virtual void body_set_axis_lock(RID p_body,BodyAxisLock p_lock);
+ virtual void body_set_axis_lock(RID p_body, BodyAxisLock p_lock);
virtual BodyAxisLock body_get_axis_lock(RID p_body) const;
virtual void body_add_collision_exception(RID p_body, RID p_body_b);
@@ -206,61 +202,60 @@ public:
virtual void body_set_contacts_reported_depth_treshold(RID p_body, real_t p_treshold);
virtual real_t body_get_contacts_reported_depth_treshold(RID p_body) const;
- virtual void body_set_omit_force_integration(RID p_body,bool p_omit);
+ virtual void body_set_omit_force_integration(RID p_body, bool p_omit);
virtual bool body_is_omitting_force_integration(RID p_body) const;
virtual void body_set_max_contacts_reported(RID p_body, int p_contacts);
virtual int body_get_max_contacts_reported(RID p_body) const;
- virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant());
+ virtual void body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata = Variant());
- virtual void body_set_ray_pickable(RID p_body,bool p_enable);
+ virtual void body_set_ray_pickable(RID p_body, bool p_enable);
virtual bool body_is_ray_pickable(RID p_body) const;
/* JOINT API */
- virtual RID joint_create_pin(RID p_body_A,const Vector3& p_local_A,RID p_body_B,const Vector3& p_local_B);
+ virtual RID joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B);
- virtual void pin_joint_set_param(RID p_joint,PinJointParam p_param, real_t p_value);
- virtual real_t pin_joint_get_param(RID p_joint,PinJointParam p_param) const;
+ virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value);
+ virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const;
- virtual void pin_joint_set_local_A(RID p_joint, const Vector3& p_A);
+ virtual void pin_joint_set_local_A(RID p_joint, const Vector3 &p_A);
virtual Vector3 pin_joint_get_local_A(RID p_joint) const;
- virtual void pin_joint_set_local_B(RID p_joint, const Vector3& p_B);
+ virtual void pin_joint_set_local_B(RID p_joint, const Vector3 &p_B);
virtual Vector3 pin_joint_get_local_B(RID p_joint) const;
- virtual RID joint_create_hinge(RID p_body_A,const Transform& p_frame_A,RID p_body_B,const Transform& p_frame_B);
- virtual RID joint_create_hinge_simple(RID p_body_A,const Vector3& p_pivot_A,const Vector3& p_axis_A,RID p_body_B,const Vector3& p_pivot_B,const Vector3& p_axis_B);
-
- virtual void hinge_joint_set_param(RID p_joint,HingeJointParam p_param, real_t p_value);
- virtual real_t hinge_joint_get_param(RID p_joint,HingeJointParam p_param) const;
+ virtual RID joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B);
+ virtual RID joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B);
- virtual void hinge_joint_set_flag(RID p_joint,HingeJointFlag p_flag, bool p_value);
- virtual bool hinge_joint_get_flag(RID p_joint,HingeJointFlag p_flag) const;
+ virtual void hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value);
+ virtual real_t hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const;
+ virtual void hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value);
+ virtual bool hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const;
- virtual RID joint_create_slider(RID p_body_A,const Transform& p_local_frame_A,RID p_body_B,const Transform& p_local_frame_B); //reference frame is A
+ virtual RID joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B); //reference frame is A
- virtual void slider_joint_set_param(RID p_joint,SliderJointParam p_param, real_t p_value);
- virtual real_t slider_joint_get_param(RID p_joint,SliderJointParam p_param) const;
+ virtual void slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value);
+ virtual real_t slider_joint_get_param(RID p_joint, SliderJointParam p_param) const;
- virtual RID joint_create_cone_twist(RID p_body_A,const Transform& p_local_frame_A,RID p_body_B,const Transform& p_local_frame_B); //reference frame is A
+ virtual RID joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B); //reference frame is A
- virtual void cone_twist_joint_set_param(RID p_joint,ConeTwistJointParam p_param, real_t p_value);
- virtual real_t cone_twist_joint_get_param(RID p_joint,ConeTwistJointParam p_param) const;
+ virtual void cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value);
+ virtual real_t cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const;
- virtual RID joint_create_generic_6dof(RID p_body_A,const Transform& p_local_frame_A,RID p_body_B,const Transform& p_local_frame_B); //reference frame is A
+ virtual RID joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B); //reference frame is A
- virtual void generic_6dof_joint_set_param(RID p_joint,Vector3::Axis,G6DOFJointAxisParam p_param, real_t p_value);
- virtual real_t generic_6dof_joint_get_param(RID p_joint,Vector3::Axis,G6DOFJointAxisParam p_param);
+ virtual void generic_6dof_joint_set_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param, real_t p_value);
+ virtual real_t generic_6dof_joint_get_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param);
- virtual void generic_6dof_joint_set_flag(RID p_joint,Vector3::Axis,G6DOFJointAxisFlag p_flag, bool p_enable);
- virtual bool generic_6dof_joint_get_flag(RID p_joint,Vector3::Axis,G6DOFJointAxisFlag p_flag);
+ virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable);
+ virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag);
virtual JointType joint_get_type(RID p_joint) const;
- virtual void joint_set_solver_priority(RID p_joint,int p_priority);
+ virtual void joint_set_solver_priority(RID p_joint, int p_priority);
virtual int joint_get_solver_priority(RID p_joint) const;
#if 0
@@ -290,8 +285,6 @@ public:
PhysicsServerSW();
~PhysicsServerSW();
-
};
#endif
-