Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread). -RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault. -Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory). -3D physics server changed to be made multithread friendly. -Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads. -Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
This commit is contained in:
@@ -1059,16 +1059,16 @@ real_t BulletPhysicsServer3D::soft_body_get_linear_stiffness(RID p_body) {
|
||||
return body->get_linear_stiffness();
|
||||
}
|
||||
|
||||
void BulletPhysicsServer3D::soft_body_set_areaAngular_stiffness(RID p_body, real_t p_stiffness) {
|
||||
void BulletPhysicsServer3D::soft_body_set_angular_stiffness(RID p_body, real_t p_stiffness) {
|
||||
SoftBodyBullet *body = soft_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
body->set_areaAngular_stiffness(p_stiffness);
|
||||
body->set_angular_stiffness(p_stiffness);
|
||||
}
|
||||
|
||||
real_t BulletPhysicsServer3D::soft_body_get_areaAngular_stiffness(RID p_body) {
|
||||
real_t BulletPhysicsServer3D::soft_body_get_angular_stiffness(RID p_body) {
|
||||
SoftBodyBullet *body = soft_body_owner.getornull(p_body);
|
||||
ERR_FAIL_COND_V(!body, 0.f);
|
||||
return body->get_areaAngular_stiffness();
|
||||
return body->get_angular_stiffness();
|
||||
}
|
||||
|
||||
void BulletPhysicsServer3D::soft_body_set_volume_stiffness(RID p_body, real_t p_stiffness) {
|
||||
|
||||
@@ -298,8 +298,8 @@ public:
|
||||
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) override;
|
||||
|
||||
virtual void soft_body_set_areaAngular_stiffness(RID p_body, real_t p_stiffness) override;
|
||||
virtual real_t soft_body_get_areaAngular_stiffness(RID p_body) override;
|
||||
virtual void soft_body_set_angular_stiffness(RID p_body, real_t p_stiffness) override;
|
||||
virtual real_t soft_body_get_angular_stiffness(RID p_body) override;
|
||||
|
||||
virtual void soft_body_set_volume_stiffness(RID p_body, real_t p_stiffness) override;
|
||||
virtual real_t soft_body_get_volume_stiffness(RID p_body) override;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
def can_build(env, platform):
|
||||
return True
|
||||
# API Changed and bullet is disabled at the moment
|
||||
return False
|
||||
|
||||
|
||||
def configure(env):
|
||||
|
||||
@@ -259,10 +259,10 @@ void SoftBodyBullet::set_linear_stiffness(real_t p_val) {
|
||||
}
|
||||
}
|
||||
|
||||
void SoftBodyBullet::set_areaAngular_stiffness(real_t p_val) {
|
||||
areaAngular_stiffness = p_val;
|
||||
void SoftBodyBullet::set_angular_stiffness(real_t p_val) {
|
||||
angular_stiffness = p_val;
|
||||
if (bt_soft_body) {
|
||||
mat0->m_kAST = areaAngular_stiffness;
|
||||
mat0->m_kAST = angular_stiffness;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ void SoftBodyBullet::setup_soft_body() {
|
||||
bt_soft_body->generateBendingConstraints(2, mat0);
|
||||
|
||||
mat0->m_kLST = linear_stiffness;
|
||||
mat0->m_kAST = areaAngular_stiffness;
|
||||
mat0->m_kAST = angular_stiffness;
|
||||
mat0->m_kVST = volume_stiffness;
|
||||
|
||||
// Clusters allow to have Soft vs Soft collision but doesn't work well right now
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
int simulation_precision = 5;
|
||||
real_t total_mass = 1.;
|
||||
real_t linear_stiffness = 0.5; // [0,1]
|
||||
real_t areaAngular_stiffness = 0.5; // [0,1]
|
||||
real_t angular_stiffness = 0.5; // [0,1]
|
||||
real_t volume_stiffness = 0.5; // [0,1]
|
||||
real_t pressure_coefficient = 0.; // [-inf,+inf]
|
||||
real_t pose_matching_coefficient = 0.; // [0,1]
|
||||
@@ -129,8 +129,8 @@ public:
|
||||
void set_linear_stiffness(real_t p_val);
|
||||
_FORCE_INLINE_ real_t get_linear_stiffness() const { return linear_stiffness; }
|
||||
|
||||
void set_areaAngular_stiffness(real_t p_val);
|
||||
_FORCE_INLINE_ real_t get_areaAngular_stiffness() const { return areaAngular_stiffness; }
|
||||
void set_angular_stiffness(real_t p_val);
|
||||
_FORCE_INLINE_ real_t get_angular_stiffness() const { return angular_stiffness; }
|
||||
|
||||
void set_volume_stiffness(real_t p_val);
|
||||
_FORCE_INLINE_ real_t get_volume_stiffness() const { return volume_stiffness; }
|
||||
|
||||
Reference in New Issue
Block a user