fabriceci / godot-rapier2d

GDExtension for Rapier2D
MIT License
15 stars 3 forks source link

Refactor cpp and rust(rapier) code #45

Closed Ughuuu closed 11 months ago

Ughuuu commented 11 months ago

Split the main rust code into smaller logical groups. Split the cpp code and group it into folders.

Rust code now: image

Add support for double precision builds in rust code: image

Also add to SConstruct a define REAL_T_IS_FLOAT to be used in the rapier wrapper to know what type to use as real.

Also remove the global variables used in space:


uint32_t g_query_collision_layer_mask = 0;
ObjectID g_query_canvas_instance_id;
rapier2d::Handle *g_query_exclude = nullptr;
uint32_t g_query_exclude_size = 0;
RID *g_query_exclude_body = nullptr;

and

RapierSpace2D *g_contact_events_space = nullptr;
RapierBody2D *g_contact_events_body1 = nullptr;
RapierBody2D *g_contact_events_body2 = nullptr;
uint32_t g_contact_events_shape1 = 0;
uint32_t g_contact_events_shape2 = 0;

And instead send them to the rapier code and then have the rapier code send them back.