You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-29 16:16:38 +00:00
Renaming of servers for coherency.
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user