diff options
author | Juan Linietsky <reduzio@gmail.com> | 2020-03-27 15:21:27 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-03-27 15:21:27 -0300 |
commit | a6f3bc7c696af03e3875f78e098d2476e409d15e (patch) | |
tree | fc1bb58e900436c48c03c52106eb57250442ae35 /modules | |
parent | 307b1b3a5835ecdb477859785c673a07e248f904 (diff) |
Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D
Also renamed corresponding files.
Diffstat (limited to 'modules')
42 files changed, 783 insertions, 783 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index 1482fe99eb..d163512bb3 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -1208,9 +1208,9 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat } Array array_copy; - array_copy.resize(VisualServer::ARRAY_MAX); + array_copy.resize(RenderingServer::ARRAY_MAX); - for (int l = 0; l < VisualServer::ARRAY_MAX; l++) { + for (int l = 0; l < RenderingServer::ARRAY_MAX; l++) { array_copy[l] = array_mesh[l].duplicate(true); } @@ -1224,13 +1224,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat Vector3 position = Vector3(ai_pos.x, ai_pos.y, ai_pos.z); vertices.ptrw()[l] = position; } - PackedVector3Array new_vertices = array_copy[VisualServer::ARRAY_VERTEX].duplicate(true); + PackedVector3Array new_vertices = array_copy[RenderingServer::ARRAY_VERTEX].duplicate(true); ERR_CONTINUE(vertices.size() != new_vertices.size()); for (int32_t l = 0; l < new_vertices.size(); l++) { Vector3 *w = new_vertices.ptrw(); w[l] = vertices[l]; } - array_copy[VisualServer::ARRAY_VERTEX] = new_vertices; + array_copy[RenderingServer::ARRAY_VERTEX] = new_vertices; } int32_t color_set = 0; @@ -1242,13 +1242,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat Color color = Color(ai_color.r, ai_color.g, ai_color.b, ai_color.a); colors.ptrw()[l] = color; } - PackedColorArray new_colors = array_copy[VisualServer::ARRAY_COLOR].duplicate(true); + PackedColorArray new_colors = array_copy[RenderingServer::ARRAY_COLOR].duplicate(true); ERR_CONTINUE(colors.size() != new_colors.size()); for (int32_t l = 0; l < colors.size(); l++) { Color *w = new_colors.ptrw(); w[l] = colors[l]; } - array_copy[VisualServer::ARRAY_COLOR] = new_colors; + array_copy[RenderingServer::ARRAY_COLOR] = new_colors; } if (ai_mesh->mAnimMeshes[j]->HasNormals()) { @@ -1259,13 +1259,13 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat Vector3 normal = Vector3(ai_normal.x, ai_normal.y, ai_normal.z); normals.ptrw()[l] = normal; } - PackedVector3Array new_normals = array_copy[VisualServer::ARRAY_NORMAL].duplicate(true); + PackedVector3Array new_normals = array_copy[RenderingServer::ARRAY_NORMAL].duplicate(true); ERR_CONTINUE(normals.size() != new_normals.size()); for (int l = 0; l < normals.size(); l++) { Vector3 *w = new_normals.ptrw(); w[l] = normals[l]; } - array_copy[VisualServer::ARRAY_NORMAL] = new_normals; + array_copy[RenderingServer::ARRAY_NORMAL] = new_normals; } if (ai_mesh->mAnimMeshes[j]->HasTangentsAndBitangents()) { @@ -1275,7 +1275,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat for (size_t l = 0; l < num_vertices; l++) { AssimpUtils::calc_tangent_from_mesh(ai_mesh, j, l, l, w); } - PackedFloat32Array new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true); + PackedFloat32Array new_tangents = array_copy[RenderingServer::ARRAY_TANGENT].duplicate(true); ERR_CONTINUE(new_tangents.size() != tangents.size() * 4); for (int32_t l = 0; l < tangents.size(); l++) { new_tangents.ptrw()[l + 0] = tangents[l].r; @@ -1283,7 +1283,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat new_tangents.ptrw()[l + 2] = tangents[l].b; new_tangents.ptrw()[l + 3] = tangents[l].a; } - array_copy[VisualServer::ARRAY_TANGENT] = new_tangents; + array_copy[RenderingServer::ARRAY_TANGENT] = new_tangents; } morphs[j] = array_copy; diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index c29e91b5aa..bf6bc1debd 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -31,7 +31,7 @@ #include "register_types.h" #include "core/os/os.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #include "texture_basisu.h" #ifdef TOOLS_ENABLED @@ -164,10 +164,10 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { switch (*(uint32_t *)(ptr)) { case BASIS_DECOMPRESS_RG: { - if (VS::get_singleton()->has_os_feature("rgtc")) { + if (RS::get_singleton()->has_os_feature("rgtc")) { format = basist::transcoder_texture_format::cTFBC5; // get this from renderer imgfmt = Image::FORMAT_RGTC_RG; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { //unfortunately, basis universal does not support // ERR_FAIL_V(image); //unimplemented here @@ -179,13 +179,13 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { } } break; case BASIS_DECOMPRESS_RGB: { - if (VS::get_singleton()->has_os_feature("bptc")) { + if (RS::get_singleton()->has_os_feature("bptc")) { format = basist::transcoder_texture_format::cTFBC7_M6_OPAQUE_ONLY; // get this from renderer imgfmt = Image::FORMAT_BPTC_RGBA; - } else if (VS::get_singleton()->has_os_feature("s3tc")) { + } else if (RS::get_singleton()->has_os_feature("s3tc")) { format = basist::transcoder_texture_format::cTFBC1; // get this from renderer imgfmt = Image::FORMAT_DXT1; - } else if (VS::get_singleton()->has_os_feature("etc")) { + } else if (RS::get_singleton()->has_os_feature("etc")) { format = basist::transcoder_texture_format::cTFETC1; // get this from renderer imgfmt = Image::FORMAT_ETC; @@ -196,13 +196,13 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { } break; case BASIS_DECOMPRESS_RGBA: { - if (VS::get_singleton()->has_os_feature("bptc")) { + if (RS::get_singleton()->has_os_feature("bptc")) { format = basist::transcoder_texture_format::cTFBC7_M5; // get this from renderer imgfmt = Image::FORMAT_BPTC_RGBA; - } else if (VS::get_singleton()->has_os_feature("s3tc")) { + } else if (RS::get_singleton()->has_os_feature("s3tc")) { format = basist::transcoder_texture_format::cTFBC3; // get this from renderer imgfmt = Image::FORMAT_DXT5; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { format = basist::transcoder_texture_format::cTFETC2; // get this from renderer imgfmt = Image::FORMAT_ETC2_RGBA8; } else { @@ -212,10 +212,10 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { } } break; case BASIS_DECOMPRESS_RG_AS_RA: { - if (VS::get_singleton()->has_os_feature("s3tc")) { + if (RS::get_singleton()->has_os_feature("s3tc")) { format = basist::transcoder_texture_format::cTFBC3; // get this from renderer imgfmt = Image::FORMAT_DXT5_RA_AS_RG; - } else if (VS::get_singleton()->has_os_feature("etc2")) { + } else if (RS::get_singleton()->has_os_feature("etc2")) { format = basist::transcoder_texture_format::cTFETC2; // get this from renderer imgfmt = Image::FORMAT_ETC2_RGBA8; } else { diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp index 12f3241c98..9c3cdac36c 100644 --- a/modules/basis_universal/texture_basisu.cpp +++ b/modules/basis_universal/texture_basisu.cpp @@ -72,7 +72,7 @@ bool TextureBasisU::has_alpha() const { void TextureBasisU::set_flags(uint32_t p_flags) { flags = p_flags; - VisualServer::get_singleton()->texture_set_flags(texture, p_flags); + RenderingServer::get_singleton()->texture_set_flags(texture, p_flags); }; uint32_t TextureBasisU::get_flags() const { @@ -144,8 +144,8 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) { img.instance(); img->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata); - VisualServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), VS::TEXTURE_TYPE_2D, flags); - VisualServer::get_singleton()->texture_set_data(texture, img); + RenderingServer::get_singleton()->texture_allocate(texture, tex_size.x, tex_size.y, 0, img->get_format(), RS::TEXTURE_TYPE_2D, flags); + RenderingServer::get_singleton()->texture_set_data(texture, img); }; Error TextureBasisU::import(const Ref<Image>& p_img) { @@ -221,13 +221,13 @@ Vector<uint8_t> TextureBasisU::get_basisu_data() const { TextureBasisU::TextureBasisU() { flags = FLAGS_DEFAULT; - texture = VisualServer::get_singleton()->texture_create(); + texture = RenderingServer::get_singleton()->texture_create(); }; TextureBasisU::~TextureBasisU() { - VisualServer::get_singleton()->free(texture); + RenderingServer::get_singleton()->free(texture); }; #endif diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index e8a5c1475a..4d727529ef 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -46,7 +46,7 @@ AreaBullet::AreaBullet() : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA), monitorable(true), - spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED), + spOv_mode(PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED), spOv_gravityPoint(false), spOv_gravityPointDistanceScale(0), spOv_gravityPointAttenuation(1), @@ -86,11 +86,11 @@ void AreaBullet::dispatch_callbacks() { switch (otherObj.state) { case OVERLAP_STATE_ENTER: otherObj.state = OVERLAP_STATE_INSIDE; - call_event(otherObj.object, PhysicsServer::AREA_BODY_ADDED); + call_event(otherObj.object, PhysicsServer3D::AREA_BODY_ADDED); otherObj.object->on_enter_area(this); break; case OVERLAP_STATE_EXIT: - call_event(otherObj.object, PhysicsServer::AREA_BODY_REMOVED); + call_event(otherObj.object, PhysicsServer3D::AREA_BODY_REMOVED); otherObj.object->on_exit_area(this); overlappingObjects.remove(i); // Remove after callback break; @@ -101,7 +101,7 @@ void AreaBullet::dispatch_callbacks() { } } -void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer::AreaBodyStatus p_status) { +void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3D::AreaBodyStatus p_status) { InOutEventCallback &event = eventsCallbacks[static_cast<int>(p_otherObject->getType())]; Object *areaGodoObject = ObjectDB::get_instance(event.event_callback_id); @@ -130,7 +130,7 @@ void AreaBullet::scratch() { void AreaBullet::clear_overlaps(bool p_notify) { for (int i = overlappingObjects.size() - 1; 0 <= i; --i) { if (p_notify) - call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED); + call_event(overlappingObjects[i].object, PhysicsServer3D::AREA_BODY_REMOVED); overlappingObjects[i].object->on_exit_area(this); } overlappingObjects.clear(); @@ -140,7 +140,7 @@ void AreaBullet::remove_overlap(CollisionObjectBullet *p_object, bool p_notify) for (int i = overlappingObjects.size() - 1; 0 <= i; --i) { if (overlappingObjects[i].object == p_object) { if (p_notify) - call_event(overlappingObjects[i].object, PhysicsServer::AREA_BODY_REMOVED); + call_event(overlappingObjects[i].object, PhysicsServer3D::AREA_BODY_REMOVED); overlappingObjects[i].object->on_exit_area(this); overlappingObjects.remove(i); break; @@ -218,30 +218,30 @@ void AreaBullet::put_overlap_as_inside(int p_index) { } } -void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value) { +void AreaBullet::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) { switch (p_param) { - case PhysicsServer::AREA_PARAM_GRAVITY: + case PhysicsServer3D::AREA_PARAM_GRAVITY: set_spOv_gravityMag(p_value); break; - case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: + case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: set_spOv_gravityVec(p_value); break; - case PhysicsServer::AREA_PARAM_LINEAR_DAMP: + case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: set_spOv_linearDump(p_value); break; - case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: set_spOv_angularDump(p_value); break; - case PhysicsServer::AREA_PARAM_PRIORITY: + case PhysicsServer3D::AREA_PARAM_PRIORITY: set_spOv_priority(p_value); break; - case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: + case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: set_spOv_gravityPoint(p_value); break; - case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: + case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: set_spOv_gravityPointDistanceScale(p_value); break; - case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: + case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: set_spOv_gravityPointAttenuation(p_value); break; default: @@ -249,23 +249,23 @@ void AreaBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant & } } -Variant AreaBullet::get_param(PhysicsServer::AreaParameter p_param) const { +Variant AreaBullet::get_param(PhysicsServer3D::AreaParameter p_param) const { switch (p_param) { - case PhysicsServer::AREA_PARAM_GRAVITY: + case PhysicsServer3D::AREA_PARAM_GRAVITY: return spOv_gravityMag; - case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: + case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: return spOv_gravityVec; - case PhysicsServer::AREA_PARAM_LINEAR_DAMP: + case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: return spOv_linearDump; - case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: return spOv_angularDump; - case PhysicsServer::AREA_PARAM_PRIORITY: + case PhysicsServer3D::AREA_PARAM_PRIORITY: return spOv_priority; - case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: + case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: return spOv_gravityPoint; - case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: + case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return spOv_gravityPointDistanceScale; - case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: + case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return spOv_gravityPointAttenuation; default: WARN_PRINT("Area doesn't support this parameter in the Bullet backend: " + itos(p_param)); diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h index 18888c6725..56977d4451 100644 --- a/modules/bullet/area_bullet.h +++ b/modules/bullet/area_bullet.h @@ -33,7 +33,7 @@ #include "collision_object_bullet.h" #include "core/vector.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include "space_bullet.h" /** @@ -88,7 +88,7 @@ private: Vector<OverlappingObjectData> overlappingObjects; bool monitorable; - PhysicsServer::AreaSpaceOverrideMode spOv_mode; + PhysicsServer3D::AreaSpaceOverrideMode spOv_mode; bool spOv_gravityPoint; real_t spOv_gravityPointDistanceScale; real_t spOv_gravityPointAttenuation; @@ -114,8 +114,8 @@ public: bool is_monitoring() const; - _FORCE_INLINE_ void set_spOv_mode(PhysicsServer::AreaSpaceOverrideMode p_mode) { spOv_mode = p_mode; } - _FORCE_INLINE_ PhysicsServer::AreaSpaceOverrideMode get_spOv_mode() { return spOv_mode; } + _FORCE_INLINE_ void set_spOv_mode(PhysicsServer3D::AreaSpaceOverrideMode p_mode) { spOv_mode = p_mode; } + _FORCE_INLINE_ PhysicsServer3D::AreaSpaceOverrideMode get_spOv_mode() { return spOv_mode; } _FORCE_INLINE_ void set_spOv_gravityPoint(bool p_isGP) { spOv_gravityPoint = p_isGP; } _FORCE_INLINE_ bool is_spOv_gravityPoint() { return spOv_gravityPoint; } @@ -146,7 +146,7 @@ public: virtual void set_space(SpaceBullet *p_space); virtual void dispatch_callbacks(); - void call_event(CollisionObjectBullet *p_otherObject, PhysicsServer::AreaBodyStatus p_status); + void call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3D::AreaBodyStatus p_status); void set_on_state_change(ObjectID p_id, const StringName &p_method, const Variant &p_udata = Variant()); void scratch(); @@ -162,8 +162,8 @@ public: void put_overlap_as_exit(int p_index); void put_overlap_as_inside(int p_index); - void set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value); - Variant get_param(PhysicsServer::AreaParameter p_param) const; + void set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value); + Variant get_param(PhysicsServer3D::AreaParameter p_param) const; void set_event_callback(Type p_callbackObjectType, ObjectID p_id, const StringName &p_method); bool has_event_callback(Type p_callbackObjectType); diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 89868babc6..5b3fe1bfac 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -74,18 +74,18 @@ body->get_space()->add_constraint(joint, joint->is_disabled_collisions_between_bodies()); // <--------------- Joint creation asserts -void BulletPhysicsServer::_bind_methods() { - //ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer::DoTest); +void BulletPhysicsServer3D::_bind_methods() { + //ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer3D::DoTest); } -BulletPhysicsServer::BulletPhysicsServer() : - PhysicsServer(), +BulletPhysicsServer3D::BulletPhysicsServer3D() : + PhysicsServer3D(), active(true), active_spaces_count(0) {} -BulletPhysicsServer::~BulletPhysicsServer() {} +BulletPhysicsServer3D::~BulletPhysicsServer3D() {} -RID BulletPhysicsServer::shape_create(ShapeType p_shape) { +RID BulletPhysicsServer3D::shape_create(ShapeType p_shape) { ShapeBullet *shape = NULL; switch (p_shape) { @@ -133,51 +133,51 @@ RID BulletPhysicsServer::shape_create(ShapeType p_shape) { CreateThenReturnRID(shape_owner, shape) } -void BulletPhysicsServer::shape_set_data(RID p_shape, const Variant &p_data) { +void BulletPhysicsServer3D::shape_set_data(RID p_shape, const Variant &p_data) { ShapeBullet *shape = shape_owner.getornull(p_shape); ERR_FAIL_COND(!shape); shape->set_data(p_data); } -void BulletPhysicsServer::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) { +void BulletPhysicsServer3D::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) { //WARN_PRINT("Bias not supported by Bullet physics engine"); } -PhysicsServer::ShapeType BulletPhysicsServer::shape_get_type(RID p_shape) const { +PhysicsServer3D::ShapeType BulletPhysicsServer3D::shape_get_type(RID p_shape) const { ShapeBullet *shape = shape_owner.getornull(p_shape); - ERR_FAIL_COND_V(!shape, PhysicsServer::SHAPE_CUSTOM); + ERR_FAIL_COND_V(!shape, PhysicsServer3D::SHAPE_CUSTOM); return shape->get_type(); } -Variant BulletPhysicsServer::shape_get_data(RID p_shape) const { +Variant BulletPhysicsServer3D::shape_get_data(RID p_shape) const { ShapeBullet *shape = shape_owner.getornull(p_shape); ERR_FAIL_COND_V(!shape, Variant()); return shape->get_data(); } -void BulletPhysicsServer::shape_set_margin(RID p_shape, real_t p_margin) { +void BulletPhysicsServer3D::shape_set_margin(RID p_shape, real_t p_margin) { ShapeBullet *shape = shape_owner.getornull(p_shape); ERR_FAIL_COND(!shape); shape->set_margin(p_margin); } -real_t BulletPhysicsServer::shape_get_margin(RID p_shape) const { +real_t BulletPhysicsServer3D::shape_get_margin(RID p_shape) const { ShapeBullet *shape = shape_owner.getornull(p_shape); ERR_FAIL_COND_V(!shape, 0.0); return shape->get_margin(); } -real_t BulletPhysicsServer::shape_get_custom_solver_bias(RID p_shape) const { +real_t BulletPhysicsServer3D::shape_get_custom_solver_bias(RID p_shape) const { //WARN_PRINT("Bias not supported by Bullet physics engine"); return 0.; } -RID BulletPhysicsServer::space_create() { +RID BulletPhysicsServer3D::space_create() { SpaceBullet *space = bulletnew(SpaceBullet); CreateThenReturnRID(space_owner, space); } -void BulletPhysicsServer::space_set_active(RID p_space, bool p_active) { +void BulletPhysicsServer3D::space_set_active(RID p_space, bool p_active) { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND(!space); @@ -195,61 +195,61 @@ void BulletPhysicsServer::space_set_active(RID p_space, bool p_active) { } } -bool BulletPhysicsServer::space_is_active(RID p_space) const { +bool BulletPhysicsServer3D::space_is_active(RID p_space) const { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND_V(!space, false); return -1 != active_spaces.find(space); } -void BulletPhysicsServer::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) { +void BulletPhysicsServer3D::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND(!space); space->set_param(p_param, p_value); } -real_t BulletPhysicsServer::space_get_param(RID p_space, SpaceParameter p_param) const { +real_t BulletPhysicsServer3D::space_get_param(RID p_space, SpaceParameter p_param) const { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND_V(!space, 0); return space->get_param(p_param); } -PhysicsDirectSpaceState *BulletPhysicsServer::space_get_direct_state(RID p_space) { +PhysicsDirectSpaceState3D *BulletPhysicsServer3D::space_get_direct_state(RID p_space) { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND_V(!space, NULL); return space->get_direct_state(); } -void BulletPhysicsServer::space_set_debug_contacts(RID p_space, int p_max_contacts) { +void BulletPhysicsServer3D::space_set_debug_contacts(RID p_space, int p_max_contacts) { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND(!space); space->set_debug_contacts(p_max_contacts); } -Vector<Vector3> BulletPhysicsServer::space_get_contacts(RID p_space) const { +Vector<Vector3> BulletPhysicsServer3D::space_get_contacts(RID p_space) const { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND_V(!space, Vector<Vector3>()); return space->get_debug_contacts(); } -int BulletPhysicsServer::space_get_contact_count(RID p_space) const { +int BulletPhysicsServer3D::space_get_contact_count(RID p_space) const { SpaceBullet *space = space_owner.getornull(p_space); ERR_FAIL_COND_V(!space, 0); return space->get_debug_contact_count(); } -RID BulletPhysicsServer::area_create() { +RID BulletPhysicsServer3D::area_create() { AreaBullet *area = bulletnew(AreaBullet); area->set_collision_layer(1); area->set_collision_mask(1); CreateThenReturnRID(area_owner, area) } -void BulletPhysicsServer::area_set_space(RID p_area, RID p_space) { +void BulletPhysicsServer3D::area_set_space(RID p_area, RID p_space) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); SpaceBullet *space = NULL; @@ -260,26 +260,26 @@ void BulletPhysicsServer::area_set_space(RID p_area, RID p_space) { area->set_space(space); } -RID BulletPhysicsServer::area_get_space(RID p_area) const { +RID BulletPhysicsServer3D::area_get_space(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); return area->get_space()->get_self(); } -void BulletPhysicsServer::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) { +void BulletPhysicsServer3D::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_spOv_mode(p_mode); } -PhysicsServer::AreaSpaceOverrideMode BulletPhysicsServer::area_get_space_override_mode(RID p_area) const { +PhysicsServer3D::AreaSpaceOverrideMode BulletPhysicsServer3D::area_get_space_override_mode(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); - ERR_FAIL_COND_V(!area, PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED); + ERR_FAIL_COND_V(!area, PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED); return area->get_spOv_mode(); } -void BulletPhysicsServer::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) { +void BulletPhysicsServer3D::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -289,7 +289,7 @@ void BulletPhysicsServer::area_add_shape(RID p_area, RID p_shape, const Transfor area->add_shape(shape, p_transform, p_disabled); } -void BulletPhysicsServer::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) { +void BulletPhysicsServer3D::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -299,41 +299,41 @@ void BulletPhysicsServer::area_set_shape(RID p_area, int p_shape_idx, RID p_shap area->set_shape(p_shape_idx, shape); } -void BulletPhysicsServer::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) { +void BulletPhysicsServer3D::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_shape_transform(p_shape_idx, p_transform); } -int BulletPhysicsServer::area_get_shape_count(RID p_area) const { +int BulletPhysicsServer3D::area_get_shape_count(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, 0); return area->get_shape_count(); } -RID BulletPhysicsServer::area_get_shape(RID p_area, int p_shape_idx) const { +RID BulletPhysicsServer3D::area_get_shape(RID p_area, int p_shape_idx) const { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, RID()); return area->get_shape(p_shape_idx)->get_self(); } -Transform BulletPhysicsServer::area_get_shape_transform(RID p_area, int p_shape_idx) const { +Transform BulletPhysicsServer3D::area_get_shape_transform(RID p_area, int p_shape_idx) const { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, Transform()); return area->get_shape_transform(p_shape_idx); } -void BulletPhysicsServer::area_remove_shape(RID p_area, int p_shape_idx) { +void BulletPhysicsServer3D::area_remove_shape(RID p_area, int p_shape_idx) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); return area->remove_shape_full(p_shape_idx); } -void BulletPhysicsServer::area_clear_shapes(RID p_area) { +void BulletPhysicsServer3D::area_clear_shapes(RID p_area) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -341,14 +341,14 @@ void BulletPhysicsServer::area_clear_shapes(RID p_area) { area->remove_shape_full(0); } -void BulletPhysicsServer::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) { +void BulletPhysicsServer3D::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_shape_disabled(p_shape_idx, p_disabled); } -void BulletPhysicsServer::area_attach_object_instance_id(RID p_area, ObjectID p_id) { +void BulletPhysicsServer3D::area_attach_object_instance_id(RID p_area, ObjectID p_id) { if (space_owner.owns(p_area)) { return; } @@ -357,7 +357,7 @@ void BulletPhysicsServer::area_attach_object_instance_id(RID p_area, ObjectID p_ area->set_instance_id(p_id); } -ObjectID BulletPhysicsServer::area_get_object_instance_id(RID p_area) const { +ObjectID BulletPhysicsServer3D::area_get_object_instance_id(RID p_area) const { if (space_owner.owns(p_area)) { return ObjectID(); } @@ -366,7 +366,7 @@ ObjectID BulletPhysicsServer::area_get_object_instance_id(RID p_area) const { return area->get_instance_id(); } -void BulletPhysicsServer::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) { +void BulletPhysicsServer3D::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) { if (space_owner.owns(p_area)) { SpaceBullet *space = space_owner.getornull(p_area); if (space) { @@ -381,7 +381,7 @@ void BulletPhysicsServer::area_set_param(RID p_area, AreaParameter p_param, cons } } -Variant BulletPhysicsServer::area_get_param(RID p_area, AreaParameter p_param) const { +Variant BulletPhysicsServer3D::area_get_param(RID p_area, AreaParameter p_param) const { if (space_owner.owns(p_area)) { SpaceBullet *space = space_owner.getornull(p_area); return space->get_param(p_param); @@ -393,64 +393,64 @@ Variant BulletPhysicsServer::area_get_param(RID p_area, AreaParameter p_param) c } } -void BulletPhysicsServer::area_set_transform(RID p_area, const Transform &p_transform) { +void BulletPhysicsServer3D::area_set_transform(RID p_area, const Transform &p_transform) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_transform(p_transform); } -Transform BulletPhysicsServer::area_get_transform(RID p_area) const { +Transform BulletPhysicsServer3D::area_get_transform(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, Transform()); return area->get_transform(); } -void BulletPhysicsServer::area_set_collision_mask(RID p_area, uint32_t p_mask) { +void BulletPhysicsServer3D::area_set_collision_mask(RID p_area, uint32_t p_mask) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_collision_mask(p_mask); } -void BulletPhysicsServer::area_set_collision_layer(RID p_area, uint32_t p_layer) { +void BulletPhysicsServer3D::area_set_collision_layer(RID p_area, uint32_t p_layer) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_collision_layer(p_layer); } -void BulletPhysicsServer::area_set_monitorable(RID p_area, bool p_monitorable) { +void BulletPhysicsServer3D::area_set_monitorable(RID p_area, bool p_monitorable) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_monitorable(p_monitorable); } -void BulletPhysicsServer::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) { +void BulletPhysicsServer3D::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_event_callback(CollisionObjectBullet::TYPE_RIGID_BODY, p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method); } -void BulletPhysicsServer::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) { +void BulletPhysicsServer3D::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_event_callback(CollisionObjectBullet::TYPE_AREA, p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method); } -void BulletPhysicsServer::area_set_ray_pickable(RID p_area, bool p_enable) { +void BulletPhysicsServer3D::area_set_ray_pickable(RID p_area, bool p_enable) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_ray_pickable(p_enable); } -bool BulletPhysicsServer::area_is_ray_pickable(RID p_area) const { +bool BulletPhysicsServer3D::area_is_ray_pickable(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND_V(!area, false); return area->is_ray_pickable(); } -RID BulletPhysicsServer::body_create(BodyMode p_mode, bool p_init_sleeping) { +RID BulletPhysicsServer3D::body_create(BodyMode p_mode, bool p_init_sleeping) { RigidBodyBullet *body = bulletnew(RigidBodyBullet); body->set_mode(p_mode); body->set_collision_layer(1); @@ -460,7 +460,7 @@ RID BulletPhysicsServer::body_create(BodyMode p_mode, bool p_init_sleeping) { CreateThenReturnRID(rigid_body_owner, body); } -void BulletPhysicsServer::body_set_space(RID p_body, RID p_space) { +void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); SpaceBullet *space = NULL; @@ -476,7 +476,7 @@ void BulletPhysicsServer::body_set_space(RID p_body, RID p_space) { body->set_space(space); } -RID BulletPhysicsServer::body_get_space(RID p_body) const { +RID BulletPhysicsServer3D::body_get_space(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, RID()); @@ -486,19 +486,19 @@ RID BulletPhysicsServer::body_get_space(RID p_body) const { return space->get_self(); } -void BulletPhysicsServer::body_set_mode(RID p_body, PhysicsServer::BodyMode p_mode) { +void BulletPhysicsServer3D::body_set_mode(RID p_body, PhysicsServer3D::BodyMode p_mode) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_mode(p_mode); } -PhysicsServer::BodyMode BulletPhysicsServer::body_get_mode(RID p_body) const { +PhysicsServer3D::BodyMode BulletPhysicsServer3D::body_get_mode(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, BODY_MODE_STATIC); return body->get_mode(); } -void BulletPhysicsServer::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) { +void BulletPhysicsServer3D::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -509,7 +509,7 @@ void BulletPhysicsServer::body_add_shape(RID p_body, RID p_shape, const Transfor body->add_shape(shape, p_transform, p_disabled); } -void BulletPhysicsServer::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) { +void BulletPhysicsServer3D::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -519,20 +519,20 @@ void BulletPhysicsServer::body_set_shape(RID p_body, int p_shape_idx, RID p_shap body->set_shape(p_shape_idx, shape); } -void BulletPhysicsServer::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) { +void BulletPhysicsServer3D::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_shape_transform(p_shape_idx, p_transform); } -int BulletPhysicsServer::body_get_shape_count(RID p_body) const { +int BulletPhysicsServer3D::body_get_shape_count(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_shape_count(); } -RID BulletPhysicsServer::body_get_shape(RID p_body, int p_shape_idx) const { +RID BulletPhysicsServer3D::body_get_shape(RID p_body, int p_shape_idx) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, RID()); @@ -542,113 +542,113 @@ RID BulletPhysicsServer::body_get_shape(RID p_body, int p_shape_idx) const { return shape->get_self(); } -Transform BulletPhysicsServer::body_get_shape_transform(RID p_body, int p_shape_idx) const { +Transform BulletPhysicsServer3D::body_get_shape_transform(RID p_body, int p_shape_idx) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Transform()); return body->get_shape_transform(p_shape_idx); } -void BulletPhysicsServer::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) { +void BulletPhysicsServer3D::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_shape_disabled(p_shape_idx, p_disabled); } -void BulletPhysicsServer::body_remove_shape(RID p_body, int p_shape_idx) { +void BulletPhysicsServer3D::body_remove_shape(RID p_body, int p_shape_idx) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->remove_shape_full(p_shape_idx); } -void BulletPhysicsServer::body_clear_shapes(RID p_body) { +void BulletPhysicsServer3D::body_clear_shapes(RID p_body) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->remove_all_shapes(); } -void BulletPhysicsServer::body_attach_object_instance_id(RID p_body, ObjectID p_id) { +void BulletPhysicsServer3D::body_attach_object_instance_id(RID p_body, ObjectID p_id) { CollisionObjectBullet *body = get_collisin_object(p_body); ERR_FAIL_COND(!body); body->set_instance_id(p_id); } -ObjectID BulletPhysicsServer::body_get_object_instance_id(RID p_body) const { +ObjectID BulletPhysicsServer3D::body_get_object_instance_id(RID p_body) const { CollisionObjectBullet *body = get_collisin_object(p_body); ERR_FAIL_COND_V(!body, ObjectID()); return body->get_instance_id(); } -void BulletPhysicsServer::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) { +void BulletPhysicsServer3D::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_continuous_collision_detection(p_enable); } -bool BulletPhysicsServer::body_is_continuous_collision_detection_enabled(RID p_body) const { +bool BulletPhysicsServer3D::body_is_continuous_collision_detection_enabled(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); return body->is_continuous_collision_detection_enabled(); } -void BulletPhysicsServer::body_set_collision_layer(RID p_body, uint32_t p_layer) { +void BulletPhysicsServer3D::body_set_collision_layer(RID p_body, uint32_t p_layer) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_collision_layer(p_layer); } -uint32_t BulletPhysicsServer::body_get_collision_layer(RID p_body) const { +uint32_t BulletPhysicsServer3D::body_get_collision_layer(RID p_body) const { const RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_collision_layer(); } -void BulletPhysicsServer::body_set_collision_mask(RID p_body, uint32_t p_mask) { +void BulletPhysicsServer3D::body_set_collision_mask(RID p_body, uint32_t p_mask) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_collision_mask(p_mask); } -uint32_t BulletPhysicsServer::body_get_collision_mask(RID p_body) const { +uint32_t BulletPhysicsServer3D::body_get_collision_mask(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_collision_mask(); } -void BulletPhysicsServer::body_set_user_flags(RID p_body, uint32_t p_flags) { +void BulletPhysicsServer3D::body_set_user_flags(RID p_body, uint32_t p_flags) { // This function si not currently supported } -uint32_t BulletPhysicsServer::body_get_user_flags(RID p_body) const { +uint32_t BulletPhysicsServer3D::body_get_user_flags(RID p_body) const { // This function si not currently supported return 0; } -void BulletPhysicsServer::body_set_param(RID p_body, BodyParameter p_param, float p_value) { +void BulletPhysicsServer3D::body_set_param(RID p_body, BodyParameter p_param, float p_value) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_param(p_param, p_value); } -float BulletPhysicsServer::body_get_param(RID p_body, BodyParameter p_param) const { +float BulletPhysicsServer3D::body_get_param(RID p_body, BodyParameter p_param) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_param(p_param); } -void BulletPhysicsServer::body_set_kinematic_safe_margin(RID p_body, real_t p_margin) { +void BulletPhysicsServer3D::body_set_kinematic_safe_margin(RID p_body, real_t p_margin) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -658,7 +658,7 @@ void BulletPhysicsServer::body_set_kinematic_safe_margin(RID p_body, real_t p_ma } } -real_t BulletPhysicsServer::body_get_kinematic_safe_margin(RID p_body) const { +real_t BulletPhysicsServer3D::body_get_kinematic_safe_margin(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); @@ -670,90 +670,90 @@ real_t BulletPhysicsServer::body_get_kinematic_safe_margin(RID p_body) const { return 0; } -void BulletPhysicsServer::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { +void BulletPhysicsServer3D::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_state(p_state, p_variant); } -Variant BulletPhysicsServer::body_get_state(RID p_body, BodyState p_state) const { +Variant BulletPhysicsServer3D::body_get_state(RID p_body, BodyState p_state) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Variant()); return body->get_state(p_state); } -void BulletPhysicsServer::body_set_applied_force(RID p_body, const Vector3 &p_force) { +void BulletPhysicsServer3D::body_set_applied_force(RID p_body, const Vector3 &p_force) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_applied_force(p_force); } -Vector3 BulletPhysicsServer::body_get_applied_force(RID p_body) const { +Vector3 BulletPhysicsServer3D::body_get_applied_force(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Vector3()); return body->get_applied_force(); } -void BulletPhysicsServer::body_set_applied_torque(RID p_body, const Vector3 &p_torque) { +void BulletPhysicsServer3D::body_set_applied_torque(RID p_body, const Vector3 &p_torque) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_applied_torque(p_torque); } -Vector3 BulletPhysicsServer::body_get_applied_torque(RID p_body) const { +Vector3 BulletPhysicsServer3D::body_get_applied_torque(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Vector3()); return body->get_applied_torque(); } -void BulletPhysicsServer::body_add_central_force(RID p_body, const Vector3 &p_force) { +void BulletPhysicsServer3D::body_add_central_force(RID p_body, const Vector3 &p_force) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_central_force(p_force); } -void BulletPhysicsServer::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) { +void BulletPhysicsServer3D::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_force(p_force, p_pos); } -void BulletPhysicsServer::body_add_torque(RID p_body, const Vector3 &p_torque) { +void BulletPhysicsServer3D::body_add_torque(RID p_body, const Vector3 &p_torque) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_torque(p_torque); } -void BulletPhysicsServer::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) { +void BulletPhysicsServer3D::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_central_impulse(p_impulse); } -void BulletPhysicsServer::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) { +void BulletPhysicsServer3D::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_impulse(p_pos, p_impulse); } -void BulletPhysicsServer::body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) { +void BulletPhysicsServer3D::body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->apply_torque_impulse(p_impulse); } -void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) { +void BulletPhysicsServer3D::body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -764,19 +764,19 @@ void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_ax body->set_linear_velocity(v); } -void BulletPhysicsServer::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) { +void BulletPhysicsServer3D::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_axis_lock(p_axis, p_lock); } -bool BulletPhysicsServer::body_is_axis_locked(RID p_body, BodyAxis p_axis) const { +bool BulletPhysicsServer3D::body_is_axis_locked(RID p_body, BodyAxis p_axis) const { const RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->is_axis_locked(p_axis); } -void BulletPhysicsServer::body_add_collision_exception(RID p_body, RID p_body_b) { +void BulletPhysicsServer3D::body_add_collision_exception(RID p_body, RID p_body_b) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -786,7 +786,7 @@ void BulletPhysicsServer::body_add_collision_exception(RID p_body, RID p_body_b) body->add_collision_exception(other_body); } -void BulletPhysicsServer::body_remove_collision_exception(RID p_body, RID p_body_b) { +void BulletPhysicsServer3D::body_remove_collision_exception(RID p_body, RID p_body_b) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -796,7 +796,7 @@ void BulletPhysicsServer::body_remove_collision_exception(RID p_body, RID p_body body->remove_collision_exception(other_body); } -void BulletPhysicsServer::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) { +void BulletPhysicsServer3D::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); for (int i = 0; i < body->get_exceptions().size(); i++) { @@ -804,68 +804,68 @@ void BulletPhysicsServer::body_get_collision_exceptions(RID p_body, List<RID> *p } } -void BulletPhysicsServer::body_set_max_contacts_reported(RID p_body, int p_contacts) { +void BulletPhysicsServer3D::body_set_max_contacts_reported(RID p_body, int p_contacts) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_max_collisions_detection(p_contacts); } -int BulletPhysicsServer::body_get_max_contacts_reported(RID p_body) const { +int BulletPhysicsServer3D::body_get_max_contacts_reported(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_max_collisions_detection(); } -void BulletPhysicsServer::body_set_contacts_reported_depth_threshold(RID p_body, float p_threshold) { +void BulletPhysicsServer3D::body_set_contacts_reported_depth_threshold(RID p_body, float p_threshold) { // Not supported by bullet and even Godot } -float BulletPhysicsServer::body_get_contacts_reported_depth_threshold(RID p_body) const { +float BulletPhysicsServer3D::body_get_contacts_reported_depth_threshold(RID p_body) const { // Not supported by bullet and even Godot return 0.; } -void BulletPhysicsServer::body_set_omit_force_integration(RID p_body, bool p_omit) { +void BulletPhysicsServer3D::body_set_omit_force_integration(RID p_body, bool p_omit) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_omit_forces_integration(p_omit); } -bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const { +bool BulletPhysicsServer3D::body_is_omitting_force_integration(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); return body->get_omit_forces_integration(); } -void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) { +void BulletPhysicsServer3D::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata); } -void BulletPhysicsServer::body_set_ray_pickable(RID p_body, bool p_enable) { +void BulletPhysicsServer3D::body_set_ray_pickable(RID p_body, bool p_enable) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_ray_pickable(p_enable); } -bool BulletPhysicsServer::body_is_ray_pickable(RID p_body) const { +bool BulletPhysicsServer3D::body_is_ray_pickable(RID p_body) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); return body->is_ray_pickable(); } -PhysicsDirectBodyState *BulletPhysicsServer::body_get_direct_state(RID p_body) { +PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, NULL); return BulletPhysicsDirectBodyState::get_singleton(body); } -bool BulletPhysicsServer::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) { +bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); ERR_FAIL_COND_V(!body->get_space(), false); @@ -873,7 +873,7 @@ bool BulletPhysicsServer::body_test_motion(RID p_body, const Transform &p_from, return body->get_space()->test_body_motion(body, p_from, p_motion, p_infinite_inertia, r_result, p_exclude_raycast_shapes); } -int BulletPhysicsServer::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) { +int BulletPhysicsServer3D::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); ERR_FAIL_COND_V(!body->get_space(), 0); @@ -881,7 +881,7 @@ int BulletPhysicsServer::body_test_ray_separation(RID p_body, const Transform &p return body->get_space()->test_ray_separation(body, p_transform, p_infinite_inertia, r_recover_motion, r_results, p_result_max, p_margin); } -RID BulletPhysicsServer::soft_body_create(bool p_init_sleeping) { +RID BulletPhysicsServer3D::soft_body_create(bool p_init_sleeping) { SoftBodyBullet *body = bulletnew(SoftBodyBullet); body->set_collision_layer(1); body->set_collision_mask(1); @@ -890,14 +890,14 @@ RID BulletPhysicsServer::soft_body_create(bool p_init_sleeping) { CreateThenReturnRID(soft_body_owner, body); } -void BulletPhysicsServer::soft_body_update_visual_server(RID p_body, class SoftBodyVisualServerHandler *p_visual_server_handler) { +void BulletPhysicsServer3D::soft_body_update_rendering_server(RID p_body, class SoftBodyRenderingServerHandler *p_rendering_server_handler) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); - body->update_visual_server(p_visual_server_handler); + body->update_rendering_server(p_rendering_server_handler); } -void BulletPhysicsServer::soft_body_set_space(RID p_body, RID p_space) { +void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); SpaceBullet *space = NULL; @@ -913,7 +913,7 @@ void BulletPhysicsServer::soft_body_set_space(RID p_body, RID p_space) { body->set_space(space); } -RID BulletPhysicsServer::soft_body_get_space(RID p_body) const { +RID BulletPhysicsServer3D::soft_body_get_space(RID p_body) const { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, RID()); @@ -923,42 +923,42 @@ RID BulletPhysicsServer::soft_body_get_space(RID p_body) const { return space->get_self(); } -void BulletPhysicsServer::soft_body_set_mesh(RID p_body, const REF &p_mesh) { +void BulletPhysicsServer3D::soft_body_set_mesh(RID p_body, const REF &p_mesh) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_soft_mesh(p_mesh); } -void BulletPhysicsServer::soft_body_set_collision_layer(RID p_body, uint32_t p_layer) { +void BulletPhysicsServer3D::soft_body_set_collision_layer(RID p_body, uint32_t p_layer) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_collision_layer(p_layer); } -uint32_t BulletPhysicsServer::soft_body_get_collision_layer(RID p_body) const { +uint32_t BulletPhysicsServer3D::soft_body_get_collision_layer(RID p_body) const { const SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_collision_layer(); } -void BulletPhysicsServer::soft_body_set_collision_mask(RID p_body, uint32_t p_mask) { +void BulletPhysicsServer3D::soft_body_set_collision_mask(RID p_body, uint32_t p_mask) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_collision_mask(p_mask); } -uint32_t BulletPhysicsServer::soft_body_get_collision_mask(RID p_body) const { +uint32_t BulletPhysicsServer3D::soft_body_get_collision_mask(RID p_body) const { const SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); return body->get_collision_mask(); } -void BulletPhysicsServer::soft_body_add_collision_exception(RID p_body, RID p_body_b) { +void BulletPhysicsServer3D::soft_body_add_collision_exception(RID p_body, RID p_body_b) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -971,7 +971,7 @@ void BulletPhysicsServer::soft_body_add_collision_exception(RID p_body, RID p_bo body->add_collision_exception(other_body); } -void BulletPhysicsServer::soft_body_remove_collision_exception(RID p_body, RID p_body_b) { +void BulletPhysicsServer3D::soft_body_remove_collision_exception(RID p_body, RID p_body_b) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -984,7 +984,7 @@ void BulletPhysicsServer::soft_body_remove_collision_exception(RID p_body, RID p body->remove_collision_exception(other_body); } -void BulletPhysicsServer::soft_body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) { +void BulletPhysicsServer3D::soft_body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); for (int i = 0; i < body->get_exceptions().size(); i++) { @@ -992,25 +992,25 @@ void BulletPhysicsServer::soft_body_get_collision_exceptions(RID p_body, List<RI } } -void BulletPhysicsServer::soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { +void BulletPhysicsServer3D::soft_body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) { // FIXME: Must be implemented. WARN_PRINT("soft_body_state is not implemented yet in Bullet backend."); } -Variant BulletPhysicsServer::soft_body_get_state(RID p_body, BodyState p_state) const { +Variant BulletPhysicsServer3D::soft_body_get_state(RID p_body, BodyState p_state) const { // FIXME: Must be implemented. WARN_PRINT("soft_body_state is not implemented yet in Bullet backend."); return Variant(); } -void BulletPhysicsServer::soft_body_set_transform(RID p_body, const Transform &p_transform) { +void BulletPhysicsServer3D::soft_body_set_transform(RID p_body, const Transform &p_transform) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_soft_transform(p_transform); } -Vector3 BulletPhysicsServer::soft_body_get_vertex_position(RID p_body, int vertex_index) const { +Vector3 BulletPhysicsServer3D::soft_body_get_vertex_position(RID p_body, int vertex_index) const { const SoftBodyBullet *body = soft_body_owner.getornull(p_body); Vector3 pos; ERR_FAIL_COND_V(!body, pos); @@ -1019,133 +1019,133 @@ Vector3 BulletPhysicsServer::soft_body_get_vertex_position(RID p_body, int verte return pos; } -void BulletPhysicsServer::soft_body_set_ray_pickable(RID p_body, bool p_enable) { +void BulletPhysicsServer3D::soft_body_set_ray_pickable(RID p_body, bool p_enable) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_ray_pickable(p_enable); } -bool BulletPhysicsServer::soft_body_is_ray_pickable(RID p_body) const { +bool BulletPhysicsServer3D::soft_body_is_ray_pickable(RID p_body) const { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); return body->is_ray_pickable(); } -void BulletPhysicsServer::soft_body_set_simulation_precision(RID p_body, int p_simulation_precision) { +void BulletPhysicsServer3D::soft_body_set_simulation_precision(RID p_body, int p_simulation_precision) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_simulation_precision(p_simulation_precision); } -int BulletPhysicsServer::soft_body_get_simulation_precision(RID p_body) { +int BulletPhysicsServer3D::soft_body_get_simulation_precision(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_simulation_precision(); } -void BulletPhysicsServer::soft_body_set_total_mass(RID p_body, real_t p_total_mass) { +void BulletPhysicsServer3D::soft_body_set_total_mass(RID p_body, real_t p_total_mass) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_total_mass(p_total_mass); } -real_t BulletPhysicsServer::soft_body_get_total_mass(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_total_mass(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_total_mass(); } -void BulletPhysicsServer::soft_body_set_linear_stiffness(RID p_body, real_t p_stiffness) { +void BulletPhysicsServer3D::soft_body_set_linear_stiffness(RID p_body, real_t p_stiffness) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_linear_stiffness(p_stiffness); } -real_t BulletPhysicsServer::soft_body_get_linear_stiffness(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_linear_stiffness(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_linear_stiffness(); } -void BulletPhysicsServer::soft_body_set_areaAngular_stiffness(RID p_body, real_t p_stiffness) { +void BulletPhysicsServer3D::soft_body_set_areaAngular_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); } -real_t BulletPhysicsServer::soft_body_get_areaAngular_stiffness(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_areaAngular_stiffness(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_areaAngular_stiffness(); } -void BulletPhysicsServer::soft_body_set_volume_stiffness(RID p_body, real_t p_stiffness) { +void BulletPhysicsServer3D::soft_body_set_volume_stiffness(RID p_body, real_t p_stiffness) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_volume_stiffness(p_stiffness); } -real_t BulletPhysicsServer::soft_body_get_volume_stiffness(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_volume_stiffness(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_volume_stiffness(); } -void BulletPhysicsServer::soft_body_set_pressure_coefficient(RID p_body, real_t p_pressure_coefficient) { +void BulletPhysicsServer3D::soft_body_set_pressure_coefficient(RID p_body, real_t p_pressure_coefficient) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_pressure_coefficient(p_pressure_coefficient); } -real_t BulletPhysicsServer::soft_body_get_pressure_coefficient(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_pressure_coefficient(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_pressure_coefficient(); } -void BulletPhysicsServer::soft_body_set_pose_matching_coefficient(RID p_body, real_t p_pose_matching_coefficient) { +void BulletPhysicsServer3D::soft_body_set_pose_matching_coefficient(RID p_body, real_t p_pose_matching_coefficient) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); return body->set_pose_matching_coefficient(p_pose_matching_coefficient); } -real_t BulletPhysicsServer::soft_body_get_pose_matching_coefficient(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_pose_matching_coefficient(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_pose_matching_coefficient(); } -void BulletPhysicsServer::soft_body_set_damping_coefficient(RID p_body, real_t p_damping_coefficient) { +void BulletPhysicsServer3D::soft_body_set_damping_coefficient(RID p_body, real_t p_damping_coefficient) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_damping_coefficient(p_damping_coefficient); } -real_t BulletPhysicsServer::soft_body_get_damping_coefficient(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_damping_coefficient(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_damping_coefficient(); } -void BulletPhysicsServer::soft_body_set_drag_coefficient(RID p_body, real_t p_drag_coefficient) { +void BulletPhysicsServer3D::soft_body_set_drag_coefficient(RID p_body, real_t p_drag_coefficient) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_drag_coefficient(p_drag_coefficient); } -real_t BulletPhysicsServer::soft_body_get_drag_coefficient(RID p_body) { +real_t BulletPhysicsServer3D::soft_body_get_drag_coefficient(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_drag_coefficient(); } -void BulletPhysicsServer::soft_body_move_point(RID p_body, int p_point_index, const Vector3 &p_global_position) { +void BulletPhysicsServer3D::soft_body_move_point(RID p_body, int p_point_index, const Vector3 &p_global_position) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_node_position(p_point_index, p_global_position); } -Vector3 BulletPhysicsServer::soft_body_get_point_global_position(RID p_body, int p_point_index) { +Vector3 BulletPhysicsServer3D::soft_body_get_point_global_position(RID p_body, int p_point_index) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Vector3(0., 0., 0.)); Vector3 pos; @@ -1153,7 +1153,7 @@ Vector3 BulletPhysicsServer::soft_body_get_point_global_position(RID p_body, int return pos; } -Vector3 BulletPhysicsServer::soft_body_get_point_offset(RID p_body, int p_point_index) const { +Vector3 BulletPhysicsServer3D::soft_body_get_point_offset(RID p_body, int p_point_index) const { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, Vector3()); Vector3 res; @@ -1161,54 +1161,54 @@ Vector3 BulletPhysicsServer::soft_body_get_point_offset(RID p_body, int p_point_ return res; } -void BulletPhysicsServer::soft_body_remove_all_pinned_points(RID p_body) { +void BulletPhysicsServer3D::soft_body_remove_all_pinned_points(RID p_body) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->reset_all_node_mass(); } -void BulletPhysicsServer::soft_body_pin_point(RID p_body, int p_point_index, bool p_pin) { +void BulletPhysicsServer3D::soft_body_pin_point(RID p_body, int p_point_index, bool p_pin) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); body->set_node_mass(p_point_index, p_pin ? 0 : 1); } -bool BulletPhysicsServer::soft_body_is_point_pinned(RID p_body, int p_point_index) { +bool BulletPhysicsServer3D::soft_body_is_point_pinned(RID p_body, int p_point_index) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0.f); return body->get_node_mass(p_point_index); } -PhysicsServer::JointType BulletPhysicsServer::joint_get_type(RID p_joint) const { +PhysicsServer3D::JointType BulletPhysicsServer3D::joint_get_type(RID p_joint) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, JOINT_PIN); return joint->get_type(); } -void BulletPhysicsServer::joint_set_solver_priority(RID p_joint, int p_priority) { +void BulletPhysicsServer3D::joint_set_solver_priority(RID p_joint, int p_priority) { // Joint priority not supported by bullet } -int BulletPhysicsServer::joint_get_solver_priority(RID p_joint) const { +int BulletPhysicsServer3D::joint_get_solver_priority(RID p_joint) const { // Joint priority not supported by bullet return 0; } -void BulletPhysicsServer::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) { +void BulletPhysicsServer3D::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); joint->disable_collisions_between_bodies(p_disable); } -bool BulletPhysicsServer::joint_is_disabled_collisions_between_bodies(RID p_joint) const { +bool BulletPhysicsServer3D::joint_is_disabled_collisions_between_bodies(RID p_joint) const { JointBullet *joint(joint_owner.getornull(p_joint)); ERR_FAIL_COND_V(!joint, false); return joint->is_disabled_collisions_between_bodies(); } -RID BulletPhysicsServer::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) { +RID BulletPhysicsServer3D::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); @@ -1229,7 +1229,7 @@ RID BulletPhysicsServer::joint_create_pin(RID p_body_A, const Vector3 &p_local_A CreateThenReturnRID(joint_owner, joint); } -void BulletPhysicsServer::pin_joint_set_param(RID p_joint, PinJointParam p_param, float p_value) { +void BulletPhysicsServer3D::pin_joint_set_param(RID p_joint, PinJointParam p_param, float p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_PIN); @@ -1237,7 +1237,7 @@ void BulletPhysicsServer::pin_joint_set_param(RID p_joint, PinJointParam p_param pin_joint->set_param(p_param, p_value); } -float BulletPhysicsServer::pin_joint_get_param(RID p_joint, PinJointParam p_param) const { +float BulletPhysicsServer3D::pin_joint_get_param(RID p_joint, PinJointParam p_param) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, 0); @@ -1245,7 +1245,7 @@ float BulletPhysicsServer::pin_joint_get_param(RID p_joint, PinJointParam p_para return pin_joint->get_param(p_param); } -void BulletPhysicsServer::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) { +void BulletPhysicsServer3D::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_PIN); @@ -1253,7 +1253,7 @@ void BulletPhysicsServer::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) pin_joint->setPivotInA(p_A); } -Vector3 BulletPhysicsServer::pin_joint_get_local_a(RID p_joint) const { +Vector3 BulletPhysicsServer3D::pin_joint_get_local_a(RID p_joint) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3()); @@ -1261,7 +1261,7 @@ Vector3 BulletPhysicsServer::pin_joint_get_local_a(RID p_joint) const { return pin_joint->getPivotInA(); } -void BulletPhysicsServer::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) { +void BulletPhysicsServer3D::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_PIN); @@ -1269,7 +1269,7 @@ void BulletPhysicsServer::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) pin_joint->setPivotInB(p_B); } -Vector3 BulletPhysicsServer::pin_joint_get_local_b(RID p_joint) const { +Vector3 BulletPhysicsServer3D::pin_joint_get_local_b(RID p_joint) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, Vector3()); ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3()); @@ -1277,7 +1277,7 @@ Vector3 BulletPhysicsServer::pin_joint_get_local_b(RID p_joint) const { return pin_joint->getPivotInB(); } -RID BulletPhysicsServer::joint_create_hinge(RID p_body_A, const Transform &p_hinge_A, RID p_body_B, const Transform &p_hinge_B) { +RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform &p_hinge_A, RID p_body_B, const Transform &p_hinge_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1297,7 +1297,7 @@ RID BulletPhysicsServer::joint_create_hinge(RID p_body_A, const Transform &p_hin CreateThenReturnRID(joint_owner, joint); } -RID BulletPhysicsServer::joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) { +RID BulletPhysicsServer3D::joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1317,7 +1317,7 @@ RID BulletPhysicsServer::joint_create_hinge_simple(RID p_body_A, const Vector3 & CreateThenReturnRID(joint_owner, joint); } -void BulletPhysicsServer::hinge_joint_set_param(RID p_joint, HingeJointParam p_param, float p_value) { +void BulletPhysicsServer3D::hinge_joint_set_param(RID p_joint, HingeJointParam p_param, float p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_HINGE); @@ -1325,7 +1325,7 @@ void BulletPhysicsServer::hinge_joint_set_param(RID p_joint, HingeJointParam p_p hinge_joint->set_param(p_param, p_value); } -float BulletPhysicsServer::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const { +float BulletPhysicsServer3D::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, 0); @@ -1333,7 +1333,7 @@ float BulletPhysicsServer::hinge_joint_get_param(RID p_joint, HingeJointParam p_ return hinge_joint->get_param(p_param); } -void BulletPhysicsServer::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value) { +void BulletPhysicsServer3D::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_HINGE); @@ -1341,7 +1341,7 @@ void BulletPhysicsServer::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_fla hinge_joint->set_flag(p_flag, p_value); } -bool BulletPhysicsServer::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const { +bool BulletPhysicsServer3D::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, false); ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, false); @@ -1349,7 +1349,7 @@ bool BulletPhysicsServer::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_fla return hinge_joint->get_flag(p_flag); } -RID BulletPhysicsServer::joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1369,7 +1369,7 @@ RID BulletPhysicsServer::joint_create_slider(RID p_body_A, const Transform &p_lo CreateThenReturnRID(joint_owner, joint); } -void BulletPhysicsServer::slider_joint_set_param(RID p_joint, SliderJointParam p_param, float p_value) { +void BulletPhysicsServer3D::slider_joint_set_param(RID p_joint, SliderJointParam p_param, float p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_SLIDER); @@ -1377,7 +1377,7 @@ void BulletPhysicsServer::slider_joint_set_param(RID p_joint, SliderJointParam p slider_joint->set_param(p_param, p_value); } -float BulletPhysicsServer::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const { +float BulletPhysicsServer3D::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); ERR_FAIL_COND_V(joint->get_type() != JOINT_SLIDER, 0); @@ -1385,7 +1385,7 @@ float BulletPhysicsServer::slider_joint_get_param(RID p_joint, SliderJointParam return slider_joint->get_param(p_param); } -RID BulletPhysicsServer::joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1403,7 +1403,7 @@ RID BulletPhysicsServer::joint_create_cone_twist(RID p_body_A, const Transform & CreateThenReturnRID(joint_owner, joint); } -void BulletPhysicsServer::cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, float p_value) { +void BulletPhysicsServer3D::cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, float p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_CONE_TWIST); @@ -1411,7 +1411,7 @@ void BulletPhysicsServer::cone_twist_joint_set_param(RID p_joint, ConeTwistJoint coneTwist_joint->set_param(p_param, p_value); } -float BulletPhysicsServer::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const { +float BulletPhysicsServer3D::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0.); ERR_FAIL_COND_V(joint->get_type() != JOINT_CONE_TWIST, 0.); @@ -1419,7 +1419,7 @@ float BulletPhysicsServer::cone_twist_joint_get_param(RID p_joint, ConeTwistJoin return coneTwist_joint->get_param(p_param); } -RID BulletPhysicsServer::joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1439,7 +1439,7 @@ RID BulletPhysicsServer::joint_create_generic_6dof(RID p_body_A, const Transform CreateThenReturnRID(joint_owner, joint); } -void BulletPhysicsServer::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, float p_value) { +void BulletPhysicsServer3D::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, float p_value) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_6DOF); @@ -1447,7 +1447,7 @@ void BulletPhysicsServer::generic_6dof_joint_set_param(RID p_joint, Vector3::Axi generic_6dof_joint->set_param(p_axis, p_param, p_value); } -float BulletPhysicsServer::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) { +float BulletPhysicsServer3D::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0); @@ -1455,7 +1455,7 @@ float BulletPhysicsServer::generic_6dof_joint_get_param(RID p_joint, Vector3::Ax return generic_6dof_joint->get_param(p_axis, p_param); } -void BulletPhysicsServer::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) { +void BulletPhysicsServer3D::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_6DOF); @@ -1463,7 +1463,7 @@ void BulletPhysicsServer::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis generic_6dof_joint->set_flag(p_axis, p_flag, p_enable); } -bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) { +bool BulletPhysicsServer3D::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, false); ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, false); @@ -1471,7 +1471,7 @@ bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis return generic_6dof_joint->get_flag(p_axis, p_flag); } -void BulletPhysicsServer::generic_6dof_joint_set_precision(RID p_joint, int p_precision) { +void BulletPhysicsServer3D::generic_6dof_joint_set_precision(RID p_joint, int p_precision) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND(!joint); ERR_FAIL_COND(joint->get_type() != JOINT_6DOF); @@ -1479,7 +1479,7 @@ void BulletPhysicsServer::generic_6dof_joint_set_precision(RID p_joint, int p_pr generic_6dof_joint->set_precision(p_precision); } -int BulletPhysicsServer::generic_6dof_joint_get_precision(RID p_joint) { +int BulletPhysicsServer3D::generic_6dof_joint_get_precision(RID p_joint) { JointBullet *joint = joint_owner.getornull(p_joint); ERR_FAIL_COND_V(!joint, 0); ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0); @@ -1487,7 +1487,7 @@ int BulletPhysicsServer::generic_6dof_joint_get_precision(RID p_joint) { return generic_6dof_joint->get_precision(); } -void BulletPhysicsServer::free(RID p_rid) { +void BulletPhysicsServer3D::free(RID p_rid) { if (shape_owner.owns(p_rid)) { ShapeBullet *shape = shape_owner.getornull(p_rid); @@ -1552,11 +1552,11 @@ void BulletPhysicsServer::free(RID p_rid) { } } -void BulletPhysicsServer::init() { +void BulletPhysicsServer3D::init() { BulletPhysicsDirectBodyState::initSingleton(); } -void BulletPhysicsServer::step(float p_deltaTime) { +void BulletPhysicsServer3D::step(float p_deltaTime) { if (!active) return; @@ -1568,21 +1568,21 @@ void BulletPhysicsServer::step(float p_deltaTime) { } } -void BulletPhysicsServer::sync() { +void BulletPhysicsServer3D::sync() { } -void BulletPhysicsServer::flush_queries() { +void BulletPhysicsServer3D::flush_queries() { } -void BulletPhysicsServer::finish() { +void BulletPhysicsServer3D::finish() { BulletPhysicsDirectBodyState::destroySingleton(); } -int BulletPhysicsServer::get_process_info(ProcessInfo p_info) { +int BulletPhysicsServer3D::get_process_info(ProcessInfo p_info) { return 0; } -CollisionObjectBullet *BulletPhysicsServer::get_collisin_object(RID p_object) const { +CollisionObjectBullet *BulletPhysicsServer3D::get_collisin_object(RID p_object) const { if (rigid_body_owner.owns(p_object)) { return rigid_body_owner.getornull(p_object); } @@ -1595,7 +1595,7 @@ CollisionObjectBullet *BulletPhysicsServer::get_collisin_object(RID p_object) co return NULL; } -RigidCollisionObjectBullet *BulletPhysicsServer::get_rigid_collisin_object(RID p_object) const { +RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID p_object) const { if (rigid_body_owner.owns(p_object)) { return rigid_body_owner.getornull(p_object); } diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index 6ea9a7a974..1269dac78b 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -36,7 +36,7 @@ #include "core/rid_owner.h" #include "joint_bullet.h" #include "rigid_body_bullet.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include "shape_bullet.h" #include "soft_body_bullet.h" #include "space_bullet.h" @@ -44,8 +44,8 @@ @author AndreaCatania */ -class BulletPhysicsServer : public PhysicsServer { - GDCLASS(BulletPhysicsServer, PhysicsServer); +class BulletPhysicsServer3D : public PhysicsServer3D { + GDCLASS(BulletPhysicsServer3D, PhysicsServer3D); friend class BulletPhysicsDirectSpaceState; @@ -64,8 +64,8 @@ protected: static void _bind_methods(); public: - BulletPhysicsServer(); - ~BulletPhysicsServer(); + BulletPhysicsServer3D(); + ~BulletPhysicsServer3D(); _FORCE_INLINE_ RID_PtrOwner<SpaceBullet> *get_space_owner() { return &space_owner; @@ -111,7 +111,7 @@ public: /// Not supported virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const; - virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space); + virtual PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space); virtual void space_set_debug_contacts(RID p_space, int p_max_contacts); virtual Vector<Vector3> space_get_contacts(RID p_space) const; @@ -252,7 +252,7 @@ public: virtual bool body_is_ray_pickable(RID p_body) const; // this function only works on physics process, errors and returns null otherwise - virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body); + virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body); virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true); virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001); @@ -261,7 +261,7 @@ public: virtual RID soft_body_create(bool p_init_sleeping = false); - virtual void soft_body_update_visual_server(RID p_body, class SoftBodyVisualServerHandler *p_visual_server_handler); + virtual void soft_body_update_rendering_server(RID p_body, class SoftBodyRenderingServerHandler *p_rendering_server_handler); virtual void soft_body_set_space(RID p_body, RID p_space); virtual RID soft_body_get_space(RID p_body) const; @@ -387,7 +387,7 @@ public: } static bool singleton_isActive() { - return static_cast<BulletPhysicsServer *>(get_singleton())->active; + return static_cast<BulletPhysicsServer3D *>(get_singleton())->active; } bool isActive() { diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 5b7e7281e4..0ce57811d7 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -60,7 +60,7 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra } btTransform CollisionObjectBullet::ShapeWrapper::get_adjusted_transform() const { - if (shape->get_type() == PhysicsServer::SHAPE_HEIGHTMAP) { + if (shape->get_type() == PhysicsServer3D::SHAPE_HEIGHTMAP) { const HeightMapShapeBullet *hm_shape = (const HeightMapShapeBullet *)shape; // should be safe to cast now btTransform adjusted_transform; diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp index 23eb39fe7e..aac51034b8 100644 --- a/modules/bullet/cone_twist_joint_bullet.cpp +++ b/modules/bullet/cone_twist_joint_bullet.cpp @@ -64,43 +64,43 @@ ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet setup(coneConstraint); } -void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) { +void ConeTwistJointBullet::set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN: + case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN: coneConstraint->setLimit(5, p_value); coneConstraint->setLimit(4, p_value); break; - case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN: + case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN: coneConstraint->setLimit(3, p_value); break; - case PhysicsServer::CONE_TWIST_JOINT_BIAS: + case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), p_value, coneConstraint->getRelaxationFactor()); break; - case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS: + case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), p_value, coneConstraint->getBiasFactor(), coneConstraint->getRelaxationFactor()); break; - case PhysicsServer::CONE_TWIST_JOINT_RELAXATION: + case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: coneConstraint->setLimit(coneConstraint->getSwingSpan1(), coneConstraint->getSwingSpan2(), coneConstraint->getTwistSpan(), coneConstraint->getLimitSoftness(), coneConstraint->getBiasFactor(), p_value); break; - case PhysicsServer::CONE_TWIST_MAX: + case PhysicsServer3D::CONE_TWIST_MAX: // Internal size value, nothing to do. break; } } -real_t ConeTwistJointBullet::get_param(PhysicsServer::ConeTwistJointParam p_param) const { +real_t ConeTwistJointBullet::get_param(PhysicsServer3D::ConeTwistJointParam p_param) const { switch (p_param) { - case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN: + case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN: return coneConstraint->getSwingSpan1(); - case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN: + case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN: return coneConstraint->getTwistSpan(); - case PhysicsServer::CONE_TWIST_JOINT_BIAS: + case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: return coneConstraint->getBiasFactor(); - case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS: + case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: return coneConstraint->getLimitSoftness(); - case PhysicsServer::CONE_TWIST_JOINT_RELAXATION: + case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: return coneConstraint->getRelaxationFactor(); - case PhysicsServer::CONE_TWIST_MAX: + case PhysicsServer3D::CONE_TWIST_MAX: // Internal size value, nothing to do. return 0; } diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h index 134706f8bb..ed4baa9d1b 100644 --- a/modules/bullet/cone_twist_joint_bullet.h +++ b/modules/bullet/cone_twist_joint_bullet.h @@ -45,9 +45,9 @@ class ConeTwistJointBullet : public JointBullet { public: ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame); - virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; } + virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_CONE_TWIST; } - void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value); - real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const; + void set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value); + real_t get_param(PhysicsServer3D::ConeTwistJointParam p_param) const; }; #endif diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index 45ab3d3bb2..a6a01ebaa8 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -118,62 +118,62 @@ void Generic6DOFJointBullet::set_angular_upper_limit(const Vector3 &angularUpper sixDOFConstraint->setAngularUpperLimit(btVec); } -void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) { +void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value) { ERR_FAIL_INDEX(p_axis, 3); switch (p_param) { - case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT: limits_lower[0][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter break; - case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT: limits_upper[0][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter break; - case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING: sixDOFConstraint->getTranslationalLimitMotor()->m_springDamping.m_floats[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: sixDOFConstraint->getTranslationalLimitMotor()->m_springStiffness.m_floats[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: sixDOFConstraint->getTranslationalLimitMotor()->m_equilibriumPoint.m_floats[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: limits_lower[1][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: limits_upper[1][p_axis] = p_value; - set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter + set_flag(p_axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springStiffness = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springDamping = p_value; break; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint = p_value; break; - case PhysicsServer::G6DOF_JOINT_MAX: + case PhysicsServer3D::G6DOF_JOINT_MAX: // Internal size value, nothing to do. break; default: @@ -182,42 +182,42 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO } } -real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const { +real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const { ERR_FAIL_INDEX_V(p_axis, 3, 0.); switch (p_param) { - case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT: return limits_lower[0][p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT: return limits_upper[0][p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: return sixDOFConstraint->getTranslationalLimitMotor()->m_maxMotorForce.m_floats[p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING: return sixDOFConstraint->getTranslationalLimitMotor()->m_springDamping.m_floats[p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: return sixDOFConstraint->getTranslationalLimitMotor()->m_springStiffness.m_floats[p_axis]; - case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: + case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: return sixDOFConstraint->getTranslationalLimitMotor()->m_equilibriumPoint.m_floats[p_axis]; - case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: return limits_lower[1][p_axis]; - case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: return limits_upper[1][p_axis]; - case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce; - case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP; - case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity; - case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springStiffness; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_springDamping; - case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: + case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_equilibriumPoint; - case PhysicsServer::G6DOF_JOINT_MAX: + case PhysicsServer3D::G6DOF_JOINT_MAX: // Internal size value, nothing to do. return 0; default: @@ -226,45 +226,45 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6 } } -void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) { +void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value) { ERR_FAIL_INDEX(p_axis, 3); flags[p_axis][p_flag] = p_value; switch (p_flag) { - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: if (flags[p_axis][p_flag]) { sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]); } else { sixDOFConstraint->setLimit(p_axis, 0, -1); // Free } break; - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: if (flags[p_axis][p_flag]) { sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]); } else { sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free } break; - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableSpring = p_value; break; - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: sixDOFConstraint->getTranslationalLimitMotor()->m_enableSpring[p_axis] = p_value; break; - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_MOTOR: sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag]; break; - case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: + case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = flags[p_axis][p_flag]; break; - case PhysicsServer::G6DOF_JOINT_FLAG_MAX: + case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX: // Internal size value, nothing to do. break; } } -bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const { +bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const { ERR_FAIL_INDEX_V(p_axis, 3, false); return flags[p_axis][p_flag]; } diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h index 75c8005811..316708bb11 100644 --- a/modules/bullet/generic_6dof_joint_bullet.h +++ b/modules/bullet/generic_6dof_joint_bullet.h @@ -45,12 +45,12 @@ class Generic6DOFJointBullet : public JointBullet { // First is linear second is angular Vector3 limits_lower[2]; Vector3 limits_upper[2]; - bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX]; + bool flags[3][PhysicsServer3D::G6DOF_JOINT_FLAG_MAX]; public: Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB); - virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; } + virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_6DOF; } Transform getFrameOffsetA() const; Transform getFrameOffsetB() const; @@ -63,11 +63,11 @@ public: void set_angular_lower_limit(const Vector3 &angularLower); void set_angular_upper_limit(const Vector3 &angularUpper); - void set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value); - real_t get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const; + void set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value); + real_t get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const; - void set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value); - bool get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const; + void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value); + bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const; void set_precision(int p_precision); int get_precision() const; diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index 20467e3ef3..ad054e3027 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -107,7 +107,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo CollisionObjectBullet *gObj = static_cast<CollisionObjectBullet *>(convexResult.m_hitCollisionObject->getUserPointer()); - PhysicsDirectSpaceState::ShapeResult &result = m_results[count]; + PhysicsDirectSpaceState3D::ShapeResult &result = m_results[count]; result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID result.rid = gObj->get_self(); @@ -207,7 +207,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con if (cp.getDistance() <= 0) { - PhysicsDirectSpaceState::ShapeResult &result = m_results[m_count]; + PhysicsDirectSpaceState3D::ShapeResult &result = m_results[m_count]; // Penetrated CollisionObjectBullet *colObj; diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h index 4f634ed6f0..7e74a2b22e 100644 --- a/modules/bullet/godot_result_callbacks.h +++ b/modules/bullet/godot_result_callbacks.h @@ -31,7 +31,7 @@ #ifndef GODOT_RESULT_CALLBACKS_H #define GODOT_RESULT_CALLBACKS_H -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> #include <btBulletDynamicsCommon.h> @@ -85,12 +85,12 @@ public: // store all colliding object struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback { public: - PhysicsDirectSpaceState::ShapeResult *m_results; + PhysicsDirectSpaceState3D::ShapeResult *m_results; int m_resultMax; const Set<RID> *m_exclude; int count; - GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) : + GodotAllConvexResultCallback(PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) : m_results(p_results), m_resultMax(p_resultMax), m_exclude(p_exclude), @@ -137,7 +137,7 @@ public: struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback { public: const btCollisionObject *m_self_object; - PhysicsDirectSpaceState::ShapeResult *m_results; + PhysicsDirectSpaceState3D::ShapeResult *m_results; int m_resultMax; const Set<RID> *m_exclude; int m_count; @@ -145,7 +145,7 @@ public: bool collide_with_bodies; bool collide_with_areas; - GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) : + GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) : m_self_object(p_self_object), m_results(p_results), m_resultMax(p_resultMax), @@ -188,7 +188,7 @@ public: struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback { public: const btCollisionObject *m_self_object; - PhysicsDirectSpaceState::ShapeRestInfo *m_result; + PhysicsDirectSpaceState3D::ShapeRestInfo *m_result; const Set<RID> *m_exclude; bool m_collided; real_t m_min_distance; @@ -197,7 +197,7 @@ public: bool collide_with_bodies; bool collide_with_areas; - GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) : + GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) : m_self_object(p_self_object), m_result(p_result), m_exclude(p_exclude), diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index 970732688a..eaac1d650d 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -93,58 +93,58 @@ real_t HingeJointBullet::get_hinge_angle() { return hingeConstraint->getHingeAngle(); } -void HingeJointBullet::set_param(PhysicsServer::HingeJointParam p_param, real_t p_value) { +void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::HINGE_JOINT_BIAS: + case PhysicsServer3D::HINGE_JOINT_BIAS: WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated."); break; - case PhysicsServer::HINGE_JOINT_LIMIT_UPPER: + case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor()); break; - case PhysicsServer::HINGE_JOINT_LIMIT_LOWER: + case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: hingeConstraint->setLimit(p_value, hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor()); break; - case PhysicsServer::HINGE_JOINT_LIMIT_BIAS: + case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), p_value, hingeConstraint->getLimitRelaxationFactor()); break; - case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS: + case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), p_value, hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor()); break; - case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION: + case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), hingeConstraint->getUpperLimit(), hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), p_value); break; - case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: hingeConstraint->setMotorTargetVelocity(p_value); break; - case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE: + case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: hingeConstraint->setMaxMotorImpulse(p_value); break; - case PhysicsServer::HINGE_JOINT_MAX: + case PhysicsServer3D::HINGE_JOINT_MAX: // Internal size value, nothing to do. break; } } -real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const { +real_t HingeJointBullet::get_param(PhysicsServer3D::HingeJointParam p_param) const { switch (p_param) { - case PhysicsServer::HINGE_JOINT_BIAS: + case PhysicsServer3D::HINGE_JOINT_BIAS: WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated."); return 0; - case PhysicsServer::HINGE_JOINT_LIMIT_UPPER: + case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: return hingeConstraint->getUpperLimit(); - case PhysicsServer::HINGE_JOINT_LIMIT_LOWER: + case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: return hingeConstraint->getLowerLimit(); - case PhysicsServer::HINGE_JOINT_LIMIT_BIAS: + case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: return hingeConstraint->getLimitBiasFactor(); - case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS: + case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: return hingeConstraint->getLimitSoftness(); - case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION: + case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: return hingeConstraint->getLimitRelaxationFactor(); - case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY: + case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: return hingeConstraint->getMotorTargetVelocity(); - case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE: + case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: return hingeConstraint->getMaxMotorImpulse(); - case PhysicsServer::HINGE_JOINT_MAX: + case PhysicsServer3D::HINGE_JOINT_MAX: // Internal size value, nothing to do. return 0; } @@ -152,25 +152,25 @@ real_t HingeJointBullet::get_param(PhysicsServer::HingeJointParam p_param) const return 0; } -void HingeJointBullet::set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value) { +void HingeJointBullet::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value) { switch (p_flag) { - case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT: + case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: if (!p_value) { hingeConstraint->setLimit(-Math_PI, Math_PI); } break; - case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR: + case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: hingeConstraint->enableMotor(p_value); break; - case PhysicsServer::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning + case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning } } -bool HingeJointBullet::get_flag(PhysicsServer::HingeJointFlag p_flag) const { +bool HingeJointBullet::get_flag(PhysicsServer3D::HingeJointFlag p_flag) const { switch (p_flag) { - case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT: + case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: return true; - case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR: + case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: return hingeConstraint->getEnableAngularMotor(); default: return false; diff --git a/modules/bullet/hinge_joint_bullet.h b/modules/bullet/hinge_joint_bullet.h index d1061fe52f..120c40e5c0 100644 --- a/modules/bullet/hinge_joint_bullet.h +++ b/modules/bullet/hinge_joint_bullet.h @@ -44,14 +44,14 @@ public: HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB); HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB); - virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; } + virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_HINGE; } real_t get_hinge_angle(); - void set_param(PhysicsServer::HingeJointParam p_param, real_t p_value); - real_t get_param(PhysicsServer::HingeJointParam p_param) const; + void set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value); + real_t get_param(PhysicsServer3D::HingeJointParam p_param) const; - void set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value); - bool get_flag(PhysicsServer::HingeJointFlag p_flag) const; + void set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value); + bool get_flag(PhysicsServer3D::HingeJointFlag p_flag) const; }; #endif diff --git a/modules/bullet/joint_bullet.h b/modules/bullet/joint_bullet.h index c840eb8f14..9cb8aab276 100644 --- a/modules/bullet/joint_bullet.h +++ b/modules/bullet/joint_bullet.h @@ -32,7 +32,7 @@ #define JOINT_BULLET_H #include "constraint_bullet.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" /** @author AndreaCatania @@ -47,6 +47,6 @@ public: JointBullet(); virtual ~JointBullet(); - virtual PhysicsServer::JointType get_type() const = 0; + virtual PhysicsServer3D::JointType get_type() const = 0; }; #endif diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp index 8d109f1866..68b40d7405 100644 --- a/modules/bullet/pin_joint_bullet.cpp +++ b/modules/bullet/pin_joint_bullet.cpp @@ -62,27 +62,27 @@ PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a PinJointBullet::~PinJointBullet() {} -void PinJointBullet::set_param(PhysicsServer::PinJointParam p_param, real_t p_value) { +void PinJointBullet::set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::PIN_JOINT_BIAS: + case PhysicsServer3D::PIN_JOINT_BIAS: p2pConstraint->m_setting.m_tau = p_value; break; - case PhysicsServer::PIN_JOINT_DAMPING: + case PhysicsServer3D::PIN_JOINT_DAMPING: p2pConstraint->m_setting.m_damping = p_value; break; - case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP: + case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: p2pConstraint->m_setting.m_impulseClamp = p_value; break; } } -real_t PinJointBullet::get_param(PhysicsServer::PinJointParam p_param) const { +real_t PinJointBullet::get_param(PhysicsServer3D::PinJointParam p_param) const { switch (p_param) { - case PhysicsServer::PIN_JOINT_BIAS: + case PhysicsServer3D::PIN_JOINT_BIAS: return p2pConstraint->m_setting.m_tau; - case PhysicsServer::PIN_JOINT_DAMPING: + case PhysicsServer3D::PIN_JOINT_DAMPING: return p2pConstraint->m_setting.m_damping; - case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP: + case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: return p2pConstraint->m_setting.m_impulseClamp; } // Compiler doesn't seem to notice that all code paths are fulfilled... diff --git a/modules/bullet/pin_joint_bullet.h b/modules/bullet/pin_joint_bullet.h index d6e7a945b5..e7d05f34d4 100644 --- a/modules/bullet/pin_joint_bullet.h +++ b/modules/bullet/pin_joint_bullet.h @@ -46,10 +46,10 @@ public: PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b); ~PinJointBullet(); - virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_PIN; } + virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_PIN; } - void set_param(PhysicsServer::PinJointParam p_param, real_t p_value); - real_t get_param(PhysicsServer::PinJointParam p_param) const; + void set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value); + real_t get_param(PhysicsServer3D::PinJointParam p_param) const; void setPivotInA(const Vector3 &p_pos); void setPivotInB(const Vector3 &p_pos); diff --git a/modules/bullet/register_types.cpp b/modules/bullet/register_types.cpp index 7819b67cad..009d0dff63 100644 --- a/modules/bullet/register_types.cpp +++ b/modules/bullet/register_types.cpp @@ -39,15 +39,15 @@ */ #ifndef _3D_DISABLED -PhysicsServer *_createBulletPhysicsCallback() { - return memnew(BulletPhysicsServer); +PhysicsServer3D *_createBulletPhysicsCallback() { + return memnew(BulletPhysicsServer3D); } #endif void register_bullet_types() { #ifndef _3D_DISABLED - PhysicsServerManager::register_server("Bullet", &_createBulletPhysicsCallback); - PhysicsServerManager::set_default_server("Bullet", 1); + PhysicsServer3DManager::register_server("Bullet", &_createBulletPhysicsCallback); + PhysicsServer3DManager::set_default_server("Bullet", 1); GLOBAL_DEF("physics/3d/active_soft_world", true); ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/active_soft_world", PropertyInfo(Variant::BOOL, "physics/3d/active_soft_world")); diff --git a/modules/bullet/rid_bullet.h b/modules/bullet/rid_bullet.h index b76641ca54..3551ca05f9 100644 --- a/modules/bullet/rid_bullet.h +++ b/modules/bullet/rid_bullet.h @@ -37,17 +37,17 @@ @author AndreaCatania */ -class BulletPhysicsServer; +class BulletPhysicsServer3D; class RIDBullet { RID self; - BulletPhysicsServer *physicsServer; + BulletPhysicsServer3D *physicsServer; public: _FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; } _FORCE_INLINE_ RID get_self() const { return self; } - _FORCE_INLINE_ void _set_physics_server(BulletPhysicsServer *p_physicsServer) { physicsServer = p_physicsServer; } - _FORCE_INLINE_ BulletPhysicsServer *get_physics_server() const { return physicsServer; } + _FORCE_INLINE_ void _set_physics_server(BulletPhysicsServer3D *p_physicsServer) { physicsServer = p_physicsServer; } + _FORCE_INLINE_ BulletPhysicsServer3D *get_physics_server() const { return physicsServer; } }; #endif diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 80f42c8441..b92166e653 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -194,7 +194,7 @@ Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position( return velocityAtPoint; } -PhysicsDirectSpaceState *BulletPhysicsDirectBodyState::get_space_state() { +PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState::get_space_state() { return body->get_space()->get_direct_state(); } @@ -231,12 +231,12 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() { shapes.write[i].transform = shape_wrapper->transform; shapes.write[i].transform.getOrigin() *= owner_scale; switch (shape_wrapper->shape->get_type()) { - case PhysicsServer::SHAPE_SPHERE: - case PhysicsServer::SHAPE_BOX: - case PhysicsServer::SHAPE_CAPSULE: - case PhysicsServer::SHAPE_CYLINDER: - case PhysicsServer::SHAPE_CONVEX_POLYGON: - case PhysicsServer::SHAPE_RAY: { + case PhysicsServer3D::SHAPE_SPHERE: + case PhysicsServer3D::SHAPE_BOX: + case PhysicsServer3D::SHAPE_CAPSULE: + case PhysicsServer3D::SHAPE_CYLINDER: + case PhysicsServer3D::SHAPE_CONVEX_POLYGON: + case PhysicsServer3D::SHAPE_RAY: { shapes.write[i].shape = static_cast<btConvexShape *>(shape_wrapper->shape->create_bt_shape(owner_scale * shape_wrapper->scale, safe_margin)); } break; default: @@ -286,7 +286,7 @@ RigidBodyBullet::RigidBodyBullet() : reload_shapes(); setupBulletCollisionObject(btBody); - set_mode(PhysicsServer::BODY_MODE_RIGID); + set_mode(PhysicsServer3D::BODY_MODE_RIGID); reload_axis_lock(); areasWhereIam.resize(maxAreasWhereIam); @@ -487,29 +487,29 @@ void RigidBodyBullet::set_omit_forces_integration(bool p_omit) { omit_forces_integration = p_omit; } -void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) { +void RigidBodyBullet::set_param(PhysicsServer3D::BodyParameter p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::BODY_PARAM_BOUNCE: + case PhysicsServer3D::BODY_PARAM_BOUNCE: btBody->setRestitution(p_value); break; - case PhysicsServer::BODY_PARAM_FRICTION: + case PhysicsServer3D::BODY_PARAM_FRICTION: btBody->setFriction(p_value); break; - case PhysicsServer::BODY_PARAM_MASS: { + case PhysicsServer3D::BODY_PARAM_MASS: { ERR_FAIL_COND(p_value < 0); mass = p_value; _internal_set_mass(p_value); break; } - case PhysicsServer::BODY_PARAM_LINEAR_DAMP: + case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP: linearDamp = p_value; btBody->setDamping(linearDamp, angularDamp); break; - case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP: angularDamp = p_value; btBody->setDamping(linearDamp, angularDamp); break; - case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: + case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: gravity_scale = p_value; /// The Bullet gravity will be is set by reload_space_override_modificator scratch_space_override_modificator(); @@ -519,21 +519,21 @@ void RigidBodyBullet::set_param(PhysicsServer::BodyParameter p_param, real_t p_v } } -real_t RigidBodyBullet::get_param(PhysicsServer::BodyParameter p_param) const { +real_t RigidBodyBullet::get_param(PhysicsServer3D::BodyParameter p_param) const { switch (p_param) { - case PhysicsServer::BODY_PARAM_BOUNCE: + case PhysicsServer3D::BODY_PARAM_BOUNCE: return btBody->getRestitution(); - case PhysicsServer::BODY_PARAM_FRICTION: + case PhysicsServer3D::BODY_PARAM_FRICTION: return btBody->getFriction(); - case PhysicsServer::BODY_PARAM_MASS: { + case PhysicsServer3D::BODY_PARAM_MASS: { const btScalar invMass = btBody->getInvMass(); return 0 == invMass ? 0 : 1 / invMass; } - case PhysicsServer::BODY_PARAM_LINEAR_DAMP: + case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP: return linearDamp; - case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP: return angularDamp; - case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: + case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: return gravity_scale; default: WARN_PRINT("Parameter " + itos(p_param) + " not supported by bullet"); @@ -541,31 +541,31 @@ real_t RigidBodyBullet::get_param(PhysicsServer::BodyParameter p_param) const { } } -void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) { +void RigidBodyBullet::set_mode(PhysicsServer3D::BodyMode p_mode) { // This is necessary to block force_integration untile next move can_integrate_forces = false; destroy_kinematic_utilities(); // The mode change is relevant to its mass switch (p_mode) { - case PhysicsServer::BODY_MODE_KINEMATIC: - mode = PhysicsServer::BODY_MODE_KINEMATIC; + case PhysicsServer3D::BODY_MODE_KINEMATIC: + mode = PhysicsServer3D::BODY_MODE_KINEMATIC; reload_axis_lock(); _internal_set_mass(0); init_kinematic_utilities(); break; - case PhysicsServer::BODY_MODE_STATIC: - mode = PhysicsServer::BODY_MODE_STATIC; + case PhysicsServer3D::BODY_MODE_STATIC: + mode = PhysicsServer3D::BODY_MODE_STATIC; reload_axis_lock(); _internal_set_mass(0); break; - case PhysicsServer::BODY_MODE_RIGID: - mode = PhysicsServer::BODY_MODE_RIGID; + case PhysicsServer3D::BODY_MODE_RIGID: + mode = PhysicsServer3D::BODY_MODE_RIGID; reload_axis_lock(); _internal_set_mass(0 == mass ? 1 : mass); scratch_space_override_modificator(); break; - case PhysicsServer::BODY_MODE_CHARACTER: - mode = PhysicsServer::BODY_MODE_CHARACTER; + case PhysicsServer3D::BODY_MODE_CHARACTER: + mode = PhysicsServer3D::BODY_MODE_CHARACTER; reload_axis_lock(); _internal_set_mass(0 == mass ? 1 : mass); scratch_space_override_modificator(); @@ -575,26 +575,26 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) { btBody->setAngularVelocity(btVector3(0, 0, 0)); btBody->setLinearVelocity(btVector3(0, 0, 0)); } -PhysicsServer::BodyMode RigidBodyBullet::get_mode() const { +PhysicsServer3D::BodyMode RigidBodyBullet::get_mode() const { return mode; } -void RigidBodyBullet::set_state(PhysicsServer::BodyState p_state, const Variant &p_variant) { +void RigidBodyBullet::set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant) { switch (p_state) { - case PhysicsServer::BODY_STATE_TRANSFORM: + case PhysicsServer3D::BODY_STATE_TRANSFORM: set_transform(p_variant); break; - case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: + case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY: set_linear_velocity(p_variant); break; - case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: + case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY: set_angular_velocity(p_variant); break; - case PhysicsServer::BODY_STATE_SLEEPING: + case PhysicsServer3D::BODY_STATE_SLEEPING: set_activation_state(!bool(p_variant)); break; - case PhysicsServer::BODY_STATE_CAN_SLEEP: + case PhysicsServer3D::BODY_STATE_CAN_SLEEP: can_sleep = bool(p_variant); if (!can_sleep) { // Can't sleep @@ -606,17 +606,17 @@ void RigidBodyBullet::set_state(PhysicsServer::BodyState p_state, const Variant } } -Variant RigidBodyBullet::get_state(PhysicsServer::BodyState p_state) const { +Variant RigidBodyBullet::get_state(PhysicsServer3D::BodyState p_state) const { switch (p_state) { - case PhysicsServer::BODY_STATE_TRANSFORM: + case PhysicsServer3D::BODY_STATE_TRANSFORM: return get_transform(); - case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: + case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY: return get_linear_velocity(); - case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: + case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY: return get_angular_velocity(); - case PhysicsServer::BODY_STATE_SLEEPING: + case PhysicsServer3D::BODY_STATE_SLEEPING: return !is_active(); - case PhysicsServer::BODY_STATE_CAN_SLEEP: + case PhysicsServer3D::BODY_STATE_CAN_SLEEP: return can_sleep; default: WARN_PRINT("This state " + itos(p_state) + " is not supported by Bullet"); @@ -714,7 +714,7 @@ Vector3 RigidBodyBullet::get_applied_torque() const { return gTotTorq; } -void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) { +void RigidBodyBullet::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock) { if (lock) { locked_axis |= p_axis; } else { @@ -724,18 +724,18 @@ void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) { reload_axis_lock(); } -bool RigidBodyBullet::is_axis_locked(PhysicsServer::BodyAxis p_axis) const { +bool RigidBodyBullet::is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const { return locked_axis & p_axis; } void RigidBodyBullet::reload_axis_lock() { - btBody->setLinearFactor(btVector3(float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_X)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Y)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Z)))); - if (PhysicsServer::BODY_MODE_CHARACTER == mode) { + btBody->setLinearFactor(btVector3(float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_X)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_Y)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_LINEAR_Z)))); + if (PhysicsServer3D::BODY_MODE_CHARACTER == mode) { /// When character angular is always locked btBody->setAngularFactor(btVector3(0., 0., 0.)); } else { - btBody->setAngularFactor(btVector3(float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_X)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Y)), float(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Z)))); + btBody->setAngularFactor(btVector3(float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_X)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_Y)), float(!is_axis_locked(PhysicsServer3D::BODY_AXIS_ANGULAR_Z)))); } } @@ -794,7 +794,7 @@ Vector3 RigidBodyBullet::get_angular_velocity() const { } void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transform) { - if (mode == PhysicsServer::BODY_MODE_KINEMATIC) { + if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) { if (space && space->get_delta_time() != 0) btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time()); // The kinematic use MotionState class @@ -862,7 +862,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) { } } } - if (PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) { + if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) { scratch_space_override_modificator(); } @@ -895,7 +895,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) { --areaWhereIamCount; areasWhereIam.write[areaWhereIamCount] = NULL; // Even if this is not required, I clear the last element to be safe - if (PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) { + if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) { scratch_space_override_modificator(); } } @@ -904,7 +904,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) { void RigidBodyBullet::reload_space_override_modificator() { // Make sure that kinematic bodies have their total gravity calculated - if (!is_active() && PhysicsServer::BODY_MODE_KINEMATIC != mode) + if (!is_active() && PhysicsServer3D::BODY_MODE_KINEMATIC != mode) return; Vector3 newGravity(space->get_gravity_direction() * space->get_gravity_magnitude()); @@ -920,7 +920,7 @@ void RigidBodyBullet::reload_space_override_modificator() { currentArea = areasWhereIam[i]; - if (!currentArea || PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED == currentArea->get_spOv_mode()) { + if (!currentArea || PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED == currentArea->get_spOv_mode()) { continue; } @@ -954,11 +954,11 @@ void RigidBodyBullet::reload_space_override_modificator() { } switch (currentArea->get_spOv_mode()) { - case PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED: + case PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED: /// This area does not affect gravity/damp. These are generally areas /// that exist only to detect collisions, and objects entering or exiting them. break; - case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE: + case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE: /// This area adds its gravity/damp values to whatever has been /// calculated so far. This way, many overlapping areas can combine /// their physics to make interesting @@ -967,7 +967,7 @@ void RigidBodyBullet::reload_space_override_modificator() { newAngularDamp += currentArea->get_spOv_angularDamp(); ++countCombined; break; - case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: + case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: /// This area adds its gravity/damp values to whatever has been calculated /// so far. Then stops taking into account the rest of the areas, even the /// default one. @@ -976,7 +976,7 @@ void RigidBodyBullet::reload_space_override_modificator() { newAngularDamp += currentArea->get_spOv_angularDamp(); ++countCombined; goto endAreasCycle; - case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE: + case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE: /// This area replaces any gravity/damp, even the default one, and /// stops taking into account the rest of the areas. newGravity = support_gravity; @@ -984,7 +984,7 @@ void RigidBodyBullet::reload_space_override_modificator() { newAngularDamp = currentArea->get_spOv_angularDamp(); countCombined = 1; goto endAreasCycle; - case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: + case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: /// This area replaces any gravity/damp calculated so far, but keeps /// calculating the rest of the areas, down to the default one. newGravity = support_gravity; @@ -1032,14 +1032,14 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) { const bool isDynamic = p_mass != 0.f; if (isDynamic) { - if (PhysicsServer::BODY_MODE_RIGID != mode && PhysicsServer::BODY_MODE_CHARACTER != mode) + if (PhysicsServer3D::BODY_MODE_RIGID != mode && PhysicsServer3D::BODY_MODE_CHARACTER != mode) return; m_isStatic = false; if (mainShape) mainShape->calculateLocalInertia(p_mass, localInertia); - if (PhysicsServer::BODY_MODE_RIGID == mode) { + if (PhysicsServer3D::BODY_MODE_RIGID == mode) { btBody->setCollisionFlags(clearedCurrentFlags); // Just set the flags without Kin and Static } else { @@ -1054,11 +1054,11 @@ void RigidBodyBullet::_internal_set_mass(real_t p_mass) { } } else { - if (PhysicsServer::BODY_MODE_STATIC != mode && PhysicsServer::BODY_MODE_KINEMATIC != mode) + if (PhysicsServer3D::BODY_MODE_STATIC != mode && PhysicsServer3D::BODY_MODE_KINEMATIC != mode) return; m_isStatic = true; - if (PhysicsServer::BODY_MODE_STATIC == mode) { + if (PhysicsServer3D::BODY_MODE_STATIC == mode) { btBody->setCollisionFlags(clearedCurrentFlags | btCollisionObject::CF_STATIC_OBJECT); } else { diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index ca599f7a77..bce3511282 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -51,10 +51,10 @@ class BulletPhysicsDirectBodyState; /// is set to be only in one single thread. /// /// In the system there is only one object at a time that manage all bodies and is -/// created by BulletPhysicsServer and is held by the "singleton" variable of this class +/// created by BulletPhysicsServer3D and is held by the "singleton" variable of this class /// Each time something require it, the body must be set again. -class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState { - GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState); +class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState3D { + GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState3D); static BulletPhysicsDirectBodyState *singleton; @@ -138,7 +138,7 @@ public: // Skip the execution of this function } - virtual PhysicsDirectSpaceState *get_space_state(); + virtual PhysicsDirectSpaceState3D *get_space_state(); }; class RigidBodyBullet : public RigidCollisionObjectBullet { @@ -192,7 +192,7 @@ private: // This is required only for Kinematic movement KinematicUtilities *kinematic_utilities; - PhysicsServer::BodyMode mode; + PhysicsServer3D::BodyMode mode; GodotMotionState *godotMotionState; btRigidBody *btBody; uint16_t locked_axis; @@ -278,14 +278,14 @@ public: void set_omit_forces_integration(bool p_omit); _FORCE_INLINE_ bool get_omit_forces_integration() const { return omit_forces_integration; } - void set_param(PhysicsServer::BodyParameter p_param, real_t); - real_t get_param(PhysicsServer::BodyParameter p_param) const; + void set_param(PhysicsServer3D::BodyParameter p_param, real_t); + real_t get_param(PhysicsServer3D::BodyParameter p_param) const; - void set_mode(PhysicsServer::BodyMode p_mode); - PhysicsServer::BodyMode get_mode() const; + void set_mode(PhysicsServer3D::BodyMode p_mode); + PhysicsServer3D::BodyMode get_mode() const; - void set_state(PhysicsServer::BodyState p_state, const Variant &p_variant); - Variant get_state(PhysicsServer::BodyState p_state) const; + void set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant); + Variant get_state(PhysicsServer3D::BodyState p_state) const; void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse); void apply_central_impulse(const Vector3 &p_impulse); @@ -300,8 +300,8 @@ public: void set_applied_torque(const Vector3 &p_torque); Vector3 get_applied_torque() const; - void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock); - bool is_axis_locked(PhysicsServer::BodyAxis p_axis) const; + void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock); + bool is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const; void reload_axis_lock(); /// Doc: diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 6780f89d9e..6b73525d10 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -150,7 +150,7 @@ btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(Vector<real_t> btHeightfieldTerrainShape *heightfield = bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges)); - // The shape can be created without params when you do PhysicsServer.shape_create(PhysicsServer.SHAPE_HEIGHTMAP) + // The shape can be created without params when you do PhysicsServer3D.shape_create(PhysicsServer3D.SHAPE_HEIGHTMAP) if (heightsPtr) heightfield->buildAccelerator(16); @@ -176,8 +176,8 @@ Variant PlaneShapeBullet::get_data() const { return plane; } -PhysicsServer::ShapeType PlaneShapeBullet::get_type() const { - return PhysicsServer::SHAPE_PLANE; +PhysicsServer3D::ShapeType PlaneShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_PLANE; } void PlaneShapeBullet::setup(const Plane &p_plane) { @@ -204,8 +204,8 @@ Variant SphereShapeBullet::get_data() const { return radius; } -PhysicsServer::ShapeType SphereShapeBullet::get_type() const { - return PhysicsServer::SHAPE_SPHERE; +PhysicsServer3D::ShapeType SphereShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_SPHERE; } void SphereShapeBullet::setup(real_t p_radius) { @@ -231,8 +231,8 @@ Variant BoxShapeBullet::get_data() const { return g_half_extents; } -PhysicsServer::ShapeType BoxShapeBullet::get_type() const { - return PhysicsServer::SHAPE_BOX; +PhysicsServer3D::ShapeType BoxShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_BOX; } void BoxShapeBullet::setup(const Vector3 &p_half_extents) { @@ -263,8 +263,8 @@ Variant CapsuleShapeBullet::get_data() const { return d; } -PhysicsServer::ShapeType CapsuleShapeBullet::get_type() const { - return PhysicsServer::SHAPE_CAPSULE; +PhysicsServer3D::ShapeType CapsuleShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_CAPSULE; } void CapsuleShapeBullet::setup(real_t p_height, real_t p_radius) { @@ -296,8 +296,8 @@ Variant CylinderShapeBullet::get_data() const { return d; } -PhysicsServer::ShapeType CylinderShapeBullet::get_type() const { - return PhysicsServer::SHAPE_CYLINDER; +PhysicsServer3D::ShapeType CylinderShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_CYLINDER; } void CylinderShapeBullet::setup(real_t p_height, real_t p_radius) { @@ -334,8 +334,8 @@ Variant ConvexPolygonShapeBullet::get_data() const { return out_vertices; } -PhysicsServer::ShapeType ConvexPolygonShapeBullet::get_type() const { - return PhysicsServer::SHAPE_CONVEX_POLYGON; +PhysicsServer3D::ShapeType ConvexPolygonShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_CONVEX_POLYGON; } void ConvexPolygonShapeBullet::setup(const Vector<Vector3> &p_vertices) { @@ -381,8 +381,8 @@ Variant ConcavePolygonShapeBullet::get_data() const { return faces; } -PhysicsServer::ShapeType ConcavePolygonShapeBullet::get_type() const { - return PhysicsServer::SHAPE_CONCAVE_POLYGON; +PhysicsServer3D::ShapeType ConcavePolygonShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_CONCAVE_POLYGON; } void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) { @@ -536,8 +536,8 @@ Variant HeightMapShapeBullet::get_data() const { ERR_FAIL_V(Variant()); } -PhysicsServer::ShapeType HeightMapShapeBullet::get_type() const { - return PhysicsServer::SHAPE_HEIGHTMAP; +PhysicsServer3D::ShapeType HeightMapShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_HEIGHTMAP; } void HeightMapShapeBullet::setup(Vector<real_t> &p_heights, int p_width, int p_depth, real_t p_min_height, real_t p_max_height) { @@ -580,8 +580,8 @@ Variant RayShapeBullet::get_data() const { return d; } -PhysicsServer::ShapeType RayShapeBullet::get_type() const { - return PhysicsServer::SHAPE_RAY; +PhysicsServer3D::ShapeType RayShapeBullet::get_type() const { + return PhysicsServer3D::SHAPE_RAY; } void RayShapeBullet::setup(real_t p_length, bool p_slips_on_slope) { diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h index c8b5ca102a..0dbc616fe5 100644 --- a/modules/bullet/shape_bullet.h +++ b/modules/bullet/shape_bullet.h @@ -34,7 +34,7 @@ #include "core/math/geometry.h" #include "core/variant.h" #include "rid_bullet.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include <LinearMath/btAlignedObjectArray.h> #include <LinearMath/btScalar.h> @@ -78,7 +78,7 @@ public: virtual void set_data(const Variant &p_data) = 0; virtual Variant get_data() const = 0; - virtual PhysicsServer::ShapeType get_type() const = 0; + virtual PhysicsServer3D::ShapeType get_type() const = 0; public: static class btEmptyShape *create_shape_empty(); @@ -103,7 +103,7 @@ public: virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -120,7 +120,7 @@ public: _FORCE_INLINE_ real_t get_radius() { return radius; } virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -137,7 +137,7 @@ public: _FORCE_INLINE_ const btVector3 &get_half_extents() { return half_extents; } virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -156,7 +156,7 @@ public: _FORCE_INLINE_ real_t get_radius() { return radius; } virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -175,7 +175,7 @@ public: _FORCE_INLINE_ real_t get_radius() { return radius; } virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_margin = 0); private: @@ -192,7 +192,7 @@ public: virtual void set_data(const Variant &p_data); void get_vertices(Vector<Vector3> &out_vertices); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -210,7 +210,7 @@ public: virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -230,7 +230,7 @@ public: virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: @@ -247,7 +247,7 @@ public: virtual void set_data(const Variant &p_data); virtual Variant get_data() const; - virtual PhysicsServer::ShapeType get_type() const; + virtual PhysicsServer3D::ShapeType get_type() const; virtual btCollisionShape *create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge = 0); private: diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp index d9ebb9d580..f193daef39 100644 --- a/modules/bullet/slider_joint_bullet.cpp +++ b/modules/bullet/slider_joint_bullet.cpp @@ -342,58 +342,58 @@ real_t SliderJointBullet::getLinearPos() { ; } -void SliderJointBullet::set_param(PhysicsServer::SliderJointParam p_param, real_t p_value) { +void SliderJointBullet::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: setUpperLinLimit(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: setLowerLinLimit(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: setSoftnessLimLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: setRestitutionLimLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: setDampingLimLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: setSoftnessDirLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: setRestitutionDirLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: setDampingDirLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: setDampingOrthoLin(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: setUpperAngLimit(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: setLowerAngLimit(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: setSoftnessLimAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: setRestitutionLimAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: setDampingLimAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: setSoftnessDirAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: setRestitutionDirAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: setDampingDirAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: setDampingOrthoAng(p_value); break; - case PhysicsServer::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: setUpperLinLimit(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: setLowerLinLimit(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: setSoftnessLimLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: setRestitutionLimLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: setDampingLimLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: setSoftnessDirLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: setRestitutionDirLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: setDampingDirLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: setDampingOrthoLin(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: setUpperAngLimit(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: setLowerAngLimit(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: setSoftnessLimAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: setRestitutionLimAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: setDampingLimAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: setSoftnessDirAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: setRestitutionDirAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: setDampingDirAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: setSoftnessOrthoAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: setRestitutionOrthoAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: setDampingOrthoAng(p_value); break; + case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning } } -real_t SliderJointBullet::get_param(PhysicsServer::SliderJointParam p_param) const { +real_t SliderJointBullet::get_param(PhysicsServer3D::SliderJointParam p_param) const { switch (p_param) { - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return getUpperLinLimit(); - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return getLowerLinLimit(); - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return getSoftnessLimLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return getRestitutionLimLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return getDampingLimLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return getSoftnessDirLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return getRestitutionDirLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return getDampingDirLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoLin(); - case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return getDampingOrthoLin(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return getUpperAngLimit(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return getLowerAngLimit(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return getSoftnessLimAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return getRestitutionLimAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return getDampingLimAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return getSoftnessDirAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return getRestitutionDirAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return getDampingDirAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoAng(); - case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return getDampingOrthoAng(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return getUpperLinLimit(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return getLowerLinLimit(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return getSoftnessLimLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return getRestitutionLimLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return getDampingLimLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return getSoftnessDirLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return getRestitutionDirLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return getDampingDirLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoLin(); + case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return getDampingOrthoLin(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return getUpperAngLimit(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return getLowerAngLimit(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return getSoftnessLimAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return getRestitutionLimAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return getDampingLimAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return getSoftnessDirAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return getRestitutionDirAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return getDampingDirAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return getSoftnessOrthoAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return getRestitutionOrthoAng(); + case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return getDampingOrthoAng(); default: return 0; } diff --git a/modules/bullet/slider_joint_bullet.h b/modules/bullet/slider_joint_bullet.h index d98a1b8c95..6410b952ed 100644 --- a/modules/bullet/slider_joint_bullet.h +++ b/modules/bullet/slider_joint_bullet.h @@ -46,7 +46,7 @@ public: /// Reference frame is A SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB); - virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_SLIDER; } + virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_SLIDER; } const RigidBodyBullet *getRigidBodyA() const; const RigidBodyBullet *getRigidBodyB() const; @@ -115,7 +115,7 @@ public: real_t getMaxAngMotorForce(); real_t getLinearPos(); - void set_param(PhysicsServer::SliderJointParam p_param, real_t p_value); - real_t get_param(PhysicsServer::SliderJointParam p_param) const; + void set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value); + real_t get_param(PhysicsServer3D::SliderJointParam p_param) const; }; #endif diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index fb36a0d3e1..2984bf9c2b 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -76,7 +76,7 @@ void SoftBodyBullet::on_enter_area(AreaBullet *p_area) {} void SoftBodyBullet::on_exit_area(AreaBullet *p_area) {} -void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_server_handler) { +void SoftBodyBullet::update_rendering_server(SoftBodyRenderingServerHandler *p_rendering_server_handler) { if (!bt_soft_body) return; @@ -96,8 +96,8 @@ void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_ const int vs_indices_size(vs_indices->size()); for (int x = 0; x < vs_indices_size; ++x) { - p_visual_server_handler->set_vertex((*vs_indices)[x], vertex_position); - p_visual_server_handler->set_normal((*vs_indices)[x], vertex_normal); + p_rendering_server_handler->set_vertex((*vs_indices)[x], vertex_position); + p_rendering_server_handler->set_normal((*vs_indices)[x], vertex_normal); } } @@ -112,7 +112,7 @@ void SoftBodyBullet::update_visual_server(SoftBodyVisualServerHandler *p_visual_ B_TO_G(aabb_min, aabb.position); B_TO_G(size, aabb.size); - p_visual_server_handler->set_aabb(aabb); + p_rendering_server_handler->set_aabb(aabb); } void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) { @@ -129,8 +129,8 @@ void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) { } Array arrays = soft_mesh->surface_get_arrays(0); - ERR_FAIL_COND(!(soft_mesh->surface_get_format(0) & VS::ARRAY_FORMAT_INDEX)); - set_trimesh_body_shape(arrays[VS::ARRAY_INDEX], arrays[VS::ARRAY_VERTEX]); + ERR_FAIL_COND(!(soft_mesh->surface_get_format(0) & RS::ARRAY_FORMAT_INDEX)); + set_trimesh_body_shape(arrays[RS::ARRAY_INDEX], arrays[RS::ARRAY_VERTEX]); } void SoftBodyBullet::destroy_soft_body() { @@ -184,7 +184,7 @@ void SoftBodyBullet::get_node_offset(int p_node_index, Vector3 &r_offset) const return; Array arrays = soft_mesh->surface_get_arrays(0); - Vector<Vector3> vertices(arrays[VS::ARRAY_VERTEX]); + Vector<Vector3> vertices(arrays[RS::ARRAY_VERTEX]); if (0 <= p_node_index && vertices.size() > p_node_index) { r_offset = vertices[p_node_index]; @@ -230,7 +230,7 @@ void SoftBodyBullet::reset_all_node_positions() { return; Array arrays = soft_mesh->surface_get_arrays(0); - Vector<Vector3> vs_vertices(arrays[VS::ARRAY_VERTEX]); + Vector<Vector3> vs_vertices(arrays[RS::ARRAY_VERTEX]); const Vector3 *vs_vertices_read = vs_vertices.ptr(); for (int vertex_index = bt_soft_body->m_nodes.size() - 1; 0 <= vertex_index; --vertex_index) { diff --git a/modules/bullet/soft_body_bullet.h b/modules/bullet/soft_body_bullet.h index 05d7e6ce3f..3c6871e0d6 100644 --- a/modules/bullet/soft_body_bullet.h +++ b/modules/bullet/soft_body_bullet.h @@ -43,7 +43,7 @@ #include "BulletSoftBody/btSoftBodyHelpers.h" #include "collision_object_bullet.h" #include "scene/resources/mesh.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #ifdef x11_None /// This is required to re add the macro None defined by x11 compiler @@ -100,7 +100,7 @@ public: _FORCE_INLINE_ btSoftBody *get_bt_soft_body() const { return bt_soft_body; } - void update_visual_server(class SoftBodyVisualServerHandler *p_visual_server_handler); + void update_rendering_server(class SoftBodyRenderingServerHandler *p_rendering_server_handler); void set_soft_mesh(const Ref<Mesh> &p_mesh); void destroy_soft_body(); diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index f6df97f11d..c40a1500f0 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -39,7 +39,7 @@ #include "godot_collision_configuration.h" #include "godot_collision_dispatcher.h" #include "rigid_body_bullet.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include "soft_body_bullet.h" #include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> @@ -59,7 +59,7 @@ */ BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) : - PhysicsDirectSpaceState(), + PhysicsDirectSpaceState3D(), space(p_space) {} int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { @@ -366,27 +366,27 @@ void SpaceBullet::step(real_t p_delta_time) { dynamicsWorld->stepSimulation(p_delta_time, 0, 0); } -void SpaceBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value) { +void SpaceBullet::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) { assert(dynamicsWorld); switch (p_param) { - case PhysicsServer::AREA_PARAM_GRAVITY: + case PhysicsServer3D::AREA_PARAM_GRAVITY: gravityMagnitude = p_value; update_gravity(); break; - case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: + case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: gravityDirection = p_value; update_gravity(); break; - case PhysicsServer::AREA_PARAM_LINEAR_DAMP: - case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: + case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: break; // No damp - case PhysicsServer::AREA_PARAM_PRIORITY: + case PhysicsServer3D::AREA_PARAM_PRIORITY: // Priority is always 0, the lower break; - case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: - case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: - case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: + case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: + case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: + case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: break; default: WARN_PRINT("This set parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it."); @@ -394,22 +394,22 @@ void SpaceBullet::set_param(PhysicsServer::AreaParameter p_param, const Variant } } -Variant SpaceBullet::get_param(PhysicsServer::AreaParameter p_param) { +Variant SpaceBullet::get_param(PhysicsServer3D::AreaParameter p_param) { switch (p_param) { - case PhysicsServer::AREA_PARAM_GRAVITY: + case PhysicsServer3D::AREA_PARAM_GRAVITY: return gravityMagnitude; - case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: + case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: return gravityDirection; - case PhysicsServer::AREA_PARAM_LINEAR_DAMP: - case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: + case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: + case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: return 0; // No damp - case PhysicsServer::AREA_PARAM_PRIORITY: + case PhysicsServer3D::AREA_PARAM_PRIORITY: return 0; // Priority is always 0, the lower - case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: + case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: return false; - case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: + case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return 0; - case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: + case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return 0; default: WARN_PRINT("This get parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it."); @@ -417,32 +417,32 @@ Variant SpaceBullet::get_param(PhysicsServer::AreaParameter p_param) { } } -void SpaceBullet::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) { +void SpaceBullet::set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value) { switch (p_param) { - case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: - case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: - case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: - case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: - case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: - case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: - case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: - case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: + case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: + case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: + case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: + case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: + case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: + case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: + case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: + case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: default: WARN_PRINT("This set parameter (" + itos(p_param) + ") is ignored, the SpaceBullet doesn't support it."); break; } } -real_t SpaceBullet::get_param(PhysicsServer::SpaceParameter p_param) { +real_t SpaceBullet::get_param(PhysicsServer3D::SpaceParameter p_param) { switch (p_param) { - case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: - case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: - case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: - case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: - case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: - case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: - case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: - case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: + case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: + case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: + case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: + case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: + case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: + case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: + case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: + case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: default: WARN_PRINT("The SpaceBullet doesn't support this get parameter (" + itos(p_param) + "), 0 is returned."); return 0.f; @@ -891,7 +891,7 @@ static Ref<StandardMaterial3D> red_mat; static Ref<StandardMaterial3D> blue_mat; #endif -bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes) { +bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes) { #if debug_test_motion /// Yes I know this is not good, but I've used it as fast debugging hack. @@ -1042,7 +1042,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f return has_penetration; } -int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, float p_margin) { +int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, float p_margin) { btTransform body_transform; G_TO_B(p_transform, body_transform); @@ -1054,7 +1054,7 @@ int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p int rays_found_this_round = 0; for (int t(RECOVERING_MOVEMENT_CYCLES); 0 < t; --t) { - PhysicsServer::SeparationResult *next_results = &r_results[rays_found]; + PhysicsServer3D::SeparationResult *next_results = &r_results[rays_found]; rays_found_this_round = recover_from_penetration_ray(p_body, body_transform, RECOVERING_MOVEMENT_SCALE, p_infinite_inertia, p_result_max - rays_found, recover_motion, next_results); rays_found += rays_found_this_round; @@ -1333,7 +1333,7 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC return false; } -int SpaceBullet::add_separation_result(PhysicsServer::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const { +int SpaceBullet::add_separation_result(PhysicsServer3D::SeparationResult *r_result, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const { // optimize results (ignore non-colliding) if (p_recover_result.penetration_distance < 0.0) { @@ -1355,7 +1355,7 @@ int SpaceBullet::add_separation_result(PhysicsServer::SeparationResult *r_result } } -int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results) { +int SpaceBullet::recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results) { // Calculate the cumulative AABB of all shapes of the kinematic body btVector3 aabb_min, aabb_max; diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index 32372f1630..fce715b48d 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -35,7 +35,7 @@ #include "core/vector.h" #include "godot_result_callbacks.h" #include "rid_bullet.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" #include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> #include <BulletCollision/BroadphaseCollision/btOverlappingPairCache.h> @@ -67,8 +67,8 @@ class btGjkEpaPenetrationDepthSolver; extern ContactAddedCallback gContactAddedCallback; -class BulletPhysicsDirectSpaceState : public PhysicsDirectSpaceState { - GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState); +class BulletPhysicsDirectSpaceState : public PhysicsDirectSpaceState3D { + GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState3D); private: SpaceBullet *space; @@ -131,15 +131,15 @@ public: /// @param p_param: /// AREA_PARAM_GRAVITY to set the gravity magnitude of entire world /// AREA_PARAM_GRAVITY_VECTOR to set the gravity direction of entire world - void set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value); + void set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value); /// Used to get some parameters to Bullet world /// @param p_param: /// AREA_PARAM_GRAVITY to get the gravity magnitude of entire world /// AREA_PARAM_GRAVITY_VECTOR to get the gravity direction of entire world - Variant get_param(PhysicsServer::AreaParameter p_param); + Variant get_param(PhysicsServer3D::AreaParameter p_param); - void set_param(PhysicsServer::SpaceParameter p_param, real_t p_value); - real_t get_param(PhysicsServer::SpaceParameter p_param); + void set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value); + real_t get_param(PhysicsServer3D::SpaceParameter p_param); void add_area(AreaBullet *p_area); void remove_area(AreaBullet *p_area); @@ -177,8 +177,8 @@ public: void update_gravity(); - bool test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes); - int test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, float p_margin); + bool test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes); + int test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, float p_margin); private: void create_empty_world(bool p_create_soft_world); @@ -213,7 +213,7 @@ private: /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL); - int add_separation_result(PhysicsServer::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const; - int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer::SeparationResult *r_results); + int add_separation_result(PhysicsServer3D::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const; + int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results); }; #endif diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index d052eba41c..848b865efb 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -43,16 +43,16 @@ void CSGShape3D::set_use_collision(bool p_enable) { if (use_collision) { root_collision_shape.instance(); - root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC); - PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid()); - PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space()); - PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id()); + root_collision_instance = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC); + PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid()); + PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space()); + PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id()); set_collision_layer(collision_layer); set_collision_mask(collision_mask); _make_dirty(); //force update } else { - PhysicsServer::get_singleton()->free(root_collision_instance); + PhysicsServer3D::get_singleton()->free(root_collision_instance); root_collision_instance = RID(); root_collision_shape.unref(); } @@ -66,7 +66,7 @@ bool CSGShape3D::is_using_collision() const { void CSGShape3D::set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; if (root_collision_instance.is_valid()) { - PhysicsServer::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer); + PhysicsServer3D::get_singleton()->body_set_collision_layer(root_collision_instance, p_layer); } } @@ -79,7 +79,7 @@ void CSGShape3D::set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; if (root_collision_instance.is_valid()) { - PhysicsServer::get_singleton()->body_set_collision_mask(root_collision_instance, p_mask); + PhysicsServer3D::get_singleton()->body_set_collision_mask(root_collision_instance, p_mask); } } @@ -506,11 +506,11 @@ void CSGShape3D::_notification(int p_what) { if (use_collision && is_root_shape()) { root_collision_shape.instance(); - root_collision_instance = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC); - PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid()); - PhysicsServer::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space()); - PhysicsServer::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id()); + root_collision_instance = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC); + PhysicsServer3D::get_singleton()->body_set_state(root_collision_instance, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_add_shape(root_collision_instance, root_collision_shape->get_rid()); + PhysicsServer3D::get_singleton()->body_set_space(root_collision_instance, get_world()->get_space()); + PhysicsServer3D::get_singleton()->body_attach_object_instance_id(root_collision_instance, get_instance_id()); set_collision_layer(collision_layer); set_collision_mask(collision_mask); } @@ -539,7 +539,7 @@ void CSGShape3D::_notification(int p_what) { parent = NULL; if (use_collision && is_root_shape() && root_collision_instance.is_valid()) { - PhysicsServer::get_singleton()->free(root_collision_instance); + PhysicsServer3D::get_singleton()->free(root_collision_instance); root_collision_instance = RID(); root_collision_shape.unref(); } diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp index 0f0c864df2..faa891e624 100644 --- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp +++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp @@ -31,7 +31,7 @@ #include "arvr_interface_gdnative.h" #include "core/input/input_filter.h" #include "servers/arvr/arvr_positional_tracker.h" -#include "servers/visual/visual_server_globals.h" +#include "servers/rendering/rendering_server_globals.h" void ARVRInterfaceGDNative::_bind_methods() { ADD_PROPERTY_DEFAULT("interface_is_initialized", false); @@ -292,7 +292,7 @@ void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_re #warning this needs to be redone #endif #if 0 - VSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); + RSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); #endif } @@ -302,13 +302,13 @@ godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target) { #if 0 RID *render_target = (RID *)p_render_target; - RID eye_texture = VSG::storage->render_target_get_texture(*render_target); + RID eye_texture = RSG::storage->render_target_get_texture(*render_target); #endif #ifndef _MSC_VER #warning need to obtain this ID again #endif - uint32_t texid = 0; //VS::get_singleton()->texture_get_texid(eye_texture); + uint32_t texid = 0; //RS::get_singleton()->texture_get_texid(eye_texture); return texid; } diff --git a/modules/gdnavigation/gd_navigation_server.cpp b/modules/gdnavigation/gd_navigation_server.cpp index a1f6ddfedc..cade6c8a6d 100644 --- a/modules/gdnavigation/gd_navigation_server.cpp +++ b/modules/gdnavigation/gd_navigation_server.cpp @@ -114,7 +114,7 @@ void GdNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) GdNavigationServer::GdNavigationServer() : - NavigationServer(), + NavigationServer3D(), active(true) { } diff --git a/modules/gdnavigation/gd_navigation_server.h b/modules/gdnavigation/gd_navigation_server.h index e9f5c1ffe6..01d1a4fba9 100644 --- a/modules/gdnavigation/gd_navigation_server.h +++ b/modules/gdnavigation/gd_navigation_server.h @@ -33,7 +33,7 @@ #include "core/rid.h" #include "core/rid_owner.h" -#include "servers/navigation_server.h" +#include "servers/navigation_server_3d.h" #include "nav_map.h" #include "nav_region.h" @@ -67,7 +67,7 @@ struct SetCommand { virtual void exec(GdNavigationServer *server) = 0; }; -class GdNavigationServer : public NavigationServer { +class GdNavigationServer : public NavigationServer3D { Mutex commands_mutex; /// Mutex used to make any operation threadsafe. Mutex operations_mutex; diff --git a/modules/gdnavigation/register_types.cpp b/modules/gdnavigation/register_types.cpp index d717733787..9965a89fde 100644 --- a/modules/gdnavigation/register_types.cpp +++ b/modules/gdnavigation/register_types.cpp @@ -32,7 +32,7 @@ #include "core/engine.h" #include "gd_navigation_server.h" -#include "servers/navigation_server.h" +#include "servers/navigation_server_3d.h" #ifndef _3D_DISABLED #include "navigation_mesh_generator.h" @@ -50,12 +50,12 @@ NavigationMeshGenerator *_nav_mesh_generator = NULL; #endif -NavigationServer *new_server() { +NavigationServer3D *new_server() { return memnew(GdNavigationServer); } void register_gdnavigation_types() { - NavigationServerManager::set_default_server(new_server); + NavigationServer3DManager::set_default_server(new_server); #ifndef _3D_DISABLED _nav_mesh_generator = memnew(NavigationMeshGenerator); diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp index d2b4a18fc7..2540ba476c 100644 --- a/modules/glslang/register_types.cpp +++ b/modules/glslang/register_types.cpp @@ -30,7 +30,7 @@ #include "register_types.h" -#include "servers/visual/rendering_device.h" +#include "servers/rendering/rendering_device.h" #include <SPIRV/GlslangToSpv.h> #include <glslang/Include/Types.h> diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 61f18fbfee..35c214d3cf 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -36,8 +36,8 @@ #include "scene/resources/mesh_library.h" #include "scene/resources/surface_tool.h" #include "scene/scene_string_names.h" -#include "servers/navigation_server.h" -#include "servers/visual_server.h" +#include "servers/navigation_server_3d.h" +#include "servers/rendering_server.h" bool GridMap::_set(const StringName &p_name, const Variant &p_value) { @@ -76,12 +76,12 @@ bool GridMap::_set(const StringName &p_name, const Variant &p_value) { BakedMesh bm; bm.mesh = meshes[i]; ERR_CONTINUE(!bm.mesh.is_valid()); - bm.instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); - VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); + bm.instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); + RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); } baked_meshes.push_back(bm); } @@ -306,17 +306,17 @@ void GridMap::set_cell_item(int p_x, int p_y, int p_z, int p_item, int p_rot) { //create octant because it does not exist Octant *g = memnew(Octant); g->dirty = true; - g->static_body = PhysicsServer::get_singleton()->body_create(PhysicsServer::BODY_MODE_STATIC); - PhysicsServer::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id()); - PhysicsServer::get_singleton()->body_set_collision_layer(g->static_body, collision_layer); - PhysicsServer::get_singleton()->body_set_collision_mask(g->static_body, collision_mask); + g->static_body = PhysicsServer3D::get_singleton()->body_create(PhysicsServer3D::BODY_MODE_STATIC); + PhysicsServer3D::get_singleton()->body_attach_object_instance_id(g->static_body, get_instance_id()); + PhysicsServer3D::get_singleton()->body_set_collision_layer(g->static_body, collision_layer); + PhysicsServer3D::get_singleton()->body_set_collision_mask(g->static_body, collision_mask); SceneTree *st = SceneTree::get_singleton(); if (st && st->is_debugging_collisions_hint()) { - g->collision_debug = VisualServer::get_singleton()->mesh_create(); - g->collision_debug_instance = VisualServer::get_singleton()->instance_create(); - VisualServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug); + g->collision_debug = RenderingServer::get_singleton()->mesh_create(); + g->collision_debug_instance = RenderingServer::get_singleton()->instance_create(); + RenderingServer::get_singleton()->instance_set_base(g->collision_debug_instance, g->collision_debug); } octant_map[octantkey] = g; @@ -392,14 +392,14 @@ void GridMap::_octant_transform(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); if (g.collision_debug_instance.is_valid()) { - VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); } } @@ -410,17 +410,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) { return false; //erase body shapes - PhysicsServer::get_singleton()->body_clear_shapes(g.static_body); + PhysicsServer3D::get_singleton()->body_clear_shapes(g.static_body); //erase body shapes debug if (g.collision_debug.is_valid()) { - VS::get_singleton()->mesh_clear(g.collision_debug); + RS::get_singleton()->mesh_clear(g.collision_debug); } //erase navigation for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) { - NavigationServer::get_singleton()->free(E->get().region); + NavigationServer3D::get_singleton()->free(E->get().region); } g.navmesh_ids.clear(); @@ -428,8 +428,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) { for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->free(g.multimesh_instances[i].instance); - VS::get_singleton()->free(g.multimesh_instances[i].multimesh); + RS::get_singleton()->free(g.multimesh_instances[i].instance); + RS::get_singleton()->free(g.multimesh_instances[i].multimesh); } g.multimesh_instances.clear(); @@ -484,7 +484,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { // add the item's shape if (!shapes[i].shape.is_valid()) continue; - PhysicsServer::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform); + PhysicsServer3D::get_singleton()->body_add_shape(g.static_body, shapes[i].shape->get_rid(), xform * shapes[i].local_transform); if (g.collision_debug.is_valid()) { shapes.write[i].shape->add_vertices_to_array(col_debug, xform * shapes[i].local_transform); } @@ -497,10 +497,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) { nm.xform = xform * mesh_library->get_item_navmesh_transform(c.item); if (navigation) { - RID region = NavigationServer::get_singleton()->region_create(); - NavigationServer::get_singleton()->region_set_navmesh(region, navmesh); - NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform); - NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); + RID region = NavigationServer3D::get_singleton()->region_create(); + NavigationServer3D::get_singleton()->region_set_navmesh(region, navmesh); + NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * nm.xform); + NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid()); nm.region = region; } g.navmesh_ids[E->get()] = nm; @@ -513,13 +513,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) { for (Map<int, List<Pair<Transform, IndexKey>>>::Element *E = multimesh_items.front(); E; E = E->next()) { Octant::MultimeshInstance mmi; - RID mm = VS::get_singleton()->multimesh_create(); - VS::get_singleton()->multimesh_allocate(mm, E->get().size(), VS::MULTIMESH_TRANSFORM_3D); - VS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); + RID mm = RS::get_singleton()->multimesh_create(); + RS::get_singleton()->multimesh_allocate(mm, E->get().size(), RS::MULTIMESH_TRANSFORM_3D); + RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); int idx = 0; for (List<Pair<Transform, IndexKey>>::Element *F = E->get().front(); F; F = F->next()) { - VS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first); + RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first); #ifdef TOOLS_ENABLED Octant::MultimeshInstance::Item it; @@ -532,12 +532,12 @@ bool GridMap::_octant_update(const OctantKey &p_key) { idx++; } - RID instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->instance_set_base(instance, mm); + RID instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->instance_set_base(instance, mm); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(instance, get_global_transform()); } mmi.multimesh = mm; @@ -550,13 +550,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (col_debug.size()) { Array arr; - arr.resize(VS::ARRAY_MAX); - arr[VS::ARRAY_VERTEX] = col_debug; + arr.resize(RS::ARRAY_MAX); + arr[RS::ARRAY_VERTEX] = col_debug; - VS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, VS::PRIMITIVE_LINES, arr); + RS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, RS::PRIMITIVE_LINES, arr); SceneTree *st = SceneTree::get_singleton(); if (st) { - VS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid()); + RS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid()); } } @@ -567,8 +567,8 @@ bool GridMap::_octant_update(const OctantKey &p_key) { void GridMap::_reset_physic_bodies_collision_filters() { for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { - PhysicsServer::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer); - PhysicsServer::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask); + PhysicsServer3D::get_singleton()->body_set_collision_layer(E->get()->static_body, collision_layer); + PhysicsServer3D::get_singleton()->body_set_collision_mask(E->get()->static_body, collision_mask); } } @@ -576,17 +576,17 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_set_space(g.static_body, get_world()->get_space()); + PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_set_space(g.static_body, get_world()->get_space()); if (g.collision_debug_instance.is_valid()) { - VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(g.collision_debug_instance, get_global_transform()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(g.multimesh_instances[i].instance, get_global_transform()); } if (navigation && mesh_library.is_valid()) { @@ -595,10 +595,10 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { if (cell_map.has(F->key()) && F->get().region.is_valid() == false) { Ref<NavigationMesh> nm = mesh_library->get_item_navmesh(cell_map[F->key()].item); if (nm.is_valid()) { - RID region = NavigationServer::get_singleton()->region_create(); - NavigationServer::get_singleton()->region_set_navmesh(region, nm); - NavigationServer::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform); - NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); + RID region = NavigationServer3D::get_singleton()->region_create(); + NavigationServer3D::get_singleton()->region_set_navmesh(region, nm); + NavigationServer3D::get_singleton()->region_set_transform(region, navigation->get_global_transform() * F->get().xform); + NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid()); F->get().region = region; } } @@ -610,23 +610,23 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) { ERR_FAIL_COND(!octant_map.has(p_key)); Octant &g = *octant_map[p_key]; - PhysicsServer::get_singleton()->body_set_state(g.static_body, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform()); - PhysicsServer::get_singleton()->body_set_space(g.static_body, RID()); + PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + PhysicsServer3D::get_singleton()->body_set_space(g.static_body, RID()); if (g.collision_debug_instance.is_valid()) { - VS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID()); + RS::get_singleton()->instance_set_scenario(g.collision_debug_instance, RID()); } for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID()); + RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID()); } if (navigation) { for (Map<IndexKey, Octant::NavMesh>::Element *F = g.navmesh_ids.front(); F; F = F->next()) { if (F->get().region.is_valid()) { - NavigationServer::get_singleton()->free(F->get().region); + NavigationServer3D::get_singleton()->free(F->get().region); F->get().region = RID(); } } @@ -639,15 +639,15 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) { Octant &g = *octant_map[p_key]; if (g.collision_debug.is_valid()) - VS::get_singleton()->free(g.collision_debug); + RS::get_singleton()->free(g.collision_debug); if (g.collision_debug_instance.is_valid()) - VS::get_singleton()->free(g.collision_debug_instance); + RS::get_singleton()->free(g.collision_debug_instance); - PhysicsServer::get_singleton()->free(g.static_body); + PhysicsServer3D::get_singleton()->free(g.static_body); // Erase navigation for (Map<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) { - NavigationServer::get_singleton()->free(E->get().region); + NavigationServer3D::get_singleton()->free(E->get().region); } g.navmesh_ids.clear(); @@ -655,8 +655,8 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) { for (int i = 0; i < g.multimesh_instances.size(); i++) { - VS::get_singleton()->free(g.multimesh_instances[i].instance); - VS::get_singleton()->free(g.multimesh_instances[i].multimesh); + RS::get_singleton()->free(g.multimesh_instances[i].instance); + RS::get_singleton()->free(g.multimesh_instances[i].multimesh); } g.multimesh_instances.clear(); } @@ -684,8 +684,8 @@ void GridMap::_notification(int p_what) { } for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); } } break; @@ -702,7 +702,7 @@ void GridMap::_notification(int p_what) { last_transform = new_xform; for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); + RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); } } break; @@ -718,7 +718,7 @@ void GridMap::_notification(int p_what) { //_update_octants_callback(); //_update_area_instances(); for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID()); + RS::get_singleton()->instance_set_scenario(baked_meshes[i].instance, RID()); } } break; @@ -738,7 +738,7 @@ void GridMap::_update_visibility() { Octant *octant = e->value(); for (int i = 0; i < octant->multimesh_instances.size(); i++) { const Octant::MultimeshInstance &mi = octant->multimesh_instances[i]; - VS::get_singleton()->instance_set_visible(mi.instance, is_visible()); + RS::get_singleton()->instance_set_visible(mi.instance, is_visible()); } } } @@ -975,7 +975,7 @@ Vector3 GridMap::_get_offset() const { void GridMap::clear_baked_meshes() { for (int i = 0; i < baked_meshes.size(); i++) { - VS::get_singleton()->free(baked_meshes[i].instance); + RS::get_singleton()->free(baked_meshes[i].instance); } baked_meshes.clear(); @@ -1050,12 +1050,12 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe BakedMesh bm; bm.mesh = mesh; - bm.instance = VS::get_singleton()->instance_create(); - VS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); - VS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); + bm.instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->get_singleton()->instance_set_base(bm.instance, bm.mesh->get_rid()); + RS::get_singleton()->instance_attach_object_instance_id(bm.instance, get_instance_id()); if (is_inside_tree()) { - VS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); - VS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); + RS::get_singleton()->instance_set_scenario(bm.instance, get_world()->get_scenario()); + RS::get_singleton()->instance_set_transform(bm.instance, get_global_transform()); } if (p_gen_lightmap_uv) { diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 43f4c09715..3f3da09fe9 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -166,10 +166,10 @@ class GridMap : public Node3D { struct BakeLight { - VS::LightType type; + RS::LightType type; Vector3 pos; Vector3 dir; - float param[VS::LIGHT_PARAM_MAX]; + float param[RS::LIGHT_PARAM_MAX]; }; _FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const { diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index a2479e764f..4a6cb8762f 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -281,8 +281,8 @@ void GridMapEditor::_update_cursor_transform() { cursor_transform = node->get_global_transform() * cursor_transform; if (cursor_instance.is_valid()) { - VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); - VisualServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible); + RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); + RenderingServer::get_singleton()->instance_set_visible(cursor_instance, cursor_visible); } } @@ -292,9 +292,9 @@ void GridMapEditor::_update_selection_transform() { if (!selection.active) { - VisualServer::get_singleton()->instance_set_transform(selection_instance, xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_instance, xf_zero); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); } return; } @@ -303,11 +303,11 @@ void GridMapEditor::_update_selection_transform() { xf.scale((Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size()); xf.origin = selection.begin * node->get_cell_size(); - VisualServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(selection_instance, node->get_global_transform() * xf); for (int i = 0; i < 3; i++) { if (i != edit_axis || (edit_floor[edit_axis] < selection.begin[edit_axis]) || (edit_floor[edit_axis] > selection.end[edit_axis] + 1)) { - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf_zero); } else { Vector3 scale = (selection.end - selection.begin + Vector3(1, 1, 1)); @@ -322,7 +322,7 @@ void GridMapEditor::_update_selection_transform() { xf2.basis.scale(scale); xf2.origin = pos; - VisualServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2); + RenderingServer::get_singleton()->instance_set_transform(selection_level_instance[i], xf2); } } } @@ -416,7 +416,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b } } - VS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform); + RS::get_singleton()->instance_set_transform(grid_instance[edit_axis], node->get_global_transform() * edit_grid_xform); if (cursor_instance.is_valid()) { @@ -528,7 +528,7 @@ void GridMapEditor::_clear_clipboard_data() { for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) { - VisualServer::get_singleton()->free(E->get().instance); + RenderingServer::get_singleton()->free(E->get().instance); } clipboard_items.clear(); @@ -556,7 +556,7 @@ void GridMapEditor::_set_clipboard_data() { item.cell_item = itm; item.grid_offset = Vector3(i, j, k) - selection.begin; item.orientation = node->get_cell_item_orientation(i, j, k); - item.instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); + item.instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); clipboard_items.push_back(item); } @@ -570,7 +570,7 @@ void GridMapEditor::_update_paste_indicator() { Transform xf; xf.basis.set_zero(); - VisualServer::get_singleton()->instance_set_transform(paste_instance, xf); + RenderingServer::get_singleton()->instance_set_transform(paste_instance, xf); return; } @@ -584,7 +584,7 @@ void GridMapEditor::_update_paste_indicator() { xf.basis = rot * xf.basis; xf.translate((-center * node->get_cell_size()) / scale); - VisualServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf); for (List<ClipboardItem>::Element *E = clipboard_items.front(); E; E = E->next()) { @@ -599,7 +599,7 @@ void GridMapEditor::_update_paste_indicator() { item_rot.set_orthogonal_index(item.orientation); xf.basis = item_rot * xf.basis * node->get_cell_scale(); - VisualServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf); + RenderingServer::get_singleton()->instance_set_transform(item.instance, node->get_global_transform() * xf); } } @@ -969,11 +969,11 @@ void GridMapEditor::edit(GridMap *p_gridmap) { if (!node) { set_process(false); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_visible(grid_instance[i], false); + RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], false); } if (cursor_instance.is_valid()) { - VisualServer::get_singleton()->instance_set_visible(cursor_instance, false); + RenderingServer::get_singleton()->instance_set_visible(cursor_instance, false); } return; @@ -1011,7 +1011,7 @@ void GridMapEditor::update_grid() { edit_grid_xform.basis = Basis(); for (int i = 0; i < 3; i++) { - VisualServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis); + RenderingServer::get_singleton()->instance_set_visible(grid_instance[i], i == edit_axis); } updating = true; @@ -1023,7 +1023,7 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) { Vector3 edited_floor = node->has_meta("_editor_floor_") ? node->get_meta("_editor_floor_") : Variant(); for (int i = 0; i < 3; i++) { - VS::get_singleton()->mesh_clear(grid[i]); + RS::get_singleton()->mesh_clear(grid[i]); edit_floor[i] = edited_floor[i]; } @@ -1065,11 +1065,11 @@ void GridMapEditor::_draw_grids(const Vector3 &cell_size) { } Array d; - d.resize(VS::ARRAY_MAX); - d[VS::ARRAY_VERTEX] = grid_points[i]; - d[VS::ARRAY_COLOR] = grid_colors[i]; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], VisualServer::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid()); + d.resize(RS::ARRAY_MAX); + d[RS::ARRAY_VERTEX] = grid_points[i]; + d[RS::ARRAY_COLOR] = grid_colors[i]; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(grid[i], RenderingServer::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(grid[i], 0, indicator_mat->get_rid()); } } @@ -1082,13 +1082,13 @@ void GridMapEditor::_notification(int p_what) { mesh_library_palette->connect("item_selected", callable_mp(this, &GridMapEditor::_item_selected_cbk)); for (int i = 0; i < 3; i++) { - grid[i] = VS::get_singleton()->mesh_create(); - grid_instance[i] = VS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); - selection_level_instance[i] = VisualServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); + grid[i] = RS::get_singleton()->mesh_create(); + grid_instance[i] = RS::get_singleton()->instance_create2(grid[i], get_tree()->get_root()->get_world()->get_scenario()); + selection_level_instance[i] = RenderingServer::get_singleton()->instance_create2(selection_level_mesh[i], get_tree()->get_root()->get_world()->get_scenario()); } - selection_instance = VisualServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); - paste_instance = VisualServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario()); + selection_instance = RenderingServer::get_singleton()->instance_create2(selection_mesh, get_tree()->get_root()->get_world()->get_scenario()); + paste_instance = RenderingServer::get_singleton()->instance_create2(paste_mesh, get_tree()->get_root()->get_world()->get_scenario()); _update_selection_transform(); _update_paste_indicator(); @@ -1100,15 +1100,15 @@ void GridMapEditor::_notification(int p_what) { for (int i = 0; i < 3; i++) { - VS::get_singleton()->free(grid_instance[i]); - VS::get_singleton()->free(grid[i]); + RS::get_singleton()->free(grid_instance[i]); + RS::get_singleton()->free(grid[i]); grid_instance[i] = RID(); grid[i] = RID(); - VisualServer::get_singleton()->free(selection_level_instance[i]); + RenderingServer::get_singleton()->free(selection_level_instance[i]); } - VisualServer::get_singleton()->free(selection_instance); - VisualServer::get_singleton()->free(paste_instance); + RenderingServer::get_singleton()->free(selection_instance); + RenderingServer::get_singleton()->free(paste_instance); selection_instance = RID(); paste_instance = RID(); } break; @@ -1123,7 +1123,7 @@ void GridMapEditor::_notification(int p_what) { if (xf != grid_xform) { for (int i = 0; i < 3; i++) { - VS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); + RS::get_singleton()->instance_set_transform(grid_instance[i], xf * edit_grid_xform); } grid_xform = xf; } @@ -1159,7 +1159,7 @@ void GridMapEditor::_update_cursor_instance() { } if (cursor_instance.is_valid()) - VisualServer::get_singleton()->free(cursor_instance); + RenderingServer::get_singleton()->free(cursor_instance); cursor_instance = RID(); if (selected_palette >= 0) { @@ -1168,8 +1168,8 @@ void GridMapEditor::_update_cursor_instance() { Ref<Mesh> mesh = node->get_mesh_library()->get_item_mesh(selected_palette); if (!mesh.is_null() && mesh->get_rid().is_valid()) { - cursor_instance = VisualServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); - VisualServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); + cursor_instance = RenderingServer::get_singleton()->instance_create2(mesh->get_rid(), get_tree()->get_root()->get_world()->get_scenario()); + RenderingServer::get_singleton()->instance_set_transform(cursor_instance, cursor_transform); } } } @@ -1353,8 +1353,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { lock_view = false; cursor_rot = 0; - selection_mesh = VisualServer::get_singleton()->mesh_create(); - paste_mesh = VisualServer::get_singleton()->mesh_create(); + selection_mesh = RenderingServer::get_singleton()->mesh_create(); + paste_mesh = RenderingServer::get_singleton()->mesh_create(); { // Selection mesh create. @@ -1431,16 +1431,16 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { } Array d; - d.resize(VS::ARRAY_MAX); + d.resize(RS::ARRAY_MAX); inner_mat.instance(); inner_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.2)); inner_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); inner_mat->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA); - d[VS::ARRAY_VERTEX] = triangles; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_TRIANGLES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid()); + d[RS::ARRAY_VERTEX] = triangles; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_TRIANGLES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 0, inner_mat->get_rid()); outer_mat.instance(); outer_mat->set_albedo(Color(0.7, 0.7, 1.0, 0.8)); @@ -1454,23 +1454,23 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { selection_floor_mat->set_on_top_of_alpha(); selection_floor_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED); - d[VS::ARRAY_VERTEX] = lines; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid()); + d[RS::ARRAY_VERTEX] = lines; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_mesh, RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_mesh, 1, outer_mat->get_rid()); - d[VS::ARRAY_VERTEX] = triangles; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_TRIANGLES, d); - VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid()); + d[RS::ARRAY_VERTEX] = triangles; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_TRIANGLES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 0, inner_mat->get_rid()); - d[VS::ARRAY_VERTEX] = lines; - VisualServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid()); + d[RS::ARRAY_VERTEX] = lines; + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(paste_mesh, RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(paste_mesh, 1, outer_mat->get_rid()); for (int i = 0; i < 3; i++) { - d[VS::ARRAY_VERTEX] = square[i]; - selection_level_mesh[i] = VS::get_singleton()->mesh_create(); - VisualServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], VS::PRIMITIVE_LINES, d); - VisualServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid()); + d[RS::ARRAY_VERTEX] = square[i]; + selection_level_mesh[i] = RS::get_singleton()->mesh_create(); + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(selection_level_mesh[i], RS::PRIMITIVE_LINES, d); + RenderingServer::get_singleton()->mesh_surface_set_material(selection_level_mesh[i], 0, selection_floor_mat->get_rid()); } } @@ -1493,24 +1493,24 @@ GridMapEditor::~GridMapEditor() { for (int i = 0; i < 3; i++) { if (grid[i].is_valid()) - VisualServer::get_singleton()->free(grid[i]); + RenderingServer::get_singleton()->free(grid[i]); if (grid_instance[i].is_valid()) - VisualServer::get_singleton()->free(grid_instance[i]); + RenderingServer::get_singleton()->free(grid_instance[i]); if (cursor_instance.is_valid()) - VisualServer::get_singleton()->free(cursor_instance); + RenderingServer::get_singleton()->free(cursor_instance); if (selection_level_instance[i].is_valid()) - VisualServer::get_singleton()->free(selection_level_instance[i]); + RenderingServer::get_singleton()->free(selection_level_instance[i]); if (selection_level_mesh[i].is_valid()) - VisualServer::get_singleton()->free(selection_level_mesh[i]); + RenderingServer::get_singleton()->free(selection_level_mesh[i]); } - VisualServer::get_singleton()->free(selection_mesh); + RenderingServer::get_singleton()->free(selection_mesh); if (selection_instance.is_valid()) - VisualServer::get_singleton()->free(selection_instance); + RenderingServer::get_singleton()->free(selection_instance); - VisualServer::get_singleton()->free(paste_mesh); + RenderingServer::get_singleton()->free(paste_mesh); if (paste_instance.is_valid()) - VisualServer::get_singleton()->free(paste_instance); + RenderingServer::get_singleton()->free(paste_instance); } void GridMapEditorPlugin::_notification(int p_what) { diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 1b253d3699..c82a521a43 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -32,7 +32,7 @@ #include "core/input/input_filter.h" #include "core/os/os.h" #include "servers/display_server.h" -#include "servers/visual/visual_server_globals.h" +#include "servers/rendering/rendering_server_globals.h" StringName MobileVRInterface::get_name() const { return "Native mobile"; diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 8e5b04f995..1a08ec416f 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -50,7 +50,7 @@ NoiseTexture::NoiseTexture() { NoiseTexture::~NoiseTexture() { if (texture.is_valid()) { - VS::get_singleton()->free(texture); + RS::get_singleton()->free(texture); } if (noise_thread) { Thread::wait_to_finish(noise_thread); @@ -100,10 +100,10 @@ void NoiseTexture::_set_texture_data(const Ref<Image> &p_image) { data = p_image; if (data.is_valid()) { if (texture.is_valid()) { - RID new_texture = VS::get_singleton()->texture_2d_create(p_image); - VS::get_singleton()->texture_replace(texture, new_texture); + RID new_texture = RS::get_singleton()->texture_2d_create(p_image); + RS::get_singleton()->texture_replace(texture, new_texture); } else { - texture = VS::get_singleton()->texture_2d_create(p_image); + texture = RS::get_singleton()->texture_2d_create(p_image); } } emit_changed(); @@ -254,7 +254,7 @@ int NoiseTexture::get_height() const { RID NoiseTexture::get_rid() const { if (!texture.is_valid()) { - texture = VS::get_singleton()->texture_2d_placeholder_create(); + texture = RS::get_singleton()->texture_2d_placeholder_create(); } return texture; |