summaryrefslogtreecommitdiff
path: root/servers/physics/space_sw.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /servers/physics/space_sw.h
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'servers/physics/space_sw.h')
-rw-r--r--servers/physics/space_sw.h84
1 files changed, 39 insertions, 45 deletions
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 208831914f..06538265bb 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -29,39 +29,35 @@
#ifndef SPACE_SW_H
#define SPACE_SW_H
-#include "typedefs.h"
-#include "hash_map.h"
-#include "body_sw.h"
+#include "area_pair_sw.h"
#include "area_sw.h"
#include "body_pair_sw.h"
-#include "area_pair_sw.h"
+#include "body_sw.h"
#include "broad_phase_sw.h"
#include "collision_object_sw.h"
#include "global_config.h"
-
+#include "hash_map.h"
+#include "typedefs.h"
class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState {
- GDCLASS( PhysicsDirectSpaceStateSW, PhysicsDirectSpaceState );
-public:
+ GDCLASS(PhysicsDirectSpaceStateSW, PhysicsDirectSpaceState);
+public:
SpaceSW *space;
- virtual bool intersect_ray(const Vector3& p_from, const Vector3& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,bool p_pick_ray=false);
- virtual int intersect_shape(const RID& p_shape, const Transform& p_xform,real_t p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
- virtual bool cast_motion(const RID& p_shape, const Transform& p_xform,const Vector3& p_motion,real_t p_margin,real_t &p_closest_safe,real_t &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION,ShapeRestInfo *r_info=NULL);
- virtual bool collide_shape(RID p_shape, const Transform& p_shape_xform,real_t p_margin,Vector3 *r_results,int p_result_max,int &r_result_count, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
- virtual bool rest_info(RID p_shape, const Transform& p_shape_xform,real_t p_margin,ShapeRestInfo *r_info, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
+ virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, bool p_pick_ray = false);
+ virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION, ShapeRestInfo *r_info = NULL);
+ virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
+ virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_layer_mask = 0xFFFFFFFF, uint32_t p_object_type_mask = TYPE_MASK_COLLISION);
PhysicsDirectSpaceStateSW();
};
-
-
class SpaceSW : public RID_Data {
public:
-
enum ElapsedTime {
ELAPSED_TIME_INTEGRATE_FORCES,
ELAPSED_TIME_GENERATE_ISLANDS,
@@ -71,8 +67,8 @@ public:
ELAPSED_TIME_MAX
};
-private:
+private:
uint64_t elapsed_time[ELAPSED_TIME_MAX];
PhysicsDirectSpaceStateSW *direct_access;
@@ -85,10 +81,10 @@ private:
SelfList<AreaSW>::List monitor_query_list;
SelfList<AreaSW>::List area_moved_list;
- static void* _broadphase_pair(CollisionObjectSW *A,int p_subindex_A,CollisionObjectSW *B,int p_subindex_B,void *p_self);
- static void _broadphase_unpair(CollisionObjectSW *A,int p_subindex_A,CollisionObjectSW *B,int p_subindex_B,void *p_data,void *p_self);
+ static void *_broadphase_pair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_self);
+ static void _broadphase_unpair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_data, void *p_self);
- Set<CollisionObjectSW*> objects;
+ Set<CollisionObjectSW *> objects;
AreaSW *area;
@@ -99,7 +95,7 @@ private:
enum {
- INTERSECTION_QUERY_MAX=2048
+ INTERSECTION_QUERY_MAX = 2048
};
CollisionObjectSW *intersection_query_results[INTERSECTION_QUERY_MAX];
@@ -121,36 +117,35 @@ private:
Vector<Vector3> contact_debug;
int contact_debug_count;
-friend class PhysicsDirectSpaceStateSW;
+ friend class PhysicsDirectSpaceStateSW;
public:
-
- _FORCE_INLINE_ void set_self(const RID& p_self) { self=p_self; }
+ _FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
_FORCE_INLINE_ RID get_self() const { return self; }
- void set_default_area(AreaSW *p_area) { area=p_area; }
+ void set_default_area(AreaSW *p_area) { area = p_area; }
AreaSW *get_default_area() const { return area; }
- const SelfList<BodySW>::List& get_active_body_list() const;
- void body_add_to_active_list(SelfList<BodySW>* p_body);
- void body_remove_from_active_list(SelfList<BodySW>* p_body);
- void body_add_to_inertia_update_list(SelfList<BodySW>* p_body);
- void body_remove_from_inertia_update_list(SelfList<BodySW>* p_body);
+ const SelfList<BodySW>::List &get_active_body_list() const;
+ void body_add_to_active_list(SelfList<BodySW> *p_body);
+ void body_remove_from_active_list(SelfList<BodySW> *p_body);
+ void body_add_to_inertia_update_list(SelfList<BodySW> *p_body);
+ void body_remove_from_inertia_update_list(SelfList<BodySW> *p_body);
- void body_add_to_state_query_list(SelfList<BodySW>* p_body);
- void body_remove_from_state_query_list(SelfList<BodySW>* p_body);
+ void body_add_to_state_query_list(SelfList<BodySW> *p_body);
+ void body_remove_from_state_query_list(SelfList<BodySW> *p_body);
- void area_add_to_monitor_query_list(SelfList<AreaSW>* p_area);
- void area_remove_from_monitor_query_list(SelfList<AreaSW>* p_area);
- void area_add_to_moved_list(SelfList<AreaSW>* p_area);
- void area_remove_from_moved_list(SelfList<AreaSW>* p_area);
- const SelfList<AreaSW>::List& get_moved_area_list() const;
+ void area_add_to_monitor_query_list(SelfList<AreaSW> *p_area);
+ void area_remove_from_monitor_query_list(SelfList<AreaSW> *p_area);
+ void area_add_to_moved_list(SelfList<AreaSW> *p_area);
+ void area_remove_from_moved_list(SelfList<AreaSW> *p_area);
+ const SelfList<AreaSW>::List &get_moved_area_list() const;
BroadPhaseSW *get_broadphase();
void add_object(CollisionObjectSW *p_object);
void remove_object(CollisionObjectSW *p_object);
- const Set<CollisionObjectSW*> &get_objects() const;
+ const Set<CollisionObjectSW *> &get_objects() const;
_FORCE_INLINE_ real_t get_contact_recycle_radius() const { return contact_recycle_radius; }
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
@@ -161,12 +156,10 @@ public:
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }
-
void update();
void setup();
void call_queries();
-
bool is_locked() const;
void lock();
void unlock();
@@ -174,10 +167,10 @@ public:
void set_param(PhysicsServer::SpaceParameter p_param, real_t p_value);
real_t get_param(PhysicsServer::SpaceParameter p_param) const;
- void set_island_count(int p_island_count) { island_count=p_island_count; }
+ void set_island_count(int p_island_count) { island_count = p_island_count; }
int get_island_count() const { return island_count; }
- void set_active_objects(int p_active_objects) { active_objects=p_active_objects; }
+ void set_active_objects(int p_active_objects) { active_objects = p_active_objects; }
int get_active_objects() const { return active_objects; }
int get_collision_pairs() const { return collision_pairs; }
@@ -186,19 +179,20 @@ public:
void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
_FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
- _FORCE_INLINE_ void add_debug_contact(const Vector3& p_contact) { if (contact_debug_count<contact_debug.size()) contact_debug[contact_debug_count++]=p_contact; }
+ _FORCE_INLINE_ void add_debug_contact(const Vector3 &p_contact) {
+ if (contact_debug_count < contact_debug.size()) contact_debug[contact_debug_count++] = p_contact;
+ }
_FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contact_debug; }
_FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; }
- void set_static_global_body(RID p_body) { static_global_body=p_body; }
+ void set_static_global_body(RID p_body) { static_global_body = p_body; }
RID get_static_global_body() { return static_global_body; }
- void set_elapsed_time(ElapsedTime p_time,uint64_t p_msec) { elapsed_time[p_time]=p_msec; }
+ void set_elapsed_time(ElapsedTime p_time, uint64_t p_msec) { elapsed_time[p_time] = p_msec; }
uint64_t get_elapsed_time(ElapsedTime p_time) const { return elapsed_time[p_time]; }
SpaceSW();
~SpaceSW();
};
-
#endif // SPACE__SW_H