Move server files into their subfolders
This commit is contained in:
6
servers/physics_3d/SCsub
Normal file
6
servers/physics_3d/SCsub
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
env.add_source_files(env.servers_sources, "*.cpp")
|
||||
1247
servers/physics_3d/physics_server_3d.cpp
Normal file
1247
servers/physics_3d/physics_server_3d.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1074
servers/physics_3d/physics_server_3d.h
Normal file
1074
servers/physics_3d/physics_server_3d.h
Normal file
File diff suppressed because it is too large
Load Diff
447
servers/physics_3d/physics_server_3d_dummy.h
Normal file
447
servers/physics_3d/physics_server_3d_dummy.h
Normal file
@ -0,0 +1,447 @@
|
||||
/**************************************************************************/
|
||||
/* physics_server_3d_dummy.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "servers/physics_3d/physics_server_3d.h"
|
||||
|
||||
class PhysicsDirectBodyState3DDummy : public PhysicsDirectBodyState3D {
|
||||
GDCLASS(PhysicsDirectBodyState3DDummy, PhysicsDirectBodyState3D);
|
||||
|
||||
PhysicsDirectSpaceState3D *space_state_dummy = nullptr;
|
||||
|
||||
public:
|
||||
virtual Vector3 get_total_gravity() const override { return Vector3(); }
|
||||
virtual real_t get_total_angular_damp() const override { return 0; }
|
||||
virtual real_t get_total_linear_damp() const override { return 0; }
|
||||
|
||||
virtual Vector3 get_center_of_mass() const override { return Vector3(); }
|
||||
virtual Vector3 get_center_of_mass_local() const override { return Vector3(); }
|
||||
virtual Basis get_principal_inertia_axes() const override { return Basis(); }
|
||||
virtual real_t get_inverse_mass() const override { return 0; }
|
||||
virtual Vector3 get_inverse_inertia() const override { return Vector3(); }
|
||||
virtual Basis get_inverse_inertia_tensor() const override { return Basis(); }
|
||||
|
||||
virtual void set_linear_velocity(const Vector3 &p_velocity) override {}
|
||||
virtual Vector3 get_linear_velocity() const override { return Vector3(); }
|
||||
|
||||
virtual void set_angular_velocity(const Vector3 &p_velocity) override {}
|
||||
virtual Vector3 get_angular_velocity() const override { return Vector3(); }
|
||||
|
||||
virtual void set_transform(const Transform3D &p_transform) override {}
|
||||
virtual Transform3D get_transform() const override { return Transform3D(); }
|
||||
|
||||
virtual Vector3 get_velocity_at_local_position(const Vector3 &p_position) const override { return Vector3(); }
|
||||
|
||||
virtual void apply_central_impulse(const Vector3 &p_impulse) override {}
|
||||
virtual void apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void apply_torque_impulse(const Vector3 &p_impulse) override {}
|
||||
|
||||
virtual void apply_central_force(const Vector3 &p_force) override {}
|
||||
virtual void apply_force(const Vector3 &p_force, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void apply_torque(const Vector3 &p_torque) override {}
|
||||
|
||||
virtual void add_constant_central_force(const Vector3 &p_force) override {}
|
||||
virtual void add_constant_force(const Vector3 &p_force, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void add_constant_torque(const Vector3 &p_torque) override {}
|
||||
|
||||
virtual void set_constant_force(const Vector3 &p_force) override {}
|
||||
virtual Vector3 get_constant_force() const override { return Vector3(); }
|
||||
|
||||
virtual void set_constant_torque(const Vector3 &p_torque) override {}
|
||||
virtual Vector3 get_constant_torque() const override { return Vector3(); }
|
||||
|
||||
virtual void set_sleep_state(bool p_sleep) override {}
|
||||
virtual bool is_sleeping() const override { return false; }
|
||||
|
||||
virtual void set_collision_layer(uint32_t p_layer) override {}
|
||||
virtual uint32_t get_collision_layer() const override { return 0; }
|
||||
|
||||
virtual void set_collision_mask(uint32_t p_mask) override {}
|
||||
virtual uint32_t get_collision_mask() const override { return 0; }
|
||||
|
||||
virtual int get_contact_count() const override { return 0; }
|
||||
|
||||
virtual Vector3 get_contact_local_position(int p_contact_idx) const override { return Vector3(); }
|
||||
virtual Vector3 get_contact_local_normal(int p_contact_idx) const override { return Vector3(); }
|
||||
virtual Vector3 get_contact_impulse(int p_contact_idx) const override { return Vector3(); }
|
||||
virtual int get_contact_local_shape(int p_contact_idx) const override { return 0; }
|
||||
virtual Vector3 get_contact_local_velocity_at_position(int p_contact_idx) const override { return Vector3(); }
|
||||
|
||||
virtual RID get_contact_collider(int p_contact_idx) const override { return RID(); }
|
||||
virtual Vector3 get_contact_collider_position(int p_contact_idx) const override { return Vector3(); }
|
||||
virtual ObjectID get_contact_collider_id(int p_contact_idx) const override { return ObjectID(); }
|
||||
virtual Object *get_contact_collider_object(int p_contact_idx) const override { return nullptr; }
|
||||
virtual int get_contact_collider_shape(int p_contact_idx) const override { return 0; }
|
||||
virtual Vector3 get_contact_collider_velocity_at_position(int p_contact_idx) const override { return Vector3(); }
|
||||
|
||||
virtual real_t get_step() const override { return 0; }
|
||||
virtual void integrate_forces() override {}
|
||||
|
||||
virtual PhysicsDirectSpaceState3D *get_space_state() override { return space_state_dummy; }
|
||||
|
||||
PhysicsDirectBodyState3DDummy(PhysicsDirectSpaceState3D *p_space_state_dummy) {
|
||||
space_state_dummy = p_space_state_dummy;
|
||||
}
|
||||
};
|
||||
|
||||
class PhysicsDirectSpaceState3DDummy : public PhysicsDirectSpaceState3D {
|
||||
GDCLASS(PhysicsDirectSpaceState3DDummy, PhysicsDirectSpaceState3D);
|
||||
|
||||
public:
|
||||
virtual bool intersect_ray(const RayParameters &p_parameters, RayResult &r_result) override { return false; }
|
||||
|
||||
virtual int intersect_point(const PointParameters &p_parameters, ShapeResult *r_results, int p_result_max) override { return 0; }
|
||||
|
||||
virtual int intersect_shape(const ShapeParameters &p_parameters, ShapeResult *r_results, int p_result_max) override { return 0; }
|
||||
virtual bool cast_motion(const ShapeParameters &p_parameters, real_t &p_closest_safe, real_t &p_closest_unsafe, ShapeRestInfo *r_info = nullptr) override { return false; }
|
||||
virtual bool collide_shape(const ShapeParameters &p_parameters, Vector3 *r_results, int p_result_max, int &r_result_count) override { return false; }
|
||||
virtual bool rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) override { return false; }
|
||||
|
||||
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const override { return Vector3(); }
|
||||
};
|
||||
|
||||
class PhysicsServer3DDummy : public PhysicsServer3D {
|
||||
GDCLASS(PhysicsServer3DDummy, PhysicsServer3D);
|
||||
|
||||
PhysicsDirectBodyState3DDummy *body_state_dummy = nullptr;
|
||||
PhysicsDirectSpaceState3DDummy *space_state_dummy = nullptr;
|
||||
|
||||
public:
|
||||
virtual RID world_boundary_shape_create() override { return RID(); }
|
||||
virtual RID separation_ray_shape_create() override { return RID(); }
|
||||
virtual RID sphere_shape_create() override { return RID(); }
|
||||
virtual RID box_shape_create() override { return RID(); }
|
||||
virtual RID capsule_shape_create() override { return RID(); }
|
||||
virtual RID cylinder_shape_create() override { return RID(); }
|
||||
virtual RID convex_polygon_shape_create() override { return RID(); }
|
||||
virtual RID concave_polygon_shape_create() override { return RID(); }
|
||||
virtual RID heightmap_shape_create() override { return RID(); }
|
||||
virtual RID custom_shape_create() override { return RID(); }
|
||||
|
||||
virtual void shape_set_data(RID p_shape, const Variant &p_data) override {}
|
||||
virtual void shape_set_custom_solver_bias(RID p_shape, real_t p_bias) override {}
|
||||
|
||||
virtual ShapeType shape_get_type(RID p_shape) const override { return SHAPE_SPHERE; }
|
||||
virtual Variant shape_get_data(RID p_shape) const override { return Variant(); }
|
||||
|
||||
virtual void shape_set_margin(RID p_shape, real_t p_margin) override {}
|
||||
virtual real_t shape_get_margin(RID p_shape) const override { return 0; }
|
||||
|
||||
virtual real_t shape_get_custom_solver_bias(RID p_shape) const override { return 0; }
|
||||
|
||||
/* SPACE API */
|
||||
|
||||
virtual RID space_create() override { return RID(); }
|
||||
virtual void space_set_active(RID p_space, bool p_active) override {}
|
||||
virtual bool space_is_active(RID p_space) const override { return false; }
|
||||
|
||||
virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) override {}
|
||||
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const override { return 0; }
|
||||
|
||||
virtual PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space) override { return space_state_dummy; }
|
||||
|
||||
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts) override {}
|
||||
virtual Vector<Vector3> space_get_contacts(RID p_space) const override { return Vector<Vector3>(); }
|
||||
virtual int space_get_contact_count(RID p_space) const override { return 0; }
|
||||
|
||||
/* AREA API */
|
||||
|
||||
virtual RID area_create() override { return RID(); }
|
||||
|
||||
virtual void area_set_space(RID p_area, RID p_space) override {}
|
||||
virtual RID area_get_space(RID p_area) const override { return RID(); }
|
||||
|
||||
virtual void area_add_shape(RID p_area, RID p_shape, const Transform3D &p_transform = Transform3D(), bool p_disabled = false) override {}
|
||||
virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape) override {}
|
||||
virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform3D &p_transform) override {}
|
||||
|
||||
virtual int area_get_shape_count(RID p_area) const override { return 0; }
|
||||
virtual RID area_get_shape(RID p_area, int p_shape_idx) const override { return RID(); }
|
||||
virtual Transform3D area_get_shape_transform(RID p_area, int p_shape_idx) const override { return Transform3D(); }
|
||||
|
||||
virtual void area_remove_shape(RID p_area, int p_shape_idx) override {}
|
||||
virtual void area_clear_shapes(RID p_area) override {}
|
||||
|
||||
virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) override {}
|
||||
|
||||
virtual void area_attach_object_instance_id(RID p_area, ObjectID p_id) override {}
|
||||
virtual ObjectID area_get_object_instance_id(RID p_area) const override { return ObjectID(); }
|
||||
|
||||
virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) override {}
|
||||
virtual void area_set_transform(RID p_area, const Transform3D &p_transform) override {}
|
||||
|
||||
virtual Variant area_get_param(RID p_parea, AreaParameter p_param) const override { return Variant(); }
|
||||
virtual Transform3D area_get_transform(RID p_area) const override { return Transform3D(); }
|
||||
|
||||
virtual void area_set_collision_layer(RID p_area, uint32_t p_layer) override {}
|
||||
virtual uint32_t area_get_collision_layer(RID p_area) const override { return 0; }
|
||||
|
||||
virtual void area_set_collision_mask(RID p_area, uint32_t p_mask) override {}
|
||||
virtual uint32_t area_get_collision_mask(RID p_area) const override { return 0; }
|
||||
|
||||
virtual void area_set_monitorable(RID p_area, bool p_monitorable) override {}
|
||||
|
||||
virtual void area_set_monitor_callback(RID p_area, const Callable &p_callback) override {}
|
||||
virtual void area_set_area_monitor_callback(RID p_area, const Callable &p_callback) override {}
|
||||
|
||||
virtual void area_set_ray_pickable(RID p_area, bool p_enable) override {}
|
||||
|
||||
/* BODY API */
|
||||
|
||||
virtual RID body_create() override { return RID(); }
|
||||
|
||||
virtual void body_set_space(RID p_body, RID p_space) override {}
|
||||
virtual RID body_get_space(RID p_body) const override { return RID(); }
|
||||
|
||||
virtual void body_set_mode(RID p_body, BodyMode p_mode) override {}
|
||||
virtual BodyMode body_get_mode(RID p_body) const override { return BodyMode::BODY_MODE_STATIC; }
|
||||
|
||||
virtual void body_add_shape(RID p_body, RID p_shape, const Transform3D &p_transform = Transform3D(), bool p_disabled = false) override {}
|
||||
virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape) override {}
|
||||
virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform3D &p_transform) override {}
|
||||
|
||||
virtual int body_get_shape_count(RID p_body) const override { return 0; }
|
||||
virtual RID body_get_shape(RID p_body, int p_shape_idx) const override { return RID(); }
|
||||
virtual Transform3D body_get_shape_transform(RID p_body, int p_shape_idx) const override { return Transform3D(); }
|
||||
|
||||
virtual void body_remove_shape(RID p_body, int p_shape_idx) override {}
|
||||
virtual void body_clear_shapes(RID p_body) override {}
|
||||
|
||||
virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) override {}
|
||||
|
||||
virtual void body_attach_object_instance_id(RID p_body, ObjectID p_id) override {}
|
||||
virtual ObjectID body_get_object_instance_id(RID p_body) const override { return ObjectID(); }
|
||||
|
||||
virtual void body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) override {}
|
||||
virtual bool body_is_continuous_collision_detection_enabled(RID p_body) const override { return false; }
|
||||
|
||||
virtual void body_set_collision_layer(RID p_body, uint32_t p_layer) override {}
|
||||
virtual uint32_t body_get_collision_layer(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_collision_mask(RID p_body, uint32_t p_mask) override {}
|
||||
virtual uint32_t body_get_collision_mask(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_collision_priority(RID p_body, real_t p_priority) override {}
|
||||
virtual real_t body_get_collision_priority(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_user_flags(RID p_body, uint32_t p_flags) override {}
|
||||
virtual uint32_t body_get_user_flags(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) override {}
|
||||
virtual Variant body_get_param(RID p_body, BodyParameter p_param) const override { return Variant(); }
|
||||
|
||||
virtual void body_reset_mass_properties(RID p_body) override {}
|
||||
|
||||
virtual void body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) override {}
|
||||
virtual Variant body_get_state(RID p_body, BodyState p_state) const override { return Variant(); }
|
||||
|
||||
virtual void body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) override {}
|
||||
virtual void body_apply_impulse(RID p_body, const Vector3 &p_impulse, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) override {}
|
||||
|
||||
virtual void body_apply_central_force(RID p_body, const Vector3 &p_force) override {}
|
||||
virtual void body_apply_force(RID p_body, const Vector3 &p_force, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void body_apply_torque(RID p_body, const Vector3 &p_torque) override {}
|
||||
|
||||
virtual void body_add_constant_central_force(RID p_body, const Vector3 &p_force) override {}
|
||||
virtual void body_add_constant_force(RID p_body, const Vector3 &p_force, const Vector3 &p_position = Vector3()) override {}
|
||||
virtual void body_add_constant_torque(RID p_body, const Vector3 &p_torque) override {}
|
||||
|
||||
virtual void body_set_constant_force(RID p_body, const Vector3 &p_force) override {}
|
||||
virtual Vector3 body_get_constant_force(RID p_body) const override { return Vector3(); }
|
||||
|
||||
virtual void body_set_constant_torque(RID p_body, const Vector3 &p_torque) override {}
|
||||
virtual Vector3 body_get_constant_torque(RID p_body) const override { return Vector3(); }
|
||||
|
||||
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) override {}
|
||||
|
||||
virtual void body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) override {}
|
||||
virtual bool body_is_axis_locked(RID p_body, BodyAxis p_axis) const override { return false; }
|
||||
|
||||
virtual void body_add_collision_exception(RID p_body, RID p_body_b) override {}
|
||||
virtual void body_remove_collision_exception(RID p_body, RID p_body_b) override {}
|
||||
virtual void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) override {}
|
||||
|
||||
virtual void body_set_max_contacts_reported(RID p_body, int p_contacts) override {}
|
||||
virtual int body_get_max_contacts_reported(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) override {}
|
||||
virtual real_t body_get_contacts_reported_depth_threshold(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void body_set_omit_force_integration(RID p_body, bool p_omit) override {}
|
||||
virtual bool body_is_omitting_force_integration(RID p_body) const override { return false; }
|
||||
|
||||
virtual void body_set_state_sync_callback(RID p_body, const Callable &p_callable) override {}
|
||||
virtual void body_set_force_integration_callback(RID p_body, const Callable &p_callable, const Variant &p_udata = Variant()) override {}
|
||||
|
||||
virtual void body_set_ray_pickable(RID p_body, bool p_enable) override {}
|
||||
|
||||
virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body) override { return body_state_dummy; }
|
||||
|
||||
virtual bool body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result = nullptr) override { return false; }
|
||||
|
||||
/* SOFT BODY */
|
||||
|
||||
virtual RID soft_body_create() override { return RID(); }
|
||||
|
||||
virtual void soft_body_update_rendering_server(RID p_body, PhysicsServer3DRenderingServerHandler *p_rendering_server_handler) override {}
|
||||
|
||||
virtual void soft_body_set_space(RID p_body, RID p_space) override {}
|
||||
virtual RID soft_body_get_space(RID p_body) const override { return RID(); }
|
||||
|
||||
virtual void soft_body_set_mesh(RID p_body, RID p_mesh) override {}
|
||||
|
||||
virtual AABB soft_body_get_bounds(RID p_body) const override { return AABB(); }
|
||||
|
||||
virtual void soft_body_set_collision_layer(RID p_body, uint32_t p_layer) override {}
|
||||
virtual uint32_t soft_body_get_collision_layer(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_collision_mask(RID p_body, uint32_t p_mask) override {}
|
||||
virtual uint32_t soft_body_get_collision_mask(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_add_collision_exception(RID p_body, RID p_body_b) override {}
|
||||
virtual void soft_body_remove_collision_exception(RID p_body, RID p_body_b) override {}
|
||||
virtual void soft_body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) override {}
|
||||
|
||||
virtual void soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) override {}
|
||||
virtual Variant soft_body_get_state(RID p_body, BodyState p_state) const override { return Variant(); }
|
||||
|
||||
virtual void soft_body_set_transform(RID p_body, const Transform3D &p_transform) override {}
|
||||
|
||||
virtual void soft_body_set_ray_pickable(RID p_body, bool p_enable) override {}
|
||||
|
||||
virtual void soft_body_set_simulation_precision(RID p_body, int p_simulation_precision) override {}
|
||||
virtual int soft_body_get_simulation_precision(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_total_mass(RID p_body, real_t p_total_mass) override {}
|
||||
virtual real_t soft_body_get_total_mass(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_linear_stiffness(RID p_body, real_t p_stiffness) override {}
|
||||
virtual real_t soft_body_get_linear_stiffness(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_shrinking_factor(RID p_body, real_t p_shrinking_factor) override {}
|
||||
virtual real_t soft_body_get_shrinking_factor(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_pressure_coefficient(RID p_body, real_t p_pressure_coefficient) override {}
|
||||
virtual real_t soft_body_get_pressure_coefficient(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_damping_coefficient(RID p_body, real_t p_damping_coefficient) override {}
|
||||
virtual real_t soft_body_get_damping_coefficient(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_set_drag_coefficient(RID p_body, real_t p_drag_coefficient) override {}
|
||||
virtual real_t soft_body_get_drag_coefficient(RID p_body) const override { return 0; }
|
||||
|
||||
virtual void soft_body_move_point(RID p_body, int p_point_index, const Vector3 &p_global_position) override {}
|
||||
virtual Vector3 soft_body_get_point_global_position(RID p_body, int p_point_index) const override { return Vector3(); }
|
||||
|
||||
virtual void soft_body_remove_all_pinned_points(RID p_body) override {}
|
||||
virtual void soft_body_pin_point(RID p_body, int p_point_index, bool p_pin) override {}
|
||||
virtual bool soft_body_is_point_pinned(RID p_body, int p_point_index) const override { return false; }
|
||||
|
||||
virtual void soft_body_apply_point_impulse(RID p_body, int p_point_index, const Vector3 &p_impulse) override {}
|
||||
virtual void soft_body_apply_point_force(RID p_body, int p_point_index, const Vector3 &p_force) override {}
|
||||
virtual void soft_body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) override {}
|
||||
virtual void soft_body_apply_central_force(RID p_body, const Vector3 &p_force) override {}
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
virtual RID joint_create() override { return RID(); }
|
||||
|
||||
virtual void joint_clear(RID p_joint) override {}
|
||||
|
||||
virtual JointType joint_get_type(RID p_joint) const override { return JointType::JOINT_TYPE_PIN; }
|
||||
|
||||
virtual void joint_set_solver_priority(RID p_joint, int p_priority) override {}
|
||||
virtual int joint_get_solver_priority(RID p_joint) const override { return 0; }
|
||||
|
||||
virtual void joint_disable_collisions_between_bodies(RID p_joint, bool p_disable) override {}
|
||||
virtual bool joint_is_disabled_collisions_between_bodies(RID p_joint) const override { return false; }
|
||||
|
||||
virtual void joint_make_pin(RID p_joint, RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) override {}
|
||||
|
||||
virtual void pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) override {}
|
||||
virtual real_t pin_joint_get_param(RID p_joint, PinJointParam p_param) const override { return 0; }
|
||||
|
||||
virtual void pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) override {}
|
||||
virtual Vector3 pin_joint_get_local_a(RID p_joint) const override { return Vector3(); }
|
||||
|
||||
virtual void pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) override {}
|
||||
virtual Vector3 pin_joint_get_local_b(RID p_joint) const override { return Vector3(); }
|
||||
|
||||
virtual void joint_make_hinge(RID p_joint, RID p_body_A, const Transform3D &p_hinge_A, RID p_body_B, const Transform3D &p_hinge_B) override {}
|
||||
virtual void joint_make_hinge_simple(RID p_joint, 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) override {}
|
||||
|
||||
virtual void hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value) override {}
|
||||
virtual real_t hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const override { return 0; }
|
||||
|
||||
virtual void hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_enabled) override {}
|
||||
virtual bool hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const override { return false; }
|
||||
|
||||
virtual void joint_make_slider(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override {}
|
||||
|
||||
virtual void slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value) override {}
|
||||
virtual real_t slider_joint_get_param(RID p_joint, SliderJointParam p_param) const override { return 0; }
|
||||
|
||||
virtual void joint_make_cone_twist(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override {}
|
||||
|
||||
virtual void cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value) override {}
|
||||
virtual real_t cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const override { return 0; }
|
||||
|
||||
virtual void joint_make_generic_6dof(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override {}
|
||||
|
||||
virtual void generic_6dof_joint_set_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param, real_t p_value) override {}
|
||||
virtual real_t generic_6dof_joint_get_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param) const override { return 0; }
|
||||
|
||||
virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) override {}
|
||||
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) const override { return false; }
|
||||
|
||||
/* MISC */
|
||||
|
||||
virtual void free_rid(RID p_rid) override {}
|
||||
|
||||
virtual void set_active(bool p_active) override {}
|
||||
virtual void init() override {
|
||||
space_state_dummy = memnew(PhysicsDirectSpaceState3DDummy);
|
||||
body_state_dummy = memnew(PhysicsDirectBodyState3DDummy(space_state_dummy));
|
||||
}
|
||||
virtual void step(real_t p_step) override {}
|
||||
virtual void sync() override {}
|
||||
virtual void flush_queries() override {}
|
||||
virtual void end_sync() override {}
|
||||
virtual void finish() override {
|
||||
memdelete(body_state_dummy);
|
||||
memdelete(space_state_dummy);
|
||||
}
|
||||
|
||||
virtual bool is_flushing_queries() const override { return false; }
|
||||
|
||||
virtual int get_process_info(ProcessInfo p_info) override { return 0; }
|
||||
};
|
||||
445
servers/physics_3d/physics_server_3d_extension.cpp
Normal file
445
servers/physics_3d/physics_server_3d_extension.cpp
Normal file
@ -0,0 +1,445 @@
|
||||
/**************************************************************************/
|
||||
/* physics_server_3d_extension.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "physics_server_3d_extension.h"
|
||||
|
||||
bool PhysicsDirectSpaceState3DExtension::is_body_excluded_from_query(const RID &p_body) const {
|
||||
return exclude && exclude->has(p_body);
|
||||
}
|
||||
|
||||
thread_local const HashSet<RID> *PhysicsDirectSpaceState3DExtension::exclude = nullptr;
|
||||
|
||||
void PhysicsDirectSpaceState3DExtension::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_body_excluded_from_query", "body"), &PhysicsDirectSpaceState3DExtension::is_body_excluded_from_query);
|
||||
|
||||
GDVIRTUAL_BIND(_intersect_ray, "from", "to", "collision_mask", "collide_with_bodies", "collide_with_areas", "hit_from_inside", "hit_back_faces", "pick_ray", "result");
|
||||
GDVIRTUAL_BIND(_intersect_point, "position", "collision_mask", "collide_with_bodies", "collide_with_areas", "results", "max_results");
|
||||
GDVIRTUAL_BIND(_intersect_shape, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "result_count", "max_results");
|
||||
GDVIRTUAL_BIND(_cast_motion, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "closest_safe", "closest_unsafe", "info");
|
||||
GDVIRTUAL_BIND(_collide_shape, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "results", "max_results", "result_count");
|
||||
GDVIRTUAL_BIND(_rest_info, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "rest_info");
|
||||
GDVIRTUAL_BIND(_get_closest_point_to_object_volume, "object", "point");
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState3DExtension::PhysicsDirectSpaceState3DExtension() {
|
||||
}
|
||||
|
||||
void PhysicsDirectBodyState3DExtension::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_get_total_gravity);
|
||||
GDVIRTUAL_BIND(_get_total_linear_damp);
|
||||
GDVIRTUAL_BIND(_get_total_angular_damp);
|
||||
|
||||
GDVIRTUAL_BIND(_get_center_of_mass);
|
||||
GDVIRTUAL_BIND(_get_center_of_mass_local);
|
||||
GDVIRTUAL_BIND(_get_principal_inertia_axes);
|
||||
|
||||
GDVIRTUAL_BIND(_get_inverse_mass);
|
||||
GDVIRTUAL_BIND(_get_inverse_inertia);
|
||||
GDVIRTUAL_BIND(_get_inverse_inertia_tensor);
|
||||
|
||||
GDVIRTUAL_BIND(_set_linear_velocity, "velocity");
|
||||
GDVIRTUAL_BIND(_get_linear_velocity);
|
||||
|
||||
GDVIRTUAL_BIND(_set_angular_velocity, "velocity");
|
||||
GDVIRTUAL_BIND(_get_angular_velocity);
|
||||
|
||||
GDVIRTUAL_BIND(_set_transform, "transform");
|
||||
GDVIRTUAL_BIND(_get_transform);
|
||||
|
||||
GDVIRTUAL_BIND(_get_velocity_at_local_position, "local_position");
|
||||
|
||||
GDVIRTUAL_BIND(_apply_central_impulse, "impulse");
|
||||
GDVIRTUAL_BIND(_apply_impulse, "impulse", "position");
|
||||
GDVIRTUAL_BIND(_apply_torque_impulse, "impulse");
|
||||
|
||||
GDVIRTUAL_BIND(_apply_central_force, "force");
|
||||
GDVIRTUAL_BIND(_apply_force, "force", "position");
|
||||
GDVIRTUAL_BIND(_apply_torque, "torque");
|
||||
|
||||
GDVIRTUAL_BIND(_add_constant_central_force, "force");
|
||||
GDVIRTUAL_BIND(_add_constant_force, "force", "position");
|
||||
GDVIRTUAL_BIND(_add_constant_torque, "torque");
|
||||
|
||||
GDVIRTUAL_BIND(_set_constant_force, "force");
|
||||
GDVIRTUAL_BIND(_get_constant_force);
|
||||
|
||||
GDVIRTUAL_BIND(_set_constant_torque, "torque");
|
||||
GDVIRTUAL_BIND(_get_constant_torque);
|
||||
|
||||
GDVIRTUAL_BIND(_set_sleep_state, "enabled");
|
||||
GDVIRTUAL_BIND(_is_sleeping);
|
||||
|
||||
GDVIRTUAL_BIND(_set_collision_layer, "layer");
|
||||
GDVIRTUAL_BIND(_get_collision_layer);
|
||||
|
||||
GDVIRTUAL_BIND(_set_collision_mask, "mask");
|
||||
GDVIRTUAL_BIND(_get_collision_mask);
|
||||
|
||||
GDVIRTUAL_BIND(_get_contact_count);
|
||||
|
||||
GDVIRTUAL_BIND(_get_contact_local_position, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_local_normal, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_impulse, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_local_shape, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_local_velocity_at_position, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider_position, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider_id, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider_object, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider_shape, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_contact_collider_velocity_at_position, "contact_idx");
|
||||
GDVIRTUAL_BIND(_get_step);
|
||||
GDVIRTUAL_BIND(_integrate_forces);
|
||||
GDVIRTUAL_BIND(_get_space_state);
|
||||
}
|
||||
|
||||
PhysicsDirectBodyState3DExtension::PhysicsDirectBodyState3DExtension() {
|
||||
}
|
||||
|
||||
thread_local const HashSet<RID> *PhysicsServer3DExtension::exclude_bodies = nullptr;
|
||||
thread_local const HashSet<ObjectID> *PhysicsServer3DExtension::exclude_objects = nullptr;
|
||||
|
||||
bool PhysicsServer3DExtension::body_test_motion_is_excluding_body(RID p_body) const {
|
||||
return exclude_bodies && exclude_bodies->has(p_body);
|
||||
}
|
||||
|
||||
bool PhysicsServer3DExtension::body_test_motion_is_excluding_object(ObjectID p_object) const {
|
||||
return exclude_objects && exclude_objects->has(p_object);
|
||||
}
|
||||
|
||||
void PhysicsServer3DExtension::_bind_methods() {
|
||||
/* SHAPE API */
|
||||
|
||||
GDVIRTUAL_BIND(_world_boundary_shape_create);
|
||||
GDVIRTUAL_BIND(_separation_ray_shape_create);
|
||||
GDVIRTUAL_BIND(_sphere_shape_create);
|
||||
GDVIRTUAL_BIND(_box_shape_create);
|
||||
GDVIRTUAL_BIND(_capsule_shape_create);
|
||||
GDVIRTUAL_BIND(_cylinder_shape_create);
|
||||
GDVIRTUAL_BIND(_convex_polygon_shape_create);
|
||||
GDVIRTUAL_BIND(_concave_polygon_shape_create);
|
||||
GDVIRTUAL_BIND(_heightmap_shape_create);
|
||||
GDVIRTUAL_BIND(_custom_shape_create);
|
||||
|
||||
GDVIRTUAL_BIND(_shape_set_data, "shape", "data");
|
||||
GDVIRTUAL_BIND(_shape_set_custom_solver_bias, "shape", "bias");
|
||||
|
||||
GDVIRTUAL_BIND(_shape_set_margin, "shape", "margin");
|
||||
GDVIRTUAL_BIND(_shape_get_margin, "shape");
|
||||
|
||||
GDVIRTUAL_BIND(_shape_get_type, "shape");
|
||||
GDVIRTUAL_BIND(_shape_get_data, "shape");
|
||||
GDVIRTUAL_BIND(_shape_get_custom_solver_bias, "shape");
|
||||
|
||||
/* SPACE API */
|
||||
|
||||
GDVIRTUAL_BIND(_space_create);
|
||||
GDVIRTUAL_BIND(_space_set_active, "space", "active");
|
||||
GDVIRTUAL_BIND(_space_is_active, "space");
|
||||
|
||||
GDVIRTUAL_BIND(_space_set_param, "space", "param", "value");
|
||||
GDVIRTUAL_BIND(_space_get_param, "space", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_space_get_direct_state, "space");
|
||||
|
||||
GDVIRTUAL_BIND(_space_set_debug_contacts, "space", "max_contacts");
|
||||
GDVIRTUAL_BIND(_space_get_contacts, "space");
|
||||
GDVIRTUAL_BIND(_space_get_contact_count, "space");
|
||||
|
||||
/* AREA API */
|
||||
|
||||
GDVIRTUAL_BIND(_area_create);
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_space, "area", "space");
|
||||
GDVIRTUAL_BIND(_area_get_space, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_add_shape, "area", "shape", "transform", "disabled");
|
||||
GDVIRTUAL_BIND(_area_set_shape, "area", "shape_idx", "shape");
|
||||
GDVIRTUAL_BIND(_area_set_shape_transform, "area", "shape_idx", "transform");
|
||||
GDVIRTUAL_BIND(_area_set_shape_disabled, "area", "shape_idx", "disabled");
|
||||
|
||||
GDVIRTUAL_BIND(_area_get_shape_count, "area");
|
||||
GDVIRTUAL_BIND(_area_get_shape, "area", "shape_idx");
|
||||
GDVIRTUAL_BIND(_area_get_shape_transform, "area", "shape_idx");
|
||||
|
||||
GDVIRTUAL_BIND(_area_remove_shape, "area", "shape_idx");
|
||||
GDVIRTUAL_BIND(_area_clear_shapes, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_attach_object_instance_id, "area", "id");
|
||||
GDVIRTUAL_BIND(_area_get_object_instance_id, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_param, "area", "param", "value");
|
||||
GDVIRTUAL_BIND(_area_set_transform, "area", "transform");
|
||||
|
||||
GDVIRTUAL_BIND(_area_get_param, "area", "param");
|
||||
GDVIRTUAL_BIND(_area_get_transform, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_collision_layer, "area", "layer");
|
||||
GDVIRTUAL_BIND(_area_get_collision_layer, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_collision_mask, "area", "mask");
|
||||
GDVIRTUAL_BIND(_area_get_collision_mask, "area");
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_monitorable, "area", "monitorable");
|
||||
GDVIRTUAL_BIND(_area_set_ray_pickable, "area", "enable");
|
||||
|
||||
GDVIRTUAL_BIND(_area_set_monitor_callback, "area", "callback");
|
||||
GDVIRTUAL_BIND(_area_set_area_monitor_callback, "area", "callback");
|
||||
|
||||
/* BODY API */
|
||||
|
||||
ClassDB::bind_method(D_METHOD("body_test_motion_is_excluding_body", "body"), &PhysicsServer3DExtension::body_test_motion_is_excluding_body);
|
||||
ClassDB::bind_method(D_METHOD("body_test_motion_is_excluding_object", "object"), &PhysicsServer3DExtension::body_test_motion_is_excluding_object);
|
||||
|
||||
GDVIRTUAL_BIND(_body_create);
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_space, "body", "space");
|
||||
GDVIRTUAL_BIND(_body_get_space, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_mode, "body", "mode");
|
||||
GDVIRTUAL_BIND(_body_get_mode, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_add_shape, "body", "shape", "transform", "disabled");
|
||||
GDVIRTUAL_BIND(_body_set_shape, "body", "shape_idx", "shape");
|
||||
GDVIRTUAL_BIND(_body_set_shape_transform, "body", "shape_idx", "transform");
|
||||
GDVIRTUAL_BIND(_body_set_shape_disabled, "body", "shape_idx", "disabled");
|
||||
|
||||
GDVIRTUAL_BIND(_body_get_shape_count, "body");
|
||||
GDVIRTUAL_BIND(_body_get_shape, "body", "shape_idx");
|
||||
GDVIRTUAL_BIND(_body_get_shape_transform, "body", "shape_idx");
|
||||
|
||||
GDVIRTUAL_BIND(_body_remove_shape, "body", "shape_idx");
|
||||
GDVIRTUAL_BIND(_body_clear_shapes, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_attach_object_instance_id, "body", "id");
|
||||
GDVIRTUAL_BIND(_body_get_object_instance_id, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_enable_continuous_collision_detection, "body", "enable");
|
||||
GDVIRTUAL_BIND(_body_is_continuous_collision_detection_enabled, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_collision_layer, "body", "layer");
|
||||
GDVIRTUAL_BIND(_body_get_collision_layer, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_collision_mask, "body", "mask");
|
||||
GDVIRTUAL_BIND(_body_get_collision_mask, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_collision_priority, "body", "priority");
|
||||
GDVIRTUAL_BIND(_body_get_collision_priority, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_user_flags, "body", "flags");
|
||||
GDVIRTUAL_BIND(_body_get_user_flags, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_param, "body", "param", "value");
|
||||
GDVIRTUAL_BIND(_body_get_param, "body", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_body_reset_mass_properties, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_state, "body", "state", "value");
|
||||
GDVIRTUAL_BIND(_body_get_state, "body", "state");
|
||||
|
||||
GDVIRTUAL_BIND(_body_apply_central_impulse, "body", "impulse");
|
||||
GDVIRTUAL_BIND(_body_apply_impulse, "body", "impulse", "position");
|
||||
GDVIRTUAL_BIND(_body_apply_torque_impulse, "body", "impulse");
|
||||
|
||||
GDVIRTUAL_BIND(_body_apply_central_force, "body", "force");
|
||||
GDVIRTUAL_BIND(_body_apply_force, "body", "force", "position");
|
||||
GDVIRTUAL_BIND(_body_apply_torque, "body", "torque");
|
||||
|
||||
GDVIRTUAL_BIND(_body_add_constant_central_force, "body", "force");
|
||||
GDVIRTUAL_BIND(_body_add_constant_force, "body", "force", "position");
|
||||
GDVIRTUAL_BIND(_body_add_constant_torque, "body", "torque");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_constant_force, "body", "force");
|
||||
GDVIRTUAL_BIND(_body_get_constant_force, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_constant_torque, "body", "torque");
|
||||
GDVIRTUAL_BIND(_body_get_constant_torque, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_axis_velocity, "body", "axis_velocity");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_axis_lock, "body", "axis", "lock");
|
||||
GDVIRTUAL_BIND(_body_is_axis_locked, "body", "axis");
|
||||
|
||||
GDVIRTUAL_BIND(_body_add_collision_exception, "body", "excepted_body");
|
||||
GDVIRTUAL_BIND(_body_remove_collision_exception, "body", "excepted_body");
|
||||
GDVIRTUAL_BIND(_body_get_collision_exceptions, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_max_contacts_reported, "body", "amount");
|
||||
GDVIRTUAL_BIND(_body_get_max_contacts_reported, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_contacts_reported_depth_threshold, "body", "threshold");
|
||||
GDVIRTUAL_BIND(_body_get_contacts_reported_depth_threshold, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_omit_force_integration, "body", "enable");
|
||||
GDVIRTUAL_BIND(_body_is_omitting_force_integration, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_state_sync_callback, "body", "callable");
|
||||
GDVIRTUAL_BIND(_body_set_force_integration_callback, "body", "callable", "userdata");
|
||||
|
||||
GDVIRTUAL_BIND(_body_set_ray_pickable, "body", "enable");
|
||||
|
||||
GDVIRTUAL_BIND(_body_test_motion, "body", "from", "motion", "margin", "max_collisions", "collide_separation_ray", "recovery_as_collision", "result");
|
||||
|
||||
GDVIRTUAL_BIND(_body_get_direct_state, "body");
|
||||
|
||||
/* SOFT BODY API */
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_create);
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_update_rendering_server, "body", "rendering_server_handler");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_space, "body", "space");
|
||||
GDVIRTUAL_BIND(_soft_body_get_space, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_ray_pickable, "body", "enable");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_collision_layer, "body", "layer");
|
||||
GDVIRTUAL_BIND(_soft_body_get_collision_layer, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_collision_mask, "body", "mask");
|
||||
GDVIRTUAL_BIND(_soft_body_get_collision_mask, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_add_collision_exception, "body", "body_b");
|
||||
GDVIRTUAL_BIND(_soft_body_remove_collision_exception, "body", "body_b");
|
||||
GDVIRTUAL_BIND(_soft_body_get_collision_exceptions, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_state, "body", "state", "variant");
|
||||
GDVIRTUAL_BIND(_soft_body_get_state, "body", "state");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_transform, "body", "transform");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_simulation_precision, "body", "simulation_precision");
|
||||
GDVIRTUAL_BIND(_soft_body_get_simulation_precision, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_total_mass, "body", "total_mass");
|
||||
GDVIRTUAL_BIND(_soft_body_get_total_mass, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_linear_stiffness, "body", "linear_stiffness");
|
||||
GDVIRTUAL_BIND(_soft_body_get_linear_stiffness, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_shrinking_factor, "body", "shrinking_factor");
|
||||
GDVIRTUAL_BIND(_soft_body_get_shrinking_factor, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_pressure_coefficient, "body", "pressure_coefficient");
|
||||
GDVIRTUAL_BIND(_soft_body_get_pressure_coefficient, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_damping_coefficient, "body", "damping_coefficient");
|
||||
GDVIRTUAL_BIND(_soft_body_get_damping_coefficient, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_drag_coefficient, "body", "drag_coefficient");
|
||||
GDVIRTUAL_BIND(_soft_body_get_drag_coefficient, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_set_mesh, "body", "mesh");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_get_bounds, "body");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_move_point, "body", "point_index", "global_position");
|
||||
GDVIRTUAL_BIND(_soft_body_get_point_global_position, "body", "point_index");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_remove_all_pinned_points, "body");
|
||||
GDVIRTUAL_BIND(_soft_body_pin_point, "body", "point_index", "pin");
|
||||
GDVIRTUAL_BIND(_soft_body_is_point_pinned, "body", "point_index");
|
||||
|
||||
GDVIRTUAL_BIND(_soft_body_apply_point_impulse, "body", "point_index", "impulse");
|
||||
GDVIRTUAL_BIND(_soft_body_apply_point_force, "body", "point_index", "force");
|
||||
GDVIRTUAL_BIND(_soft_body_apply_central_impulse, "body", "impulse");
|
||||
GDVIRTUAL_BIND(_soft_body_apply_central_force, "body", "force");
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
GDVIRTUAL_BIND(_joint_create);
|
||||
GDVIRTUAL_BIND(_joint_clear, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_make_pin, "joint", "body_A", "local_A", "body_B", "local_B");
|
||||
|
||||
GDVIRTUAL_BIND(_pin_joint_set_param, "joint", "param", "value");
|
||||
GDVIRTUAL_BIND(_pin_joint_get_param, "joint", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_pin_joint_set_local_a, "joint", "local_A");
|
||||
GDVIRTUAL_BIND(_pin_joint_get_local_a, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_pin_joint_set_local_b, "joint", "local_B");
|
||||
GDVIRTUAL_BIND(_pin_joint_get_local_b, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_make_hinge, "joint", "body_A", "hinge_A", "body_B", "hinge_B");
|
||||
GDVIRTUAL_BIND(_joint_make_hinge_simple, "joint", "body_A", "pivot_A", "axis_A", "body_B", "pivot_B", "axis_B");
|
||||
|
||||
GDVIRTUAL_BIND(_hinge_joint_set_param, "joint", "param", "value");
|
||||
GDVIRTUAL_BIND(_hinge_joint_get_param, "joint", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_hinge_joint_set_flag, "joint", "flag", "enabled");
|
||||
GDVIRTUAL_BIND(_hinge_joint_get_flag, "joint", "flag");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_make_slider, "joint", "body_A", "local_ref_A", "body_B", "local_ref_B");
|
||||
|
||||
GDVIRTUAL_BIND(_slider_joint_set_param, "joint", "param", "value");
|
||||
GDVIRTUAL_BIND(_slider_joint_get_param, "joint", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_make_cone_twist, "joint", "body_A", "local_ref_A", "body_B", "local_ref_B");
|
||||
|
||||
GDVIRTUAL_BIND(_cone_twist_joint_set_param, "joint", "param", "value");
|
||||
GDVIRTUAL_BIND(_cone_twist_joint_get_param, "joint", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_make_generic_6dof, "joint", "body_A", "local_ref_A", "body_B", "local_ref_B");
|
||||
|
||||
GDVIRTUAL_BIND(_generic_6dof_joint_set_param, "joint", "axis", "param", "value");
|
||||
GDVIRTUAL_BIND(_generic_6dof_joint_get_param, "joint", "axis", "param");
|
||||
|
||||
GDVIRTUAL_BIND(_generic_6dof_joint_set_flag, "joint", "axis", "flag", "enable");
|
||||
GDVIRTUAL_BIND(_generic_6dof_joint_get_flag, "joint", "axis", "flag");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_get_type, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_set_solver_priority, "joint", "priority");
|
||||
GDVIRTUAL_BIND(_joint_get_solver_priority, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_joint_disable_collisions_between_bodies, "joint", "disable");
|
||||
GDVIRTUAL_BIND(_joint_is_disabled_collisions_between_bodies, "joint");
|
||||
|
||||
GDVIRTUAL_BIND(_free_rid, "rid");
|
||||
|
||||
GDVIRTUAL_BIND(_set_active, "active");
|
||||
|
||||
GDVIRTUAL_BIND(_init);
|
||||
GDVIRTUAL_BIND(_step, "step");
|
||||
GDVIRTUAL_BIND(_sync);
|
||||
GDVIRTUAL_BIND(_flush_queries);
|
||||
GDVIRTUAL_BIND(_end_sync);
|
||||
GDVIRTUAL_BIND(_finish);
|
||||
|
||||
GDVIRTUAL_BIND(_is_flushing_queries);
|
||||
GDVIRTUAL_BIND(_get_process_info, "process_info");
|
||||
}
|
||||
|
||||
PhysicsServer3DExtension::PhysicsServer3DExtension() {
|
||||
}
|
||||
|
||||
PhysicsServer3DExtension::~PhysicsServer3DExtension() {
|
||||
}
|
||||
554
servers/physics_3d/physics_server_3d_extension.h
Normal file
554
servers/physics_3d/physics_server_3d_extension.h
Normal file
@ -0,0 +1,554 @@
|
||||
/**************************************************************************/
|
||||
/* physics_server_3d_extension.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/extension/ext_wrappers.gen.inc"
|
||||
#include "core/object/script_language.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "servers/physics_3d/physics_server_3d.h"
|
||||
|
||||
class PhysicsDirectBodyState3DExtension : public PhysicsDirectBodyState3D {
|
||||
GDCLASS(PhysicsDirectBodyState3DExtension, PhysicsDirectBodyState3D);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// The warning is valid, but unavoidable. If the function is not overridden it will error anyway.
|
||||
|
||||
EXBIND0RC(Vector3, get_total_gravity)
|
||||
EXBIND0RC(real_t, get_total_angular_damp)
|
||||
EXBIND0RC(real_t, get_total_linear_damp)
|
||||
|
||||
EXBIND0RC(Vector3, get_center_of_mass)
|
||||
EXBIND0RC(Vector3, get_center_of_mass_local)
|
||||
EXBIND0RC(Basis, get_principal_inertia_axes)
|
||||
EXBIND0RC(real_t, get_inverse_mass)
|
||||
EXBIND0RC(Vector3, get_inverse_inertia)
|
||||
EXBIND0RC(Basis, get_inverse_inertia_tensor)
|
||||
|
||||
EXBIND1(set_linear_velocity, const Vector3 &)
|
||||
EXBIND0RC(Vector3, get_linear_velocity)
|
||||
|
||||
EXBIND1(set_angular_velocity, const Vector3 &)
|
||||
EXBIND0RC(Vector3, get_angular_velocity)
|
||||
|
||||
EXBIND1(set_transform, const Transform3D &)
|
||||
EXBIND0RC(Transform3D, get_transform)
|
||||
|
||||
EXBIND1RC(Vector3, get_velocity_at_local_position, const Vector3 &)
|
||||
|
||||
EXBIND1(apply_central_impulse, const Vector3 &)
|
||||
EXBIND2(apply_impulse, const Vector3 &, const Vector3 &)
|
||||
EXBIND1(apply_torque_impulse, const Vector3 &)
|
||||
|
||||
EXBIND1(apply_central_force, const Vector3 &)
|
||||
EXBIND2(apply_force, const Vector3 &, const Vector3 &)
|
||||
EXBIND1(apply_torque, const Vector3 &)
|
||||
|
||||
EXBIND1(add_constant_central_force, const Vector3 &)
|
||||
EXBIND2(add_constant_force, const Vector3 &, const Vector3 &)
|
||||
EXBIND1(add_constant_torque, const Vector3 &)
|
||||
|
||||
EXBIND1(set_constant_force, const Vector3 &)
|
||||
EXBIND0RC(Vector3, get_constant_force)
|
||||
|
||||
EXBIND1(set_constant_torque, const Vector3 &)
|
||||
EXBIND0RC(Vector3, get_constant_torque)
|
||||
|
||||
EXBIND1(set_sleep_state, bool)
|
||||
EXBIND0RC(bool, is_sleeping)
|
||||
|
||||
EXBIND1(set_collision_layer, uint32_t);
|
||||
EXBIND0RC(uint32_t, get_collision_layer);
|
||||
|
||||
EXBIND1(set_collision_mask, uint32_t);
|
||||
EXBIND0RC(uint32_t, get_collision_mask);
|
||||
|
||||
EXBIND0RC(int, get_contact_count)
|
||||
|
||||
EXBIND1RC(Vector3, get_contact_local_position, int)
|
||||
EXBIND1RC(Vector3, get_contact_local_normal, int)
|
||||
EXBIND1RC(Vector3, get_contact_impulse, int)
|
||||
EXBIND1RC(int, get_contact_local_shape, int)
|
||||
EXBIND1RC(Vector3, get_contact_local_velocity_at_position, int)
|
||||
EXBIND1RC(RID, get_contact_collider, int)
|
||||
EXBIND1RC(Vector3, get_contact_collider_position, int)
|
||||
EXBIND1RC(ObjectID, get_contact_collider_id, int)
|
||||
EXBIND1RC(Object *, get_contact_collider_object, int)
|
||||
EXBIND1RC(int, get_contact_collider_shape, int)
|
||||
EXBIND1RC(Vector3, get_contact_collider_velocity_at_position, int)
|
||||
|
||||
EXBIND0RC(real_t, get_step)
|
||||
|
||||
EXBIND0(integrate_forces)
|
||||
EXBIND0R(PhysicsDirectSpaceState3D *, get_space_state)
|
||||
|
||||
PhysicsDirectBodyState3DExtension();
|
||||
};
|
||||
|
||||
typedef PhysicsDirectSpaceState3D::RayResult PhysicsServer3DExtensionRayResult;
|
||||
typedef PhysicsDirectSpaceState3D::ShapeResult PhysicsServer3DExtensionShapeResult;
|
||||
typedef PhysicsDirectSpaceState3D::ShapeRestInfo PhysicsServer3DExtensionShapeRestInfo;
|
||||
|
||||
GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionRayResult)
|
||||
GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionShapeResult)
|
||||
GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionShapeRestInfo)
|
||||
|
||||
class PhysicsDirectSpaceState3DExtension : public PhysicsDirectSpaceState3D {
|
||||
GDCLASS(PhysicsDirectSpaceState3DExtension, PhysicsDirectSpaceState3D);
|
||||
|
||||
thread_local static const HashSet<RID> *exclude;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
bool is_body_excluded_from_query(const RID &p_body) const;
|
||||
|
||||
GDVIRTUAL9R_REQUIRED(bool, _intersect_ray, const Vector3 &, const Vector3 &, uint32_t, bool, bool, bool, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionRayResult>)
|
||||
GDVIRTUAL6R_REQUIRED(int, _intersect_point, const Vector3 &, uint32_t, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionShapeResult>, int)
|
||||
GDVIRTUAL9R_REQUIRED(int, _intersect_shape, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionShapeResult>, int)
|
||||
GDVIRTUAL10R_REQUIRED(bool, _cast_motion, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<real_t>, GDExtensionPtr<real_t>, GDExtensionPtr<PhysicsServer3DExtensionShapeRestInfo>)
|
||||
GDVIRTUAL10R_REQUIRED(bool, _collide_shape, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<Vector3>, int, GDExtensionPtr<int>)
|
||||
GDVIRTUAL8R_REQUIRED(bool, _rest_info, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionShapeRestInfo>)
|
||||
GDVIRTUAL2RC_REQUIRED(Vector3, _get_closest_point_to_object_volume, RID, const Vector3 &)
|
||||
|
||||
public:
|
||||
virtual bool intersect_ray(const RayParameters &p_parameters, RayResult &r_result) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_intersect_ray, p_parameters.from, p_parameters.to, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, p_parameters.hit_from_inside, p_parameters.hit_back_faces, p_parameters.pick_ray, &r_result, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
virtual int intersect_point(const PointParameters &p_parameters, ShapeResult *r_results, int p_result_max) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
int ret = false;
|
||||
GDVIRTUAL_CALL(_intersect_point, p_parameters.position, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, r_results, p_result_max, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
virtual int intersect_shape(const ShapeParameters &p_parameters, ShapeResult *r_results, int p_result_max) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
int ret = 0;
|
||||
GDVIRTUAL_CALL(_intersect_shape, p_parameters.shape_rid, p_parameters.transform, p_parameters.motion, p_parameters.margin, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, r_results, p_result_max, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
virtual bool cast_motion(const ShapeParameters &p_parameters, real_t &p_closest_safe, real_t &p_closest_unsafe, ShapeRestInfo *r_info = nullptr) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_cast_motion, p_parameters.shape_rid, p_parameters.transform, p_parameters.motion, p_parameters.margin, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, &p_closest_safe, &p_closest_unsafe, r_info, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
virtual bool collide_shape(const ShapeParameters &p_parameters, Vector3 *r_results, int p_result_max, int &r_result_count) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_collide_shape, p_parameters.shape_rid, p_parameters.transform, p_parameters.motion, p_parameters.margin, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, r_results, p_result_max, &r_result_count, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
virtual bool rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) override {
|
||||
exclude = &p_parameters.exclude;
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_rest_info, p_parameters.shape_rid, p_parameters.transform, p_parameters.motion, p_parameters.margin, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, r_info, ret);
|
||||
exclude = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const override {
|
||||
Vector3 ret;
|
||||
GDVIRTUAL_CALL(_get_closest_point_to_object_volume, p_object, p_point, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
PhysicsDirectSpaceState3DExtension();
|
||||
};
|
||||
|
||||
typedef PhysicsServer3D::MotionCollision PhysicsServer3DExtensionMotionCollision;
|
||||
typedef PhysicsServer3D::MotionResult PhysicsServer3DExtensionMotionResult;
|
||||
|
||||
GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionMotionCollision)
|
||||
GDVIRTUAL_NATIVE_PTR(PhysicsServer3DExtensionMotionResult)
|
||||
|
||||
class PhysicsServer3DExtension : public PhysicsServer3D {
|
||||
GDCLASS(PhysicsServer3DExtension, PhysicsServer3D);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// The warning is valid, but unavoidable. If the function is not overridden it will error anyway.
|
||||
|
||||
/* SHAPE API */
|
||||
|
||||
EXBIND0R(RID, world_boundary_shape_create)
|
||||
EXBIND0R(RID, separation_ray_shape_create)
|
||||
EXBIND0R(RID, sphere_shape_create)
|
||||
EXBIND0R(RID, box_shape_create)
|
||||
EXBIND0R(RID, capsule_shape_create)
|
||||
EXBIND0R(RID, cylinder_shape_create)
|
||||
EXBIND0R(RID, convex_polygon_shape_create)
|
||||
EXBIND0R(RID, concave_polygon_shape_create)
|
||||
EXBIND0R(RID, heightmap_shape_create)
|
||||
EXBIND0R(RID, custom_shape_create)
|
||||
|
||||
EXBIND2(shape_set_data, RID, const Variant &)
|
||||
EXBIND2(shape_set_custom_solver_bias, RID, real_t)
|
||||
|
||||
EXBIND2(shape_set_margin, RID, real_t)
|
||||
EXBIND1RC(real_t, shape_get_margin, RID)
|
||||
|
||||
EXBIND1RC(ShapeType, shape_get_type, RID)
|
||||
EXBIND1RC(Variant, shape_get_data, RID)
|
||||
EXBIND1RC(real_t, shape_get_custom_solver_bias, RID)
|
||||
|
||||
/* SPACE API */
|
||||
|
||||
EXBIND0R(RID, space_create)
|
||||
EXBIND2(space_set_active, RID, bool)
|
||||
EXBIND1RC(bool, space_is_active, RID)
|
||||
|
||||
EXBIND3(space_set_param, RID, SpaceParameter, real_t)
|
||||
EXBIND2RC(real_t, space_get_param, RID, SpaceParameter)
|
||||
|
||||
EXBIND1R(PhysicsDirectSpaceState3D *, space_get_direct_state, RID)
|
||||
|
||||
EXBIND2(space_set_debug_contacts, RID, int)
|
||||
EXBIND1RC(Vector<Vector3>, space_get_contacts, RID)
|
||||
EXBIND1RC(int, space_get_contact_count, RID)
|
||||
|
||||
/* AREA API */
|
||||
|
||||
//EXBIND0RID(area);
|
||||
EXBIND0R(RID, area_create)
|
||||
|
||||
EXBIND2(area_set_space, RID, RID)
|
||||
EXBIND1RC(RID, area_get_space, RID)
|
||||
|
||||
EXBIND4(area_add_shape, RID, RID, const Transform3D &, bool)
|
||||
EXBIND3(area_set_shape, RID, int, RID)
|
||||
EXBIND3(area_set_shape_transform, RID, int, const Transform3D &)
|
||||
EXBIND3(area_set_shape_disabled, RID, int, bool)
|
||||
|
||||
EXBIND1RC(int, area_get_shape_count, RID)
|
||||
EXBIND2RC(RID, area_get_shape, RID, int)
|
||||
EXBIND2RC(Transform3D, area_get_shape_transform, RID, int)
|
||||
|
||||
EXBIND2(area_remove_shape, RID, int)
|
||||
EXBIND1(area_clear_shapes, RID)
|
||||
|
||||
EXBIND2(area_attach_object_instance_id, RID, ObjectID)
|
||||
EXBIND1RC(ObjectID, area_get_object_instance_id, RID)
|
||||
|
||||
EXBIND3(area_set_param, RID, AreaParameter, const Variant &)
|
||||
EXBIND2(area_set_transform, RID, const Transform3D &)
|
||||
|
||||
EXBIND2RC(Variant, area_get_param, RID, AreaParameter)
|
||||
EXBIND1RC(Transform3D, area_get_transform, RID)
|
||||
|
||||
EXBIND2(area_set_collision_layer, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, area_get_collision_layer, RID)
|
||||
|
||||
EXBIND2(area_set_collision_mask, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, area_get_collision_mask, RID)
|
||||
|
||||
EXBIND2(area_set_monitorable, RID, bool)
|
||||
EXBIND2(area_set_ray_pickable, RID, bool)
|
||||
|
||||
EXBIND2(area_set_monitor_callback, RID, const Callable &)
|
||||
EXBIND2(area_set_area_monitor_callback, RID, const Callable &)
|
||||
|
||||
/* BODY API */
|
||||
|
||||
//EXBIND2RID(body,BodyMode,bool);
|
||||
EXBIND0R(RID, body_create)
|
||||
|
||||
EXBIND2(body_set_space, RID, RID)
|
||||
EXBIND1RC(RID, body_get_space, RID)
|
||||
|
||||
EXBIND2(body_set_mode, RID, BodyMode)
|
||||
EXBIND1RC(BodyMode, body_get_mode, RID)
|
||||
|
||||
EXBIND4(body_add_shape, RID, RID, const Transform3D &, bool)
|
||||
EXBIND3(body_set_shape, RID, int, RID)
|
||||
EXBIND3(body_set_shape_transform, RID, int, const Transform3D &)
|
||||
EXBIND3(body_set_shape_disabled, RID, int, bool)
|
||||
|
||||
EXBIND1RC(int, body_get_shape_count, RID)
|
||||
EXBIND2RC(RID, body_get_shape, RID, int)
|
||||
EXBIND2RC(Transform3D, body_get_shape_transform, RID, int)
|
||||
|
||||
EXBIND2(body_remove_shape, RID, int)
|
||||
EXBIND1(body_clear_shapes, RID)
|
||||
|
||||
EXBIND2(body_attach_object_instance_id, RID, ObjectID)
|
||||
EXBIND1RC(ObjectID, body_get_object_instance_id, RID)
|
||||
|
||||
EXBIND2(body_set_enable_continuous_collision_detection, RID, bool)
|
||||
EXBIND1RC(bool, body_is_continuous_collision_detection_enabled, RID)
|
||||
|
||||
EXBIND2(body_set_collision_layer, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, body_get_collision_layer, RID)
|
||||
|
||||
EXBIND2(body_set_collision_mask, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, body_get_collision_mask, RID)
|
||||
|
||||
EXBIND2(body_set_collision_priority, RID, real_t)
|
||||
EXBIND1RC(real_t, body_get_collision_priority, RID)
|
||||
|
||||
EXBIND2(body_set_user_flags, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, body_get_user_flags, RID)
|
||||
|
||||
EXBIND3(body_set_param, RID, BodyParameter, const Variant &)
|
||||
EXBIND2RC(Variant, body_get_param, RID, BodyParameter)
|
||||
|
||||
EXBIND1(body_reset_mass_properties, RID)
|
||||
|
||||
EXBIND3(body_set_state, RID, BodyState, const Variant &)
|
||||
EXBIND2RC(Variant, body_get_state, RID, BodyState)
|
||||
|
||||
EXBIND2(body_apply_central_impulse, RID, const Vector3 &)
|
||||
EXBIND3(body_apply_impulse, RID, const Vector3 &, const Vector3 &)
|
||||
EXBIND2(body_apply_torque_impulse, RID, const Vector3 &)
|
||||
|
||||
EXBIND2(body_apply_central_force, RID, const Vector3 &)
|
||||
EXBIND3(body_apply_force, RID, const Vector3 &, const Vector3 &)
|
||||
EXBIND2(body_apply_torque, RID, const Vector3 &)
|
||||
|
||||
EXBIND2(body_add_constant_central_force, RID, const Vector3 &)
|
||||
EXBIND3(body_add_constant_force, RID, const Vector3 &, const Vector3 &)
|
||||
EXBIND2(body_add_constant_torque, RID, const Vector3 &)
|
||||
|
||||
EXBIND2(body_set_constant_force, RID, const Vector3 &)
|
||||
EXBIND1RC(Vector3, body_get_constant_force, RID)
|
||||
|
||||
EXBIND2(body_set_constant_torque, RID, const Vector3 &)
|
||||
EXBIND1RC(Vector3, body_get_constant_torque, RID)
|
||||
|
||||
EXBIND2(body_set_axis_velocity, RID, const Vector3 &)
|
||||
|
||||
EXBIND3(body_set_axis_lock, RID, BodyAxis, bool)
|
||||
EXBIND2RC(bool, body_is_axis_locked, RID, BodyAxis)
|
||||
|
||||
EXBIND2(body_add_collision_exception, RID, RID)
|
||||
EXBIND2(body_remove_collision_exception, RID, RID)
|
||||
|
||||
GDVIRTUAL1RC_REQUIRED(TypedArray<RID>, _body_get_collision_exceptions, RID)
|
||||
|
||||
void body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) override {
|
||||
TypedArray<RID> ret;
|
||||
GDVIRTUAL_CALL(_body_get_collision_exceptions, p_body, ret);
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
p_exceptions->push_back(ret[i]);
|
||||
}
|
||||
}
|
||||
|
||||
EXBIND2(body_set_max_contacts_reported, RID, int)
|
||||
EXBIND1RC(int, body_get_max_contacts_reported, RID)
|
||||
|
||||
EXBIND2(body_set_contacts_reported_depth_threshold, RID, real_t)
|
||||
EXBIND1RC(real_t, body_get_contacts_reported_depth_threshold, RID)
|
||||
|
||||
EXBIND2(body_set_omit_force_integration, RID, bool)
|
||||
EXBIND1RC(bool, body_is_omitting_force_integration, RID)
|
||||
|
||||
EXBIND2(body_set_state_sync_callback, RID, const Callable &)
|
||||
EXBIND3(body_set_force_integration_callback, RID, const Callable &, const Variant &)
|
||||
|
||||
EXBIND2(body_set_ray_pickable, RID, bool)
|
||||
|
||||
GDVIRTUAL8RC_REQUIRED(bool, _body_test_motion, RID, const Transform3D &, const Vector3 &, real_t, int, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionMotionResult>)
|
||||
|
||||
thread_local static const HashSet<RID> *exclude_bodies;
|
||||
thread_local static const HashSet<ObjectID> *exclude_objects;
|
||||
|
||||
bool body_test_motion_is_excluding_body(RID p_body) const;
|
||||
bool body_test_motion_is_excluding_object(ObjectID p_object) const;
|
||||
|
||||
bool body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result = nullptr) override {
|
||||
bool ret = false;
|
||||
exclude_bodies = &p_parameters.exclude_bodies;
|
||||
exclude_objects = &p_parameters.exclude_objects;
|
||||
GDVIRTUAL_CALL(_body_test_motion, p_body, p_parameters.from, p_parameters.motion, p_parameters.margin, p_parameters.max_collisions, p_parameters.collide_separation_ray, p_parameters.recovery_as_collision, r_result, ret);
|
||||
exclude_bodies = nullptr;
|
||||
exclude_objects = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXBIND1R(PhysicsDirectBodyState3D *, body_get_direct_state, RID)
|
||||
|
||||
/* SOFT BODY API */
|
||||
|
||||
EXBIND0R(RID, soft_body_create)
|
||||
|
||||
EXBIND2(soft_body_update_rendering_server, RID, PhysicsServer3DRenderingServerHandler *)
|
||||
|
||||
EXBIND2(soft_body_set_space, RID, RID)
|
||||
EXBIND1RC(RID, soft_body_get_space, RID)
|
||||
|
||||
EXBIND2(soft_body_set_ray_pickable, RID, bool)
|
||||
|
||||
EXBIND2(soft_body_set_collision_layer, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, soft_body_get_collision_layer, RID)
|
||||
|
||||
EXBIND2(soft_body_set_collision_mask, RID, uint32_t)
|
||||
EXBIND1RC(uint32_t, soft_body_get_collision_mask, RID)
|
||||
|
||||
EXBIND2(soft_body_add_collision_exception, RID, RID)
|
||||
EXBIND2(soft_body_remove_collision_exception, RID, RID)
|
||||
|
||||
GDVIRTUAL1RC_REQUIRED(TypedArray<RID>, _soft_body_get_collision_exceptions, RID)
|
||||
|
||||
void soft_body_get_collision_exceptions(RID p_soft_body, List<RID> *p_exceptions) override {
|
||||
TypedArray<RID> ret;
|
||||
GDVIRTUAL_CALL(_soft_body_get_collision_exceptions, p_soft_body, ret);
|
||||
for (int i = 0; i < ret.size(); i++) {
|
||||
p_exceptions->push_back(ret[i]);
|
||||
}
|
||||
}
|
||||
|
||||
EXBIND3(soft_body_set_state, RID, BodyState, const Variant &)
|
||||
EXBIND2RC(Variant, soft_body_get_state, RID, BodyState)
|
||||
|
||||
EXBIND2(soft_body_set_transform, RID, const Transform3D &)
|
||||
|
||||
EXBIND2(soft_body_set_simulation_precision, RID, int)
|
||||
EXBIND1RC(int, soft_body_get_simulation_precision, RID)
|
||||
|
||||
EXBIND2(soft_body_set_total_mass, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_total_mass, RID)
|
||||
|
||||
EXBIND2(soft_body_set_linear_stiffness, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_linear_stiffness, RID)
|
||||
|
||||
EXBIND2(soft_body_set_shrinking_factor, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_shrinking_factor, RID)
|
||||
|
||||
EXBIND2(soft_body_set_pressure_coefficient, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_pressure_coefficient, RID)
|
||||
|
||||
EXBIND2(soft_body_set_damping_coefficient, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_damping_coefficient, RID)
|
||||
|
||||
EXBIND2(soft_body_set_drag_coefficient, RID, real_t)
|
||||
EXBIND1RC(real_t, soft_body_get_drag_coefficient, RID)
|
||||
|
||||
EXBIND2(soft_body_set_mesh, RID, RID)
|
||||
|
||||
EXBIND1RC(AABB, soft_body_get_bounds, RID)
|
||||
|
||||
EXBIND3(soft_body_move_point, RID, int, const Vector3 &)
|
||||
EXBIND2RC(Vector3, soft_body_get_point_global_position, RID, int)
|
||||
|
||||
EXBIND1(soft_body_remove_all_pinned_points, RID)
|
||||
EXBIND3(soft_body_pin_point, RID, int, bool)
|
||||
EXBIND2RC(bool, soft_body_is_point_pinned, RID, int)
|
||||
|
||||
EXBIND3(soft_body_apply_point_impulse, RID, int, const Vector3 &)
|
||||
EXBIND3(soft_body_apply_point_force, RID, int, const Vector3 &)
|
||||
EXBIND2(soft_body_apply_central_impulse, RID, const Vector3 &)
|
||||
EXBIND2(soft_body_apply_central_force, RID, const Vector3 &)
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
EXBIND0R(RID, joint_create)
|
||||
EXBIND1(joint_clear, RID)
|
||||
|
||||
EXBIND5(joint_make_pin, RID, RID, const Vector3 &, RID, const Vector3 &)
|
||||
|
||||
EXBIND3(pin_joint_set_param, RID, PinJointParam, real_t)
|
||||
EXBIND2RC(real_t, pin_joint_get_param, RID, PinJointParam)
|
||||
|
||||
EXBIND2(pin_joint_set_local_a, RID, const Vector3 &)
|
||||
EXBIND1RC(Vector3, pin_joint_get_local_a, RID)
|
||||
|
||||
EXBIND2(pin_joint_set_local_b, RID, const Vector3 &)
|
||||
EXBIND1RC(Vector3, pin_joint_get_local_b, RID)
|
||||
|
||||
EXBIND5(joint_make_hinge, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
EXBIND7(joint_make_hinge_simple, RID, RID, const Vector3 &, const Vector3 &, RID, const Vector3 &, const Vector3 &)
|
||||
|
||||
EXBIND3(hinge_joint_set_param, RID, HingeJointParam, real_t)
|
||||
EXBIND2RC(real_t, hinge_joint_get_param, RID, HingeJointParam)
|
||||
|
||||
EXBIND3(hinge_joint_set_flag, RID, HingeJointFlag, bool)
|
||||
EXBIND2RC(bool, hinge_joint_get_flag, RID, HingeJointFlag)
|
||||
|
||||
EXBIND5(joint_make_slider, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
EXBIND3(slider_joint_set_param, RID, SliderJointParam, real_t)
|
||||
EXBIND2RC(real_t, slider_joint_get_param, RID, SliderJointParam)
|
||||
|
||||
EXBIND5(joint_make_cone_twist, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
EXBIND3(cone_twist_joint_set_param, RID, ConeTwistJointParam, real_t)
|
||||
EXBIND2RC(real_t, cone_twist_joint_get_param, RID, ConeTwistJointParam)
|
||||
|
||||
EXBIND5(joint_make_generic_6dof, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
EXBIND4(generic_6dof_joint_set_param, RID, Vector3::Axis, G6DOFJointAxisParam, real_t)
|
||||
EXBIND3RC(real_t, generic_6dof_joint_get_param, RID, Vector3::Axis, G6DOFJointAxisParam)
|
||||
|
||||
EXBIND4(generic_6dof_joint_set_flag, RID, Vector3::Axis, G6DOFJointAxisFlag, bool)
|
||||
EXBIND3RC(bool, generic_6dof_joint_get_flag, RID, Vector3::Axis, G6DOFJointAxisFlag)
|
||||
|
||||
EXBIND1RC(JointType, joint_get_type, RID)
|
||||
|
||||
EXBIND2(joint_set_solver_priority, RID, int)
|
||||
EXBIND1RC(int, joint_get_solver_priority, RID)
|
||||
|
||||
EXBIND2(joint_disable_collisions_between_bodies, RID, bool)
|
||||
EXBIND1RC(bool, joint_is_disabled_collisions_between_bodies, RID)
|
||||
|
||||
/* MISC */
|
||||
|
||||
GDVIRTUAL1_REQUIRED(_free_rid, RID)
|
||||
virtual void free_rid(RID p_rid) override {
|
||||
GDVIRTUAL_CALL(_free_rid, p_rid);
|
||||
}
|
||||
|
||||
EXBIND1(set_active, bool)
|
||||
|
||||
EXBIND0(init)
|
||||
EXBIND1(step, real_t)
|
||||
EXBIND0(sync)
|
||||
EXBIND0(flush_queries)
|
||||
EXBIND0(end_sync)
|
||||
EXBIND0(finish)
|
||||
|
||||
EXBIND0RC(bool, is_flushing_queries)
|
||||
EXBIND1R(int, get_process_info, ProcessInfo)
|
||||
|
||||
PhysicsServer3DExtension();
|
||||
~PhysicsServer3DExtension();
|
||||
};
|
||||
121
servers/physics_3d/physics_server_3d_wrap_mt.cpp
Normal file
121
servers/physics_3d/physics_server_3d_wrap_mt.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
/**************************************************************************/
|
||||
/* physics_server_3d_wrap_mt.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "physics_server_3d_wrap_mt.h"
|
||||
|
||||
void PhysicsServer3DWrapMT::_assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id) {
|
||||
server_thread = Thread::get_caller_id();
|
||||
server_task_id = p_pump_task_id;
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::_thread_exit() {
|
||||
exit = true;
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::_thread_loop() {
|
||||
while (!exit) {
|
||||
WorkerThreadPool::get_singleton()->yield();
|
||||
|
||||
if (!doing_sync.is_set()) {
|
||||
command_queue.flush_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::_thread_sync() {
|
||||
doing_sync.set();
|
||||
}
|
||||
|
||||
/* EVENT QUEUING */
|
||||
|
||||
void PhysicsServer3DWrapMT::step(real_t p_step) {
|
||||
if (create_thread) {
|
||||
command_queue.push(physics_server_3d, &PhysicsServer3D::step, p_step);
|
||||
} else {
|
||||
physics_server_3d->step(p_step);
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::sync() {
|
||||
if (create_thread) {
|
||||
command_queue.push_and_sync(this, &PhysicsServer3DWrapMT::_thread_sync);
|
||||
} else {
|
||||
command_queue.flush_all(); // Flush all pending from other threads.
|
||||
}
|
||||
physics_server_3d->sync();
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::flush_queries() {
|
||||
physics_server_3d->flush_queries();
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::end_sync() {
|
||||
physics_server_3d->end_sync();
|
||||
|
||||
if (create_thread) {
|
||||
doing_sync.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::init() {
|
||||
if (create_thread) {
|
||||
WorkerThreadPool::TaskID tid = WorkerThreadPool::get_singleton()->add_task(callable_mp(this, &PhysicsServer3DWrapMT::_thread_loop), true, "Physics server 3D pump task", true);
|
||||
command_queue.set_pump_task_id(tid);
|
||||
command_queue.push(this, &PhysicsServer3DWrapMT::_assign_mt_ids, tid);
|
||||
command_queue.push_and_sync(physics_server_3d, &PhysicsServer3D::init);
|
||||
DEV_ASSERT(server_task_id == tid);
|
||||
} else {
|
||||
server_thread = Thread::MAIN_ID;
|
||||
physics_server_3d->init();
|
||||
}
|
||||
}
|
||||
|
||||
void PhysicsServer3DWrapMT::finish() {
|
||||
if (create_thread) {
|
||||
command_queue.push(physics_server_3d, &PhysicsServer3D::finish);
|
||||
command_queue.push(this, &PhysicsServer3DWrapMT::_thread_exit);
|
||||
if (server_task_id != WorkerThreadPool::INVALID_TASK_ID) {
|
||||
WorkerThreadPool::get_singleton()->wait_for_task_completion(server_task_id);
|
||||
server_task_id = WorkerThreadPool::INVALID_TASK_ID;
|
||||
}
|
||||
server_thread = Thread::MAIN_ID;
|
||||
} else {
|
||||
physics_server_3d->finish();
|
||||
}
|
||||
}
|
||||
|
||||
PhysicsServer3DWrapMT::PhysicsServer3DWrapMT(PhysicsServer3D *p_contained, bool p_create_thread) {
|
||||
physics_server_3d = p_contained;
|
||||
create_thread = p_create_thread;
|
||||
}
|
||||
|
||||
PhysicsServer3DWrapMT::~PhysicsServer3DWrapMT() {
|
||||
memdelete(physics_server_3d);
|
||||
}
|
||||
431
servers/physics_3d/physics_server_3d_wrap_mt.h
Normal file
431
servers/physics_3d/physics_server_3d_wrap_mt.h
Normal file
@ -0,0 +1,431 @@
|
||||
/**************************************************************************/
|
||||
/* physics_server_3d_wrap_mt.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/worker_thread_pool.h"
|
||||
#include "core/os/thread.h"
|
||||
#include "core/templates/command_queue_mt.h"
|
||||
#include "servers/physics_3d/physics_server_3d.h"
|
||||
|
||||
#define ASYNC_COND_PUSH (Thread::get_caller_id() != server_thread)
|
||||
#define ASYNC_COND_PUSH_AND_RET (Thread::get_caller_id() != server_thread && !(doing_sync.is_set() && Thread::is_main_thread()))
|
||||
#define ASYNC_COND_PUSH_AND_SYNC (Thread::get_caller_id() != server_thread && !(doing_sync.is_set() && Thread::is_main_thread()))
|
||||
|
||||
#ifdef DEBUG_SYNC
|
||||
#define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
|
||||
#else
|
||||
#define SYNC_DEBUG
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#ifdef DEV_ENABLED
|
||||
#define MAIN_THREAD_SYNC_WARN WARN_PRINT("Call to " + String(__FUNCTION__) + " causing PhysicsServer3D synchronizations on every frame. This significantly affects performance.");
|
||||
#else
|
||||
#define MAIN_THREAD_SYNC_WARN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class PhysicsServer3DWrapMT : public PhysicsServer3D {
|
||||
GDSOFTCLASS(PhysicsServer3DWrapMT, PhysicsServer3D);
|
||||
|
||||
mutable PhysicsServer3D *physics_server_3d = nullptr;
|
||||
|
||||
mutable CommandQueueMT command_queue;
|
||||
|
||||
Thread::ID server_thread = Thread::UNASSIGNED_ID;
|
||||
WorkerThreadPool::TaskID server_task_id = WorkerThreadPool::INVALID_TASK_ID;
|
||||
bool exit = false;
|
||||
bool create_thread = false;
|
||||
SafeFlag doing_sync;
|
||||
|
||||
void _assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id);
|
||||
void _thread_exit();
|
||||
void _thread_step(real_t p_delta);
|
||||
void _thread_loop();
|
||||
void _thread_sync();
|
||||
|
||||
public:
|
||||
#define ServerName PhysicsServer3D
|
||||
#define ServerNameWrapMT PhysicsServer3DWrapMT
|
||||
#define server_name physics_server_3d
|
||||
#define WRITE_ACTION
|
||||
|
||||
#include "servers/server_wrap_mt_common.h"
|
||||
|
||||
//FUNC1RID(shape,ShapeType); todo fix
|
||||
FUNCRID(world_boundary_shape)
|
||||
FUNCRID(separation_ray_shape)
|
||||
FUNCRID(sphere_shape)
|
||||
FUNCRID(box_shape)
|
||||
FUNCRID(capsule_shape)
|
||||
FUNCRID(cylinder_shape)
|
||||
FUNCRID(convex_polygon_shape)
|
||||
FUNCRID(concave_polygon_shape)
|
||||
FUNCRID(heightmap_shape)
|
||||
FUNCRID(custom_shape)
|
||||
|
||||
FUNC2(shape_set_data, RID, const Variant &);
|
||||
FUNC2(shape_set_custom_solver_bias, RID, real_t);
|
||||
|
||||
FUNC2(shape_set_margin, RID, real_t)
|
||||
FUNC1RC(real_t, shape_get_margin, RID)
|
||||
|
||||
FUNC1RC(ShapeType, shape_get_type, RID);
|
||||
FUNC1RC(Variant, shape_get_data, RID);
|
||||
FUNC1RC(real_t, shape_get_custom_solver_bias, RID);
|
||||
#if 0
|
||||
//these work well, but should be used from the main thread only
|
||||
bool shape_collide(RID p_shape_A, const Transform &p_xform_A, const Vector3 &p_motion_A, RID p_shape_B, const Transform &p_xform_B, const Vector3 &p_motion_B, Vector3 *r_results, int p_result_max, int &r_result_count) {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), false);
|
||||
return physics_server_3d->shape_collide(p_shape_A, p_xform_A, p_motion_A, p_shape_B, p_xform_B, p_motion_B, r_results, p_result_max, r_result_count);
|
||||
}
|
||||
#endif
|
||||
/* SPACE API */
|
||||
|
||||
FUNCRID(space);
|
||||
FUNC2(space_set_active, RID, bool);
|
||||
FUNC1RC(bool, space_is_active, RID);
|
||||
|
||||
FUNC3(space_set_param, RID, SpaceParameter, real_t);
|
||||
FUNC2RC(real_t, space_get_param, RID, SpaceParameter);
|
||||
|
||||
// this function only works on physics process, errors and returns null otherwise
|
||||
PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space) override {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), nullptr);
|
||||
return physics_server_3d->space_get_direct_state(p_space);
|
||||
}
|
||||
|
||||
FUNC2(space_set_debug_contacts, RID, int);
|
||||
virtual Vector<Vector3> space_get_contacts(RID p_space) const override {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), Vector<Vector3>());
|
||||
return physics_server_3d->space_get_contacts(p_space);
|
||||
}
|
||||
|
||||
virtual int space_get_contact_count(RID p_space) const override {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), 0);
|
||||
return physics_server_3d->space_get_contact_count(p_space);
|
||||
}
|
||||
|
||||
/* AREA API */
|
||||
|
||||
//FUNC0RID(area);
|
||||
FUNCRID(area);
|
||||
|
||||
FUNC2(area_set_space, RID, RID);
|
||||
FUNC1RC(RID, area_get_space, RID);
|
||||
|
||||
FUNC4(area_add_shape, RID, RID, const Transform3D &, bool);
|
||||
FUNC3(area_set_shape, RID, int, RID);
|
||||
FUNC3(area_set_shape_transform, RID, int, const Transform3D &);
|
||||
FUNC3(area_set_shape_disabled, RID, int, bool);
|
||||
|
||||
FUNC1RC(int, area_get_shape_count, RID);
|
||||
FUNC2RC(RID, area_get_shape, RID, int);
|
||||
FUNC2RC(Transform3D, area_get_shape_transform, RID, int);
|
||||
FUNC2(area_remove_shape, RID, int);
|
||||
FUNC1(area_clear_shapes, RID);
|
||||
|
||||
FUNC2(area_attach_object_instance_id, RID, ObjectID);
|
||||
FUNC1RC(ObjectID, area_get_object_instance_id, RID);
|
||||
|
||||
FUNC3(area_set_param, RID, AreaParameter, const Variant &);
|
||||
FUNC2(area_set_transform, RID, const Transform3D &);
|
||||
|
||||
FUNC2RC(Variant, area_get_param, RID, AreaParameter);
|
||||
FUNC1RC(Transform3D, area_get_transform, RID);
|
||||
|
||||
FUNC2(area_set_collision_layer, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, area_get_collision_layer, RID);
|
||||
|
||||
FUNC2(area_set_collision_mask, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, area_get_collision_mask, RID);
|
||||
|
||||
FUNC2(area_set_monitorable, RID, bool);
|
||||
FUNC2(area_set_ray_pickable, RID, bool);
|
||||
|
||||
FUNC2(area_set_monitor_callback, RID, const Callable &);
|
||||
FUNC2(area_set_area_monitor_callback, RID, const Callable &);
|
||||
|
||||
/* BODY API */
|
||||
|
||||
//FUNC2RID(body,BodyMode,bool);
|
||||
FUNCRID(body)
|
||||
|
||||
FUNC2(body_set_space, RID, RID);
|
||||
FUNC1RC(RID, body_get_space, RID);
|
||||
|
||||
FUNC2(body_set_mode, RID, BodyMode);
|
||||
FUNC1RC(BodyMode, body_get_mode, RID);
|
||||
|
||||
FUNC4(body_add_shape, RID, RID, const Transform3D &, bool);
|
||||
FUNC3(body_set_shape, RID, int, RID);
|
||||
FUNC3(body_set_shape_transform, RID, int, const Transform3D &);
|
||||
|
||||
FUNC1RC(int, body_get_shape_count, RID);
|
||||
FUNC2RC(Transform3D, body_get_shape_transform, RID, int);
|
||||
FUNC2RC(RID, body_get_shape, RID, int);
|
||||
|
||||
FUNC3(body_set_shape_disabled, RID, int, bool);
|
||||
|
||||
FUNC2(body_remove_shape, RID, int);
|
||||
FUNC1(body_clear_shapes, RID);
|
||||
|
||||
FUNC2(body_attach_object_instance_id, RID, ObjectID);
|
||||
FUNC1RC(ObjectID, body_get_object_instance_id, RID);
|
||||
|
||||
FUNC2(body_set_enable_continuous_collision_detection, RID, bool);
|
||||
FUNC1RC(bool, body_is_continuous_collision_detection_enabled, RID);
|
||||
|
||||
FUNC2(body_set_collision_layer, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, body_get_collision_layer, RID);
|
||||
|
||||
FUNC2(body_set_collision_mask, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, body_get_collision_mask, RID);
|
||||
|
||||
FUNC2(body_set_collision_priority, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_collision_priority, RID);
|
||||
|
||||
FUNC2(body_set_user_flags, RID, uint32_t);
|
||||
FUNC1RC(uint32_t, body_get_user_flags, RID);
|
||||
|
||||
FUNC3(body_set_param, RID, BodyParameter, const Variant &);
|
||||
FUNC2RC(Variant, body_get_param, RID, BodyParameter);
|
||||
|
||||
FUNC1(body_reset_mass_properties, RID);
|
||||
|
||||
FUNC3(body_set_state, RID, BodyState, const Variant &);
|
||||
FUNC2RC(Variant, body_get_state, RID, BodyState);
|
||||
|
||||
FUNC2(body_apply_torque_impulse, RID, const Vector3 &);
|
||||
FUNC2(body_apply_central_impulse, RID, const Vector3 &);
|
||||
FUNC3(body_apply_impulse, RID, const Vector3 &, const Vector3 &);
|
||||
|
||||
FUNC2(body_apply_central_force, RID, const Vector3 &);
|
||||
FUNC3(body_apply_force, RID, const Vector3 &, const Vector3 &);
|
||||
FUNC2(body_apply_torque, RID, const Vector3 &);
|
||||
|
||||
FUNC3(soft_body_apply_point_impulse, RID, int, const Vector3 &);
|
||||
FUNC3(soft_body_apply_point_force, RID, int, const Vector3 &);
|
||||
FUNC2(soft_body_apply_central_impulse, RID, const Vector3 &);
|
||||
FUNC2(soft_body_apply_central_force, RID, const Vector3 &);
|
||||
|
||||
FUNC2(body_add_constant_central_force, RID, const Vector3 &);
|
||||
FUNC3(body_add_constant_force, RID, const Vector3 &, const Vector3 &);
|
||||
FUNC2(body_add_constant_torque, RID, const Vector3 &);
|
||||
|
||||
FUNC2(body_set_constant_force, RID, const Vector3 &);
|
||||
FUNC1RC(Vector3, body_get_constant_force, RID);
|
||||
|
||||
FUNC2(body_set_constant_torque, RID, const Vector3 &);
|
||||
FUNC1RC(Vector3, body_get_constant_torque, RID);
|
||||
|
||||
FUNC2(body_set_axis_velocity, RID, const Vector3 &);
|
||||
|
||||
FUNC3(body_set_axis_lock, RID, BodyAxis, bool);
|
||||
FUNC2RC(bool, body_is_axis_locked, RID, BodyAxis);
|
||||
|
||||
FUNC2(body_add_collision_exception, RID, RID);
|
||||
FUNC2(body_remove_collision_exception, RID, RID);
|
||||
FUNC2S(body_get_collision_exceptions, RID, List<RID> *);
|
||||
|
||||
FUNC2(body_set_max_contacts_reported, RID, int);
|
||||
FUNC1RC(int, body_get_max_contacts_reported, RID);
|
||||
|
||||
FUNC2(body_set_contacts_reported_depth_threshold, RID, real_t);
|
||||
FUNC1RC(real_t, body_get_contacts_reported_depth_threshold, RID);
|
||||
|
||||
FUNC2(body_set_omit_force_integration, RID, bool);
|
||||
FUNC1RC(bool, body_is_omitting_force_integration, RID);
|
||||
|
||||
FUNC2(body_set_state_sync_callback, RID, const Callable &);
|
||||
FUNC3(body_set_force_integration_callback, RID, const Callable &, const Variant &);
|
||||
|
||||
FUNC2(body_set_ray_pickable, RID, bool);
|
||||
|
||||
bool body_test_motion(RID p_body, const MotionParameters &p_parameters, MotionResult *r_result = nullptr) override {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), false);
|
||||
return physics_server_3d->body_test_motion(p_body, p_parameters, r_result);
|
||||
}
|
||||
|
||||
// this function only works on physics process, errors and returns null otherwise
|
||||
PhysicsDirectBodyState3D *body_get_direct_state(RID p_body) override {
|
||||
ERR_FAIL_COND_V(!Thread::is_main_thread(), nullptr);
|
||||
return physics_server_3d->body_get_direct_state(p_body);
|
||||
}
|
||||
|
||||
/* SOFT BODY API */
|
||||
|
||||
FUNCRID(soft_body)
|
||||
|
||||
FUNC2(soft_body_update_rendering_server, RID, PhysicsServer3DRenderingServerHandler *)
|
||||
|
||||
FUNC2(soft_body_set_space, RID, RID)
|
||||
FUNC1RC(RID, soft_body_get_space, RID)
|
||||
|
||||
FUNC2(soft_body_set_ray_pickable, RID, bool);
|
||||
|
||||
FUNC2(soft_body_set_collision_layer, RID, uint32_t)
|
||||
FUNC1RC(uint32_t, soft_body_get_collision_layer, RID)
|
||||
|
||||
FUNC2(soft_body_set_collision_mask, RID, uint32_t)
|
||||
FUNC1RC(uint32_t, soft_body_get_collision_mask, RID)
|
||||
|
||||
FUNC2(soft_body_add_collision_exception, RID, RID)
|
||||
FUNC2(soft_body_remove_collision_exception, RID, RID)
|
||||
FUNC2S(soft_body_get_collision_exceptions, RID, List<RID> *)
|
||||
|
||||
FUNC3(soft_body_set_state, RID, BodyState, const Variant &);
|
||||
FUNC2RC(Variant, soft_body_get_state, RID, BodyState);
|
||||
|
||||
FUNC2(soft_body_set_transform, RID, const Transform3D &);
|
||||
|
||||
FUNC2(soft_body_set_simulation_precision, RID, int);
|
||||
FUNC1RC(int, soft_body_get_simulation_precision, RID);
|
||||
|
||||
FUNC2(soft_body_set_total_mass, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_total_mass, RID);
|
||||
|
||||
FUNC2(soft_body_set_linear_stiffness, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_linear_stiffness, RID);
|
||||
|
||||
FUNC2(soft_body_set_shrinking_factor, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_shrinking_factor, RID);
|
||||
|
||||
FUNC2(soft_body_set_pressure_coefficient, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_pressure_coefficient, RID);
|
||||
|
||||
FUNC2(soft_body_set_damping_coefficient, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_damping_coefficient, RID);
|
||||
|
||||
FUNC2(soft_body_set_drag_coefficient, RID, real_t);
|
||||
FUNC1RC(real_t, soft_body_get_drag_coefficient, RID);
|
||||
|
||||
FUNC2(soft_body_set_mesh, RID, RID);
|
||||
|
||||
FUNC1RC(AABB, soft_body_get_bounds, RID);
|
||||
|
||||
FUNC3(soft_body_move_point, RID, int, const Vector3 &);
|
||||
FUNC2RC(Vector3, soft_body_get_point_global_position, RID, int);
|
||||
|
||||
FUNC1(soft_body_remove_all_pinned_points, RID);
|
||||
FUNC3(soft_body_pin_point, RID, int, bool);
|
||||
FUNC2RC(bool, soft_body_is_point_pinned, RID, int);
|
||||
|
||||
/* JOINT API */
|
||||
|
||||
FUNCRID(joint)
|
||||
|
||||
FUNC1(joint_clear, RID)
|
||||
|
||||
FUNC5(joint_make_pin, RID, RID, const Vector3 &, RID, const Vector3 &)
|
||||
|
||||
FUNC3(pin_joint_set_param, RID, PinJointParam, real_t)
|
||||
FUNC2RC(real_t, pin_joint_get_param, RID, PinJointParam)
|
||||
|
||||
FUNC2(pin_joint_set_local_a, RID, const Vector3 &)
|
||||
FUNC1RC(Vector3, pin_joint_get_local_a, RID)
|
||||
|
||||
FUNC2(pin_joint_set_local_b, RID, const Vector3 &)
|
||||
FUNC1RC(Vector3, pin_joint_get_local_b, RID)
|
||||
|
||||
FUNC5(joint_make_hinge, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
FUNC7(joint_make_hinge_simple, RID, RID, const Vector3 &, const Vector3 &, RID, const Vector3 &, const Vector3 &)
|
||||
|
||||
FUNC3(hinge_joint_set_param, RID, HingeJointParam, real_t)
|
||||
FUNC2RC(real_t, hinge_joint_get_param, RID, HingeJointParam)
|
||||
|
||||
FUNC3(hinge_joint_set_flag, RID, HingeJointFlag, bool)
|
||||
FUNC2RC(bool, hinge_joint_get_flag, RID, HingeJointFlag)
|
||||
|
||||
FUNC5(joint_make_slider, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
FUNC3(slider_joint_set_param, RID, SliderJointParam, real_t)
|
||||
FUNC2RC(real_t, slider_joint_get_param, RID, SliderJointParam)
|
||||
|
||||
FUNC5(joint_make_cone_twist, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
FUNC3(cone_twist_joint_set_param, RID, ConeTwistJointParam, real_t)
|
||||
FUNC2RC(real_t, cone_twist_joint_get_param, RID, ConeTwistJointParam)
|
||||
|
||||
FUNC5(joint_make_generic_6dof, RID, RID, const Transform3D &, RID, const Transform3D &)
|
||||
|
||||
FUNC4(generic_6dof_joint_set_param, RID, Vector3::Axis, G6DOFJointAxisParam, real_t)
|
||||
FUNC3RC(real_t, generic_6dof_joint_get_param, RID, Vector3::Axis, G6DOFJointAxisParam)
|
||||
|
||||
FUNC4(generic_6dof_joint_set_flag, RID, Vector3::Axis, G6DOFJointAxisFlag, bool)
|
||||
FUNC3RC(bool, generic_6dof_joint_get_flag, RID, Vector3::Axis, G6DOFJointAxisFlag)
|
||||
|
||||
FUNC1RC(JointType, joint_get_type, RID);
|
||||
|
||||
FUNC2(joint_set_solver_priority, RID, int);
|
||||
FUNC1RC(int, joint_get_solver_priority, RID);
|
||||
|
||||
FUNC2(joint_disable_collisions_between_bodies, RID, bool);
|
||||
FUNC1RC(bool, joint_is_disabled_collisions_between_bodies, RID);
|
||||
|
||||
/* MISC */
|
||||
|
||||
FUNC1(free_rid, RID);
|
||||
FUNC1(set_active, bool);
|
||||
|
||||
virtual void init() override;
|
||||
virtual void step(real_t p_step) override;
|
||||
virtual void sync() override;
|
||||
virtual void end_sync() override;
|
||||
virtual void flush_queries() override;
|
||||
virtual void finish() override;
|
||||
|
||||
virtual bool is_flushing_queries() const override {
|
||||
return physics_server_3d->is_flushing_queries();
|
||||
}
|
||||
|
||||
int get_process_info(ProcessInfo p_info) override {
|
||||
return physics_server_3d->get_process_info(p_info);
|
||||
}
|
||||
|
||||
PhysicsServer3DWrapMT(PhysicsServer3D *p_contained, bool p_create_thread);
|
||||
~PhysicsServer3DWrapMT();
|
||||
|
||||
#undef ServerNameWrapMT
|
||||
#undef ServerName
|
||||
#undef server_name
|
||||
#undef WRITE_ACTION
|
||||
};
|
||||
|
||||
#ifdef DEBUG_SYNC
|
||||
#undef DEBUG_SYNC
|
||||
#endif
|
||||
#undef SYNC_DEBUG
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
#undef MAIN_THREAD_SYNC_WARN
|
||||
#endif
|
||||
Reference in New Issue
Block a user