summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/SCsub4
-rw-r--r--scene/3d/area_3d.cpp40
-rw-r--r--scene/3d/arvr_nodes.cpp34
-rw-r--r--scene/3d/audio_stream_player_3d.cpp9
-rw-r--r--scene/3d/audio_stream_player_3d.h2
-rw-r--r--scene/3d/baked_lightmap.cpp36
-rw-r--r--scene/3d/camera_3d.cpp57
-rw-r--r--scene/3d/collision_object_3d.cpp48
-rw-r--r--scene/3d/collision_object_3d.h2
-rw-r--r--scene/3d/collision_polygon_3d.cpp8
-rw-r--r--scene/3d/collision_shape_3d.cpp28
-rw-r--r--scene/3d/cpu_particles_3d.cpp40
-rw-r--r--scene/3d/gi_probe.cpp53
-rw-r--r--scene/3d/gi_probe.h2
-rw-r--r--scene/3d/gpu_particles_3d.cpp64
-rw-r--r--scene/3d/immediate_geometry_3d.cpp22
-rw-r--r--scene/3d/immediate_geometry_3d.h2
-rw-r--r--scene/3d/light_3d.cpp60
-rw-r--r--scene/3d/light_3d.h48
-rw-r--r--scene/3d/listener_3d.cpp2
-rw-r--r--scene/3d/mesh_instance_3d.cpp36
-rw-r--r--scene/3d/mesh_instance_3d.h1
-rw-r--r--scene/3d/navigation_3d.cpp26
-rw-r--r--scene/3d/navigation_agent_3d.cpp60
-rw-r--r--scene/3d/navigation_obstacle_3d.cpp40
-rw-r--r--scene/3d/navigation_region_3d.cpp39
-rw-r--r--scene/3d/node_3d.cpp20
-rw-r--r--scene/3d/path_3d.cpp8
-rw-r--r--scene/3d/physics_body_3d.cpp424
-rw-r--r--scene/3d/physics_body_3d.h20
-rw-r--r--scene/3d/physics_joint_3d.cpp70
-rw-r--r--scene/3d/physics_joint_3d.h138
-rw-r--r--scene/3d/ray_cast_3d.cpp12
-rw-r--r--scene/3d/reflection_probe.cpp34
-rw-r--r--scene/3d/reflection_probe.h2
-rw-r--r--scene/3d/skeleton_3d.cpp22
-rw-r--r--scene/3d/skeleton_3d.h4
-rw-r--r--scene/3d/skeleton_ik_3d.cpp26
-rw-r--r--scene/3d/skeleton_ik_3d.h10
-rw-r--r--scene/3d/soft_body_3d.cpp159
-rw-r--r--scene/3d/soft_body_3d.h6
-rw-r--r--scene/3d/spring_arm_3d.cpp4
-rw-r--r--scene/3d/sprite_3d.cpp52
-rw-r--r--scene/3d/vehicle_body_3d.cpp38
-rw-r--r--scene/3d/vehicle_body_3d.h18
-rw-r--r--scene/3d/visual_instance_3d.cpp46
-rw-r--r--scene/3d/visual_instance_3d.h16
47 files changed, 950 insertions, 942 deletions
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 45b96bd9c4..ce69e8aa19 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if env['disable_3d']:
+if env["disable_3d"]:
env.add_source_files(env.scene_sources, "node_3d.cpp")
env.add_source_files(env.scene_sources, "skeleton_3d.cpp")
else:
diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp
index beeaf7125a..17ae553e5e 100644
--- a/scene/3d/area_3d.cpp
+++ b/scene/3d/area_3d.cpp
@@ -32,12 +32,12 @@
#include "scene/scene_string_names.h"
#include "servers/audio_server.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
void Area3D::set_space_override_mode(SpaceOverride p_mode) {
space_override = p_mode;
- PhysicsServer::get_singleton()->area_set_space_override_mode(get_rid(), PhysicsServer::AreaSpaceOverrideMode(p_mode));
+ PhysicsServer3D::get_singleton()->area_set_space_override_mode(get_rid(), PhysicsServer3D::AreaSpaceOverrideMode(p_mode));
}
Area3D::SpaceOverride Area3D::get_space_override_mode() const {
@@ -47,7 +47,7 @@ Area3D::SpaceOverride Area3D::get_space_override_mode() const {
void Area3D::set_gravity_is_point(bool p_enabled) {
gravity_is_point = p_enabled;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT, p_enabled);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT, p_enabled);
}
bool Area3D::is_gravity_a_point() const {
@@ -57,7 +57,7 @@ bool Area3D::is_gravity_a_point() const {
void Area3D::set_gravity_distance_scale(real_t p_scale) {
gravity_distance_scale = p_scale;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale);
}
real_t Area3D::get_gravity_distance_scale() const {
@@ -67,7 +67,7 @@ real_t Area3D::get_gravity_distance_scale() const {
void Area3D::set_gravity_vector(const Vector3 &p_vec) {
gravity_vec = p_vec;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_GRAVITY_VECTOR, p_vec);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR, p_vec);
}
Vector3 Area3D::get_gravity_vector() const {
@@ -77,7 +77,7 @@ Vector3 Area3D::get_gravity_vector() const {
void Area3D::set_gravity(real_t p_gravity) {
gravity = p_gravity;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_GRAVITY, p_gravity);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_GRAVITY, p_gravity);
}
real_t Area3D::get_gravity() const {
@@ -86,7 +86,7 @@ real_t Area3D::get_gravity() const {
void Area3D::set_linear_damp(real_t p_linear_damp) {
linear_damp = p_linear_damp;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_LINEAR_DAMP, p_linear_damp);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_LINEAR_DAMP, p_linear_damp);
}
real_t Area3D::get_linear_damp() const {
@@ -96,7 +96,7 @@ real_t Area3D::get_linear_damp() const {
void Area3D::set_angular_damp(real_t p_angular_damp) {
angular_damp = p_angular_damp;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_ANGULAR_DAMP, p_angular_damp);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP, p_angular_damp);
}
real_t Area3D::get_angular_damp() const {
@@ -107,7 +107,7 @@ real_t Area3D::get_angular_damp() const {
void Area3D::set_priority(real_t p_priority) {
priority = p_priority;
- PhysicsServer::get_singleton()->area_set_param(get_rid(), PhysicsServer::AREA_PARAM_PRIORITY, p_priority);
+ PhysicsServer3D::get_singleton()->area_set_param(get_rid(), PhysicsServer3D::AREA_PARAM_PRIORITY, p_priority);
}
real_t Area3D::get_priority() const {
@@ -150,7 +150,7 @@ void Area3D::_body_exit_tree(ObjectID p_id) {
void Area3D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape) {
- bool body_in = p_status == PhysicsServer::AREA_BODY_ADDED;
+ bool body_in = p_status == PhysicsServer3D::AREA_BODY_ADDED;
ObjectID objid = p_instance;
Object *obj = ObjectDB::get_instance(objid);
@@ -298,11 +298,11 @@ void Area3D::set_monitoring(bool p_enable) {
if (monitoring) {
- PhysicsServer::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout);
- PhysicsServer::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout);
+ PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout);
+ PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout);
} else {
- PhysicsServer::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName());
- PhysicsServer::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName());
+ PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), nullptr, StringName());
+ PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), nullptr, StringName());
_clear_monitoring();
}
}
@@ -343,7 +343,7 @@ void Area3D::_area_exit_tree(ObjectID p_id) {
void Area3D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape) {
- bool area_in = p_status == PhysicsServer::AREA_BODY_ADDED;
+ bool area_in = p_status == PhysicsServer3D::AREA_BODY_ADDED;
ObjectID objid = p_instance;
Object *obj = ObjectDB::get_instance(objid);
@@ -436,14 +436,14 @@ Array Area3D::get_overlapping_bodies() const {
void Area3D::set_monitorable(bool p_enable) {
- ERR_FAIL_COND_MSG(locked || (is_inside_tree() && PhysicsServer::get_singleton()->is_flushing_queries()), "Function blocked during in/out signal. Use set_deferred(\"monitorable\", true/false).");
+ ERR_FAIL_COND_MSG(locked || (is_inside_tree() && PhysicsServer3D::get_singleton()->is_flushing_queries()), "Function blocked during in/out signal. Use set_deferred(\"monitorable\", true/false).");
if (p_enable == monitorable)
return;
monitorable = p_enable;
- PhysicsServer::get_singleton()->area_set_monitorable(get_rid(), monitorable);
+ PhysicsServer3D::get_singleton()->area_set_monitorable(get_rid(), monitorable);
}
bool Area3D::is_monitorable() const {
@@ -489,7 +489,7 @@ bool Area3D::overlaps_body(Node *p_body) const {
void Area3D::set_collision_mask(uint32_t p_mask) {
collision_mask = p_mask;
- PhysicsServer::get_singleton()->area_set_collision_mask(get_rid(), p_mask);
+ PhysicsServer3D::get_singleton()->area_set_collision_mask(get_rid(), p_mask);
}
uint32_t Area3D::get_collision_mask() const {
@@ -499,7 +499,7 @@ uint32_t Area3D::get_collision_mask() const {
void Area3D::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
- PhysicsServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer);
+ PhysicsServer3D::get_singleton()->area_set_collision_layer(get_rid(), p_layer);
}
uint32_t Area3D::get_collision_layer() const {
@@ -728,7 +728,7 @@ void Area3D::_bind_methods() {
}
Area3D::Area3D() :
- CollisionObject3D(PhysicsServer::get_singleton()->area_create(), true) {
+ CollisionObject3D(PhysicsServer3D::get_singleton()->area_create(), true) {
space_override = SPACE_OVERRIDE_DISABLED;
set_gravity(9.8);
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index ce7c885a40..537c094ceb 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -40,14 +40,14 @@ void ARVRCamera::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
// need to find our ARVROrigin parent and let it know we're its camera!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin != NULL) {
+ if (origin != nullptr) {
origin->set_tracked_camera(this);
}
}; break;
case NOTIFICATION_EXIT_TREE: {
// need to find our ARVROrigin parent and let it know we're no longer its camera!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin != NULL) {
+ if (origin != nullptr) {
origin->clear_tracked_camera_if(this);
}
}; break;
@@ -60,7 +60,7 @@ String ARVRCamera::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRCamera must have an ARVROrigin node as its parent.");
};
@@ -192,7 +192,7 @@ void ARVRController::_notification(int p_what) {
// find the tracker for our controller
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// this controller is currently turned off
is_active = false;
button_states = 0;
@@ -279,7 +279,7 @@ String ARVRController::get_controller_name(void) const {
ERR_FAIL_NULL_V(arvr_server, String());
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return String("Not connected");
};
@@ -292,7 +292,7 @@ int ARVRController::get_joystick_id() const {
ERR_FAIL_NULL_V(arvr_server, 0);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// No tracker? no joystick id... (0 is our first joystick)
return -1;
};
@@ -324,7 +324,7 @@ real_t ARVRController::get_rumble() const {
ERR_FAIL_NULL_V(arvr_server, 0.0);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return 0.0;
};
@@ -337,7 +337,7 @@ void ARVRController::set_rumble(real_t p_rumble) {
ERR_FAIL_NULL(arvr_server);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
tracker->set_rumble(p_rumble);
};
};
@@ -356,7 +356,7 @@ ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const {
ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN;
};
@@ -369,7 +369,7 @@ String ARVRController::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRController must have an ARVROrigin node as its parent.");
};
@@ -407,7 +407,7 @@ void ARVRAnchor::_notification(int p_what) {
// find the tracker for our anchor
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// this anchor is currently not available
is_active = false;
} else {
@@ -479,7 +479,7 @@ String ARVRAnchor::get_anchor_name(void) const {
ERR_FAIL_NULL_V(arvr_server, String());
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return String("Not connected");
};
@@ -496,7 +496,7 @@ String ARVRAnchor::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRAnchor must have an ARVROrigin node as its parent.");
};
@@ -535,7 +535,7 @@ String ARVROrigin::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
- if (tracked_camera == NULL)
+ if (tracked_camera == nullptr)
return TTR("ARVROrigin requires an ARVRCamera child node.");
return String();
@@ -553,7 +553,7 @@ void ARVROrigin::set_tracked_camera(ARVRCamera *p_tracked_camera) {
void ARVROrigin::clear_tracked_camera_if(ARVRCamera *p_tracked_camera) {
if (tracked_camera == p_tracked_camera) {
- tracked_camera = NULL;
+ tracked_camera = nullptr;
};
};
@@ -591,7 +591,7 @@ void ARVROrigin::_notification(int p_what) {
// check if we have a primary interface
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_valid() && tracked_camera != NULL) {
+ if (arvr_interface.is_valid() && tracked_camera != nullptr) {
// get our positioning transform for our headset
Transform t = arvr_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, Transform());
@@ -613,7 +613,7 @@ void ARVROrigin::_notification(int p_what) {
};
ARVROrigin::ARVROrigin() {
- tracked_camera = NULL;
+ tracked_camera = nullptr;
};
ARVROrigin::~ARVROrigin(){
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 807515219f..097368853e 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "audio_stream_player_3d.h"
+
#include "core/engine.h"
#include "scene/3d/area_3d.h"
#include "scene/3d/camera_3d.h"
@@ -96,7 +97,7 @@ static const Vector3 speaker_directions[7] = {
};
void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tightness, AudioStreamPlayer3D::Output &output) {
- unsigned int speaker_count; // only main speakers (no LFE)
+ unsigned int speaker_count = 0; // only main speakers (no LFE)
switch (AudioServer::get_singleton()->get_speaker_mode()) {
case AudioServer::SPEAKER_MODE_STEREO:
speaker_count = 2;
@@ -395,12 +396,12 @@ void AudioStreamPlayer3D::_notification(int p_what) {
//check if any area is diverting sound into a bus
- PhysicsDirectSpaceState *space_state = PhysicsServer::get_singleton()->space_get_direct_state(world->get_space());
+ PhysicsDirectSpaceState3D *space_state = PhysicsServer3D::get_singleton()->space_get_direct_state(world->get_space());
- PhysicsDirectSpaceState::ShapeResult sr[MAX_INTERSECT_AREAS];
+ PhysicsDirectSpaceState3D::ShapeResult sr[MAX_INTERSECT_AREAS];
int areas = space_state->intersect_point(global_pos, sr, MAX_INTERSECT_AREAS, Set<RID>(), area_mask, false, true);
- Area3D *area = NULL;
+ Area3D *area = nullptr;
for (int i = 0; i < areas; i++) {
if (!sr[i].collider)
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 1cce0c77d5..13e08339e2 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -82,7 +82,7 @@ private:
Output() {
filter_gain = 0;
- viewport = NULL;
+ viewport = nullptr;
reverb_bus_index = -1;
bus_index = -1;
}
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 73b1d450f0..6bde56104e 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -39,7 +39,7 @@
void BakedLightmapData::set_bounds(const AABB &p_bounds) {
bounds = p_bounds;
- VS::get_singleton()->lightmap_capture_set_bounds(baked_light, p_bounds);
+ RS::get_singleton()->lightmap_capture_set_bounds(baked_light, p_bounds);
}
AABB BakedLightmapData::get_bounds() const {
@@ -49,18 +49,18 @@ AABB BakedLightmapData::get_bounds() const {
void BakedLightmapData::set_octree(const Vector<uint8_t> &p_octree) {
- VS::get_singleton()->lightmap_capture_set_octree(baked_light, p_octree);
+ RS::get_singleton()->lightmap_capture_set_octree(baked_light, p_octree);
}
Vector<uint8_t> BakedLightmapData::get_octree() const {
- return VS::get_singleton()->lightmap_capture_get_octree(baked_light);
+ return RS::get_singleton()->lightmap_capture_get_octree(baked_light);
}
void BakedLightmapData::set_cell_space_transform(const Transform &p_xform) {
cell_space_xform = p_xform;
- VS::get_singleton()->lightmap_capture_set_octree_cell_transform(baked_light, p_xform);
+ RS::get_singleton()->lightmap_capture_set_octree_cell_transform(baked_light, p_xform);
}
Transform BakedLightmapData::get_cell_space_transform() const {
@@ -69,7 +69,7 @@ Transform BakedLightmapData::get_cell_space_transform() const {
void BakedLightmapData::set_cell_subdiv(int p_cell_subdiv) {
cell_subdiv = p_cell_subdiv;
- VS::get_singleton()->lightmap_capture_set_octree_cell_subdiv(baked_light, p_cell_subdiv);
+ RS::get_singleton()->lightmap_capture_set_octree_cell_subdiv(baked_light, p_cell_subdiv);
}
int BakedLightmapData::get_cell_subdiv() const {
@@ -79,7 +79,7 @@ int BakedLightmapData::get_cell_subdiv() const {
void BakedLightmapData::set_energy(float p_energy) {
energy = p_energy;
- VS::get_singleton()->lightmap_capture_set_energy(baked_light, energy);
+ RS::get_singleton()->lightmap_capture_set_energy(baked_light, energy);
}
float BakedLightmapData::get_energy() const {
@@ -181,21 +181,21 @@ void BakedLightmapData::_bind_methods() {
BakedLightmapData::BakedLightmapData() {
- baked_light = VS::get_singleton()->lightmap_capture_create();
+ baked_light = RS::get_singleton()->lightmap_capture_create();
energy = 1;
cell_subdiv = 1;
}
BakedLightmapData::~BakedLightmapData() {
- VS::get_singleton()->free(baked_light);
+ RS::get_singleton()->free(baked_light);
}
///////////////////////////
-BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = NULL;
-BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = NULL;
-BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = NULL;
+BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = nullptr;
+BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = nullptr;
+BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = nullptr;
void BakedLightmap::set_bake_cell_size(float p_cell_size) {
bake_cell_size = p_cell_size;
@@ -425,13 +425,13 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi
pmc++;
PlotLight pl = E->get();
switch (pl.light->get_light_type()) {
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
baker.plot_light_directional(-pl.local_xform.basis.get_axis(2), pl.light->get_color(), pl.light->get_param(Light::PARAM_ENERGY), pl.light->get_param(Light::PARAM_INDIRECT_ENERGY), pl.light->get_bake_mode() == Light::BAKE_ALL);
} break;
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
baker.plot_light_omni(pl.local_xform.origin, pl.light->get_color(), pl.light->get_param(Light::PARAM_ENERGY), pl.light->get_param(Light::PARAM_INDIRECT_ENERGY), pl.light->get_param(Light::PARAM_RANGE), pl.light->get_param(Light::PARAM_ATTENUATION), pl.light->get_bake_mode() == Light::BAKE_ALL);
} break;
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
baker.plot_light_spot(pl.local_xform.origin, pl.local_xform.basis.get_axis(2), pl.light->get_color(), pl.light->get_param(Light::PARAM_ENERGY), pl.light->get_param(Light::PARAM_INDIRECT_ENERGY), pl.light->get_param(Light::PARAM_RANGE), pl.light->get_param(Light::PARAM_ATTENUATION), pl.light->get_param(Light::PARAM_SPOT_ANGLE), pl.light->get_param(Light::PARAM_SPOT_ATTENUATION), pl.light->get_bake_mode() == Light::BAKE_ALL);
} break;
@@ -675,12 +675,12 @@ void BakedLightmap::_assign_lightmaps() {
if (instance_idx >= 0) {
RID instance = node->call("get_bake_mesh_instance", instance_idx);
if (instance.is_valid()) {
- VS::get_singleton()->instance_set_use_lightmap(instance, get_instance(), lightmap->get_rid());
+ RS::get_singleton()->instance_set_use_lightmap(instance, get_instance(), lightmap->get_rid());
}
} else {
VisualInstance *vi = Object::cast_to<VisualInstance>(node);
ERR_CONTINUE(!vi);
- VS::get_singleton()->instance_set_use_lightmap(vi->get_instance(), get_instance(), lightmap->get_rid());
+ RS::get_singleton()->instance_set_use_lightmap(vi->get_instance(), get_instance(), lightmap->get_rid());
}
}
}
@@ -693,12 +693,12 @@ void BakedLightmap::_clear_lightmaps() {
if (instance_idx >= 0) {
RID instance = node->call("get_bake_mesh_instance", instance_idx);
if (instance.is_valid()) {
- VS::get_singleton()->instance_set_use_lightmap(instance, get_instance(), RID());
+ RS::get_singleton()->instance_set_use_lightmap(instance, get_instance(), RID());
}
} else {
VisualInstance *vi = Object::cast_to<VisualInstance>(node);
ERR_CONTINUE(!vi);
- VS::get_singleton()->instance_set_use_lightmap(vi->get_instance(), get_instance(), RID());
+ RS::get_singleton()->instance_set_use_lightmap(vi->get_instance(), get_instance(), RID());
}
}
}
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 60cccbeedd..706c49b43b 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -82,7 +82,7 @@ void Camera3D::_update_camera() {
if (!is_inside_tree())
return;
- VisualServer::get_singleton()->camera_set_transform(camera, get_camera_transform());
+ RenderingServer::get_singleton()->camera_set_transform(camera, get_camera_transform());
// here goes listener stuff
/*
@@ -138,7 +138,7 @@ void Camera3D::_notification(int p_what) {
if (viewport) {
viewport->_camera_remove(this);
- viewport = NULL;
+ viewport = nullptr;
}
} break;
@@ -173,7 +173,7 @@ void Camera3D::set_perspective(float p_fovy_degrees, float p_z_near, float p_z_f
far = p_z_far;
mode = PROJECTION_PERSPECTIVE;
- VisualServer::get_singleton()->camera_set_perspective(camera, fov, near, far);
+ RenderingServer::get_singleton()->camera_set_perspective(camera, fov, near, far);
update_gizmo();
force_change = false;
}
@@ -189,7 +189,7 @@ void Camera3D::set_orthogonal(float p_size, float p_z_near, float p_z_far) {
mode = PROJECTION_ORTHOGONAL;
force_change = false;
- VisualServer::get_singleton()->camera_set_orthogonal(camera, size, near, far);
+ RenderingServer::get_singleton()->camera_set_orthogonal(camera, size, near, far);
update_gizmo();
}
@@ -205,7 +205,7 @@ void Camera3D::set_frustum(float p_size, Vector2 p_offset, float p_z_near, float
mode = PROJECTION_FRUSTUM;
force_change = false;
- VisualServer::get_singleton()->camera_set_frustum(camera, size, frustum_offset, near, far);
+ RenderingServer::get_singleton()->camera_set_frustum(camera, size, frustum_offset, near, far);
update_gizmo();
}
@@ -241,7 +241,7 @@ void Camera3D::clear_current(bool p_enable_next) {
return;
if (get_viewport()->get_camera() == this) {
- get_viewport()->_camera_set(NULL);
+ get_viewport()->_camera_set(nullptr);
if (p_enable_next) {
get_viewport()->_camera_make_next_current(this);
@@ -413,30 +413,13 @@ Vector3 Camera3D::project_position(const Point2 &p_point, float p_z_depth) const
return get_camera_transform().xform(p);
}
-/*
-void Camera::_camera_make_current(Node *p_camera) {
-
-
- if (p_camera==this) {
- VisualServer::get_singleton()->viewport_attach_camera(viewport_id,camera);
- active=true;
- } else {
- if (active && p_camera==NULL) {
- //detech camera because no one else will claim it
- VisualServer::get_singleton()->viewport_attach_camera(viewport_id,RID());
- }
- active=false;
- }
-}
-*/
-
void Camera3D::set_environment(const Ref<Environment> &p_environment) {
environment = p_environment;
if (environment.is_valid())
- VS::get_singleton()->camera_set_environment(camera, environment->get_rid());
+ RS::get_singleton()->camera_set_environment(camera, environment->get_rid());
else
- VS::get_singleton()->camera_set_environment(camera, RID());
+ RS::get_singleton()->camera_set_environment(camera, RID());
_update_camera_mode();
}
@@ -449,9 +432,9 @@ void Camera3D::set_effects(const Ref<CameraEffects> &p_effects) {
effects = p_effects;
if (effects.is_valid())
- VS::get_singleton()->camera_set_camera_effects(camera, effects->get_rid());
+ RS::get_singleton()->camera_set_camera_effects(camera, effects->get_rid());
else
- VS::get_singleton()->camera_set_camera_effects(camera, RID());
+ RS::get_singleton()->camera_set_camera_effects(camera, RID());
_update_camera_mode();
}
@@ -462,7 +445,7 @@ Ref<CameraEffects> Camera3D::get_effects() const {
void Camera3D::set_keep_aspect_mode(KeepAspect p_aspect) {
keep_aspect = p_aspect;
- VisualServer::get_singleton()->camera_set_use_vertical_aspect(camera, p_aspect == KEEP_WIDTH);
+ RenderingServer::get_singleton()->camera_set_use_vertical_aspect(camera, p_aspect == KEEP_WIDTH);
_update_camera_mode();
_change_notify();
}
@@ -628,7 +611,7 @@ void Camera3D::set_zfar(float p_zfar) {
void Camera3D::set_cull_mask(uint32_t p_layers) {
layers = p_layers;
- VisualServer::get_singleton()->camera_set_cull_mask(camera, layers);
+ RenderingServer::get_singleton()->camera_set_cull_mask(camera, layers);
_update_camera_mode();
}
@@ -696,14 +679,14 @@ Vector3 Camera3D::get_doppler_tracked_velocity() const {
}
Camera3D::Camera3D() {
- camera = VisualServer::get_singleton()->camera_create();
+ camera = RenderingServer::get_singleton()->camera_create();
size = 1;
fov = 0;
frustum_offset = Vector2();
near = 0;
far = 0;
current = false;
- viewport = NULL;
+ viewport = nullptr;
force_change = false;
mode = PROJECTION_PERSPECTIVE;
set_perspective(70.0, 0.05, 100.0);
@@ -711,7 +694,7 @@ Camera3D::Camera3D() {
layers = 0xfffff;
v_offset = 0;
h_offset = 0;
- VisualServer::get_singleton()->camera_set_cull_mask(camera, layers);
+ RenderingServer::get_singleton()->camera_set_cull_mask(camera, layers);
//active=false;
velocity_tracker.instance();
doppler_tracking = DOPPLER_TRACKING_DISABLED;
@@ -721,7 +704,7 @@ Camera3D::Camera3D() {
Camera3D::~Camera3D() {
- VisualServer::get_singleton()->free(camera);
+ RenderingServer::get_singleton()->free(camera);
}
////////////////////////////////////////
@@ -760,7 +743,7 @@ void ClippedCamera3D::_notification(int p_what) {
return;
}
- PhysicsDirectSpaceState *dspace = get_world()->get_direct_space_state();
+ PhysicsDirectSpaceState3D *dspace = get_world()->get_direct_space_state();
ERR_FAIL_COND(!dspace); // most likely physics set to threads
Vector3 cam_fw = -get_global_transform().basis.get_axis(Vector3::AXIS_Z).normalized();
@@ -791,7 +774,7 @@ void ClippedCamera3D::_notification(int p_what) {
}
if (!all_equal) {
- PhysicsServer::get_singleton()->shape_set_data(pyramid_shape, local_points);
+ PhysicsServer3D::get_singleton()->shape_set_data(pyramid_shape, local_points);
points = local_points;
}
}
@@ -945,10 +928,10 @@ ClippedCamera3D::ClippedCamera3D() {
collision_mask = 1;
set_notify_local_transform(Engine::get_singleton()->is_editor_hint());
points.resize(5);
- pyramid_shape = PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON);
+ pyramid_shape = PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON);
clip_to_areas = false;
clip_to_bodies = true;
}
ClippedCamera3D::~ClippedCamera3D() {
- PhysicsServer::get_singleton()->free(pyramid_shape);
+ PhysicsServer3D::get_singleton()->free(pyramid_shape);
}
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 9ae7371b6a..e6cd7bfe7e 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -31,7 +31,7 @@
#include "collision_object_3d.h"
#include "scene/scene_string_names.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
void CollisionObject3D::_notification(int p_what) {
@@ -40,15 +40,15 @@ void CollisionObject3D::_notification(int p_what) {
case NOTIFICATION_ENTER_WORLD: {
if (area)
- PhysicsServer::get_singleton()->area_set_transform(rid, get_global_transform());
+ PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform());
else
- PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
+ PhysicsServer3D::get_singleton()->body_set_state(rid, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
RID space = get_world()->get_space();
if (area) {
- PhysicsServer::get_singleton()->area_set_space(rid, space);
+ PhysicsServer3D::get_singleton()->area_set_space(rid, space);
} else
- PhysicsServer::get_singleton()->body_set_space(rid, space);
+ PhysicsServer3D::get_singleton()->body_set_space(rid, space);
_update_pickable();
//get space
@@ -57,9 +57,9 @@ void CollisionObject3D::_notification(int p_what) {
case NOTIFICATION_TRANSFORM_CHANGED: {
if (area)
- PhysicsServer::get_singleton()->area_set_transform(rid, get_global_transform());
+ PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform());
else
- PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
+ PhysicsServer3D::get_singleton()->body_set_state(rid, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -70,9 +70,9 @@ void CollisionObject3D::_notification(int p_what) {
case NOTIFICATION_EXIT_WORLD: {
if (area) {
- PhysicsServer::get_singleton()->area_set_space(rid, RID());
+ PhysicsServer3D::get_singleton()->area_set_space(rid, RID());
} else
- PhysicsServer::get_singleton()->body_set_space(rid, RID());
+ PhysicsServer3D::get_singleton()->body_set_space(rid, RID());
} break;
}
@@ -108,9 +108,9 @@ void CollisionObject3D::_update_pickable() {
bool pickable = ray_pickable && is_visible_in_tree();
if (area)
- PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable);
+ PhysicsServer3D::get_singleton()->area_set_ray_pickable(rid, pickable);
else
- PhysicsServer::get_singleton()->body_set_ray_pickable(rid, pickable);
+ PhysicsServer3D::get_singleton()->body_set_ray_pickable(rid, pickable);
}
void CollisionObject3D::set_ray_pickable(bool p_ray_pickable) {
@@ -191,9 +191,9 @@ void CollisionObject3D::shape_owner_set_disabled(uint32_t p_owner, bool p_disabl
sd.disabled = p_disabled;
for (int i = 0; i < sd.shapes.size(); i++) {
if (area) {
- PhysicsServer::get_singleton()->area_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
+ PhysicsServer3D::get_singleton()->area_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
} else {
- PhysicsServer::get_singleton()->body_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
+ PhysicsServer3D::get_singleton()->body_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
}
}
}
@@ -230,9 +230,9 @@ void CollisionObject3D::shape_owner_set_transform(uint32_t p_owner, const Transf
sd.xform = p_transform;
for (int i = 0; i < sd.shapes.size(); i++) {
if (area) {
- PhysicsServer::get_singleton()->area_set_shape_transform(rid, sd.shapes[i].index, p_transform);
+ PhysicsServer3D::get_singleton()->area_set_shape_transform(rid, sd.shapes[i].index, p_transform);
} else {
- PhysicsServer::get_singleton()->body_set_shape_transform(rid, sd.shapes[i].index, p_transform);
+ PhysicsServer3D::get_singleton()->body_set_shape_transform(rid, sd.shapes[i].index, p_transform);
}
}
}
@@ -245,7 +245,7 @@ Transform CollisionObject3D::shape_owner_get_transform(uint32_t p_owner) const {
Object *CollisionObject3D::shape_owner_get_owner(uint32_t p_owner) const {
- ERR_FAIL_COND_V(!shapes.has(p_owner), NULL);
+ ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr);
return shapes[p_owner].owner;
}
@@ -260,9 +260,9 @@ void CollisionObject3D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape3
s.index = total_subshapes;
s.shape = p_shape;
if (area) {
- PhysicsServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
+ PhysicsServer3D::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
} else {
- PhysicsServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
+ PhysicsServer3D::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
}
sd.shapes.push_back(s);
@@ -296,9 +296,9 @@ void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape)
int index_to_remove = shapes[p_owner].shapes[p_shape].index;
if (area) {
- PhysicsServer::get_singleton()->area_remove_shape(rid, index_to_remove);
+ PhysicsServer3D::get_singleton()->area_remove_shape(rid, index_to_remove);
} else {
- PhysicsServer::get_singleton()->body_remove_shape(rid, index_to_remove);
+ PhysicsServer3D::get_singleton()->body_remove_shape(rid, index_to_remove);
}
shapes[p_owner].shapes.remove(p_shape);
@@ -349,9 +349,9 @@ CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) {
total_subshapes = 0;
if (p_area) {
- PhysicsServer::get_singleton()->area_attach_object_instance_id(rid, get_instance_id());
+ PhysicsServer3D::get_singleton()->area_attach_object_instance_id(rid, get_instance_id());
} else {
- PhysicsServer::get_singleton()->body_attach_object_instance_id(rid, get_instance_id());
+ PhysicsServer3D::get_singleton()->body_attach_object_instance_id(rid, get_instance_id());
}
//set_transform_notify(true);
}
@@ -374,7 +374,7 @@ String CollisionObject3D::get_configuration_warning() const {
if (!warning.empty()) {
warning += "\n\n";
}
- warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape or CollisionPolygon as a child to define its shape.");
+ warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape.");
}
return warning;
@@ -392,5 +392,5 @@ CollisionObject3D::CollisionObject3D() {
CollisionObject3D::~CollisionObject3D() {
- PhysicsServer::get_singleton()->free(rid);
+ PhysicsServer3D::get_singleton()->free(rid);
}
diff --git a/scene/3d/collision_object_3d.h b/scene/3d/collision_object_3d.h
index 6a70f56caa..67d3aed3c8 100644
--- a/scene/3d/collision_object_3d.h
+++ b/scene/3d/collision_object_3d.h
@@ -56,7 +56,7 @@ class CollisionObject3D : public Node3D {
ShapeData() {
disabled = false;
- owner = NULL;
+ owner = nullptr;
}
};
diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp
index c8b1b728bc..66bd903eeb 100644
--- a/scene/3d/collision_polygon_3d.cpp
+++ b/scene/3d/collision_polygon_3d.cpp
@@ -112,7 +112,7 @@ void CollisionPolygon3D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
}
}
@@ -165,11 +165,11 @@ bool CollisionPolygon3D::is_disabled() const {
String CollisionPolygon3D::get_configuration_warning() const {
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- return TTR("CollisionPolygon only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape.");
+ return TTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape.");
}
if (polygon.empty()) {
- return TTR("An empty CollisionPolygon has no effect on collision.");
+ return TTR("An empty CollisionPolygon3D has no effect on collision.");
}
return String();
@@ -201,7 +201,7 @@ CollisionPolygon3D::CollisionPolygon3D() {
aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
depth = 1.0;
set_notify_local_transform(true);
- parent = NULL;
+ parent = nullptr;
owner_id = 0;
disabled = false;
}
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp
index eab09883cd..a66e84ac3c 100644
--- a/scene/3d/collision_shape_3d.cpp
+++ b/scene/3d/collision_shape_3d.cpp
@@ -29,6 +29,10 @@
/*************************************************************************/
#include "collision_shape_3d.h"
+
+#include "core/math/quick_hull.h"
+#include "mesh_instance_3d.h"
+#include "physics_body_3d.h"
#include "scene/resources/box_shape_3d.h"
#include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/concave_polygon_shape_3d.h"
@@ -36,11 +40,9 @@
#include "scene/resources/ray_shape_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
+
//TODO: Implement CylinderShape and HeightMapShape?
-#include "core/math/quick_hull.h"
-#include "mesh_instance_3d.h"
-#include "physics_body_3d.h"
void CollisionShape3D::make_convex_from_brothers() {
@@ -103,7 +105,7 @@ void CollisionShape3D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
}
}
@@ -116,17 +118,17 @@ void CollisionShape3D::resource_changed(RES res) {
String CollisionShape3D::get_configuration_warning() const {
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- return TTR("CollisionShape only serves to provide a collision shape to a CollisionObject derived node. Please only use it as a child of Area, StaticBody, RigidBody, KinematicBody, etc. to give them a shape.");
+ return TTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape.");
}
if (!shape.is_valid()) {
- return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it.");
+ return TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it.");
}
if (Object::cast_to<RigidBody3D>(get_parent())) {
if (Object::cast_to<ConcavePolygonShape3D>(*shape)) {
if (Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) {
- return TTR("ConcavePolygonShape doesn't support RigidBody in another mode than static.");
+ return TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static.");
}
}
}
@@ -196,10 +198,10 @@ bool CollisionShape3D::is_disabled() const {
CollisionShape3D::CollisionShape3D() {
- //indicator = VisualServer::get_singleton()->mesh_create();
+ //indicator = RenderingServer::get_singleton()->mesh_create();
disabled = false;
- debug_shape = NULL;
- parent = NULL;
+ debug_shape = nullptr;
+ parent = nullptr;
owner_id = 0;
set_notify_local_transform(true);
}
@@ -207,7 +209,7 @@ CollisionShape3D::CollisionShape3D() {
CollisionShape3D::~CollisionShape3D() {
if (!shape.is_null())
shape->unregister_owner(this);
- //VisualServer::get_singleton()->free(indicator);
+ //RenderingServer::get_singleton()->free(indicator);
}
void CollisionShape3D::_update_debug_shape() {
@@ -215,7 +217,7 @@ void CollisionShape3D::_update_debug_shape() {
if (debug_shape) {
debug_shape->queue_delete();
- debug_shape = NULL;
+ debug_shape = nullptr;
}
Ref<Shape3D> s = get_shape();
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp
index 71e869e6e9..12c105b0f4 100644
--- a/scene/3d/cpu_particles_3d.cpp
+++ b/scene/3d/cpu_particles_3d.cpp
@@ -33,7 +33,7 @@
#include "scene/3d/camera_3d.h"
#include "scene/3d/gpu_particles_3d.h"
#include "scene/resources/particles_material.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
AABB CPUParticles3D::get_aabb() const {
@@ -73,7 +73,7 @@ void CPUParticles3D::set_amount(int p_amount) {
}
particle_data.resize((12 + 4 + 4) * p_amount);
- VS::get_singleton()->multimesh_allocate(multimesh, p_amount, VS::MULTIMESH_TRANSFORM_3D, true, true);
+ RS::get_singleton()->multimesh_allocate(multimesh, p_amount, RS::MULTIMESH_TRANSFORM_3D, true, true);
particle_order.resize(p_amount);
}
@@ -171,9 +171,9 @@ void CPUParticles3D::set_mesh(const Ref<Mesh> &p_mesh) {
mesh = p_mesh;
if (mesh.is_valid()) {
- VS::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid());
+ RS::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid());
} else {
- VS::get_singleton()->multimesh_set_mesh(multimesh, RID());
+ RS::get_singleton()->multimesh_set_mesh(multimesh, RID());
}
}
@@ -208,13 +208,13 @@ String CPUParticles3D::get_configuration_warning() const {
if (get_mesh().is_valid()) {
mesh_found = true;
for (int j = 0; j < get_mesh()->get_surface_count(); j++) {
- anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != NULL;
+ anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_mesh()->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
}
- anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL;
+ anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
@@ -228,7 +228,7 @@ String CPUParticles3D::get_configuration_warning() const {
get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) {
if (warnings != String())
warnings += "\n";
- warnings += "- " + TTR("CPUParticles animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".");
+ warnings += "- " + TTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".");
}
return warnings;
@@ -1022,7 +1022,7 @@ void CPUParticles3D::_update_particle_data_buffer() {
int pc = particles.size();
int *ow;
- int *order = NULL;
+ int *order = nullptr;
float *w = particle_data.ptrw();
const Particle *r = particles.ptr();
@@ -1115,15 +1115,15 @@ void CPUParticles3D::_set_redraw(bool p_redraw) {
MutexLock lock(update_mutex);
if (redraw) {
- VS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread));
- VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, true);
- VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1);
+ RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread));
+ RS::get_singleton()->instance_geometry_set_flag(get_instance(), RS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, true);
+ RS::get_singleton()->multimesh_set_visible_instances(multimesh, -1);
} else {
- if (VS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread))) {
- VS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread));
+ if (RS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread))) {
+ RS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &CPUParticles3D::_update_render_thread));
}
- VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, false);
- VS::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
+ RS::get_singleton()->instance_geometry_set_flag(get_instance(), RS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, false);
+ RS::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
}
}
}
@@ -1133,7 +1133,7 @@ void CPUParticles3D::_update_render_thread() {
MutexLock lock(update_mutex);
if (can_update) {
- VS::get_singleton()->multimesh_set_buffer(multimesh, particle_data);
+ RS::get_singleton()->multimesh_set_buffer(multimesh, particle_data);
can_update = false; //wait for next time
}
}
@@ -1206,7 +1206,7 @@ void CPUParticles3D::_notification(int p_what) {
void CPUParticles3D::convert_from_particles(Node *p_particles) {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_particles);
- ERR_FAIL_COND_MSG(!particles, "Only Particles nodes can be converted to CPUParticles.");
+ ERR_FAIL_COND_MSG(!particles, "Only GPUParticles3D nodes can be converted to CPUParticles3D.");
set_emitting(particles->is_emitting());
set_amount(particles->get_amount());
@@ -1488,8 +1488,8 @@ CPUParticles3D::CPUParticles3D() {
set_notify_transform(true);
- multimesh = VisualServer::get_singleton()->multimesh_create();
- VisualServer::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
+ multimesh = RenderingServer::get_singleton()->multimesh_create();
+ RenderingServer::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
set_base(multimesh);
set_emitting(true);
@@ -1542,5 +1542,5 @@ CPUParticles3D::CPUParticles3D() {
}
CPUParticles3D::~CPUParticles3D() {
- VS::get_singleton()->free(multimesh);
+ RS::get_singleton()->free(multimesh);
}
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index 413d5a2b1d..6d571ee4f2 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -92,7 +92,7 @@ Dictionary GIProbeData::_get_data() const {
}
void GIProbeData::allocate(const Transform &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) {
- VS::get_singleton()->gi_probe_allocate(probe, p_to_cell_xform, p_aabb, p_octree_size, p_octree_cells, p_data_cells, p_distance_field, p_level_counts);
+ RS::get_singleton()->gi_probe_allocate(probe, p_to_cell_xform, p_aabb, p_octree_size, p_octree_cells, p_data_cells, p_distance_field, p_level_counts);
bounds = p_aabb;
to_cell_xform = p_to_cell_xform;
octree_size = p_octree_size;
@@ -105,24 +105,24 @@ Vector3 GIProbeData::get_octree_size() const {
return octree_size;
}
Vector<uint8_t> GIProbeData::get_octree_cells() const {
- return VS::get_singleton()->gi_probe_get_octree_cells(probe);
+ return RS::get_singleton()->gi_probe_get_octree_cells(probe);
}
Vector<uint8_t> GIProbeData::get_data_cells() const {
- return VS::get_singleton()->gi_probe_get_data_cells(probe);
+ return RS::get_singleton()->gi_probe_get_data_cells(probe);
}
Vector<uint8_t> GIProbeData::get_distance_field() const {
- return VS::get_singleton()->gi_probe_get_distance_field(probe);
+ return RS::get_singleton()->gi_probe_get_distance_field(probe);
}
Vector<int> GIProbeData::get_level_counts() const {
- return VS::get_singleton()->gi_probe_get_level_counts(probe);
+ return RS::get_singleton()->gi_probe_get_level_counts(probe);
}
Transform GIProbeData::get_to_cell_xform() const {
return to_cell_xform;
}
void GIProbeData::set_dynamic_range(float p_range) {
- VS::get_singleton()->gi_probe_set_dynamic_range(probe, p_range);
+ RS::get_singleton()->gi_probe_set_dynamic_range(probe, p_range);
dynamic_range = p_range;
}
@@ -131,7 +131,7 @@ float GIProbeData::get_dynamic_range() const {
}
void GIProbeData::set_propagation(float p_propagation) {
- VS::get_singleton()->gi_probe_set_propagation(probe, p_propagation);
+ RS::get_singleton()->gi_probe_set_propagation(probe, p_propagation);
propagation = p_propagation;
}
@@ -140,7 +140,7 @@ float GIProbeData::get_propagation() const {
}
void GIProbeData::set_anisotropy_strength(float p_anisotropy_strength) {
- VS::get_singleton()->gi_probe_set_anisotropy_strength(probe, p_anisotropy_strength);
+ RS::get_singleton()->gi_probe_set_anisotropy_strength(probe, p_anisotropy_strength);
anisotropy_strength = p_anisotropy_strength;
}
@@ -149,7 +149,7 @@ float GIProbeData::get_anisotropy_strength() const {
}
void GIProbeData::set_energy(float p_energy) {
- VS::get_singleton()->gi_probe_set_energy(probe, p_energy);
+ RS::get_singleton()->gi_probe_set_energy(probe, p_energy);
energy = p_energy;
}
@@ -158,7 +158,7 @@ float GIProbeData::get_energy() const {
}
void GIProbeData::set_ao(float p_ao) {
- VS::get_singleton()->gi_probe_set_ao(probe, p_ao);
+ RS::get_singleton()->gi_probe_set_ao(probe, p_ao);
ao = p_ao;
}
@@ -167,7 +167,7 @@ float GIProbeData::get_ao() const {
}
void GIProbeData::set_ao_size(float p_ao_size) {
- VS::get_singleton()->gi_probe_set_ao_size(probe, p_ao_size);
+ RS::get_singleton()->gi_probe_set_ao_size(probe, p_ao_size);
ao_size = p_ao_size;
}
@@ -176,7 +176,7 @@ float GIProbeData::get_ao_size() const {
}
void GIProbeData::set_bias(float p_bias) {
- VS::get_singleton()->gi_probe_set_bias(probe, p_bias);
+ RS::get_singleton()->gi_probe_set_bias(probe, p_bias);
bias = p_bias;
}
@@ -185,7 +185,7 @@ float GIProbeData::get_bias() const {
}
void GIProbeData::set_normal_bias(float p_normal_bias) {
- VS::get_singleton()->gi_probe_set_normal_bias(probe, p_normal_bias);
+ RS::get_singleton()->gi_probe_set_normal_bias(probe, p_normal_bias);
normal_bias = p_normal_bias;
}
@@ -194,7 +194,7 @@ float GIProbeData::get_normal_bias() const {
}
void GIProbeData::set_interior(bool p_enable) {
- VS::get_singleton()->gi_probe_set_interior(probe, p_enable);
+ RS::get_singleton()->gi_probe_set_interior(probe, p_enable);
interior = p_enable;
}
@@ -203,7 +203,7 @@ bool GIProbeData::is_interior() const {
}
void GIProbeData::set_use_two_bounces(bool p_enable) {
- VS::get_singleton()->gi_probe_set_use_two_bounces(probe, p_enable);
+ RS::get_singleton()->gi_probe_set_use_two_bounces(probe, p_enable);
use_two_bounces = p_enable;
}
@@ -293,13 +293,14 @@ GIProbeData::GIProbeData() {
propagation = 0.7;
anisotropy_strength = 0.5;
interior = false;
+ use_two_bounces = false;
- probe = VS::get_singleton()->gi_probe_create();
+ probe = RS::get_singleton()->gi_probe_create();
}
GIProbeData::~GIProbeData() {
- VS::get_singleton()->free(probe);
+ RS::get_singleton()->free(probe);
}
//////////////////////
@@ -308,9 +309,9 @@ GIProbeData::~GIProbeData() {
void GIProbe::set_probe_data(const Ref<GIProbeData> &p_data) {
if (p_data.is_valid()) {
- VS::get_singleton()->instance_set_base(get_instance(), p_data->get_rid());
+ RS::get_singleton()->instance_set_base(get_instance(), p_data->get_rid());
} else {
- VS::get_singleton()->instance_set_base(get_instance(), RID());
+ RS::get_singleton()->instance_set_base(get_instance(), RID());
}
probe_data = p_data;
@@ -402,9 +403,9 @@ void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
}
}
-GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL;
-GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL;
-GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL;
+GIProbe::BakeBeginFunc GIProbe::bake_begin_function = nullptr;
+GIProbe::BakeStepFunc GIProbe::bake_step_function = nullptr;
+GIProbe::BakeEndFunc GIProbe::bake_end_function = nullptr;
Vector3i GIProbe::get_estimated_cell_size() const {
static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 };
@@ -511,7 +512,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
void GIProbe::_debug_bake() {
- bake(NULL, true);
+ bake(nullptr, true);
}
AABB GIProbe::get_aabb() const {
@@ -526,7 +527,7 @@ Vector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const {
String GIProbe::get_configuration_warning() const {
- if (VisualServer::get_singleton()->is_low_end()) {
+ if (RenderingServer::get_singleton()->is_low_end()) {
return TTR("GIProbes are not supported by the GLES2 video driver.\nUse a BakedLightmap instead.");
}
return String();
@@ -563,10 +564,10 @@ GIProbe::GIProbe() {
subdiv = SUBDIV_128;
extents = Vector3(10, 10, 10);
- gi_probe = VS::get_singleton()->gi_probe_create();
+ gi_probe = RS::get_singleton()->gi_probe_create();
set_disable_scale(true);
}
GIProbe::~GIProbe() {
- VS::get_singleton()->free(gi_probe);
+ RS::get_singleton()->free(gi_probe);
}
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index c00ee2cb73..28b533e82d 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -161,7 +161,7 @@ public:
Vector3 get_extents() const;
Vector3i get_estimated_cell_size() const;
- void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false);
+ void bake(Node *p_from_node = nullptr, bool p_create_visual_debug = false);
virtual AABB get_aabb() const;
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const;
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index a283ec41b2..7744c477cb 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -33,7 +33,7 @@
#include "core/os/os.h"
#include "scene/resources/particles_material.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
AABB GPUParticles3D::get_aabb() const {
@@ -46,7 +46,7 @@ Vector<Face3> GPUParticles3D::get_faces(uint32_t p_usage_flags) const {
void GPUParticles3D::set_emitting(bool p_emitting) {
- VS::get_singleton()->particles_set_emitting(particles, p_emitting);
+ RS::get_singleton()->particles_set_emitting(particles, p_emitting);
if (p_emitting && one_shot) {
set_process_internal(true);
@@ -59,25 +59,25 @@ void GPUParticles3D::set_amount(int p_amount) {
ERR_FAIL_COND_MSG(p_amount < 1, "Amount of particles cannot be smaller than 1.");
amount = p_amount;
- VS::get_singleton()->particles_set_amount(particles, amount);
+ RS::get_singleton()->particles_set_amount(particles, amount);
}
void GPUParticles3D::set_lifetime(float p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime;
- VS::get_singleton()->particles_set_lifetime(particles, lifetime);
+ RS::get_singleton()->particles_set_lifetime(particles, lifetime);
}
void GPUParticles3D::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
- VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ RS::get_singleton()->particles_set_one_shot(particles, one_shot);
if (is_emitting()) {
set_process_internal(true);
if (!one_shot)
- VisualServer::get_singleton()->particles_restart(particles);
+ RenderingServer::get_singleton()->particles_restart(particles);
}
if (!one_shot)
@@ -87,29 +87,29 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) {
void GPUParticles3D::set_pre_process_time(float p_time) {
pre_process_time = p_time;
- VS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
+ RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
void GPUParticles3D::set_explosiveness_ratio(float p_ratio) {
explosiveness_ratio = p_ratio;
- VS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
+ RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
}
void GPUParticles3D::set_randomness_ratio(float p_ratio) {
randomness_ratio = p_ratio;
- VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
+ RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
void GPUParticles3D::set_visibility_aabb(const AABB &p_aabb) {
visibility_aabb = p_aabb;
- VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb);
+ RS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb);
update_gizmo();
_change_notify("visibility_aabb");
}
void GPUParticles3D::set_use_local_coordinates(bool p_enable) {
local_coords = p_enable;
- VS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
+ RS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
}
void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
@@ -117,7 +117,7 @@ void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
RID material_rid;
if (process_material.is_valid())
material_rid = process_material->get_rid();
- VS::get_singleton()->particles_set_process_material(particles, material_rid);
+ RS::get_singleton()->particles_set_process_material(particles, material_rid);
update_configuration_warning();
}
@@ -125,12 +125,12 @@ void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
void GPUParticles3D::set_speed_scale(float p_scale) {
speed_scale = p_scale;
- VS::get_singleton()->particles_set_speed_scale(particles, p_scale);
+ RS::get_singleton()->particles_set_speed_scale(particles, p_scale);
}
bool GPUParticles3D::is_emitting() const {
- return VS::get_singleton()->particles_get_emitting(particles);
+ return RS::get_singleton()->particles_get_emitting(particles);
}
int GPUParticles3D::get_amount() const {
@@ -178,7 +178,7 @@ float GPUParticles3D::get_speed_scale() const {
void GPUParticles3D::set_draw_order(DrawOrder p_order) {
draw_order = p_order;
- VS::get_singleton()->particles_set_draw_order(particles, VS::ParticlesDrawOrder(p_order));
+ RS::get_singleton()->particles_set_draw_order(particles, RS::ParticlesDrawOrder(p_order));
}
GPUParticles3D::DrawOrder GPUParticles3D::get_draw_order() const {
@@ -190,7 +190,7 @@ void GPUParticles3D::set_draw_passes(int p_count) {
ERR_FAIL_COND(p_count < 1);
draw_passes.resize(p_count);
- VS::get_singleton()->particles_set_draw_passes(particles, p_count);
+ RS::get_singleton()->particles_set_draw_passes(particles, p_count);
_change_notify();
}
int GPUParticles3D::get_draw_passes() const {
@@ -208,7 +208,7 @@ void GPUParticles3D::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) {
if (p_mesh.is_valid())
mesh_rid = p_mesh->get_rid();
- VS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid);
+ RS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid);
update_configuration_warning();
}
@@ -222,7 +222,7 @@ Ref<Mesh> GPUParticles3D::get_draw_pass_mesh(int p_pass) const {
void GPUParticles3D::set_fixed_fps(int p_count) {
fixed_fps = p_count;
- VS::get_singleton()->particles_set_fixed_fps(particles, p_count);
+ RS::get_singleton()->particles_set_fixed_fps(particles, p_count);
}
int GPUParticles3D::get_fixed_fps() const {
@@ -231,7 +231,7 @@ int GPUParticles3D::get_fixed_fps() const {
void GPUParticles3D::set_fractional_delta(bool p_enable) {
fractional_delta = p_enable;
- VS::get_singleton()->particles_set_fractional_delta(particles, p_enable);
+ RS::get_singleton()->particles_set_fractional_delta(particles, p_enable);
}
bool GPUParticles3D::get_fractional_delta() const {
@@ -240,8 +240,8 @@ bool GPUParticles3D::get_fractional_delta() const {
String GPUParticles3D::get_configuration_warning() const {
- if (VisualServer::get_singleton()->is_low_end()) {
- return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
+ if (RenderingServer::get_singleton()->is_low_end()) {
+ return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose.");
}
String warnings;
@@ -253,7 +253,7 @@ String GPUParticles3D::get_configuration_warning() const {
if (draw_passes[i].is_valid()) {
meshes_found = true;
for (int j = 0; j < draw_passes[i]->get_surface_count(); j++) {
- anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != NULL;
+ anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
@@ -261,7 +261,7 @@ String GPUParticles3D::get_configuration_warning() const {
}
}
- anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL;
+ anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
@@ -291,13 +291,13 @@ String GPUParticles3D::get_configuration_warning() const {
void GPUParticles3D::restart() {
- VisualServer::get_singleton()->particles_restart(particles);
- VisualServer::get_singleton()->particles_set_emitting(particles, true);
+ RenderingServer::get_singleton()->particles_restart(particles);
+ RenderingServer::get_singleton()->particles_set_emitting(particles, true);
}
AABB GPUParticles3D::capture_aabb() const {
- return VS::get_singleton()->particles_get_current_aabb(particles);
+ return RS::get_singleton()->particles_get_current_aabb(particles);
}
void GPUParticles3D::_validate_property(PropertyInfo &property) const {
@@ -315,10 +315,10 @@ void GPUParticles3D::_notification(int p_what) {
if (p_what == NOTIFICATION_PAUSED || p_what == NOTIFICATION_UNPAUSED) {
if (can_process()) {
- VS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
+ RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
} else {
- VS::get_singleton()->particles_set_speed_scale(particles, 0);
+ RS::get_singleton()->particles_set_speed_scale(particles, 0);
}
}
@@ -334,8 +334,8 @@ void GPUParticles3D::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
// make sure particles are updated before rendering occurs if they were active before
- if (is_visible_in_tree() && !VS::get_singleton()->particles_is_inactive(particles)) {
- VS::get_singleton()->particles_request_process(particles);
+ if (is_visible_in_tree() && !RS::get_singleton()->particles_is_inactive(particles)) {
+ RS::get_singleton()->particles_request_process(particles);
}
}
}
@@ -416,7 +416,7 @@ void GPUParticles3D::_bind_methods() {
GPUParticles3D::GPUParticles3D() {
- particles = VS::get_singleton()->particles_create();
+ particles = RS::get_singleton()->particles_create();
set_base(particles);
one_shot = false; // Needed so that set_emitting doesn't access uninitialized values
set_emitting(true);
@@ -437,5 +437,5 @@ GPUParticles3D::GPUParticles3D() {
GPUParticles3D::~GPUParticles3D() {
- VS::get_singleton()->free(particles);
+ RS::get_singleton()->free(particles);
}
diff --git a/scene/3d/immediate_geometry_3d.cpp b/scene/3d/immediate_geometry_3d.cpp
index acc1f407f9..63d4b1ac84 100644
--- a/scene/3d/immediate_geometry_3d.cpp
+++ b/scene/3d/immediate_geometry_3d.cpp
@@ -32,39 +32,39 @@
void ImmediateGeometry3D::begin(Mesh::PrimitiveType p_primitive, const Ref<Texture2D> &p_texture) {
- VS::get_singleton()->immediate_begin(im, (VS::PrimitiveType)p_primitive, p_texture.is_valid() ? p_texture->get_rid() : RID());
+ RS::get_singleton()->immediate_begin(im, (RS::PrimitiveType)p_primitive, p_texture.is_valid() ? p_texture->get_rid() : RID());
if (p_texture.is_valid())
cached_textures.push_back(p_texture);
}
void ImmediateGeometry3D::set_normal(const Vector3 &p_normal) {
- VS::get_singleton()->immediate_normal(im, p_normal);
+ RS::get_singleton()->immediate_normal(im, p_normal);
}
void ImmediateGeometry3D::set_tangent(const Plane &p_tangent) {
- VS::get_singleton()->immediate_tangent(im, p_tangent);
+ RS::get_singleton()->immediate_tangent(im, p_tangent);
}
void ImmediateGeometry3D::set_color(const Color &p_color) {
- VS::get_singleton()->immediate_color(im, p_color);
+ RS::get_singleton()->immediate_color(im, p_color);
}
void ImmediateGeometry3D::set_uv(const Vector2 &p_uv) {
- VS::get_singleton()->immediate_uv(im, p_uv);
+ RS::get_singleton()->immediate_uv(im, p_uv);
}
void ImmediateGeometry3D::set_uv2(const Vector2 &p_uv2) {
- VS::get_singleton()->immediate_uv2(im, p_uv2);
+ RS::get_singleton()->immediate_uv2(im, p_uv2);
}
void ImmediateGeometry3D::add_vertex(const Vector3 &p_vertex) {
- VS::get_singleton()->immediate_vertex(im, p_vertex);
+ RS::get_singleton()->immediate_vertex(im, p_vertex);
if (empty) {
aabb.position = p_vertex;
aabb.size = Vector3();
@@ -76,12 +76,12 @@ void ImmediateGeometry3D::add_vertex(const Vector3 &p_vertex) {
void ImmediateGeometry3D::end() {
- VS::get_singleton()->immediate_end(im);
+ RS::get_singleton()->immediate_end(im);
}
void ImmediateGeometry3D::clear() {
- VS::get_singleton()->immediate_clear(im);
+ RS::get_singleton()->immediate_clear(im);
empty = true;
cached_textures.clear();
}
@@ -158,12 +158,12 @@ void ImmediateGeometry3D::_bind_methods() {
ImmediateGeometry3D::ImmediateGeometry3D() {
- im = VisualServer::get_singleton()->immediate_create();
+ im = RenderingServer::get_singleton()->immediate_create();
set_base(im);
empty = true;
}
ImmediateGeometry3D::~ImmediateGeometry3D() {
- VisualServer::get_singleton()->free(im);
+ RenderingServer::get_singleton()->free(im);
}
diff --git a/scene/3d/immediate_geometry_3d.h b/scene/3d/immediate_geometry_3d.h
index d968187ba3..6e15450a5b 100644
--- a/scene/3d/immediate_geometry_3d.h
+++ b/scene/3d/immediate_geometry_3d.h
@@ -40,7 +40,7 @@ class ImmediateGeometry3D : public GeometryInstance3D {
RID im;
//a list of textures drawn need to be kept, to avoid references
- // in VisualServer from becoming invalid if the texture is no longer used
+ // in RenderingServer from becoming invalid if the texture is no longer used
List<Ref<Texture2D>> cached_textures;
bool empty;
AABB aabb;
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 434f35fc57..be3b369724 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -44,7 +44,7 @@ void Light3D::set_param(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
param[p_param] = p_value;
- VS::get_singleton()->light_set_param(light, VS::LightParam(p_param), p_value);
+ RS::get_singleton()->light_set_param(light, RS::LightParam(p_param), p_value);
if (p_param == PARAM_SPOT_ANGLE || p_param == PARAM_RANGE) {
update_gizmo();
@@ -68,9 +68,9 @@ float Light3D::get_param(Param p_param) const {
void Light3D::set_shadow(bool p_enable) {
shadow = p_enable;
- VS::get_singleton()->light_set_shadow(light, p_enable);
+ RS::get_singleton()->light_set_shadow(light, p_enable);
- if (type == VisualServer::LIGHT_SPOT) {
+ if (type == RenderingServer::LIGHT_SPOT) {
update_configuration_warning();
}
}
@@ -82,7 +82,7 @@ bool Light3D::has_shadow() const {
void Light3D::set_negative(bool p_enable) {
negative = p_enable;
- VS::get_singleton()->light_set_negative(light, p_enable);
+ RS::get_singleton()->light_set_negative(light, p_enable);
}
bool Light3D::is_negative() const {
@@ -92,7 +92,7 @@ bool Light3D::is_negative() const {
void Light3D::set_cull_mask(uint32_t p_cull_mask) {
cull_mask = p_cull_mask;
- VS::get_singleton()->light_set_cull_mask(light, p_cull_mask);
+ RS::get_singleton()->light_set_cull_mask(light, p_cull_mask);
}
uint32_t Light3D::get_cull_mask() const {
@@ -102,7 +102,7 @@ uint32_t Light3D::get_cull_mask() const {
void Light3D::set_color(const Color &p_color) {
color = p_color;
- VS::get_singleton()->light_set_color(light, p_color);
+ RS::get_singleton()->light_set_color(light, p_color);
// The gizmo color depends on the light color, so update it.
update_gizmo();
}
@@ -114,7 +114,7 @@ Color Light3D::get_color() const {
void Light3D::set_shadow_color(const Color &p_shadow_color) {
shadow_color = p_shadow_color;
- VS::get_singleton()->light_set_shadow_color(light, p_shadow_color);
+ RS::get_singleton()->light_set_shadow_color(light, p_shadow_color);
}
Color Light3D::get_shadow_color() const {
@@ -124,7 +124,7 @@ Color Light3D::get_shadow_color() const {
void Light3D::set_shadow_reverse_cull_face(bool p_enable) {
reverse_cull = p_enable;
- VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
+ RS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull);
}
bool Light3D::get_shadow_reverse_cull_face() const {
@@ -134,15 +134,15 @@ bool Light3D::get_shadow_reverse_cull_face() const {
AABB Light3D::get_aabb() const {
- if (type == VisualServer::LIGHT_DIRECTIONAL) {
+ if (type == RenderingServer::LIGHT_DIRECTIONAL) {
return AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
- } else if (type == VisualServer::LIGHT_OMNI) {
+ } else if (type == RenderingServer::LIGHT_OMNI) {
return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]);
- } else if (type == VisualServer::LIGHT_SPOT) {
+ } else if (type == RenderingServer::LIGHT_SPOT) {
float len = param[PARAM_RANGE];
float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len;
@@ -159,7 +159,7 @@ Vector<Face3> Light3D::get_faces(uint32_t p_usage_flags) const {
void Light3D::set_bake_mode(BakeMode p_mode) {
bake_mode = p_mode;
- VS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED);
+ RS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED);
}
Light3D::BakeMode Light3D::get_bake_mode() const {
@@ -187,7 +187,7 @@ void Light3D::_update_visibility() {
}
#endif
- VS::get_singleton()->instance_set_visible(get_instance(), is_visible_in_tree() && editor_ok);
+ RS::get_singleton()->instance_set_visible(get_instance(), is_visible_in_tree() && editor_ok);
_change_notify("geometry/visible");
}
@@ -217,7 +217,7 @@ bool Light3D::is_editor_only() const {
void Light3D::_validate_property(PropertyInfo &property) const {
- if (VisualServer::get_singleton()->is_low_end() && property.name == "shadow_contact") {
+ if (RenderingServer::get_singleton()->is_low_end() && property.name == "shadow_contact") {
property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
}
}
@@ -292,18 +292,18 @@ void Light3D::_bind_methods() {
BIND_ENUM_CONSTANT(BAKE_ALL);
}
-Light3D::Light3D(VisualServer::LightType p_type) {
+Light3D::Light3D(RenderingServer::LightType p_type) {
type = p_type;
switch (p_type) {
- case VS::LIGHT_DIRECTIONAL: light = VisualServer::get_singleton()->directional_light_create(); break;
- case VS::LIGHT_OMNI: light = VisualServer::get_singleton()->omni_light_create(); break;
- case VS::LIGHT_SPOT: light = VisualServer::get_singleton()->spot_light_create(); break;
+ case RS::LIGHT_DIRECTIONAL: light = RenderingServer::get_singleton()->directional_light_create(); break;
+ case RS::LIGHT_OMNI: light = RenderingServer::get_singleton()->omni_light_create(); break;
+ case RS::LIGHT_SPOT: light = RenderingServer::get_singleton()->spot_light_create(); break;
default: {
};
}
- VS::get_singleton()->instance_set_base(get_instance(), light);
+ RS::get_singleton()->instance_set_base(get_instance(), light);
reverse_cull = false;
bake_mode = BAKE_INDIRECT;
@@ -335,23 +335,23 @@ Light3D::Light3D(VisualServer::LightType p_type) {
Light3D::Light3D() {
- type = VisualServer::LIGHT_DIRECTIONAL;
- ERR_PRINT("Light should not be instanced directly; use the DirectionalLight, OmniLight or SpotLight subtypes instead.");
+ type = RenderingServer::LIGHT_DIRECTIONAL;
+ ERR_PRINT("Light3D should not be instanced directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead.");
}
Light3D::~Light3D() {
- VS::get_singleton()->instance_set_base(get_instance(), RID());
+ RS::get_singleton()->instance_set_base(get_instance(), RID());
if (light.is_valid())
- VisualServer::get_singleton()->free(light);
+ RenderingServer::get_singleton()->free(light);
}
/////////////////////////////////////////
void DirectionalLight3D::set_shadow_mode(ShadowMode p_mode) {
shadow_mode = p_mode;
- VS::get_singleton()->light_directional_set_shadow_mode(light, VS::LightDirectionalShadowMode(p_mode));
+ RS::get_singleton()->light_directional_set_shadow_mode(light, RS::LightDirectionalShadowMode(p_mode));
}
DirectionalLight3D::ShadowMode DirectionalLight3D::get_shadow_mode() const {
@@ -361,7 +361,7 @@ DirectionalLight3D::ShadowMode DirectionalLight3D::get_shadow_mode() const {
void DirectionalLight3D::set_shadow_depth_range(ShadowDepthRange p_range) {
shadow_depth_range = p_range;
- VS::get_singleton()->light_directional_set_shadow_depth_range_mode(light, VS::LightDirectionalShadowDepthRangeMode(p_range));
+ RS::get_singleton()->light_directional_set_shadow_depth_range_mode(light, RS::LightDirectionalShadowDepthRangeMode(p_range));
}
DirectionalLight3D::ShadowDepthRange DirectionalLight3D::get_shadow_depth_range() const {
@@ -372,7 +372,7 @@ DirectionalLight3D::ShadowDepthRange DirectionalLight3D::get_shadow_depth_range(
void DirectionalLight3D::set_blend_splits(bool p_enable) {
blend_splits = p_enable;
- VS::get_singleton()->light_directional_set_blend_splits(light, p_enable);
+ RS::get_singleton()->light_directional_set_blend_splits(light, p_enable);
}
bool DirectionalLight3D::is_blend_splits_enabled() const {
@@ -412,7 +412,7 @@ void DirectionalLight3D::_bind_methods() {
}
DirectionalLight3D::DirectionalLight3D() :
- Light3D(VisualServer::LIGHT_DIRECTIONAL) {
+ Light3D(RenderingServer::LIGHT_DIRECTIONAL) {
set_param(PARAM_SHADOW_NORMAL_BIAS, 0.8);
set_param(PARAM_SHADOW_BIAS, 0.1);
@@ -428,7 +428,7 @@ DirectionalLight3D::DirectionalLight3D() :
void OmniLight3D::set_shadow_mode(ShadowMode p_mode) {
shadow_mode = p_mode;
- VS::get_singleton()->light_omni_set_shadow_mode(light, VS::LightOmniShadowMode(p_mode));
+ RS::get_singleton()->light_omni_set_shadow_mode(light, RS::LightOmniShadowMode(p_mode));
}
OmniLight3D::ShadowMode OmniLight3D::get_shadow_mode() const {
@@ -451,7 +451,7 @@ void OmniLight3D::_bind_methods() {
}
OmniLight3D::OmniLight3D() :
- Light3D(VisualServer::LIGHT_OMNI) {
+ Light3D(RenderingServer::LIGHT_OMNI) {
set_shadow_mode(SHADOW_CUBE);
}
@@ -464,7 +464,7 @@ String SpotLight3D::get_configuration_warning() const {
warning += "\n\n";
}
- warning += TTR("A SpotLight with an angle wider than 90 degrees cannot cast shadows.");
+ warning += TTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows.");
}
return warning;
diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h
index 7b3273e1e4..197e5854ec 100644
--- a/scene/3d/light_3d.h
+++ b/scene/3d/light_3d.h
@@ -33,7 +33,7 @@
#include "scene/3d/visual_instance_3d.h"
#include "scene/resources/texture.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
class Light3D : public VisualInstance3D {
@@ -42,23 +42,23 @@ class Light3D : public VisualInstance3D {
public:
enum Param {
- PARAM_ENERGY = VS::LIGHT_PARAM_ENERGY,
- PARAM_INDIRECT_ENERGY = VS::LIGHT_PARAM_INDIRECT_ENERGY,
- PARAM_SPECULAR = VS::LIGHT_PARAM_SPECULAR,
- PARAM_RANGE = VS::LIGHT_PARAM_RANGE,
- PARAM_ATTENUATION = VS::LIGHT_PARAM_ATTENUATION,
- PARAM_SPOT_ANGLE = VS::LIGHT_PARAM_SPOT_ANGLE,
- PARAM_SPOT_ATTENUATION = VS::LIGHT_PARAM_SPOT_ATTENUATION,
- PARAM_CONTACT_SHADOW_SIZE = VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE,
- PARAM_SHADOW_MAX_DISTANCE = VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE,
- PARAM_SHADOW_SPLIT_1_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
- PARAM_SHADOW_SPLIT_2_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
- PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
- PARAM_SHADOW_FADE_START = VS::LIGHT_PARAM_SHADOW_FADE_START,
- PARAM_SHADOW_NORMAL_BIAS = VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS,
- PARAM_SHADOW_BIAS = VS::LIGHT_PARAM_SHADOW_BIAS,
- PARAM_SHADOW_BIAS_SPLIT_SCALE = VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
- PARAM_MAX = VS::LIGHT_PARAM_MAX
+ PARAM_ENERGY = RS::LIGHT_PARAM_ENERGY,
+ PARAM_INDIRECT_ENERGY = RS::LIGHT_PARAM_INDIRECT_ENERGY,
+ PARAM_SPECULAR = RS::LIGHT_PARAM_SPECULAR,
+ PARAM_RANGE = RS::LIGHT_PARAM_RANGE,
+ PARAM_ATTENUATION = RS::LIGHT_PARAM_ATTENUATION,
+ PARAM_SPOT_ANGLE = RS::LIGHT_PARAM_SPOT_ANGLE,
+ PARAM_SPOT_ATTENUATION = RS::LIGHT_PARAM_SPOT_ATTENUATION,
+ PARAM_CONTACT_SHADOW_SIZE = RS::LIGHT_PARAM_CONTACT_SHADOW_SIZE,
+ PARAM_SHADOW_MAX_DISTANCE = RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE,
+ PARAM_SHADOW_SPLIT_1_OFFSET = RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
+ PARAM_SHADOW_SPLIT_2_OFFSET = RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
+ PARAM_SHADOW_SPLIT_3_OFFSET = RS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
+ PARAM_SHADOW_FADE_START = RS::LIGHT_PARAM_SHADOW_FADE_START,
+ PARAM_SHADOW_NORMAL_BIAS = RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS,
+ PARAM_SHADOW_BIAS = RS::LIGHT_PARAM_SHADOW_BIAS,
+ PARAM_SHADOW_BIAS_SPLIT_SCALE = RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE,
+ PARAM_MAX = RS::LIGHT_PARAM_MAX
};
enum BakeMode {
@@ -75,7 +75,7 @@ private:
bool negative;
bool reverse_cull;
uint32_t cull_mask;
- VS::LightType type;
+ RS::LightType type;
bool editor_only;
void _update_visibility();
BakeMode bake_mode;
@@ -91,10 +91,10 @@ protected:
void _notification(int p_what);
virtual void _validate_property(PropertyInfo &property) const;
- Light3D(VisualServer::LightType p_type);
+ Light3D(RenderingServer::LightType p_type);
public:
- VS::LightType get_light_type() const { return type; }
+ RS::LightType get_light_type() const { return type; }
void set_editor_only(bool p_editor_only);
bool is_editor_only() const;
@@ -145,8 +145,8 @@ public:
};
enum ShadowDepthRange {
- SHADOW_DEPTH_RANGE_STABLE = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE,
- SHADOW_DEPTH_RANGE_OPTIMIZED = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED,
+ SHADOW_DEPTH_RANGE_STABLE = RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE,
+ SHADOW_DEPTH_RANGE_OPTIMIZED = RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED,
};
private:
@@ -210,7 +210,7 @@ public:
virtual String get_configuration_warning() const;
SpotLight3D() :
- Light3D(VisualServer::LIGHT_SPOT) {}
+ Light3D(RenderingServer::LIGHT_SPOT) {}
};
#endif
diff --git a/scene/3d/listener_3d.cpp b/scene/3d/listener_3d.cpp
index f352eb24b1..426e34ea80 100644
--- a/scene/3d/listener_3d.cpp
+++ b/scene/3d/listener_3d.cpp
@@ -131,7 +131,7 @@ void Listener3D::clear_current() {
return;
if (get_viewport()->get_listener() == this) {
- get_viewport()->_listener_set(NULL);
+ get_viewport()->_listener_set(nullptr);
get_viewport()->_listener_make_next_current(this);
}
}
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 5f826505b4..d56a095a5b 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -47,7 +47,7 @@ bool MeshInstance3D::_set(const StringName &p_name, const Variant &p_value) {
Map<StringName, BlendShapeTrack>::Element *E = blend_shape_tracks.find(p_name);
if (E) {
E->get().value = p_value;
- VisualServer::get_singleton()->instance_set_blend_shape_weight(get_instance(), E->get().idx, E->get().value);
+ RenderingServer::get_singleton()->instance_set_blend_shape_weight(get_instance(), E->get().idx, E->get().value);
return true;
}
@@ -165,9 +165,9 @@ void MeshInstance3D::_resolve_skeleton_path() {
skin_ref = new_skin_reference;
if (skin_ref.is_valid()) {
- VisualServer::get_singleton()->instance_attach_skeleton(get_instance(), skin_ref->get_skeleton());
+ RenderingServer::get_singleton()->instance_attach_skeleton(get_instance(), skin_ref->get_skeleton());
} else {
- VisualServer::get_singleton()->instance_attach_skeleton(get_instance(), RID());
+ RenderingServer::get_singleton()->instance_attach_skeleton(get_instance(), RID());
}
}
@@ -217,11 +217,11 @@ Vector<Face3> MeshInstance3D::get_faces(uint32_t p_usage_flags) const {
Node *MeshInstance3D::create_trimesh_collision_node() {
if (mesh.is_null())
- return NULL;
+ return nullptr;
Ref<Shape3D> shape = mesh->create_trimesh_shape();
if (shape.is_null())
- return NULL;
+ return nullptr;
StaticBody3D *static_body = memnew(StaticBody3D);
CollisionShape3D *cshape = memnew(CollisionShape3D);
@@ -247,11 +247,11 @@ void MeshInstance3D::create_trimesh_collision() {
Node *MeshInstance3D::create_convex_collision_node() {
if (mesh.is_null())
- return NULL;
+ return nullptr;
Ref<Shape3D> shape = mesh->create_convex_shape();
if (shape.is_null())
- return NULL;
+ return nullptr;
StaticBody3D *static_body = memnew(StaticBody3D);
CollisionShape3D *cshape = memnew(CollisionShape3D);
@@ -293,9 +293,9 @@ void MeshInstance3D::set_surface_material(int p_surface, const Ref<Material> &p_
materials.write[p_surface] = p_material;
if (materials[p_surface].is_valid())
- VS::get_singleton()->instance_set_surface_material(get_instance(), p_surface, materials[p_surface]->get_rid());
+ RS::get_singleton()->instance_set_surface_material(get_instance(), p_surface, materials[p_surface]->get_rid());
else
- VS::get_singleton()->instance_set_surface_material(get_instance(), p_surface, RID());
+ RS::get_singleton()->instance_set_surface_material(get_instance(), p_surface, RID());
}
Ref<Material> MeshInstance3D::get_surface_material(int p_surface) const {
@@ -305,6 +305,23 @@ Ref<Material> MeshInstance3D::get_surface_material(int p_surface) const {
return materials[p_surface];
}
+Ref<Material> MeshInstance3D::get_active_material(int p_surface) const {
+
+ if (get_material_override() != Ref<Material>()) {
+ return get_material_override();
+ } else if (p_surface < materials.size()) {
+ return materials[p_surface];
+ } else {
+ Ref<Mesh> mesh = get_mesh();
+
+ if (mesh.is_null() || p_surface >= mesh->get_surface_count()) {
+ return Ref<Material>();
+ }
+
+ return mesh->surface_get_material(p_surface);
+ }
+}
+
void MeshInstance3D::_mesh_changed() {
materials.resize(mesh->get_surface_count());
@@ -397,6 +414,7 @@ void MeshInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_surface_material_count"), &MeshInstance3D::get_surface_material_count);
ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance3D::set_surface_material);
ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance3D::get_surface_material);
+ ClassDB::bind_method(D_METHOD("get_active_material", "surface"), &MeshInstance3D::get_active_material);
ClassDB::bind_method(D_METHOD("create_trimesh_collision"), &MeshInstance3D::create_trimesh_collision);
ClassDB::set_method_flags("MeshInstance3D", "create_trimesh_collision", METHOD_FLAGS_DEFAULT);
diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h
index e45f68e295..914148f427 100644
--- a/scene/3d/mesh_instance_3d.h
+++ b/scene/3d/mesh_instance_3d.h
@@ -84,6 +84,7 @@ public:
int get_surface_material_count() const;
void set_surface_material(int p_surface, const Ref<Material> &p_material);
Ref<Material> get_surface_material(int p_surface) const;
+ Ref<Material> get_active_material(int p_surface) const;
Node *create_trimesh_collision_node();
void create_trimesh_collision();
diff --git a/scene/3d/navigation_3d.cpp b/scene/3d/navigation_3d.cpp
index 28da04fcbe..f880f65d37 100644
--- a/scene/3d/navigation_3d.cpp
+++ b/scene/3d/navigation_3d.cpp
@@ -30,33 +30,33 @@
#include "navigation_3d.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
Vector<Vector3> Navigation3D::get_simple_path(const Vector3 &p_start, const Vector3 &p_end, bool p_optimize) const {
- return NavigationServer::get_singleton()->map_get_path(map, p_start, p_end, p_optimize);
+ return NavigationServer3D::get_singleton()->map_get_path(map, p_start, p_end, p_optimize);
}
Vector3 Navigation3D::get_closest_point_to_segment(const Vector3 &p_from, const Vector3 &p_to, bool p_use_collision) const {
- return NavigationServer::get_singleton()->map_get_closest_point_to_segment(map, p_from, p_to, p_use_collision);
+ return NavigationServer3D::get_singleton()->map_get_closest_point_to_segment(map, p_from, p_to, p_use_collision);
}
Vector3 Navigation3D::get_closest_point(const Vector3 &p_point) const {
- return NavigationServer::get_singleton()->map_get_closest_point(map, p_point);
+ return NavigationServer3D::get_singleton()->map_get_closest_point(map, p_point);
}
Vector3 Navigation3D::get_closest_point_normal(const Vector3 &p_point) const {
- return NavigationServer::get_singleton()->map_get_closest_point_normal(map, p_point);
+ return NavigationServer3D::get_singleton()->map_get_closest_point_normal(map, p_point);
}
RID Navigation3D::get_closest_point_owner(const Vector3 &p_point) const {
- return NavigationServer::get_singleton()->map_get_closest_point_owner(map, p_point);
+ return NavigationServer3D::get_singleton()->map_get_closest_point_owner(map, p_point);
}
void Navigation3D::set_up_vector(const Vector3 &p_up) {
up = p_up;
- NavigationServer::get_singleton()->map_set_up(map, up);
+ NavigationServer3D::get_singleton()->map_set_up(map, up);
}
Vector3 Navigation3D::get_up_vector() const {
@@ -66,12 +66,12 @@ Vector3 Navigation3D::get_up_vector() const {
void Navigation3D::set_cell_size(float p_cell_size) {
cell_size = p_cell_size;
- NavigationServer::get_singleton()->map_set_cell_size(map, cell_size);
+ NavigationServer3D::get_singleton()->map_set_cell_size(map, cell_size);
}
void Navigation3D::set_edge_connection_margin(float p_edge_connection_margin) {
edge_connection_margin = p_edge_connection_margin;
- NavigationServer::get_singleton()->map_set_edge_connection_margin(map, edge_connection_margin);
+ NavigationServer3D::get_singleton()->map_set_edge_connection_margin(map, edge_connection_margin);
}
void Navigation3D::_bind_methods() {
@@ -101,18 +101,18 @@ void Navigation3D::_bind_methods() {
void Navigation3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
- NavigationServer::get_singleton()->map_set_active(map, true);
+ NavigationServer3D::get_singleton()->map_set_active(map, true);
} break;
case NOTIFICATION_EXIT_TREE: {
- NavigationServer::get_singleton()->map_set_active(map, false);
+ NavigationServer3D::get_singleton()->map_set_active(map, false);
} break;
}
}
Navigation3D::Navigation3D() {
- map = NavigationServer::get_singleton()->map_create();
+ map = NavigationServer3D::get_singleton()->map_create();
set_cell_size(0.3);
set_edge_connection_margin(5.0); // Five meters, depends alot on the agents radius
@@ -121,5 +121,5 @@ Navigation3D::Navigation3D() {
}
Navigation3D::~Navigation3D() {
- NavigationServer::get_singleton()->free(map);
+ NavigationServer3D::get_singleton()->free(map);
}
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 219e868f29..0449ab15b7 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -32,7 +32,7 @@
#include "core/engine.h"
#include "scene/3d/navigation_3d.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
void NavigationAgent3D::_bind_methods() {
@@ -102,16 +102,16 @@ void NavigationAgent3D::_notification(int p_what) {
agent_parent = Object::cast_to<Node3D>(get_parent());
- NavigationServer::get_singleton()->agent_set_callback(agent, this, "_avoidance_done");
+ NavigationServer3D::get_singleton()->agent_set_callback(agent, this, "_avoidance_done");
// Search the navigation node and set it
{
- Navigation3D *nav = NULL;
+ Navigation3D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation3D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -122,14 +122,14 @@ void NavigationAgent3D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- agent_parent = NULL;
- set_navigation(NULL);
+ agent_parent = nullptr;
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (agent_parent) {
- NavigationServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
+ NavigationServer3D::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
if (!target_reached) {
if (distance_to_target() < target_desired_distance) {
emit_signal("target_reached");
@@ -142,8 +142,8 @@ void NavigationAgent3D::_notification(int p_what) {
}
NavigationAgent3D::NavigationAgent3D() :
- agent_parent(NULL),
- navigation(NULL),
+ agent_parent(nullptr),
+ navigation(nullptr),
agent(RID()),
target_desired_distance(1.0),
navigation_height_offset(0.0),
@@ -151,7 +151,7 @@ NavigationAgent3D::NavigationAgent3D() :
velocity_submitted(false),
target_reached(false),
navigation_finished(true) {
- agent = NavigationServer::get_singleton()->agent_create();
+ agent = NavigationServer3D::get_singleton()->agent_create();
set_neighbor_dist(50.0);
set_max_neighbors(10);
set_time_horizon(5.0);
@@ -161,7 +161,7 @@ NavigationAgent3D::NavigationAgent3D() :
}
NavigationAgent3D::~NavigationAgent3D() {
- NavigationServer::get_singleton()->free(agent);
+ NavigationServer3D::get_singleton()->free(agent);
agent = RID(); // Pointless
}
@@ -170,12 +170,12 @@ void NavigationAgent3D::set_navigation(Navigation3D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationAgent3D::set_navigation_node(Node *p_nav) {
Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
@@ -189,7 +189,7 @@ void NavigationAgent3D::set_target_desired_distance(real_t p_dd) {
void NavigationAgent3D::set_radius(real_t p_radius) {
radius = p_radius;
- NavigationServer::get_singleton()->agent_set_radius(agent, radius);
+ NavigationServer3D::get_singleton()->agent_set_radius(agent, radius);
}
void NavigationAgent3D::set_agent_height_offset(real_t p_hh) {
@@ -198,27 +198,27 @@ void NavigationAgent3D::set_agent_height_offset(real_t p_hh) {
void NavigationAgent3D::set_ignore_y(bool p_ignore_y) {
ignore_y = p_ignore_y;
- NavigationServer::get_singleton()->agent_set_ignore_y(agent, ignore_y);
+ NavigationServer3D::get_singleton()->agent_set_ignore_y(agent, ignore_y);
}
void NavigationAgent3D::set_neighbor_dist(real_t p_dist) {
neighbor_dist = p_dist;
- NavigationServer::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist);
+ NavigationServer3D::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist);
}
void NavigationAgent3D::set_max_neighbors(int p_count) {
max_neighbors = p_count;
- NavigationServer::get_singleton()->agent_set_max_neighbors(agent, max_neighbors);
+ NavigationServer3D::get_singleton()->agent_set_max_neighbors(agent, max_neighbors);
}
void NavigationAgent3D::set_time_horizon(real_t p_time) {
time_horizon = p_time;
- NavigationServer::get_singleton()->agent_set_time_horizon(agent, time_horizon);
+ NavigationServer3D::get_singleton()->agent_set_time_horizon(agent, time_horizon);
}
void NavigationAgent3D::set_max_speed(real_t p_max_speed) {
max_speed = p_max_speed;
- NavigationServer::get_singleton()->agent_set_max_speed(agent, max_speed);
+ NavigationServer3D::get_singleton()->agent_set_max_speed(agent, max_speed);
}
void NavigationAgent3D::set_path_max_distance(real_t p_pmd) {
@@ -244,7 +244,7 @@ Vector3 NavigationAgent3D::get_target_location() const {
Vector3 NavigationAgent3D::get_next_location() {
update_navigation();
if (navigation_path.size() == 0) {
- ERR_FAIL_COND_V(agent_parent == NULL, Vector3());
+ ERR_FAIL_COND_V(agent_parent == nullptr, Vector3());
return agent_parent->get_global_transform().origin;
} else {
return navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0);
@@ -252,7 +252,7 @@ Vector3 NavigationAgent3D::get_next_location() {
}
real_t NavigationAgent3D::distance_to_target() const {
- ERR_FAIL_COND_V(agent_parent == NULL, 0.0);
+ ERR_FAIL_COND_V(agent_parent == nullptr, 0.0);
return agent_parent->get_global_transform().origin.distance_to(target_location);
}
@@ -279,8 +279,8 @@ Vector3 NavigationAgent3D::get_final_location() {
void NavigationAgent3D::set_velocity(Vector3 p_velocity) {
target_velocity = p_velocity;
- NavigationServer::get_singleton()->agent_set_target_velocity(agent, target_velocity);
- NavigationServer::get_singleton()->agent_set_velocity(agent, prev_safe_velocity);
+ NavigationServer3D::get_singleton()->agent_set_target_velocity(agent, target_velocity);
+ NavigationServer3D::get_singleton()->agent_set_velocity(agent, prev_safe_velocity);
velocity_submitted = true;
}
@@ -298,7 +298,7 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) {
String NavigationAgent3D::get_configuration_warning() const {
if (!Object::cast_to<Node3D>(get_parent())) {
- return TTR("The NavigationAgent can be used only under a spatial node.");
+ return TTR("The NavigationAgent3D can be used only under a spatial node.");
}
return String();
@@ -306,8 +306,8 @@ String NavigationAgent3D::get_configuration_warning() const {
void NavigationAgent3D::update_navigation() {
- if (agent_parent == NULL) return;
- if (navigation == NULL) return;
+ if (agent_parent == nullptr) return;
+ if (navigation == nullptr) return;
if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
@@ -316,7 +316,7 @@ void NavigationAgent3D::update_navigation() {
bool reload_path = false;
- if (NavigationServer::get_singleton()->agent_is_map_changed(agent)) {
+ if (NavigationServer3D::get_singleton()->agent_is_map_changed(agent)) {
reload_path = true;
} else if (navigation_path.size() == 0) {
reload_path = true;
@@ -337,7 +337,7 @@ void NavigationAgent3D::update_navigation() {
}
if (reload_path) {
- navigation_path = NavigationServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true);
+ navigation_path = NavigationServer3D::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true);
navigation_finished = false;
nav_path_index = 0;
emit_signal("path_changed");
diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp
index 9eef4a1340..2ee2008799 100644
--- a/scene/3d/navigation_obstacle_3d.cpp
+++ b/scene/3d/navigation_obstacle_3d.cpp
@@ -33,7 +33,7 @@
#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/navigation_3d.h"
#include "scene/3d/physics_body_3d.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
void NavigationObstacle3D::_bind_methods() {
@@ -49,12 +49,12 @@ void NavigationObstacle3D::_notification(int p_what) {
// Search the navigation node and set it
{
- Navigation3D *nav = NULL;
+ Navigation3D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation3D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -65,21 +65,21 @@ void NavigationObstacle3D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- set_navigation(NULL);
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
Node3D *spatial = Object::cast_to<Node3D>(get_parent());
if (spatial) {
- NavigationServer::get_singleton()->agent_set_position(agent, spatial->get_global_transform().origin);
+ NavigationServer3D::get_singleton()->agent_set_position(agent, spatial->get_global_transform().origin);
}
PhysicsBody3D *rigid = Object::cast_to<PhysicsBody3D>(get_parent());
if (rigid) {
Vector3 v = rigid->get_linear_velocity();
- NavigationServer::get_singleton()->agent_set_velocity(agent, v);
- NavigationServer::get_singleton()->agent_set_target_velocity(agent, v);
+ NavigationServer3D::get_singleton()->agent_set_velocity(agent, v);
+ NavigationServer3D::get_singleton()->agent_set_target_velocity(agent, v);
}
} break;
@@ -87,13 +87,13 @@ void NavigationObstacle3D::_notification(int p_what) {
}
NavigationObstacle3D::NavigationObstacle3D() :
- navigation(NULL),
+ navigation(nullptr),
agent(RID()) {
- agent = NavigationServer::get_singleton()->agent_create();
+ agent = NavigationServer3D::get_singleton()->agent_create();
}
NavigationObstacle3D::~NavigationObstacle3D() {
- NavigationServer::get_singleton()->free(agent);
+ NavigationServer3D::get_singleton()->free(agent);
agent = RID(); // Pointless
}
@@ -102,12 +102,12 @@ void NavigationObstacle3D::set_navigation(Navigation3D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationObstacle3D::set_navigation_node(Node *p_nav) {
Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
@@ -118,7 +118,7 @@ Node *NavigationObstacle3D::get_navigation_node() const {
String NavigationObstacle3D::get_configuration_warning() const {
if (!Object::cast_to<Node3D>(get_parent())) {
- return TTR("The NavigationObstacle only serves to provide collision avoidance to a spatial object.");
+ return TTR("The NavigationObstacle3D only serves to provide collision avoidance to a spatial object.");
}
return String();
@@ -155,9 +155,9 @@ void NavigationObstacle3D::update_agent_shape() {
radius = 1.0; // Never a 0 radius
// Initialize the Agent as an object
- NavigationServer::get_singleton()->agent_set_neighbor_dist(agent, 0.0);
- NavigationServer::get_singleton()->agent_set_max_neighbors(agent, 0);
- NavigationServer::get_singleton()->agent_set_time_horizon(agent, 0.0);
- NavigationServer::get_singleton()->agent_set_radius(agent, radius);
- NavigationServer::get_singleton()->agent_set_max_speed(agent, 0.0);
+ NavigationServer3D::get_singleton()->agent_set_neighbor_dist(agent, 0.0);
+ NavigationServer3D::get_singleton()->agent_set_max_neighbors(agent, 0);
+ NavigationServer3D::get_singleton()->agent_set_time_horizon(agent, 0.0);
+ NavigationServer3D::get_singleton()->agent_set_radius(agent, radius);
+ NavigationServer3D::get_singleton()->agent_set_max_speed(agent, 0.0);
}
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 8035e6149d..043b816033 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -29,10 +29,11 @@
/*************************************************************************/
#include "navigation_region_3d.h"
+
#include "core/os/thread.h"
#include "mesh_instance_3d.h"
#include "navigation_3d.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
void NavigationRegion3D::set_enabled(bool p_enabled) {
@@ -45,12 +46,12 @@ void NavigationRegion3D::set_enabled(bool p_enabled) {
if (!enabled) {
- NavigationServer::get_singleton()->region_set_map(region, RID());
+ NavigationServer3D::get_singleton()->region_set_map(region, RID());
} else {
if (navigation) {
- NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid());
+ NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
}
}
@@ -86,7 +87,7 @@ void NavigationRegion3D::_notification(int p_what) {
if (enabled) {
- NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid());
+ NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
}
break;
}
@@ -110,21 +111,21 @@ void NavigationRegion3D::_notification(int p_what) {
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
- NavigationServer::get_singleton()->region_set_transform(region, get_global_transform());
+ NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform());
} break;
case NOTIFICATION_EXIT_TREE: {
if (navigation) {
- NavigationServer::get_singleton()->region_set_map(region, RID());
+ NavigationServer3D::get_singleton()->region_set_map(region, RID());
}
if (debug_view) {
debug_view->queue_delete();
- debug_view = NULL;
+ debug_view = nullptr;
}
- navigation = NULL;
+ navigation = nullptr;
} break;
}
}
@@ -144,7 +145,7 @@ void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmes
navmesh->add_change_receptor(this);
}
- NavigationServer::get_singleton()->region_set_navmesh(region, p_navmesh);
+ NavigationServer3D::get_singleton()->region_set_navmesh(region, p_navmesh);
if (debug_view && navmesh.is_valid()) {
Object::cast_to<MeshInstance3D>(debug_view)->set_mesh(navmesh->get_debug_mesh());
@@ -171,7 +172,7 @@ void _bake_navigation_mesh(void *p_user_data) {
if (args->nav_region->get_navigation_mesh().is_valid()) {
Ref<NavigationMesh> nav_mesh = args->nav_region->get_navigation_mesh()->duplicate();
- NavigationServer::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region);
+ NavigationServer3D::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region);
args->nav_region->call_deferred("_bake_finished", nav_mesh);
memdelete(args);
} else {
@@ -183,18 +184,18 @@ void _bake_navigation_mesh(void *p_user_data) {
}
void NavigationRegion3D::bake_navigation_mesh() {
- ERR_FAIL_COND(bake_thread != NULL);
+ ERR_FAIL_COND(bake_thread != nullptr);
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
args->nav_region = this;
bake_thread = Thread::create(_bake_navigation_mesh, args);
- ERR_FAIL_COND(bake_thread == NULL);
+ ERR_FAIL_COND(bake_thread == nullptr);
}
void NavigationRegion3D::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
set_navigation_mesh(p_nav_mesh);
- bake_thread = NULL;
+ bake_thread = nullptr;
}
String NavigationRegion3D::get_configuration_warning() const {
@@ -214,7 +215,7 @@ String NavigationRegion3D::get_configuration_warning() const {
c = Object::cast_to<Node3D>(c->get_parent());
}
- return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data.");
+ return TTR("NavigationRegion3D must be a child or grandchild to a Navigation3D node. It only provides navigation data.");
}
void NavigationRegion3D::_bind_methods() {
@@ -244,15 +245,15 @@ NavigationRegion3D::NavigationRegion3D() {
enabled = true;
set_notify_transform(true);
- region = NavigationServer::get_singleton()->region_create();
+ region = NavigationServer3D::get_singleton()->region_create();
- navigation = NULL;
- debug_view = NULL;
- bake_thread = NULL;
+ navigation = nullptr;
+ debug_view = nullptr;
+ bake_thread = nullptr;
}
NavigationRegion3D::~NavigationRegion3D() {
if (navmesh.is_valid())
navmesh->remove_change_receptor(this);
- NavigationServer::get_singleton()->free(region);
+ NavigationServer3D::get_singleton()->free(region);
}
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 7f444d59bf..0b7407e049 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -134,7 +134,7 @@ void Node3D::_notification(int p_what) {
if (data.parent)
data.C = data.parent->data.children.push_back(this);
else
- data.C = NULL;
+ data.C = nullptr;
if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) {
@@ -158,14 +158,14 @@ void Node3D::_notification(int p_what) {
get_tree()->xform_change_list.remove(&xform_change);
if (data.C)
data.parent->data.children.erase(data.C);
- data.parent = NULL;
- data.C = NULL;
+ data.parent = nullptr;
+ data.C = nullptr;
data.toplevel_active = false;
} break;
case NOTIFICATION_ENTER_WORLD: {
data.inside_world = true;
- data.viewport = NULL;
+ data.viewport = nullptr;
Node *parent = get_parent();
while (parent && !data.viewport) {
data.viewport = Object::cast_to<Viewport>(parent);
@@ -176,7 +176,7 @@ void Node3D::_notification(int p_what) {
if (get_script_instance()) {
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, nullptr, 0);
}
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) {
@@ -208,10 +208,10 @@ void Node3D::_notification(int p_what) {
if (get_script_instance()) {
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, NULL, 0);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, nullptr, 0);
}
- data.viewport = NULL;
+ data.viewport = nullptr;
data.inside_world = false;
} break;
@@ -829,7 +829,7 @@ Node3D::Node3D() :
data.toplevel = false;
data.toplevel_active = false;
data.scale = Vector3(1, 1, 1);
- data.viewport = NULL;
+ data.viewport = nullptr;
data.inside_world = false;
data.visible = true;
data.disable_scale = false;
@@ -840,8 +840,8 @@ Node3D::Node3D() :
#endif
data.notify_local_transform = false;
data.notify_transform = false;
- data.parent = NULL;
- data.C = NULL;
+ data.parent = nullptr;
+ data.C = nullptr;
}
Node3D::~Node3D() {
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp
index 2169f664ea..f06135f53d 100644
--- a/scene/3d/path_3d.cpp
+++ b/scene/3d/path_3d.cpp
@@ -229,7 +229,7 @@ void PathFollow3D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
- path = NULL;
+ path = nullptr;
} break;
}
}
@@ -262,11 +262,11 @@ String PathFollow3D::get_configuration_warning() const {
return String();
if (!Object::cast_to<Path3D>(get_parent())) {
- return TTR("PathFollow only works when set as a child of a Path node.");
+ return TTR("PathFollow3D only works when set as a child of a Path3D node.");
} else {
Path3D *path = Object::cast_to<Path3D>(get_parent());
if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) {
- return TTR("PathFollow's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path's Curve resource.");
+ return TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.");
}
}
@@ -409,7 +409,7 @@ PathFollow3D::PathFollow3D() {
delta_offset = 0;
h_offset = 0;
v_offset = 0;
- path = NULL;
+ path = nullptr;
rotation_mode = ROTATION_XYZ;
cubic = true;
loop = true;
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index ce1643aa6c..2b6eb8ac8a 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -38,7 +38,7 @@
#include "core/rid.h"
#include "scene/3d/collision_shape_3d.h"
#include "scene/scene_string_names.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
#ifdef TOOLS_ENABLED
#include "editor/plugins/node_3d_editor_plugin.h"
@@ -61,7 +61,7 @@ float PhysicsBody3D::get_inverse_mass() const {
void PhysicsBody3D::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
- PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), p_layer);
+ PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), p_layer);
}
uint32_t PhysicsBody3D::get_collision_layer() const {
@@ -72,7 +72,7 @@ uint32_t PhysicsBody3D::get_collision_layer() const {
void PhysicsBody3D::set_collision_mask(uint32_t p_mask) {
collision_mask = p_mask;
- PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), p_mask);
+ PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), p_mask);
}
uint32_t PhysicsBody3D::get_collision_mask() const {
@@ -112,11 +112,11 @@ bool PhysicsBody3D::get_collision_layer_bit(int p_bit) const {
Array PhysicsBody3D::get_collision_exceptions() {
List<RID> exceptions;
- PhysicsServer::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
+ PhysicsServer3D::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions);
Array ret;
for (List<RID>::Element *E = exceptions.front(); E; E = E->next()) {
RID body = E->get();
- ObjectID instance_id = PhysicsServer::get_singleton()->body_get_object_instance_id(body);
+ ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
ret.append(physics_body);
@@ -128,16 +128,16 @@ void PhysicsBody3D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
- PhysicsServer::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
+ PhysicsServer3D::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
}
void PhysicsBody3D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
- PhysicsServer::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
+ PhysicsServer3D::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
}
void PhysicsBody3D::_set_layers(uint32_t p_mask) {
@@ -171,8 +171,8 @@ void PhysicsBody3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
}
-PhysicsBody3D::PhysicsBody3D(PhysicsServer::BodyMode p_mode) :
- CollisionObject3D(PhysicsServer::get_singleton()->body_create(p_mode), false) {
+PhysicsBody3D::PhysicsBody3D(PhysicsServer3D::BodyMode p_mode) :
+ CollisionObject3D(PhysicsServer3D::get_singleton()->body_create(p_mode), false) {
collision_layer = 1;
collision_mask = 1;
@@ -200,13 +200,13 @@ Ref<PhysicsMaterial> StaticBody3D::get_physics_material_override() const {
void StaticBody3D::set_constant_linear_velocity(const Vector3 &p_vel) {
constant_linear_velocity = p_vel;
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_LINEAR_VELOCITY, constant_linear_velocity);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY, constant_linear_velocity);
}
void StaticBody3D::set_constant_angular_velocity(const Vector3 &p_vel) {
constant_angular_velocity = p_vel;
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_ANGULAR_VELOCITY, constant_angular_velocity);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY, constant_angular_velocity);
}
Vector3 StaticBody3D::get_constant_linear_velocity() const {
@@ -238,18 +238,18 @@ void StaticBody3D::_bind_methods() {
}
StaticBody3D::StaticBody3D() :
- PhysicsBody3D(PhysicsServer::BODY_MODE_STATIC) {
+ PhysicsBody3D(PhysicsServer3D::BODY_MODE_STATIC) {
}
StaticBody3D::~StaticBody3D() {}
void StaticBody3D::_reload_physics_characteristics() {
if (physics_material_override.is_null()) {
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, 0);
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, 1);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_BOUNCE, 0);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_FRICTION, 1);
} else {
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce());
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, physics_material_override->computed_friction());
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce());
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_FRICTION, physics_material_override->computed_friction());
}
}
@@ -372,9 +372,9 @@ struct _RigidBodyInOut {
void RigidBody3D::_direct_state_changed(Object *p_state) {
#ifdef DEBUG_ENABLED
- state = Object::cast_to<PhysicsDirectBodyState>(p_state);
+ state = Object::cast_to<PhysicsDirectBodyState3D>(p_state);
#else
- state = (PhysicsDirectBodyState *)p_state; //trust it
+ state = (PhysicsDirectBodyState3D *)p_state; //trust it
#endif
set_ignore_transform_notification(true);
@@ -406,7 +406,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) {
_RigidBodyInOut *toadd = (_RigidBodyInOut *)alloca(state->get_contact_count() * sizeof(_RigidBodyInOut));
int toadd_count = 0; //state->get_contact_count();
- RigidBody_RemoveAction *toremove = (RigidBody_RemoveAction *)alloca(rc * sizeof(RigidBody_RemoveAction));
+ RigidBody3D_RemoveAction *toremove = (RigidBody3D_RemoveAction *)alloca(rc * sizeof(RigidBody3D_RemoveAction));
int toremove_count = 0;
//put the ones to add
@@ -474,7 +474,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) {
contact_monitor->locked = false;
}
- state = NULL;
+ state = nullptr;
}
void RigidBody3D::_notification(int p_what) {
@@ -502,20 +502,20 @@ void RigidBody3D::set_mode(Mode p_mode) {
case MODE_RIGID: {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_RIGID);
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_RIGID);
} break;
case MODE_STATIC: {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_STATIC);
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_STATIC);
} break;
case MODE_CHARACTER: {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_CHARACTER);
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_CHARACTER);
} break;
case MODE_KINEMATIC: {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_KINEMATIC);
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_KINEMATIC);
} break;
}
update_configuration_warning();
@@ -532,7 +532,7 @@ void RigidBody3D::set_mass(real_t p_mass) {
mass = p_mass;
_change_notify("mass");
_change_notify("weight");
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_MASS, mass);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_MASS, mass);
}
real_t RigidBody3D::get_mass() const {
@@ -570,7 +570,7 @@ Ref<PhysicsMaterial> RigidBody3D::get_physics_material_override() const {
void RigidBody3D::set_gravity_scale(real_t p_gravity_scale) {
gravity_scale = p_gravity_scale;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
}
real_t RigidBody3D::get_gravity_scale() const {
@@ -581,7 +581,7 @@ void RigidBody3D::set_linear_damp(real_t p_linear_damp) {
ERR_FAIL_COND(p_linear_damp < -1);
linear_damp = p_linear_damp;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_LINEAR_DAMP, linear_damp);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_LINEAR_DAMP, linear_damp);
}
real_t RigidBody3D::get_linear_damp() const {
@@ -592,7 +592,7 @@ void RigidBody3D::set_angular_damp(real_t p_angular_damp) {
ERR_FAIL_COND(p_angular_damp < -1);
angular_damp = p_angular_damp;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_ANGULAR_DAMP, angular_damp);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP, angular_damp);
}
real_t RigidBody3D::get_angular_damp() const {
@@ -608,7 +608,7 @@ void RigidBody3D::set_axis_velocity(const Vector3 &p_axis) {
if (state) {
set_linear_velocity(v);
} else {
- PhysicsServer::get_singleton()->body_set_axis_velocity(get_rid(), p_axis);
+ PhysicsServer3D::get_singleton()->body_set_axis_velocity(get_rid(), p_axis);
linear_velocity = v;
}
}
@@ -619,7 +619,7 @@ void RigidBody3D::set_linear_velocity(const Vector3 &p_velocity) {
if (state)
state->set_linear_velocity(linear_velocity);
else
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_LINEAR_VELOCITY, linear_velocity);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY, linear_velocity);
}
Vector3 RigidBody3D::get_linear_velocity() const {
@@ -633,7 +633,7 @@ void RigidBody3D::set_angular_velocity(const Vector3 &p_velocity) {
if (state)
state->set_angular_velocity(angular_velocity);
else
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_ANGULAR_VELOCITY, angular_velocity);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY, angular_velocity);
}
Vector3 RigidBody3D::get_angular_velocity() const {
@@ -646,7 +646,7 @@ void RigidBody3D::set_use_custom_integrator(bool p_enable) {
return;
custom_integrator = p_enable;
- PhysicsServer::get_singleton()->body_set_omit_force_integration(get_rid(), p_enable);
+ PhysicsServer3D::get_singleton()->body_set_omit_force_integration(get_rid(), p_enable);
}
bool RigidBody3D::is_using_custom_integrator() {
@@ -656,13 +656,13 @@ bool RigidBody3D::is_using_custom_integrator() {
void RigidBody3D::set_sleeping(bool p_sleeping) {
sleeping = p_sleeping;
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_SLEEPING, sleeping);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_SLEEPING, sleeping);
}
void RigidBody3D::set_can_sleep(bool p_active) {
can_sleep = p_active;
- PhysicsServer::get_singleton()->body_set_state(get_rid(), PhysicsServer::BODY_STATE_CAN_SLEEP, p_active);
+ PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_CAN_SLEEP, p_active);
}
bool RigidBody3D::is_able_to_sleep() const {
@@ -678,7 +678,7 @@ bool RigidBody3D::is_sleeping() const {
void RigidBody3D::set_max_contacts_reported(int p_amount) {
max_contacts_reported = p_amount;
- PhysicsServer::get_singleton()->body_set_max_contacts_reported(get_rid(), p_amount);
+ PhysicsServer3D::get_singleton()->body_set_max_contacts_reported(get_rid(), p_amount);
}
int RigidBody3D::get_max_contacts_reported() const {
@@ -687,34 +687,34 @@ int RigidBody3D::get_max_contacts_reported() const {
}
void RigidBody3D::add_central_force(const Vector3 &p_force) {
- PhysicsServer::get_singleton()->body_add_central_force(get_rid(), p_force);
+ PhysicsServer3D::get_singleton()->body_add_central_force(get_rid(), p_force);
}
void RigidBody3D::add_force(const Vector3 &p_force, const Vector3 &p_pos) {
- PhysicsServer::get_singleton()->body_add_force(get_rid(), p_force, p_pos);
+ PhysicsServer3D::get_singleton()->body_add_force(get_rid(), p_force, p_pos);
}
void RigidBody3D::add_torque(const Vector3 &p_torque) {
- PhysicsServer::get_singleton()->body_add_torque(get_rid(), p_torque);
+ PhysicsServer3D::get_singleton()->body_add_torque(get_rid(), p_torque);
}
void RigidBody3D::apply_central_impulse(const Vector3 &p_impulse) {
- PhysicsServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
+ PhysicsServer3D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
}
void RigidBody3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
- PhysicsServer::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
+ PhysicsServer3D::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
}
void RigidBody3D::apply_torque_impulse(const Vector3 &p_impulse) {
- PhysicsServer::get_singleton()->body_apply_torque_impulse(get_rid(), p_impulse);
+ PhysicsServer3D::get_singleton()->body_apply_torque_impulse(get_rid(), p_impulse);
}
void RigidBody3D::set_use_continuous_collision_detection(bool p_enable) {
ccd = p_enable;
- PhysicsServer::get_singleton()->body_set_enable_continuous_collision_detection(get_rid(), p_enable);
+ PhysicsServer3D::get_singleton()->body_set_enable_continuous_collision_detection(get_rid(), p_enable);
}
bool RigidBody3D::is_using_continuous_collision_detection() const {
@@ -744,7 +744,7 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) {
}
memdelete(contact_monitor);
- contact_monitor = NULL;
+ contact_monitor = nullptr;
} else {
contact_monitor = memnew(ContactMonitor);
@@ -754,15 +754,15 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) {
bool RigidBody3D::is_contact_monitor_enabled() const {
- return contact_monitor != NULL;
+ return contact_monitor != nullptr;
}
-void RigidBody3D::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool p_lock) {
- PhysicsServer::get_singleton()->body_set_axis_lock(get_rid(), p_axis, p_lock);
+void RigidBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) {
+ PhysicsServer3D::get_singleton()->body_set_axis_lock(get_rid(), p_axis, p_lock);
}
-bool RigidBody3D::get_axis_lock(PhysicsServer::BodyAxis p_axis) const {
- return PhysicsServer::get_singleton()->body_is_axis_locked(get_rid(), p_axis);
+bool RigidBody3D::get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const {
+ return PhysicsServer3D::get_singleton()->body_is_axis_locked(get_rid(), p_axis);
}
Array RigidBody3D::get_colliding_bodies() const {
@@ -794,7 +794,7 @@ String RigidBody3D::get_configuration_warning() const {
if (warning != String()) {
warning += "\n\n";
}
- warning += TTR("Size changes to RigidBody (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
+ warning += TTR("Size changes to RigidBody3D (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
return warning;
@@ -864,7 +864,7 @@ void RigidBody3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_colliding_bodies"), &RigidBody3D::get_colliding_bodies);
- BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState")));
+ BIND_VMETHOD(MethodInfo("_integrate_forces", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectBodyState3D")));
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
@@ -878,12 +878,12 @@ void RigidBody3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sleeping"), "set_sleeping", "is_sleeping");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "can_sleep"), "set_can_sleep", "is_able_to_sleep");
ADD_GROUP("Axis Lock", "axis_lock_");
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_x"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_X);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_y"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_z"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_Z);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_x"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_ANGULAR_X);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_y"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_ANGULAR_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_z"), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_ANGULAR_Z);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_x"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_X);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_y"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Y);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_linear_z"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Z);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_x"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_ANGULAR_X);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_y"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_ANGULAR_Y);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "axis_lock_angular_z"), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_ANGULAR_Z);
ADD_GROUP("Linear", "linear_");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "linear_velocity"), "set_linear_velocity", "get_linear_velocity");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), "set_linear_damp", "get_linear_damp");
@@ -904,13 +904,13 @@ void RigidBody3D::_bind_methods() {
}
RigidBody3D::RigidBody3D() :
- PhysicsBody3D(PhysicsServer::BODY_MODE_RIGID) {
+ PhysicsBody3D(PhysicsServer3D::BODY_MODE_RIGID) {
mode = MODE_RIGID;
mass = 1;
max_contacts_reported = 0;
- state = NULL;
+ state = nullptr;
gravity_scale = 1;
linear_damp = -1;
@@ -921,10 +921,10 @@ RigidBody3D::RigidBody3D() :
ccd = false;
custom_integrator = false;
- contact_monitor = NULL;
+ contact_monitor = nullptr;
can_sleep = true;
- PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
}
RigidBody3D::~RigidBody3D() {
@@ -935,11 +935,11 @@ RigidBody3D::~RigidBody3D() {
void RigidBody3D::_reload_physics_characteristics() {
if (physics_material_override.is_null()) {
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, 0);
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, 1);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_BOUNCE, 0);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_FRICTION, 1);
} else {
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce());
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, physics_material_override->computed_friction());
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce());
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_FRICTION, physics_material_override->computed_friction());
}
}
@@ -974,8 +974,8 @@ Vector3 KinematicBody3D::get_angular_velocity() const {
bool KinematicBody3D::move_and_collide(const Vector3 &p_motion, bool p_infinite_inertia, Collision &r_collision, bool p_exclude_raycast_shapes, bool p_test_only) {
Transform gt = get_global_transform();
- PhysicsServer::MotionResult result;
- bool colliding = PhysicsServer::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_infinite_inertia, &result, p_exclude_raycast_shapes);
+ PhysicsServer3D::MotionResult result;
+ bool colliding = PhysicsServer3D::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_infinite_inertia, &result, p_exclude_raycast_shapes);
if (colliding) {
r_collision.collider_metadata = result.collider_metadata;
@@ -1168,17 +1168,17 @@ bool KinematicBody3D::test_move(const Transform &p_from, const Vector3 &p_motion
ERR_FAIL_COND_V(!is_inside_tree(), false);
- return PhysicsServer::get_singleton()->body_test_motion(get_rid(), p_from, p_motion, p_infinite_inertia);
+ return PhysicsServer3D::get_singleton()->body_test_motion(get_rid(), p_from, p_motion, p_infinite_inertia);
}
bool KinematicBody3D::separate_raycast_shapes(bool p_infinite_inertia, Collision &r_collision) {
- PhysicsServer::SeparationResult sep_res[8]; //max 8 rays
+ PhysicsServer3D::SeparationResult sep_res[8]; //max 8 rays
Transform gt = get_global_transform();
Vector3 recover;
- int hits = PhysicsServer::get_singleton()->body_test_ray_separation(get_rid(), gt, p_infinite_inertia, recover, sep_res, 8, margin);
+ int hits = PhysicsServer3D::get_singleton()->body_test_ray_separation(get_rid(), gt, p_infinite_inertia, recover, sep_res, 8, margin);
int deepest = -1;
float deepest_depth;
for (int i = 0; i < hits; i++) {
@@ -1208,18 +1208,18 @@ bool KinematicBody3D::separate_raycast_shapes(bool p_infinite_inertia, Collision
}
}
-void KinematicBody3D::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool p_lock) {
- PhysicsServer::get_singleton()->body_set_axis_lock(get_rid(), p_axis, p_lock);
+void KinematicBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) {
+ PhysicsServer3D::get_singleton()->body_set_axis_lock(get_rid(), p_axis, p_lock);
}
-bool KinematicBody3D::get_axis_lock(PhysicsServer::BodyAxis p_axis) const {
- return PhysicsServer::get_singleton()->body_is_axis_locked(get_rid(), p_axis);
+bool KinematicBody3D::get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const {
+ return PhysicsServer3D::get_singleton()->body_is_axis_locked(get_rid(), p_axis);
}
void KinematicBody3D::set_safe_margin(float p_margin) {
margin = p_margin;
- PhysicsServer::get_singleton()->body_set_kinematic_safe_margin(get_rid(), margin);
+ PhysicsServer3D::get_singleton()->body_set_kinematic_safe_margin(get_rid(), margin);
}
float KinematicBody3D::get_safe_margin() const {
@@ -1289,18 +1289,18 @@ void KinematicBody3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_slide_count"), &KinematicBody3D::get_slide_count);
ClassDB::bind_method(D_METHOD("get_slide_collision", "slide_idx"), &KinematicBody3D::_get_slide_collision);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_x", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_X);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_y", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_Y);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_z", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer::BODY_AXIS_LINEAR_Z);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_x", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_X);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_y", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Y);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "move_lock_z", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_axis_lock", "get_axis_lock", PhysicsServer3D::BODY_AXIS_LINEAR_Z);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "collision/safe_margin", PROPERTY_HINT_RANGE, "0.001,256,0.001"), "set_safe_margin", "get_safe_margin");
}
void KinematicBody3D::_direct_state_changed(Object *p_state) {
#ifdef DEBUG_ENABLED
- PhysicsDirectBodyState *state = Object::cast_to<PhysicsDirectBodyState>(p_state);
+ PhysicsDirectBodyState3D *state = Object::cast_to<PhysicsDirectBodyState3D>(p_state);
#else
- PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state; //trust it
+ PhysicsDirectBodyState3D *state = (PhysicsDirectBodyState3D *)p_state; //trust it
#endif
linear_velocity = state->get_linear_velocity();
@@ -1308,7 +1308,7 @@ void KinematicBody3D::_direct_state_changed(Object *p_state) {
}
KinematicBody3D::KinematicBody3D() :
- PhysicsBody3D(PhysicsServer::BODY_MODE_KINEMATIC) {
+ PhysicsBody3D(PhysicsServer3D::BODY_MODE_KINEMATIC) {
margin = 0.001;
locked_axis = 0;
@@ -1316,17 +1316,17 @@ KinematicBody3D::KinematicBody3D() :
on_ceiling = false;
on_wall = false;
- PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
}
KinematicBody3D::~KinematicBody3D() {
if (motion_cache.is_valid()) {
- motion_cache->owner = NULL;
+ motion_cache->owner = nullptr;
}
for (int i = 0; i < slide_colliders.size(); i++) {
if (slide_colliders[i].is_valid()) {
- slide_colliders.write[i]->owner = NULL;
+ slide_colliders.write[i]->owner = nullptr;
}
}
}
@@ -1346,7 +1346,7 @@ Vector3 KinematicCollision3D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision3D::get_local_shape() const {
- if (!owner) return NULL;
+ if (!owner) return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
@@ -1357,7 +1357,7 @@ Object *KinematicCollision3D::get_collider() const {
return ObjectDB::get_instance(collision.collider);
}
- return NULL;
+ return nullptr;
}
ObjectID KinematicCollision3D::get_collider_id() const {
@@ -1374,7 +1374,7 @@ Object *KinematicCollision3D::get_collider_shape() const {
}
}
- return NULL;
+ return nullptr;
}
int KinematicCollision3D::get_collider_shape_index() const {
@@ -1420,7 +1420,7 @@ KinematicCollision3D::KinematicCollision3D() {
collision.collider_shape = 0;
collision.local_shape = 0;
- owner = NULL;
+ owner = nullptr;
}
///////////////////////////////////////
@@ -1437,11 +1437,11 @@ void PhysicalBone3D::JointData::_get_property_list(List<PropertyInfo> *p_list) c
}
void PhysicalBone3D::apply_central_impulse(const Vector3 &p_impulse) {
- PhysicsServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
+ PhysicsServer3D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
}
void PhysicalBone3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
- PhysicsServer::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
+ PhysicsServer3D::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
}
void PhysicalBone3D::reset_physics_simulation_state() {
@@ -1470,17 +1470,17 @@ bool PhysicalBone3D::PinJointData::_set(const StringName &p_name, const Variant
if ("joint_constraints/bias" == p_name) {
bias = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_BIAS, bias);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(j, PhysicsServer3D::PIN_JOINT_BIAS, bias);
} else if ("joint_constraints/damping" == p_name) {
damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_DAMPING, damping);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(j, PhysicsServer3D::PIN_JOINT_DAMPING, damping);
} else if ("joint_constraints/impulse_clamp" == p_name) {
impulse_clamp = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PIN_JOINT_IMPULSE_CLAMP, impulse_clamp);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(j, PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP, impulse_clamp);
} else {
return false;
@@ -1523,27 +1523,27 @@ bool PhysicalBone3D::ConeJointData::_set(const StringName &p_name, const Variant
if ("joint_constraints/swing_span" == p_name) {
swing_span = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN, swing_span);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN, swing_span);
} else if ("joint_constraints/twist_span" == p_name) {
twist_span = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN, twist_span);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN, twist_span);
} else if ("joint_constraints/bias" == p_name) {
bias = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_BIAS, bias);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_BIAS, bias);
} else if ("joint_constraints/softness" == p_name) {
softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_SOFTNESS, softness);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS, softness);
} else if ("joint_constraints/relaxation" == p_name) {
relaxation = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::CONE_TWIST_JOINT_RELAXATION, relaxation);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION, relaxation);
} else {
return false;
@@ -1592,32 +1592,32 @@ bool PhysicalBone3D::HingeJointData::_set(const StringName &p_name, const Varian
if ("joint_constraints/angular_limit_enabled" == p_name) {
angular_limit_enabled = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_flag(j, PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT, angular_limit_enabled);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_flag(j, PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT, angular_limit_enabled);
} else if ("joint_constraints/angular_limit_upper" == p_name) {
angular_limit_upper = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_UPPER, angular_limit_upper);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER, angular_limit_upper);
} else if ("joint_constraints/angular_limit_lower" == p_name) {
angular_limit_lower = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_LOWER, angular_limit_lower);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER, angular_limit_lower);
} else if ("joint_constraints/angular_limit_bias" == p_name) {
angular_limit_bias = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_BIAS, angular_limit_bias);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS, angular_limit_bias);
} else if ("joint_constraints/angular_limit_softness" == p_name) {
angular_limit_softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS, angular_limit_softness);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS, angular_limit_softness);
} else if ("joint_constraints/angular_limit_relaxation" == p_name) {
angular_limit_relaxation = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION, angular_limit_relaxation);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION, angular_limit_relaxation);
} else {
return false;
@@ -1669,52 +1669,52 @@ bool PhysicalBone3D::SliderJointData::_set(const StringName &p_name, const Varia
if ("joint_constraints/linear_limit_upper" == p_name) {
linear_limit_upper = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER, linear_limit_upper);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER, linear_limit_upper);
} else if ("joint_constraints/linear_limit_lower" == p_name) {
linear_limit_lower = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER, linear_limit_lower);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER, linear_limit_lower);
} else if ("joint_constraints/linear_limit_softness" == p_name) {
linear_limit_softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, linear_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, linear_limit_softness);
} else if ("joint_constraints/linear_limit_restitution" == p_name) {
linear_limit_restitution = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, linear_limit_restitution);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, linear_limit_restitution);
} else if ("joint_constraints/linear_limit_damping" == p_name) {
linear_limit_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, linear_limit_restitution);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, linear_limit_restitution);
} else if ("joint_constraints/angular_limit_upper" == p_name) {
angular_limit_upper = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, angular_limit_upper);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, angular_limit_upper);
} else if ("joint_constraints/angular_limit_lower" == p_name) {
angular_limit_lower = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, angular_limit_lower);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, angular_limit_lower);
} else if ("joint_constraints/angular_limit_softness" == p_name) {
angular_limit_softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
} else if ("joint_constraints/angular_limit_restitution" == p_name) {
angular_limit_restitution = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, angular_limit_softness);
} else if ("joint_constraints/angular_limit_damping" == p_name) {
angular_limit_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, angular_limit_damping);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, angular_limit_damping);
} else {
return false;
@@ -1797,107 +1797,107 @@ bool PhysicalBone3D::SixDOFJointData::_set(const StringName &p_name, const Varia
if ("linear_limit_enabled" == var_name) {
axis_data[axis].linear_limit_enabled = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, axis_data[axis].linear_limit_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, axis_data[axis].linear_limit_enabled);
} else if ("linear_limit_upper" == var_name) {
axis_data[axis].linear_limit_upper = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT, axis_data[axis].linear_limit_upper);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT, axis_data[axis].linear_limit_upper);
} else if ("linear_limit_lower" == var_name) {
axis_data[axis].linear_limit_lower = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT, axis_data[axis].linear_limit_lower);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT, axis_data[axis].linear_limit_lower);
} else if ("linear_limit_softness" == var_name) {
axis_data[axis].linear_limit_softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, axis_data[axis].linear_limit_softness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, axis_data[axis].linear_limit_softness);
} else if ("linear_spring_enabled" == var_name) {
axis_data[axis].linear_spring_enabled = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, axis_data[axis].linear_spring_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, axis_data[axis].linear_spring_enabled);
} else if ("linear_spring_stiffness" == var_name) {
axis_data[axis].linear_spring_stiffness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, axis_data[axis].linear_spring_stiffness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, axis_data[axis].linear_spring_stiffness);
} else if ("linear_spring_damping" == var_name) {
axis_data[axis].linear_spring_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING, axis_data[axis].linear_spring_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING, axis_data[axis].linear_spring_damping);
} else if ("linear_equilibrium_point" == var_name) {
axis_data[axis].linear_equilibrium_point = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].linear_equilibrium_point);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].linear_equilibrium_point);
} else if ("linear_restitution" == var_name) {
axis_data[axis].linear_restitution = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION, axis_data[axis].linear_restitution);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION, axis_data[axis].linear_restitution);
} else if ("linear_damping" == var_name) {
axis_data[axis].linear_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING, axis_data[axis].linear_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING, axis_data[axis].linear_damping);
} else if ("angular_limit_enabled" == var_name) {
axis_data[axis].angular_limit_enabled = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, axis_data[axis].angular_limit_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, axis_data[axis].angular_limit_enabled);
} else if ("angular_limit_upper" == var_name) {
axis_data[axis].angular_limit_upper = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, axis_data[axis].angular_limit_upper);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, axis_data[axis].angular_limit_upper);
} else if ("angular_limit_lower" == var_name) {
axis_data[axis].angular_limit_lower = Math::deg2rad(real_t(p_value));
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, axis_data[axis].angular_limit_lower);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, axis_data[axis].angular_limit_lower);
} else if ("angular_limit_softness" == var_name) {
axis_data[axis].angular_limit_softness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, axis_data[axis].angular_limit_softness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, axis_data[axis].angular_limit_softness);
} else if ("angular_restitution" == var_name) {
axis_data[axis].angular_restitution = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION, axis_data[axis].angular_restitution);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION, axis_data[axis].angular_restitution);
} else if ("angular_damping" == var_name) {
axis_data[axis].angular_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING, axis_data[axis].angular_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING, axis_data[axis].angular_damping);
} else if ("erp" == var_name) {
axis_data[axis].erp = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, axis_data[axis].erp);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP, axis_data[axis].erp);
} else if ("angular_spring_enabled" == var_name) {
axis_data[axis].angular_spring_enabled = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, axis_data[axis].angular_spring_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, axis, PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, axis_data[axis].angular_spring_enabled);
} else if ("angular_spring_stiffness" == var_name) {
axis_data[axis].angular_spring_stiffness = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, axis_data[axis].angular_spring_stiffness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, axis_data[axis].angular_spring_stiffness);
} else if ("angular_spring_damping" == var_name) {
axis_data[axis].angular_spring_damping = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, axis_data[axis].angular_spring_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, axis_data[axis].angular_spring_damping);
} else if ("angular_equilibrium_point" == var_name) {
axis_data[axis].angular_equilibrium_point = p_value;
if (j.is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].angular_equilibrium_point);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, axis, PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, axis_data[axis].angular_equilibrium_point);
} else {
return false;
@@ -2078,9 +2078,9 @@ void PhysicalBone3D::_notification(int p_what) {
parent_skeleton->unbind_physical_bone_from_bone(bone_id);
}
}
- parent_skeleton = NULL;
+ parent_skeleton = nullptr;
if (joint.is_valid()) {
- PhysicsServer::get_singleton()->free(joint);
+ PhysicsServer3D::get_singleton()->free(joint);
joint = RID();
}
break;
@@ -2101,12 +2101,12 @@ void PhysicalBone3D::_direct_state_changed(Object *p_state) {
/// Update bone transform
- PhysicsDirectBodyState *state;
+ PhysicsDirectBodyState3D *state;
#ifdef DEBUG_ENABLED
- state = Object::cast_to<PhysicsDirectBodyState>(p_state);
+ state = Object::cast_to<PhysicsDirectBodyState3D>(p_state);
#else
- state = (PhysicsDirectBodyState *)p_state; //trust it
+ state = (PhysicsDirectBodyState3D *)p_state; //trust it
#endif
Transform global_transform(state->get_transform());
@@ -2181,7 +2181,7 @@ void PhysicalBone3D::_bind_methods() {
Skeleton3D *PhysicalBone3D::find_skeleton_parent(Node *p_parent) {
if (!p_parent) {
- return NULL;
+ return nullptr;
}
Skeleton3D *s = Object::cast_to<Skeleton3D>(p_parent);
return s ? s : find_skeleton_parent(p_parent->get_parent());
@@ -2197,7 +2197,7 @@ void PhysicalBone3D::_fix_joint_offset() {
void PhysicalBone3D::_reload_joint() {
if (joint.is_valid()) {
- PhysicsServer::get_singleton()->free(joint);
+ PhysicsServer3D::get_singleton()->free(joint);
joint = RID();
}
@@ -2217,78 +2217,78 @@ void PhysicalBone3D::_reload_joint() {
switch (get_joint_type()) {
case JOINT_TYPE_PIN: {
- joint = PhysicsServer::get_singleton()->joint_create_pin(body_a->get_rid(), local_a.origin, get_rid(), joint_offset.origin);
+ joint = PhysicsServer3D::get_singleton()->joint_create_pin(body_a->get_rid(), local_a.origin, get_rid(), joint_offset.origin);
const PinJointData *pjd(static_cast<const PinJointData *>(joint_data));
- PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_BIAS, pjd->bias);
- PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_DAMPING, pjd->damping);
- PhysicsServer::get_singleton()->pin_joint_set_param(joint, PhysicsServer::PIN_JOINT_IMPULSE_CLAMP, pjd->impulse_clamp);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(joint, PhysicsServer3D::PIN_JOINT_BIAS, pjd->bias);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(joint, PhysicsServer3D::PIN_JOINT_DAMPING, pjd->damping);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(joint, PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP, pjd->impulse_clamp);
} break;
case JOINT_TYPE_CONE: {
- joint = PhysicsServer::get_singleton()->joint_create_cone_twist(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ joint = PhysicsServer3D::get_singleton()->joint_create_cone_twist(body_a->get_rid(), local_a, get_rid(), joint_offset);
const ConeJointData *cjd(static_cast<const ConeJointData *>(joint_data));
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN, cjd->swing_span);
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN, cjd->twist_span);
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_BIAS, cjd->bias);
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_SOFTNESS, cjd->softness);
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer::CONE_TWIST_JOINT_RELAXATION, cjd->relaxation);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN, cjd->swing_span);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN, cjd->twist_span);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer3D::CONE_TWIST_JOINT_BIAS, cjd->bias);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS, cjd->softness);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(joint, PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION, cjd->relaxation);
} break;
case JOINT_TYPE_HINGE: {
- joint = PhysicsServer::get_singleton()->joint_create_hinge(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ joint = PhysicsServer3D::get_singleton()->joint_create_hinge(body_a->get_rid(), local_a, get_rid(), joint_offset);
const HingeJointData *hjd(static_cast<const HingeJointData *>(joint_data));
- PhysicsServer::get_singleton()->hinge_joint_set_flag(joint, PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT, hjd->angular_limit_enabled);
- PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_UPPER, hjd->angular_limit_upper);
- PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_LOWER, hjd->angular_limit_lower);
- PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_BIAS, hjd->angular_limit_bias);
- PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS, hjd->angular_limit_softness);
- PhysicsServer::get_singleton()->hinge_joint_set_param(joint, PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION, hjd->angular_limit_relaxation);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_flag(joint, PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT, hjd->angular_limit_enabled);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(joint, PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER, hjd->angular_limit_upper);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(joint, PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER, hjd->angular_limit_lower);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(joint, PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS, hjd->angular_limit_bias);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(joint, PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS, hjd->angular_limit_softness);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(joint, PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION, hjd->angular_limit_relaxation);
} break;
case JOINT_TYPE_SLIDER: {
- joint = PhysicsServer::get_singleton()->joint_create_slider(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ joint = PhysicsServer3D::get_singleton()->joint_create_slider(body_a->get_rid(), local_a, get_rid(), joint_offset);
const SliderJointData *sjd(static_cast<const SliderJointData *>(joint_data));
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER, sjd->linear_limit_upper);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER, sjd->linear_limit_lower);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, sjd->linear_limit_softness);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, sjd->linear_limit_restitution);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, sjd->linear_limit_restitution);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, sjd->angular_limit_upper);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, sjd->angular_limit_lower);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
- PhysicsServer::get_singleton()->slider_joint_set_param(joint, PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, sjd->angular_limit_damping);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER, sjd->linear_limit_upper);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER, sjd->linear_limit_lower);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS, sjd->linear_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION, sjd->linear_limit_restitution);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING, sjd->linear_limit_restitution);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER, sjd->angular_limit_upper);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER, sjd->angular_limit_lower);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS, sjd->angular_limit_softness);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(joint, PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING, sjd->angular_limit_damping);
} break;
case JOINT_TYPE_6DOF: {
- joint = PhysicsServer::get_singleton()->joint_create_generic_6dof(body_a->get_rid(), local_a, get_rid(), joint_offset);
+ joint = PhysicsServer3D::get_singleton()->joint_create_generic_6dof(body_a->get_rid(), local_a, get_rid(), joint_offset);
const SixDOFJointData *g6dofjd(static_cast<const SixDOFJointData *>(joint_data));
for (int axis = 0; axis < 3; ++axis) {
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, g6dofjd->axis_data[axis].linear_limit_enabled);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT, g6dofjd->axis_data[axis].linear_limit_upper);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT, g6dofjd->axis_data[axis].linear_limit_lower);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].linear_limit_softness);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, g6dofjd->axis_data[axis].linear_spring_enabled);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].linear_spring_stiffness);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING, g6dofjd->axis_data[axis].linear_spring_damping);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].linear_equilibrium_point);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION, g6dofjd->axis_data[axis].linear_restitution);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING, g6dofjd->axis_data[axis].linear_damping);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, g6dofjd->axis_data[axis].angular_limit_enabled);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, g6dofjd->axis_data[axis].angular_limit_upper);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, g6dofjd->axis_data[axis].angular_limit_lower);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].angular_limit_softness);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION, g6dofjd->axis_data[axis].angular_restitution);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING, g6dofjd->axis_data[axis].angular_damping);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_ERP, g6dofjd->axis_data[axis].erp);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, g6dofjd->axis_data[axis].angular_spring_enabled);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].angular_spring_stiffness);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, g6dofjd->axis_data[axis].angular_spring_damping);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].angular_equilibrium_point);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, g6dofjd->axis_data[axis].linear_limit_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT, g6dofjd->axis_data[axis].linear_limit_upper);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT, g6dofjd->axis_data[axis].linear_limit_lower);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].linear_limit_softness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING, g6dofjd->axis_data[axis].linear_spring_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].linear_spring_stiffness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING, g6dofjd->axis_data[axis].linear_spring_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].linear_equilibrium_point);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION, g6dofjd->axis_data[axis].linear_restitution);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING, g6dofjd->axis_data[axis].linear_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, g6dofjd->axis_data[axis].angular_limit_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT, g6dofjd->axis_data[axis].angular_limit_upper);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT, g6dofjd->axis_data[axis].angular_limit_lower);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS, g6dofjd->axis_data[axis].angular_limit_softness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION, g6dofjd->axis_data[axis].angular_restitution);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING, g6dofjd->axis_data[axis].angular_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP, g6dofjd->axis_data[axis].erp);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING, g6dofjd->axis_data[axis].angular_spring_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS, g6dofjd->axis_data[axis].angular_spring_stiffness);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING, g6dofjd->axis_data[axis].angular_spring_damping);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(joint, static_cast<Vector3::Axis>(axis), PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT, g6dofjd->axis_data[axis].angular_equilibrium_point);
}
} break;
@@ -2333,7 +2333,7 @@ void PhysicalBone3D::set_joint_type(JointType p_joint_type) {
if (joint_data)
memdelete(joint_data);
- joint_data = NULL;
+ joint_data = nullptr;
switch (p_joint_type) {
case JOINT_TYPE_PIN:
joint_data = memnew(PinJointData);
@@ -2441,7 +2441,7 @@ void PhysicalBone3D::set_mass(real_t p_mass) {
ERR_FAIL_COND(p_mass <= 0);
mass = p_mass;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_MASS, mass);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_MASS, mass);
}
real_t PhysicalBone3D::get_mass() const {
@@ -2464,7 +2464,7 @@ void PhysicalBone3D::set_friction(real_t p_friction) {
ERR_FAIL_COND(p_friction < 0 || p_friction > 1);
friction = p_friction;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, friction);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_FRICTION, friction);
}
real_t PhysicalBone3D::get_friction() const {
@@ -2477,7 +2477,7 @@ void PhysicalBone3D::set_bounce(real_t p_bounce) {
ERR_FAIL_COND(p_bounce < 0 || p_bounce > 1);
bounce = p_bounce;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_BOUNCE, bounce);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_BOUNCE, bounce);
}
real_t PhysicalBone3D::get_bounce() const {
@@ -2488,7 +2488,7 @@ real_t PhysicalBone3D::get_bounce() const {
void PhysicalBone3D::set_gravity_scale(real_t p_gravity_scale) {
gravity_scale = p_gravity_scale;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
+ PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
}
real_t PhysicalBone3D::get_gravity_scale() const {
@@ -2497,12 +2497,12 @@ real_t PhysicalBone3D::get_gravity_scale() const {
}
PhysicalBone3D::PhysicalBone3D() :
- PhysicsBody3D(PhysicsServer::BODY_MODE_STATIC),
+ PhysicsBody3D(PhysicsServer3D::BODY_MODE_STATIC),
#ifdef TOOLS_ENABLED
gizmo_move_joint(false),
#endif
- joint_data(NULL),
- parent_skeleton(NULL),
+ joint_data(nullptr),
+ parent_skeleton(nullptr),
simulate_physics(false),
_internal_simulate_physics(false),
bone_id(-1),
@@ -2566,10 +2566,10 @@ void PhysicalBone3D::_start_physics_simulation() {
return;
}
reset_to_rest_position();
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_RIGID);
- PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
- PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
- PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_RIGID);
+ PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
+ PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
+ PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
set_as_toplevel(true);
_internal_simulate_physics = true;
}
@@ -2579,16 +2579,16 @@ void PhysicalBone3D::_stop_physics_simulation() {
return;
}
if (parent_skeleton->get_animate_physical_bones()) {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_KINEMATIC);
- PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
- PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_KINEMATIC);
+ PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), get_collision_layer());
+ PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), get_collision_mask());
} else {
- PhysicsServer::get_singleton()->body_set_mode(get_rid(), PhysicsServer::BODY_MODE_STATIC);
- PhysicsServer::get_singleton()->body_set_collision_layer(get_rid(), 0);
- PhysicsServer::get_singleton()->body_set_collision_mask(get_rid(), 0);
+ PhysicsServer3D::get_singleton()->body_set_mode(get_rid(), PhysicsServer3D::BODY_MODE_STATIC);
+ PhysicsServer3D::get_singleton()->body_set_collision_layer(get_rid(), 0);
+ PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), 0);
}
if (_internal_simulate_physics) {
- PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, "");
+ PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, "");
parent_skeleton->set_bone_global_pose_override(bone_id, Transform(), 0.0, false);
set_as_toplevel(false);
_internal_simulate_physics = false;
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index e7a403122b..bf7854b68d 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -34,7 +34,7 @@
#include "core/vset.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/resources/physics_material.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
#include "skeleton_3d.h"
class PhysicsBody3D : public CollisionObject3D {
@@ -49,7 +49,7 @@ class PhysicsBody3D : public CollisionObject3D {
protected:
static void _bind_methods();
- PhysicsBody3D(PhysicsServer::BodyMode p_mode);
+ PhysicsBody3D(PhysicsServer3D::BodyMode p_mode);
public:
virtual Vector3 get_linear_velocity() const;
@@ -118,7 +118,7 @@ public:
protected:
bool can_sleep;
- PhysicsDirectBodyState *state;
+ PhysicsDirectBodyState3D *state;
Mode mode;
real_t mass;
@@ -156,7 +156,7 @@ protected:
tagged = false;
}
};
- struct RigidBody_RemoveAction {
+ struct RigidBody3D_RemoveAction {
ObjectID body_id;
ShapePair pair;
@@ -234,8 +234,8 @@ public:
void set_use_continuous_collision_detection(bool p_enable);
bool is_using_continuous_collision_detection() const;
- void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool p_lock);
- bool get_axis_lock(PhysicsServer::BodyAxis p_axis) const;
+ void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock);
+ bool get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const;
Array get_colliding_bodies() const;
@@ -296,7 +296,7 @@ private:
Vector<Ref<KinematicCollision3D>> slide_colliders;
Ref<KinematicCollision3D> motion_cache;
- _FORCE_INLINE_ bool _ignores_mode(PhysicsServer::BodyMode) const;
+ _FORCE_INLINE_ bool _ignores_mode(PhysicsServer3D::BodyMode) const;
Ref<KinematicCollision3D> _move(const Vector3 &p_motion, bool p_infinite_inertia = true, bool p_exclude_raycast_shapes = true, bool p_test_only = false);
Ref<KinematicCollision3D> _get_slide_collision(int p_bounce);
@@ -316,8 +316,8 @@ public:
bool separate_raycast_shapes(bool p_infinite_inertia, Collision &r_collision);
- void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool p_lock);
- bool get_axis_lock(PhysicsServer::BodyAxis p_axis) const;
+ void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock);
+ bool get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const;
void set_safe_margin(float p_margin);
float get_safe_margin() const;
@@ -381,7 +381,7 @@ public:
struct JointData {
virtual JointType get_joint_type() { return JOINT_TYPE_NONE; }
- /// "j" is used to set the parameter inside the PhysicsServer
+ /// "j" is used to set the parameter inside the PhysicsServer3D
virtual bool _set(const StringName &p_name, const Variant &p_value, RID j = RID());
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp
index dd7868cb38..591c17a91e 100644
--- a/scene/3d/physics_joint_3d.cpp
+++ b/scene/3d/physics_joint_3d.cpp
@@ -34,9 +34,9 @@ void Joint3D::_update_joint(bool p_only_free) {
if (joint.is_valid()) {
if (ba.is_valid() && bb.is_valid())
- PhysicsServer::get_singleton()->body_remove_collision_exception(ba, bb);
+ PhysicsServer3D::get_singleton()->body_remove_collision_exception(ba, bb);
- PhysicsServer::get_singleton()->free(joint);
+ PhysicsServer3D::get_singleton()->free(joint);
joint = RID();
ba = RID();
bb = RID();
@@ -45,8 +45,8 @@ void Joint3D::_update_joint(bool p_only_free) {
if (p_only_free || !is_inside_tree())
return;
- Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL;
- Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL;
+ Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)nullptr;
+ Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)nullptr;
PhysicsBody3D *body_a = Object::cast_to<PhysicsBody3D>(node_a);
PhysicsBody3D *body_b = Object::cast_to<PhysicsBody3D>(node_b);
@@ -62,13 +62,13 @@ void Joint3D::_update_joint(bool p_only_free) {
if (!joint.is_valid())
return;
- PhysicsServer::get_singleton()->joint_set_solver_priority(joint, solver_priority);
+ PhysicsServer3D::get_singleton()->joint_set_solver_priority(joint, solver_priority);
ba = body_a->get_rid();
if (body_b)
bb = body_b->get_rid();
- PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
+ PhysicsServer3D::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}
void Joint3D::set_node_a(const NodePath &p_node_a) {
@@ -101,7 +101,7 @@ void Joint3D::set_solver_priority(int p_priority) {
solver_priority = p_priority;
if (joint.is_valid())
- PhysicsServer::get_singleton()->joint_set_solver_priority(joint, solver_priority);
+ PhysicsServer3D::get_singleton()->joint_set_solver_priority(joint, solver_priority);
}
int Joint3D::get_solver_priority() const {
@@ -186,7 +186,7 @@ void PinJoint3D::set_param(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, 3);
params[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->pin_joint_set_param(get_joint(), PhysicsServer::PinJointParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(get_joint(), PhysicsServer3D::PinJointParam(p_param), p_value);
}
float PinJoint3D::get_param(Param p_param) const {
@@ -205,9 +205,9 @@ RID PinJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b) {
else
local_b = pinpos;
- RID j = PhysicsServer::get_singleton()->joint_create_pin(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
+ RID j = PhysicsServer3D::get_singleton()->joint_create_pin(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
for (int i = 0; i < 3; i++) {
- PhysicsServer::get_singleton()->pin_joint_set_param(j, PhysicsServer::PinJointParam(i), params[i]);
+ PhysicsServer3D::get_singleton()->pin_joint_set_param(j, PhysicsServer3D::PinJointParam(i), params[i]);
}
return j;
}
@@ -290,7 +290,7 @@ void HingeJoint3D::set_param(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_param(get_joint(), PhysicsServer::HingeJointParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(get_joint(), PhysicsServer3D::HingeJointParam(p_param), p_value);
update_gizmo();
}
@@ -305,7 +305,7 @@ void HingeJoint3D::set_flag(Flag p_flag, bool p_value) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
flags[p_flag] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->hinge_joint_set_flag(get_joint(), PhysicsServer::HingeJointFlag(p_flag), p_value);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_flag(get_joint(), PhysicsServer3D::HingeJointFlag(p_flag), p_value);
update_gizmo();
}
@@ -331,13 +331,13 @@ RID HingeJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b)
local_b.orthonormalize();
- RID j = PhysicsServer::get_singleton()->joint_create_hinge(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
+ RID j = PhysicsServer3D::get_singleton()->joint_create_hinge(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
for (int i = 0; i < PARAM_MAX; i++) {
- PhysicsServer::get_singleton()->hinge_joint_set_param(j, PhysicsServer::HingeJointParam(i), params[i]);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_param(j, PhysicsServer3D::HingeJointParam(i), params[i]);
}
for (int i = 0; i < FLAG_MAX; i++) {
set_flag(Flag(i), flags[i]);
- PhysicsServer::get_singleton()->hinge_joint_set_flag(j, PhysicsServer::HingeJointFlag(i), flags[i]);
+ PhysicsServer3D::get_singleton()->hinge_joint_set_flag(j, PhysicsServer3D::HingeJointFlag(i), flags[i]);
}
return j;
}
@@ -448,7 +448,7 @@ void SliderJoint3D::set_param(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->slider_joint_set_param(get_joint(), PhysicsServer::SliderJointParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(get_joint(), PhysicsServer3D::SliderJointParam(p_param), p_value);
update_gizmo();
}
float SliderJoint3D::get_param(Param p_param) const {
@@ -473,9 +473,9 @@ RID SliderJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *body_b
local_b.orthonormalize();
- RID j = PhysicsServer::get_singleton()->joint_create_slider(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
+ RID j = PhysicsServer3D::get_singleton()->joint_create_slider(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
for (int i = 0; i < PARAM_MAX; i++) {
- PhysicsServer::get_singleton()->slider_joint_set_param(j, PhysicsServer::SliderJointParam(i), params[i]);
+ PhysicsServer3D::get_singleton()->slider_joint_set_param(j, PhysicsServer3D::SliderJointParam(i), params[i]);
}
return j;
@@ -561,7 +561,7 @@ void ConeTwistJoint3D::set_param(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(get_joint(), PhysicsServer::ConeTwistJointParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(get_joint(), PhysicsServer3D::ConeTwistJointParam(p_param), p_value);
update_gizmo();
}
@@ -590,9 +590,9 @@ RID ConeTwistJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *bod
local_b.orthonormalize();
- RID j = PhysicsServer::get_singleton()->joint_create_cone_twist(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
+ RID j = PhysicsServer3D::get_singleton()->joint_create_cone_twist(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
for (int i = 0; i < PARAM_MAX; i++) {
- PhysicsServer::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer::ConeTwistJointParam(i), params[i]);
+ PhysicsServer3D::get_singleton()->cone_twist_joint_set_param(j, PhysicsServer3D::ConeTwistJointParam(i), params[i]);
}
return j;
@@ -832,7 +832,7 @@ void Generic6DOFJoint3D::set_param_x(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params_x[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_X, PhysicsServer::G6DOFJointAxisParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_X, PhysicsServer3D::G6DOFJointAxisParam(p_param), p_value);
update_gizmo();
}
@@ -847,7 +847,7 @@ void Generic6DOFJoint3D::set_param_y(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params_y[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_Y, PhysicsServer::G6DOFJointAxisParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_Y, PhysicsServer3D::G6DOFJointAxisParam(p_param), p_value);
update_gizmo();
}
float Generic6DOFJoint3D::get_param_y(Param p_param) const {
@@ -861,7 +861,7 @@ void Generic6DOFJoint3D::set_param_z(Param p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
params_z[p_param] = p_value;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_Z, PhysicsServer::G6DOFJointAxisParam(p_param), p_value);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(get_joint(), Vector3::AXIS_Z, PhysicsServer3D::G6DOFJointAxisParam(p_param), p_value);
update_gizmo();
}
float Generic6DOFJoint3D::get_param_z(Param p_param) const {
@@ -875,7 +875,7 @@ void Generic6DOFJoint3D::set_flag_x(Flag p_flag, bool p_enabled) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
flags_x[p_flag] = p_enabled;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_X, PhysicsServer::G6DOFJointAxisFlag(p_flag), p_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_X, PhysicsServer3D::G6DOFJointAxisFlag(p_flag), p_enabled);
update_gizmo();
}
bool Generic6DOFJoint3D::get_flag_x(Flag p_flag) const {
@@ -889,7 +889,7 @@ void Generic6DOFJoint3D::set_flag_y(Flag p_flag, bool p_enabled) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
flags_y[p_flag] = p_enabled;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_Y, PhysicsServer::G6DOFJointAxisFlag(p_flag), p_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_Y, PhysicsServer3D::G6DOFJointAxisFlag(p_flag), p_enabled);
update_gizmo();
}
bool Generic6DOFJoint3D::get_flag_y(Flag p_flag) const {
@@ -903,7 +903,7 @@ void Generic6DOFJoint3D::set_flag_z(Flag p_flag, bool p_enabled) {
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
flags_z[p_flag] = p_enabled;
if (get_joint().is_valid())
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_Z, PhysicsServer::G6DOFJointAxisFlag(p_flag), p_enabled);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(get_joint(), Vector3::AXIS_Z, PhysicsServer3D::G6DOFJointAxisFlag(p_flag), p_enabled);
update_gizmo();
}
bool Generic6DOFJoint3D::get_flag_z(Flag p_flag) const {
@@ -915,7 +915,7 @@ bool Generic6DOFJoint3D::get_flag_z(Flag p_flag) const {
void Generic6DOFJoint3D::set_precision(int p_precision) {
precision = p_precision;
- PhysicsServer::get_singleton()->generic_6dof_joint_set_precision(
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_precision(
get_joint(),
precision);
}
@@ -939,16 +939,16 @@ RID Generic6DOFJoint3D::_configure_joint(PhysicsBody3D *body_a, PhysicsBody3D *b
local_b.orthonormalize();
- RID j = PhysicsServer::get_singleton()->joint_create_generic_6dof(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
+ RID j = PhysicsServer3D::get_singleton()->joint_create_generic_6dof(body_a->get_rid(), local_a, body_b ? body_b->get_rid() : RID(), local_b);
for (int i = 0; i < PARAM_MAX; i++) {
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_X, PhysicsServer::G6DOFJointAxisParam(i), params_x[i]);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_Y, PhysicsServer::G6DOFJointAxisParam(i), params_y[i]);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_Z, PhysicsServer::G6DOFJointAxisParam(i), params_z[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_X, PhysicsServer3D::G6DOFJointAxisParam(i), params_x[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_Y, PhysicsServer3D::G6DOFJointAxisParam(i), params_y[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_param(j, Vector3::AXIS_Z, PhysicsServer3D::G6DOFJointAxisParam(i), params_z[i]);
}
for (int i = 0; i < FLAG_MAX; i++) {
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_X, PhysicsServer::G6DOFJointAxisFlag(i), flags_x[i]);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_Y, PhysicsServer::G6DOFJointAxisFlag(i), flags_y[i]);
- PhysicsServer::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_Z, PhysicsServer::G6DOFJointAxisFlag(i), flags_z[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_X, PhysicsServer3D::G6DOFJointAxisFlag(i), flags_x[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_Y, PhysicsServer3D::G6DOFJointAxisFlag(i), flags_y[i]);
+ PhysicsServer3D::get_singleton()->generic_6dof_joint_set_flag(j, Vector3::AXIS_Z, PhysicsServer3D::G6DOFJointAxisFlag(i), flags_z[i]);
}
return j;
diff --git a/scene/3d/physics_joint_3d.h b/scene/3d/physics_joint_3d.h
index b7c131c666..ce0c7af5d1 100644
--- a/scene/3d/physics_joint_3d.h
+++ b/scene/3d/physics_joint_3d.h
@@ -82,9 +82,9 @@ class PinJoint3D : public Joint3D {
public:
enum Param {
- PARAM_BIAS = PhysicsServer::PIN_JOINT_BIAS,
- PARAM_DAMPING = PhysicsServer::PIN_JOINT_DAMPING,
- PARAM_IMPULSE_CLAMP = PhysicsServer::PIN_JOINT_IMPULSE_CLAMP
+ PARAM_BIAS = PhysicsServer3D::PIN_JOINT_BIAS,
+ PARAM_DAMPING = PhysicsServer3D::PIN_JOINT_DAMPING,
+ PARAM_IMPULSE_CLAMP = PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP
};
protected:
@@ -107,21 +107,21 @@ class HingeJoint3D : public Joint3D {
public:
enum Param {
- PARAM_BIAS = PhysicsServer::HINGE_JOINT_BIAS,
- PARAM_LIMIT_UPPER = PhysicsServer::HINGE_JOINT_LIMIT_UPPER,
- PARAM_LIMIT_LOWER = PhysicsServer::HINGE_JOINT_LIMIT_LOWER,
- PARAM_LIMIT_BIAS = PhysicsServer::HINGE_JOINT_LIMIT_BIAS,
- PARAM_LIMIT_SOFTNESS = PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS,
- PARAM_LIMIT_RELAXATION = PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION,
- PARAM_MOTOR_TARGET_VELOCITY = PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY,
- PARAM_MOTOR_MAX_IMPULSE = PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE,
- PARAM_MAX = PhysicsServer::HINGE_JOINT_MAX
+ PARAM_BIAS = PhysicsServer3D::HINGE_JOINT_BIAS,
+ PARAM_LIMIT_UPPER = PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER,
+ PARAM_LIMIT_LOWER = PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER,
+ PARAM_LIMIT_BIAS = PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS,
+ PARAM_LIMIT_SOFTNESS = PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS,
+ PARAM_LIMIT_RELAXATION = PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION,
+ PARAM_MOTOR_TARGET_VELOCITY = PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY,
+ PARAM_MOTOR_MAX_IMPULSE = PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE,
+ PARAM_MAX = PhysicsServer3D::HINGE_JOINT_MAX
};
enum Flag {
- FLAG_USE_LIMIT = PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT,
- FLAG_ENABLE_MOTOR = PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR,
- FLAG_MAX = PhysicsServer::HINGE_JOINT_FLAG_MAX
+ FLAG_USE_LIMIT = PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT,
+ FLAG_ENABLE_MOTOR = PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR,
+ FLAG_MAX = PhysicsServer3D::HINGE_JOINT_FLAG_MAX
};
protected:
@@ -155,30 +155,30 @@ class SliderJoint3D : public Joint3D {
public:
enum Param {
- PARAM_LINEAR_LIMIT_UPPER = PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER,
- PARAM_LINEAR_LIMIT_LOWER = PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER,
- PARAM_LINEAR_LIMIT_SOFTNESS = PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS,
- PARAM_LINEAR_LIMIT_RESTITUTION = PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION,
- PARAM_LINEAR_LIMIT_DAMPING = PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING,
- PARAM_LINEAR_MOTION_SOFTNESS = PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS,
- PARAM_LINEAR_MOTION_RESTITUTION = PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION,
- PARAM_LINEAR_MOTION_DAMPING = PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING,
- PARAM_LINEAR_ORTHOGONAL_SOFTNESS = PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS,
- PARAM_LINEAR_ORTHOGONAL_RESTITUTION = PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION,
- PARAM_LINEAR_ORTHOGONAL_DAMPING = PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING,
-
- PARAM_ANGULAR_LIMIT_UPPER = PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER,
- PARAM_ANGULAR_LIMIT_LOWER = PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER,
- PARAM_ANGULAR_LIMIT_SOFTNESS = PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS,
- PARAM_ANGULAR_LIMIT_RESTITUTION = PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION,
- PARAM_ANGULAR_LIMIT_DAMPING = PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING,
- PARAM_ANGULAR_MOTION_SOFTNESS = PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS,
- PARAM_ANGULAR_MOTION_RESTITUTION = PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION,
- PARAM_ANGULAR_MOTION_DAMPING = PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING,
- PARAM_ANGULAR_ORTHOGONAL_SOFTNESS = PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS,
- PARAM_ANGULAR_ORTHOGONAL_RESTITUTION = PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION,
- PARAM_ANGULAR_ORTHOGONAL_DAMPING = PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING,
- PARAM_MAX = PhysicsServer::SLIDER_JOINT_MAX
+ PARAM_LINEAR_LIMIT_UPPER = PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER,
+ PARAM_LINEAR_LIMIT_LOWER = PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER,
+ PARAM_LINEAR_LIMIT_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS,
+ PARAM_LINEAR_LIMIT_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION,
+ PARAM_LINEAR_LIMIT_DAMPING = PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING,
+ PARAM_LINEAR_MOTION_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS,
+ PARAM_LINEAR_MOTION_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION,
+ PARAM_LINEAR_MOTION_DAMPING = PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING,
+ PARAM_LINEAR_ORTHOGONAL_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS,
+ PARAM_LINEAR_ORTHOGONAL_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION,
+ PARAM_LINEAR_ORTHOGONAL_DAMPING = PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING,
+
+ PARAM_ANGULAR_LIMIT_UPPER = PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER,
+ PARAM_ANGULAR_LIMIT_LOWER = PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER,
+ PARAM_ANGULAR_LIMIT_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS,
+ PARAM_ANGULAR_LIMIT_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION,
+ PARAM_ANGULAR_LIMIT_DAMPING = PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING,
+ PARAM_ANGULAR_MOTION_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS,
+ PARAM_ANGULAR_MOTION_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION,
+ PARAM_ANGULAR_MOTION_DAMPING = PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING,
+ PARAM_ANGULAR_ORTHOGONAL_SOFTNESS = PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS,
+ PARAM_ANGULAR_ORTHOGONAL_RESTITUTION = PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION,
+ PARAM_ANGULAR_ORTHOGONAL_DAMPING = PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING,
+ PARAM_MAX = PhysicsServer3D::SLIDER_JOINT_MAX
};
@@ -244,39 +244,39 @@ class Generic6DOFJoint3D : public Joint3D {
public:
enum Param {
- PARAM_LINEAR_LOWER_LIMIT = PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT,
- PARAM_LINEAR_UPPER_LIMIT = PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT,
- PARAM_LINEAR_LIMIT_SOFTNESS = PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS,
- PARAM_LINEAR_RESTITUTION = PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION,
- PARAM_LINEAR_DAMPING = PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING,
- PARAM_LINEAR_MOTOR_TARGET_VELOCITY = PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY,
- PARAM_LINEAR_MOTOR_FORCE_LIMIT = PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT,
- PARAM_LINEAR_SPRING_STIFFNESS = PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS,
- PARAM_LINEAR_SPRING_DAMPING = PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING,
- PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT = PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT,
- PARAM_ANGULAR_LOWER_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT,
- PARAM_ANGULAR_UPPER_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT,
- PARAM_ANGULAR_LIMIT_SOFTNESS = PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS,
- PARAM_ANGULAR_DAMPING = PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING,
- PARAM_ANGULAR_RESTITUTION = PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION,
- PARAM_ANGULAR_FORCE_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT,
- PARAM_ANGULAR_ERP = PhysicsServer::G6DOF_JOINT_ANGULAR_ERP,
- PARAM_ANGULAR_MOTOR_TARGET_VELOCITY = PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY,
- PARAM_ANGULAR_MOTOR_FORCE_LIMIT = PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT,
- PARAM_ANGULAR_SPRING_STIFFNESS = PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS,
- PARAM_ANGULAR_SPRING_DAMPING = PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING,
- PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT = PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT,
- PARAM_MAX = PhysicsServer::G6DOF_JOINT_MAX,
+ PARAM_LINEAR_LOWER_LIMIT = PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT,
+ PARAM_LINEAR_UPPER_LIMIT = PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT,
+ PARAM_LINEAR_LIMIT_SOFTNESS = PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS,
+ PARAM_LINEAR_RESTITUTION = PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION,
+ PARAM_LINEAR_DAMPING = PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING,
+ PARAM_LINEAR_MOTOR_TARGET_VELOCITY = PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY,
+ PARAM_LINEAR_MOTOR_FORCE_LIMIT = PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT,
+ PARAM_LINEAR_SPRING_STIFFNESS = PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS,
+ PARAM_LINEAR_SPRING_DAMPING = PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING,
+ PARAM_LINEAR_SPRING_EQUILIBRIUM_POINT = PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT,
+ PARAM_ANGULAR_LOWER_LIMIT = PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT,
+ PARAM_ANGULAR_UPPER_LIMIT = PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT,
+ PARAM_ANGULAR_LIMIT_SOFTNESS = PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS,
+ PARAM_ANGULAR_DAMPING = PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING,
+ PARAM_ANGULAR_RESTITUTION = PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION,
+ PARAM_ANGULAR_FORCE_LIMIT = PhysicsServer3D::G6DOF_JOINT_ANGULAR_FORCE_LIMIT,
+ PARAM_ANGULAR_ERP = PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP,
+ PARAM_ANGULAR_MOTOR_TARGET_VELOCITY = PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY,
+ PARAM_ANGULAR_MOTOR_FORCE_LIMIT = PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT,
+ PARAM_ANGULAR_SPRING_STIFFNESS = PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS,
+ PARAM_ANGULAR_SPRING_DAMPING = PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING,
+ PARAM_ANGULAR_SPRING_EQUILIBRIUM_POINT = PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT,
+ PARAM_MAX = PhysicsServer3D::G6DOF_JOINT_MAX,
};
enum Flag {
- FLAG_ENABLE_LINEAR_LIMIT = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT,
- FLAG_ENABLE_ANGULAR_LIMIT = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT,
- FLAG_ENABLE_LINEAR_SPRING = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING,
- FLAG_ENABLE_ANGULAR_SPRING = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING,
- FLAG_ENABLE_MOTOR = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR,
- FLAG_ENABLE_LINEAR_MOTOR = PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR,
- FLAG_MAX = PhysicsServer::G6DOF_JOINT_FLAG_MAX
+ FLAG_ENABLE_LINEAR_LIMIT = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT,
+ FLAG_ENABLE_ANGULAR_LIMIT = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT,
+ FLAG_ENABLE_LINEAR_SPRING = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING,
+ FLAG_ENABLE_ANGULAR_SPRING = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING,
+ FLAG_ENABLE_MOTOR = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_MOTOR,
+ FLAG_ENABLE_LINEAR_MOTOR = PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR,
+ FLAG_MAX = PhysicsServer3D::G6DOF_JOINT_FLAG_MAX
};
protected:
diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp
index e22c44a3a2..a18da61656 100644
--- a/scene/3d/ray_cast_3d.cpp
+++ b/scene/3d/ray_cast_3d.cpp
@@ -33,7 +33,7 @@
#include "collision_object_3d.h"
#include "core/engine.h"
#include "mesh_instance_3d.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
void RayCast3D::set_cast_to(const Vector3 &p_point) {
@@ -81,7 +81,7 @@ bool RayCast3D::is_colliding() const {
Object *RayCast3D::get_collider() const {
if (against.is_null())
- return NULL;
+ return nullptr;
return ObjectDB::get_instance(against);
}
@@ -199,7 +199,7 @@ void RayCast3D::_update_raycast_state() {
Ref<World3D> w3d = get_world();
ERR_FAIL_COND(w3d.is_null());
- PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());
+ PhysicsDirectSpaceState3D *dss = PhysicsServer3D::get_singleton()->space_get_direct_state(w3d->get_space());
ERR_FAIL_COND(!dss);
Transform gt = get_global_transform();
@@ -208,7 +208,7 @@ void RayCast3D::_update_raycast_state() {
if (to == Vector3())
to = Vector3(0, 0.01, 0);
- PhysicsDirectSpaceState::RayResult rr;
+ PhysicsDirectSpaceState3D::RayResult rr;
if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_mask, collide_with_bodies, collide_with_areas)) {
@@ -387,7 +387,7 @@ void RayCast3D::_clear_debug_shape() {
else
memdelete(mi);
- debug_shape = NULL;
+ debug_shape = nullptr;
}
RayCast3D::RayCast3D() {
@@ -398,7 +398,7 @@ RayCast3D::RayCast3D() {
against_shape = 0;
collision_mask = 1;
cast_to = Vector3(0, -1, 0);
- debug_shape = NULL;
+ debug_shape = nullptr;
exclude_parent_body = true;
collide_with_areas = false;
collide_with_bodies = true;
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 3cf8e43ec2..24bf8b43d1 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -33,7 +33,7 @@
void ReflectionProbe::set_intensity(float p_intensity) {
intensity = p_intensity;
- VS::get_singleton()->reflection_probe_set_intensity(probe, p_intensity);
+ RS::get_singleton()->reflection_probe_set_intensity(probe, p_intensity);
}
float ReflectionProbe::get_intensity() const {
@@ -44,12 +44,12 @@ float ReflectionProbe::get_intensity() const {
void ReflectionProbe::set_interior_ambient(Color p_ambient) {
interior_ambient = p_ambient;
- VS::get_singleton()->reflection_probe_set_interior_ambient(probe, p_ambient);
+ RS::get_singleton()->reflection_probe_set_interior_ambient(probe, p_ambient);
}
void ReflectionProbe::set_interior_ambient_energy(float p_energy) {
interior_ambient_energy = p_energy;
- VS::get_singleton()->reflection_probe_set_interior_ambient_energy(probe, p_energy);
+ RS::get_singleton()->reflection_probe_set_interior_ambient_energy(probe, p_energy);
}
float ReflectionProbe::get_interior_ambient_energy() const {
@@ -64,7 +64,7 @@ Color ReflectionProbe::get_interior_ambient() const {
void ReflectionProbe::set_interior_ambient_probe_contribution(float p_contribution) {
interior_ambient_probe_contribution = p_contribution;
- VS::get_singleton()->reflection_probe_set_interior_ambient_probe_contribution(probe, p_contribution);
+ RS::get_singleton()->reflection_probe_set_interior_ambient_probe_contribution(probe, p_contribution);
}
float ReflectionProbe::get_interior_ambient_probe_contribution() const {
@@ -75,7 +75,7 @@ float ReflectionProbe::get_interior_ambient_probe_contribution() const {
void ReflectionProbe::set_max_distance(float p_distance) {
max_distance = p_distance;
- VS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance);
+ RS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance);
}
float ReflectionProbe::get_max_distance() const {
@@ -97,8 +97,8 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) {
}
}
- VS::get_singleton()->reflection_probe_set_extents(probe, extents);
- VS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
+ RS::get_singleton()->reflection_probe_set_extents(probe, extents);
+ RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
_change_notify("extents");
update_gizmo();
}
@@ -117,8 +117,8 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
}
}
- VS::get_singleton()->reflection_probe_set_extents(probe, extents);
- VS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
+ RS::get_singleton()->reflection_probe_set_extents(probe, extents);
+ RS::get_singleton()->reflection_probe_set_origin_offset(probe, origin_offset);
_change_notify("origin_offset");
update_gizmo();
@@ -131,7 +131,7 @@ Vector3 ReflectionProbe::get_origin_offset() const {
void ReflectionProbe::set_enable_box_projection(bool p_enable) {
box_projection = p_enable;
- VS::get_singleton()->reflection_probe_set_enable_box_projection(probe, p_enable);
+ RS::get_singleton()->reflection_probe_set_enable_box_projection(probe, p_enable);
}
bool ReflectionProbe::is_box_projection_enabled() const {
@@ -141,7 +141,7 @@ bool ReflectionProbe::is_box_projection_enabled() const {
void ReflectionProbe::set_as_interior(bool p_enable) {
interior = p_enable;
- VS::get_singleton()->reflection_probe_set_as_interior(probe, interior);
+ RS::get_singleton()->reflection_probe_set_as_interior(probe, interior);
_change_notify();
}
@@ -153,7 +153,7 @@ bool ReflectionProbe::is_set_as_interior() const {
void ReflectionProbe::set_enable_shadows(bool p_enable) {
enable_shadows = p_enable;
- VS::get_singleton()->reflection_probe_set_enable_shadows(probe, p_enable);
+ RS::get_singleton()->reflection_probe_set_enable_shadows(probe, p_enable);
}
bool ReflectionProbe::are_shadows_enabled() const {
@@ -163,7 +163,7 @@ bool ReflectionProbe::are_shadows_enabled() const {
void ReflectionProbe::set_cull_mask(uint32_t p_layers) {
cull_mask = p_layers;
- VS::get_singleton()->reflection_probe_set_cull_mask(probe, p_layers);
+ RS::get_singleton()->reflection_probe_set_cull_mask(probe, p_layers);
}
uint32_t ReflectionProbe::get_cull_mask() const {
@@ -172,7 +172,7 @@ uint32_t ReflectionProbe::get_cull_mask() const {
void ReflectionProbe::set_update_mode(UpdateMode p_mode) {
update_mode = p_mode;
- VS::get_singleton()->reflection_probe_set_update_mode(probe, VS::ReflectionProbeUpdateMode(p_mode));
+ RS::get_singleton()->reflection_probe_set_update_mode(probe, RS::ReflectionProbeUpdateMode(p_mode));
}
ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
@@ -272,12 +272,12 @@ ReflectionProbe::ReflectionProbe() {
cull_mask = (1 << 20) - 1;
update_mode = UPDATE_ONCE;
- probe = VisualServer::get_singleton()->reflection_probe_create();
- VS::get_singleton()->instance_set_base(get_instance(), probe);
+ probe = RenderingServer::get_singleton()->reflection_probe_create();
+ RS::get_singleton()->instance_set_base(get_instance(), probe);
set_disable_scale(true);
}
ReflectionProbe::~ReflectionProbe() {
- VS::get_singleton()->free(probe);
+ RS::get_singleton()->free(probe);
}
diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h
index 9cc0c3e8c7..3867d13435 100644
--- a/scene/3d/reflection_probe.h
+++ b/scene/3d/reflection_probe.h
@@ -34,7 +34,7 @@
#include "scene/3d/visual_instance_3d.h"
#include "scene/resources/sky.h"
#include "scene/resources/texture.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
class ReflectionProbe : public VisualInstance3D {
GDCLASS(ReflectionProbe, VisualInstance3D);
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 1ea6647d61..59a6e23005 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -62,7 +62,7 @@ SkinReference::~SkinReference() {
skeleton_node->skin_bindings.erase(this);
}
- VS::get_singleton()->free(skeleton);
+ RS::get_singleton()->free(skeleton);
}
bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {
@@ -227,7 +227,7 @@ void Skeleton3D::_notification(int p_what) {
case NOTIFICATION_UPDATE_SKELETON: {
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
Bone *bonesptr = bones.ptrw();
int len = bones.size();
@@ -320,7 +320,7 @@ void Skeleton3D::_notification(int p_what) {
uint32_t bind_count = skin->get_bind_count();
if (E->get()->bind_count != bind_count) {
- VS::get_singleton()->skeleton_allocate(skeleton, bind_count);
+ RS::get_singleton()->skeleton_allocate(skeleton, bind_count);
E->get()->bind_count = bind_count;
E->get()->skin_bone_indices.resize(bind_count);
E->get()->skin_bone_indices_ptrs = E->get()->skin_bone_indices.ptrw();
@@ -685,19 +685,19 @@ void Skeleton3D::bind_physical_bone_to_bone(int p_bone, PhysicalBone3D *p_physic
void Skeleton3D::unbind_physical_bone_from_bone(int p_bone) {
ERR_FAIL_INDEX(p_bone, bones.size());
- bones.write[p_bone].physical_bone = NULL;
+ bones.write[p_bone].physical_bone = nullptr;
_rebuild_physical_bones_cache();
}
PhysicalBone3D *Skeleton3D::get_physical_bone(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
return bones[p_bone].physical_bone;
}
PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
if (bones[p_bone].cache_parent_physical_bone) {
return bones[p_bone].cache_parent_physical_bone;
@@ -707,11 +707,11 @@ PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) {
}
PhysicalBone3D *Skeleton3D::_get_physical_bone_parent(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
const int parent_bone = bones[p_bone].parent;
if (0 > parent_bone) {
- return NULL;
+ return nullptr;
}
PhysicalBone3D *pb = bones[parent_bone].physical_bone;
@@ -802,9 +802,9 @@ void _physical_bones_add_remove_collision_exception(bool p_add, Node *p_node, RI
CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_node);
if (co) {
if (p_add) {
- PhysicsServer::get_singleton()->body_add_collision_exception(co->get_rid(), p_exception);
+ PhysicsServer3D::get_singleton()->body_add_collision_exception(co->get_rid(), p_exception);
} else {
- PhysicsServer::get_singleton()->body_remove_collision_exception(co->get_rid(), p_exception);
+ PhysicsServer3D::get_singleton()->body_remove_collision_exception(co->get_rid(), p_exception);
}
}
}
@@ -871,7 +871,7 @@ Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
skin_ref->skeleton_node = this;
skin_ref->bind_count = 0;
- skin_ref->skeleton = VisualServer::get_singleton()->skeleton_create();
+ skin_ref->skeleton = RenderingServer::get_singleton()->skeleton_create();
skin_ref->skeleton_node = this;
skin_ref->skin = skin;
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index 2ae04aa575..08b8691658 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -112,8 +112,8 @@ private:
global_pose_override_amount = 0;
global_pose_override_reset = false;
#ifndef _3D_DISABLED
- physical_bone = NULL;
- cache_parent_physical_bone = NULL;
+ physical_bone = nullptr;
+ cache_parent_physical_bone = nullptr;
#endif // _3D_DISABLED
}
};
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index a6c3e25399..7366290ed3 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -42,7 +42,7 @@ FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::find_child
return &children.write[i];
}
}
- return NULL;
+ return nullptr;
}
FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(const BoneId p_bone_id) {
@@ -65,7 +65,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
chain.chain_root.initial_transform = p_task->skeleton->get_bone_global_pose(chain.chain_root.bone);
chain.chain_root.current_pos = chain.chain_root.initial_transform.origin;
chain.chain_root.pb = p_task->skeleton->get_physical_bone(chain.chain_root.bone);
- chain.middle_chain_item = NULL;
+ chain.middle_chain_item = nullptr;
// Holds all IDs that are composing a single chain in reverse order
Vector<BoneId> chain_ids;
@@ -119,7 +119,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
}
if (!middle_chain_item_id)
- chain.middle_chain_item = NULL;
+ chain.middle_chain_item = nullptr;
// Initialize current tip
chain.tips.write[x].chain_item = sub_chain;
@@ -226,14 +226,14 @@ void FabrikInverseKinematic::solve_simple_forwards(Chain &r_chain, bool p_solve_
if (p_solve_magnet && sub_chain_root == r_chain.middle_chain_item) {
// In case of magnet solving this is the tip
- sub_chain_root = NULL;
+ sub_chain_root = nullptr;
} else {
sub_chain_root = &child;
}
} else {
// Is tip
- sub_chain_root = NULL;
+ sub_chain_root = nullptr;
}
}
}
@@ -251,7 +251,7 @@ FabrikInverseKinematic::Task *FabrikInverseKinematic::create_simple_task(Skeleto
if (!build_chain(task)) {
free_task(task);
- return NULL;
+ return nullptr;
}
return task;
@@ -328,7 +328,7 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
if (!ci->children.empty())
ci = &ci->children.write[0];
else
- ci = NULL;
+ ci = nullptr;
}
}
@@ -432,14 +432,14 @@ SkeletonIK3D::SkeletonIK3D() :
use_magnet(false),
min_distance(0.01),
max_iterations(10),
- skeleton(NULL),
- target_node_override(NULL),
- task(NULL) {
+ skeleton(nullptr),
+ target_node_override(nullptr),
+ task(nullptr) {
}
SkeletonIK3D::~SkeletonIK3D() {
FabrikInverseKinematic::free_task(task);
- task = NULL;
+ task = nullptr;
}
void SkeletonIK3D::set_root_bone(const StringName &p_root_bone) {
@@ -479,7 +479,7 @@ const Transform &SkeletonIK3D::get_target_transform() const {
void SkeletonIK3D::set_target_node(const NodePath &p_node) {
target_node_path_override = p_node;
- target_node_override = NULL;
+ target_node_override = nullptr;
reload_goal();
}
@@ -550,7 +550,7 @@ Transform SkeletonIK3D::_get_target_transform() {
void SkeletonIK3D::reload_chain() {
FabrikInverseKinematic::free_task(task);
- task = NULL;
+ task = nullptr;
if (!skeleton)
return;
diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h
index ebfebd1e66..5fbbe6e9e7 100644
--- a/scene/3d/skeleton_ik_3d.h
+++ b/scene/3d/skeleton_ik_3d.h
@@ -64,9 +64,9 @@ class FabrikInverseKinematic {
Vector3 current_ori;
ChainItem() :
- parent_item(NULL),
+ parent_item(nullptr),
bone(-1),
- pb(NULL),
+ pb(nullptr),
length(0) {}
ChainItem *find_child(const BoneId p_bone_id);
@@ -78,8 +78,8 @@ class FabrikInverseKinematic {
const EndEffector *end_effector;
ChainTip() :
- chain_item(NULL),
- end_effector(NULL) {}
+ chain_item(nullptr),
+ end_effector(nullptr) {}
ChainTip(ChainItem *p_chain_item, const EndEffector *p_end_effector) :
chain_item(p_chain_item),
@@ -115,7 +115,7 @@ public:
Transform goal_global_transform;
Task() :
- skeleton(NULL),
+ skeleton(nullptr),
min_distance(0.01),
max_iterations(10),
root_bone(-1) {}
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 6c93c3c1c7..6092818252 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "soft_body_3d.h"
+
#include "core/list.h"
#include "core/object.h"
#include "core/os/os.h"
@@ -36,11 +37,11 @@
#include "scene/3d/collision_object_3d.h"
#include "scene/3d/physics_body_3d.h"
#include "scene/3d/skeleton_3d.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
-SoftBodyVisualServerHandler::SoftBodyVisualServerHandler() {}
+SoftBodyRenderingServerHandler::SoftBodyRenderingServerHandler() {}
-void SoftBodyVisualServerHandler::prepare(RID p_mesh, int p_surface) {
+void SoftBodyRenderingServerHandler::prepare(RID p_mesh, int p_surface) {
clear();
ERR_FAIL_COND(!p_mesh.is_valid());
@@ -51,19 +52,19 @@ void SoftBodyVisualServerHandler::prepare(RID p_mesh, int p_surface) {
#warning Softbody is not working, needs to be redone considering that these functions no longer exist
#endif
#if 0
- const uint32_t surface_format = VS::get_singleton()->mesh_surface_get_format(mesh, surface);
- const int surface_vertex_len = VS::get_singleton()->mesh_surface_get_array_len(mesh, p_surface);
- const int surface_index_len = VS::get_singleton()->mesh_surface_get_array_index_len(mesh, p_surface);
- uint32_t surface_offsets[VS::ARRAY_MAX];
-
- buffer = VS::get_singleton()->mesh_surface_get_array(mesh, surface);
- stride = VS::get_singleton()->mesh_surface_make_offsets_from_format(surface_format, surface_vertex_len, surface_index_len, surface_offsets);
- offset_vertices = surface_offsets[VS::ARRAY_VERTEX];
- offset_normal = surface_offsets[VS::ARRAY_NORMAL];
+ const uint32_t surface_format = RS::get_singleton()->mesh_surface_get_format(mesh, surface);
+ const int surface_vertex_len = RS::get_singleton()->mesh_surface_get_array_len(mesh, p_surface);
+ const int surface_index_len = RS::get_singleton()->mesh_surface_get_array_index_len(mesh, p_surface);
+ uint32_t surface_offsets[RS::ARRAY_MAX];
+
+ buffer = RS::get_singleton()->mesh_surface_get_array(mesh, surface);
+ stride = RS::get_singleton()->mesh_surface_make_offsets_from_format(surface_format, surface_vertex_len, surface_index_len, surface_offsets);
+ offset_vertices = surface_offsets[RS::ARRAY_VERTEX];
+ offset_normal = surface_offsets[RS::ARRAY_NORMAL];
#endif
}
-void SoftBodyVisualServerHandler::clear() {
+void SoftBodyRenderingServerHandler::clear() {
if (mesh.is_valid()) {
buffer.resize(0);
@@ -72,33 +73,33 @@ void SoftBodyVisualServerHandler::clear() {
mesh = RID();
}
-void SoftBodyVisualServerHandler::open() {
+void SoftBodyRenderingServerHandler::open() {
write_buffer = buffer.ptrw();
}
-void SoftBodyVisualServerHandler::close() {
+void SoftBodyRenderingServerHandler::close() {
//write_buffer.release();
}
-void SoftBodyVisualServerHandler::commit_changes() {
- VS::get_singleton()->mesh_surface_update_region(mesh, surface, 0, buffer);
+void SoftBodyRenderingServerHandler::commit_changes() {
+ RS::get_singleton()->mesh_surface_update_region(mesh, surface, 0, buffer);
}
-void SoftBodyVisualServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) {
+void SoftBodyRenderingServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) {
copymem(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3);
}
-void SoftBodyVisualServerHandler::set_normal(int p_vertex_id, const void *p_vector3) {
+void SoftBodyRenderingServerHandler::set_normal(int p_vertex_id, const void *p_vector3) {
copymem(&write_buffer[p_vertex_id * stride + offset_normal], p_vector3, sizeof(float) * 3);
}
-void SoftBodyVisualServerHandler::set_aabb(const AABB &p_aabb) {
- VS::get_singleton()->mesh_set_custom_aabb(mesh, p_aabb);
+void SoftBodyRenderingServerHandler::set_aabb(const AABB &p_aabb) {
+ RS::get_singleton()->mesh_set_custom_aabb(mesh, p_aabb);
}
SoftBody3D::PinnedPoint::PinnedPoint() :
point_index(-1),
- spatial_attachment(NULL) {
+ spatial_attachment(nullptr) {
}
SoftBody3D::PinnedPoint::PinnedPoint(const PinnedPoint &obj_tocopy) {
@@ -120,7 +121,7 @@ void SoftBody3D::_update_pickable() {
if (!is_inside_tree())
return;
bool pickable = ray_pickable && is_visible_in_tree();
- PhysicsServer::get_singleton()->soft_body_set_ray_pickable(physics_rid, pickable);
+ PhysicsServer3D::get_singleton()->soft_body_set_ray_pickable(physics_rid, pickable);
}
bool SoftBody3D::_set(const StringName &p_name, const Variant &p_value) {
@@ -270,7 +271,7 @@ void SoftBody3D::_notification(int p_what) {
}
RID space = get_world()->get_space();
- PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space);
+ PhysicsServer3D::get_singleton()->soft_body_set_space(physics_rid, space);
prepare_physics_server();
} break;
case NOTIFICATION_READY: {
@@ -285,10 +286,10 @@ void SoftBody3D::_notification(int p_what) {
return;
}
- PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());
+ PhysicsServer3D::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());
set_notify_transform(false);
- // Required to be top level with Transform at center of world in order to modify VisualServer only to support custom Transform
+ // Required to be top level with Transform at center of world in order to modify RenderingServer only to support custom Transform
set_as_toplevel(true);
set_transform(Transform());
set_notify_transform(true);
@@ -301,7 +302,7 @@ void SoftBody3D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_WORLD: {
- PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, RID());
+ PhysicsServer3D::get_singleton()->soft_body_set_space(physics_rid, RID());
} break;
}
@@ -402,7 +403,7 @@ String SoftBody3D::get_configuration_warning() const {
if (!warning.empty())
warning += "\n\n";
- warning += TTR("Size changes to SoftBody will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
+ warning += TTR("Size changes to SoftBody3D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
return warning;
@@ -418,7 +419,7 @@ void SoftBody3D::_update_physics_server() {
const PinnedPoint *r = pinned_points.ptr();
for (int i = 0; i < pinned_points_indices_size; ++i) {
if (r[i].spatial_attachment) {
- PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset));
+ PhysicsServer3D::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset));
}
}
}
@@ -427,9 +428,9 @@ void SoftBody3D::_draw_soft_mesh() {
if (get_mesh().is_null())
return;
- if (!visual_server_handler.is_ready()) {
+ if (!rendering_server_handler.is_ready()) {
- visual_server_handler.prepare(get_mesh()->get_rid(), 0);
+ rendering_server_handler.prepare(get_mesh()->get_rid(), 0);
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
simulation_started = true;
@@ -439,11 +440,11 @@ void SoftBody3D::_draw_soft_mesh() {
_update_physics_server();
- visual_server_handler.open();
- PhysicsServer::get_singleton()->soft_body_update_visual_server(physics_rid, &visual_server_handler);
- visual_server_handler.close();
+ rendering_server_handler.open();
+ PhysicsServer3D::get_singleton()->soft_body_update_rendering_server(physics_rid, &rendering_server_handler);
+ rendering_server_handler.close();
- visual_server_handler.commit_changes();
+ rendering_server_handler.commit_changes();
}
void SoftBody3D::prepare_physics_server() {
@@ -451,9 +452,9 @@ void SoftBody3D::prepare_physics_server() {
if (Engine::get_singleton()->is_editor_hint()) {
if (get_mesh().is_valid())
- PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh());
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh());
else
- PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, NULL);
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr);
return;
}
@@ -461,13 +462,13 @@ void SoftBody3D::prepare_physics_server() {
if (get_mesh().is_valid()) {
become_mesh_owner();
- PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh());
- VS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh());
+ RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
} else {
- PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, NULL);
- if (VS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh))) {
- VS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr);
+ if (RS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh))) {
+ RS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
}
}
}
@@ -508,7 +509,7 @@ void SoftBody3D::become_mesh_owner() {
void SoftBody3D::set_collision_mask(uint32_t p_mask) {
collision_mask = p_mask;
- PhysicsServer::get_singleton()->soft_body_set_collision_mask(physics_rid, p_mask);
+ PhysicsServer3D::get_singleton()->soft_body_set_collision_mask(physics_rid, p_mask);
}
uint32_t SoftBody3D::get_collision_mask() const {
@@ -516,7 +517,7 @@ uint32_t SoftBody3D::get_collision_mask() const {
}
void SoftBody3D::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
- PhysicsServer::get_singleton()->soft_body_set_collision_layer(physics_rid, p_layer);
+ PhysicsServer3D::get_singleton()->soft_body_set_collision_layer(physics_rid, p_layer);
}
uint32_t SoftBody3D::get_collision_layer() const {
@@ -570,11 +571,11 @@ Vector<SoftBody3D::PinnedPoint> SoftBody3D::get_pinned_points_indices() {
Array SoftBody3D::get_collision_exceptions() {
List<RID> exceptions;
- PhysicsServer::get_singleton()->soft_body_get_collision_exceptions(physics_rid, &exceptions);
+ PhysicsServer3D::get_singleton()->soft_body_get_collision_exceptions(physics_rid, &exceptions);
Array ret;
for (List<RID>::Element *E = exceptions.front(); E; E = E->next()) {
RID body = E->get();
- ObjectID instance_id = PhysicsServer::get_singleton()->body_get_object_instance_id(body);
+ ObjectID instance_id = PhysicsServer3D::get_singleton()->body_get_object_instance_id(body);
Object *obj = ObjectDB::get_instance(instance_id);
PhysicsBody3D *physics_body = Object::cast_to<PhysicsBody3D>(obj);
ret.append(physics_body);
@@ -585,91 +586,91 @@ Array SoftBody3D::get_collision_exceptions() {
void SoftBody3D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
- PhysicsServer::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid());
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
+ PhysicsServer3D::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid());
}
void SoftBody3D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
- PhysicsServer::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
+ PhysicsServer3D::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
}
int SoftBody3D::get_simulation_precision() {
- return PhysicsServer::get_singleton()->soft_body_get_simulation_precision(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_simulation_precision(physics_rid);
}
void SoftBody3D::set_simulation_precision(int p_simulation_precision) {
- PhysicsServer::get_singleton()->soft_body_set_simulation_precision(physics_rid, p_simulation_precision);
+ PhysicsServer3D::get_singleton()->soft_body_set_simulation_precision(physics_rid, p_simulation_precision);
}
real_t SoftBody3D::get_total_mass() {
- return PhysicsServer::get_singleton()->soft_body_get_total_mass(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_total_mass(physics_rid);
}
void SoftBody3D::set_total_mass(real_t p_total_mass) {
- PhysicsServer::get_singleton()->soft_body_set_total_mass(physics_rid, p_total_mass);
+ PhysicsServer3D::get_singleton()->soft_body_set_total_mass(physics_rid, p_total_mass);
}
void SoftBody3D::set_linear_stiffness(real_t p_linear_stiffness) {
- PhysicsServer::get_singleton()->soft_body_set_linear_stiffness(physics_rid, p_linear_stiffness);
+ PhysicsServer3D::get_singleton()->soft_body_set_linear_stiffness(physics_rid, p_linear_stiffness);
}
real_t SoftBody3D::get_linear_stiffness() {
- return PhysicsServer::get_singleton()->soft_body_get_linear_stiffness(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_linear_stiffness(physics_rid);
}
void SoftBody3D::set_areaAngular_stiffness(real_t p_areaAngular_stiffness) {
- PhysicsServer::get_singleton()->soft_body_set_areaAngular_stiffness(physics_rid, p_areaAngular_stiffness);
+ PhysicsServer3D::get_singleton()->soft_body_set_areaAngular_stiffness(physics_rid, p_areaAngular_stiffness);
}
real_t SoftBody3D::get_areaAngular_stiffness() {
- return PhysicsServer::get_singleton()->soft_body_get_areaAngular_stiffness(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_areaAngular_stiffness(physics_rid);
}
void SoftBody3D::set_volume_stiffness(real_t p_volume_stiffness) {
- PhysicsServer::get_singleton()->soft_body_set_volume_stiffness(physics_rid, p_volume_stiffness);
+ PhysicsServer3D::get_singleton()->soft_body_set_volume_stiffness(physics_rid, p_volume_stiffness);
}
real_t SoftBody3D::get_volume_stiffness() {
- return PhysicsServer::get_singleton()->soft_body_get_volume_stiffness(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_volume_stiffness(physics_rid);
}
real_t SoftBody3D::get_pressure_coefficient() {
- return PhysicsServer::get_singleton()->soft_body_get_pressure_coefficient(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_pressure_coefficient(physics_rid);
}
void SoftBody3D::set_pose_matching_coefficient(real_t p_pose_matching_coefficient) {
- PhysicsServer::get_singleton()->soft_body_set_pose_matching_coefficient(physics_rid, p_pose_matching_coefficient);
+ PhysicsServer3D::get_singleton()->soft_body_set_pose_matching_coefficient(physics_rid, p_pose_matching_coefficient);
}
real_t SoftBody3D::get_pose_matching_coefficient() {
- return PhysicsServer::get_singleton()->soft_body_get_pose_matching_coefficient(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_pose_matching_coefficient(physics_rid);
}
void SoftBody3D::set_pressure_coefficient(real_t p_pressure_coefficient) {
- PhysicsServer::get_singleton()->soft_body_set_pressure_coefficient(physics_rid, p_pressure_coefficient);
+ PhysicsServer3D::get_singleton()->soft_body_set_pressure_coefficient(physics_rid, p_pressure_coefficient);
}
real_t SoftBody3D::get_damping_coefficient() {
- return PhysicsServer::get_singleton()->soft_body_get_damping_coefficient(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_damping_coefficient(physics_rid);
}
void SoftBody3D::set_damping_coefficient(real_t p_damping_coefficient) {
- PhysicsServer::get_singleton()->soft_body_set_damping_coefficient(physics_rid, p_damping_coefficient);
+ PhysicsServer3D::get_singleton()->soft_body_set_damping_coefficient(physics_rid, p_damping_coefficient);
}
real_t SoftBody3D::get_drag_coefficient() {
- return PhysicsServer::get_singleton()->soft_body_get_drag_coefficient(physics_rid);
+ return PhysicsServer3D::get_singleton()->soft_body_get_drag_coefficient(physics_rid);
}
void SoftBody3D::set_drag_coefficient(real_t p_drag_coefficient) {
- PhysicsServer::get_singleton()->soft_body_set_drag_coefficient(physics_rid, p_drag_coefficient);
+ PhysicsServer3D::get_singleton()->soft_body_set_drag_coefficient(physics_rid, p_drag_coefficient);
}
Vector3 SoftBody3D::get_point_transform(int p_point_index) {
- return PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, p_point_index);
+ return PhysicsServer3D::get_singleton()->soft_body_get_point_global_position(physics_rid, p_point_index);
}
void SoftBody3D::pin_point_toggle(int p_point_index) {
@@ -701,7 +702,7 @@ bool SoftBody3D::is_ray_pickable() const {
}
SoftBody3D::SoftBody3D() :
- physics_rid(PhysicsServer::get_singleton()->soft_body_create()),
+ physics_rid(PhysicsServer3D::get_singleton()->soft_body_create()),
mesh_owner(false),
collision_mask(1),
collision_layer(1),
@@ -709,18 +710,18 @@ SoftBody3D::SoftBody3D() :
pinned_points_cache_dirty(true),
ray_pickable(true) {
- PhysicsServer::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id());
+ PhysicsServer3D::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id());
}
SoftBody3D::~SoftBody3D() {
- PhysicsServer::get_singleton()->free(physics_rid);
+ PhysicsServer3D::get_singleton()->free(physics_rid);
}
void SoftBody3D::reset_softbody_pin() {
- PhysicsServer::get_singleton()->soft_body_remove_all_pinned_points(physics_rid);
+ PhysicsServer3D::get_singleton()->soft_body_remove_all_pinned_points(physics_rid);
const PinnedPoint *pps = pinned_points.ptr();
for (int i = pinned_points.size() - 1; 0 < i; --i) {
- PhysicsServer::get_singleton()->soft_body_pin_point(physics_rid, pps[i].point_index, true);
+ PhysicsServer3D::get_singleton()->soft_body_pin_point(physics_rid, pps[i].point_index, true);
}
}
@@ -747,7 +748,7 @@ void SoftBody3D::_update_cache_pin_points_datas() {
}
void SoftBody3D::_pin_point_on_physics_server(int p_point_index, bool pin) {
- PhysicsServer::get_singleton()->soft_body_pin_point(physics_rid, p_point_index, pin);
+ PhysicsServer3D::get_singleton()->soft_body_pin_point(physics_rid, p_point_index, pin);
}
void SoftBody3D::_add_pinned_point(int p_point_index, const NodePath &p_spatial_attachment_path) {
@@ -761,7 +762,7 @@ void SoftBody3D::_add_pinned_point(int p_point_index, const NodePath &p_spatial_
if (!p_spatial_attachment_path.is_empty() && has_node(p_spatial_attachment_path)) {
pp.spatial_attachment = Object::cast_to<Node3D>(get_node(p_spatial_attachment_path));
- pp.offset = (pp.spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, pp.point_index));
+ pp.offset = (pp.spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer3D::get_singleton()->soft_body_get_point_global_position(physics_rid, pp.point_index));
}
pinned_points.push_back(pp);
@@ -773,7 +774,7 @@ void SoftBody3D::_add_pinned_point(int p_point_index, const NodePath &p_spatial_
if (!p_spatial_attachment_path.is_empty() && has_node(p_spatial_attachment_path)) {
pinned_point->spatial_attachment = Object::cast_to<Node3D>(get_node(p_spatial_attachment_path));
- pinned_point->offset = (pinned_point->spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, pinned_point->point_index));
+ pinned_point->offset = (pinned_point->spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer3D::get_singleton()->soft_body_get_point_global_position(physics_rid, pinned_point->point_index));
}
}
}
@@ -793,7 +794,7 @@ void SoftBody3D::_reset_points_offsets() {
if (!r[i].spatial_attachment)
continue;
- w[i].offset = (r[i].spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer::get_singleton()->soft_body_get_point_global_position(physics_rid, r[i].point_index));
+ w[i].offset = (r[i].spatial_attachment->get_global_transform().affine_inverse() * get_global_transform()).xform(PhysicsServer3D::get_singleton()->soft_body_get_point_global_position(physics_rid, r[i].point_index));
}
}
@@ -807,7 +808,7 @@ void SoftBody3D::_remove_pinned_point(int p_point_index) {
int SoftBody3D::_get_pinned_point(int p_point_index, SoftBody3D::PinnedPoint *&r_point) const {
const int id = _has_pinned_point(p_point_index);
if (-1 == id) {
- r_point = NULL;
+ r_point = nullptr;
return -1;
} else {
r_point = const_cast<SoftBody3D::PinnedPoint *>(&pinned_points.ptr()[id]);
diff --git a/scene/3d/soft_body_3d.h b/scene/3d/soft_body_3d.h
index a1a4b4fa2f..7dd5880985 100644
--- a/scene/3d/soft_body_3d.h
+++ b/scene/3d/soft_body_3d.h
@@ -35,7 +35,7 @@
class SoftBody3D;
-class SoftBodyVisualServerHandler {
+class SoftBodyRenderingServerHandler {
friend class SoftBody3D;
@@ -49,7 +49,7 @@ class SoftBodyVisualServerHandler {
uint8_t *write_buffer;
private:
- SoftBodyVisualServerHandler();
+ SoftBodyRenderingServerHandler();
bool is_ready() { return mesh.is_valid(); }
void prepare(RID p_mesh_rid, int p_surface);
void clear();
@@ -79,7 +79,7 @@ public:
};
private:
- SoftBodyVisualServerHandler visual_server_handler;
+ SoftBodyRenderingServerHandler rendering_server_handler;
RID physics_rid;
diff --git a/scene/3d/spring_arm_3d.cpp b/scene/3d/spring_arm_3d.cpp
index 1856171539..281be3f7d3 100644
--- a/scene/3d/spring_arm_3d.cpp
+++ b/scene/3d/spring_arm_3d.cpp
@@ -32,7 +32,7 @@
#include "core/engine.h"
#include "scene/3d/collision_object_3d.h"
#include "scene/resources/sphere_shape_3d.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
SpringArm3D::SpringArm3D() :
spring_length(1),
@@ -146,7 +146,7 @@ void SpringArm3D::process_spring() {
if (shape.is_null()) {
motion = Vector3(cast_direction * (spring_length));
- PhysicsDirectSpaceState::RayResult r;
+ PhysicsDirectSpaceState3D::RayResult r;
bool intersected = get_world()->get_direct_space_state()->intersect_ray(get_global_transform().origin, get_global_transform().origin + motion, r, excluded_objects, mask);
if (intersected) {
float dist = get_global_transform().origin.distance_to(r.position);
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index fd22076091..85e5ebc475 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -83,8 +83,8 @@ void SpriteBase3D::_notification(int p_what) {
if (parent_sprite) {
parent_sprite->children.erase(pI);
- pI = NULL;
- parent_sprite = NULL;
+ pI = nullptr;
+ parent_sprite = nullptr;
}
}
}
@@ -364,8 +364,8 @@ SpriteBase3D::SpriteBase3D() {
centered = true;
hflip = false;
vflip = false;
- parent_sprite = NULL;
- pI = NULL;
+ parent_sprite = nullptr;
+ pI = nullptr;
for (int i = 0; i < FLAG_MAX; i++)
flags[i] = i == FLAG_TRANSPARENT || i == FLAG_DOUBLE_SIDED;
@@ -377,13 +377,13 @@ SpriteBase3D::SpriteBase3D() {
modulate = Color(1, 1, 1, 1);
pending_update = false;
opacity = 1.0;
- immediate = VisualServer::get_singleton()->immediate_create();
+ immediate = RenderingServer::get_singleton()->immediate_create();
set_base(immediate);
}
SpriteBase3D::~SpriteBase3D() {
- VisualServer::get_singleton()->free(immediate);
+ RenderingServer::get_singleton()->free(immediate);
}
///////////////////////////////////////////
@@ -392,7 +392,7 @@ void Sprite3D::_draw() {
RID immediate = get_immediate();
- VS::get_singleton()->immediate_clear(immediate);
+ RS::get_singleton()->immediate_clear(immediate);
if (!texture.is_valid())
return;
Vector2 tsize = texture->get_size();
@@ -441,7 +441,7 @@ void Sprite3D::_draw() {
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
- if (atlas_tex != NULL) {
+ if (atlas_tex != nullptr) {
src_tsize[0] = atlas_tex->get_atlas()->get_width();
src_tsize[1] = atlas_tex->get_atlas()->get_height();
}
@@ -475,9 +475,9 @@ void Sprite3D::_draw() {
}
RID mat = StandardMaterial3D::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y);
- VS::get_singleton()->immediate_set_material(immediate, mat);
+ RS::get_singleton()->immediate_set_material(immediate, mat);
- VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLES, texture->get_rid());
+ RS::get_singleton()->immediate_begin(immediate, RS::PRIMITIVE_TRIANGLES, texture->get_rid());
int x_axis = ((axis + 1) % 3);
int y_axis = ((axis + 2) % 3);
@@ -502,15 +502,15 @@ void Sprite3D::_draw() {
static const int index[6] = { 0, 1, 2, 0, 2, 3 };
- VS::get_singleton()->immediate_normal(immediate, normal);
- VS::get_singleton()->immediate_tangent(immediate, tangent);
- VS::get_singleton()->immediate_color(immediate, color);
- VS::get_singleton()->immediate_uv(immediate, uvs[i]);
+ RS::get_singleton()->immediate_normal(immediate, normal);
+ RS::get_singleton()->immediate_tangent(immediate, tangent);
+ RS::get_singleton()->immediate_color(immediate, color);
+ RS::get_singleton()->immediate_uv(immediate, uvs[i]);
Vector3 vtx;
vtx[x_axis] = vertices[index[i]][0];
vtx[y_axis] = vertices[index[i]][1];
- VS::get_singleton()->immediate_vertex(immediate, vtx);
+ RS::get_singleton()->immediate_vertex(immediate, vtx);
if (i == 0) {
aabb.position = vtx;
aabb.size = Vector3();
@@ -519,7 +519,7 @@ void Sprite3D::_draw() {
}
}
set_aabb(aabb);
- VS::get_singleton()->immediate_end(immediate);
+ RS::get_singleton()->immediate_end(immediate);
}
void Sprite3D::_texture_changed() {
@@ -717,7 +717,7 @@ Sprite3D::Sprite3D() {
void AnimatedSprite3D::_draw() {
RID immediate = get_immediate();
- VS::get_singleton()->immediate_clear(immediate);
+ RS::get_singleton()->immediate_clear(immediate);
if (frames.is_null()) {
return;
@@ -775,7 +775,7 @@ void AnimatedSprite3D::_draw() {
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
- if (atlas_tex != NULL) {
+ if (atlas_tex != nullptr) {
src_tsize[0] = atlas_tex->get_atlas()->get_width();
src_tsize[1] = atlas_tex->get_atlas()->get_height();
}
@@ -810,9 +810,9 @@ void AnimatedSprite3D::_draw() {
RID mat = StandardMaterial3D::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == StandardMaterial3D::BILLBOARD_ENABLED, get_billboard_mode() == StandardMaterial3D::BILLBOARD_FIXED_Y);
- VS::get_singleton()->immediate_set_material(immediate, mat);
+ RS::get_singleton()->immediate_set_material(immediate, mat);
- VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_TRIANGLES, texture->get_rid());
+ RS::get_singleton()->immediate_begin(immediate, RS::PRIMITIVE_TRIANGLES, texture->get_rid());
int x_axis = ((axis + 1) % 3);
int y_axis = ((axis + 2) % 3);
@@ -840,15 +840,15 @@ void AnimatedSprite3D::_draw() {
0, 2, 3
};
- VS::get_singleton()->immediate_normal(immediate, normal);
- VS::get_singleton()->immediate_tangent(immediate, tangent);
- VS::get_singleton()->immediate_color(immediate, color);
- VS::get_singleton()->immediate_uv(immediate, uvs[i]);
+ RS::get_singleton()->immediate_normal(immediate, normal);
+ RS::get_singleton()->immediate_tangent(immediate, tangent);
+ RS::get_singleton()->immediate_color(immediate, color);
+ RS::get_singleton()->immediate_uv(immediate, uvs[i]);
Vector3 vtx;
vtx[x_axis] = vertices[indices[i]][0];
vtx[y_axis] = vertices[indices[i]][1];
- VS::get_singleton()->immediate_vertex(immediate, vtx);
+ RS::get_singleton()->immediate_vertex(immediate, vtx);
if (i == 0) {
aabb.position = vtx;
aabb.size = Vector3();
@@ -857,7 +857,7 @@ void AnimatedSprite3D::_draw() {
}
}
set_aabb(aabb);
- VS::get_singleton()->immediate_end(immediate);
+ RS::get_singleton()->immediate_end(immediate);
}
void AnimatedSprite3D::_validate_property(PropertyInfo &property) const {
diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp
index 5d601b0d43..5c2fa59a21 100644
--- a/scene/3d/vehicle_body_3d.cpp
+++ b/scene/3d/vehicle_body_3d.cpp
@@ -99,19 +99,19 @@ void VehicleWheel3D::_notification(int p_what) {
if (!cb)
return;
cb->wheels.erase(this);
- body = NULL;
+ body = nullptr;
}
}
String VehicleWheel3D::get_configuration_warning() const {
if (!Object::cast_to<VehicleBody3D>(get_parent())) {
- return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
+ return TTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D.");
}
return String();
}
-void VehicleWheel3D::_update(PhysicsDirectBodyState *s) {
+void VehicleWheel3D::_update(PhysicsDirectBodyState3D *s) {
if (m_raycastInfo.m_isInContact)
@@ -285,7 +285,7 @@ void VehicleWheel3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
- ADD_GROUP("VehicleBody Motion", "");
+ ADD_GROUP("VehicleBody3D Motion", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering");
ADD_GROUP("Wheel", "wheel_");
@@ -385,10 +385,10 @@ VehicleWheel3D::VehicleWheel3D() {
m_clippedInvContactDotSuspension = 1.0;
m_raycastInfo.m_isInContact = false;
- body = NULL;
+ body = nullptr;
}
-void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s) {
+void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState3D *s) {
wheel.m_raycastInfo.m_isInContact = false;
@@ -405,7 +405,7 @@ void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirect
wheel.m_raycastInfo.m_wheelAxleWS = chassisTrans.get_basis().xform(wheel.m_wheelAxleCS).normalized();
}
-void VehicleBody3D::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
+void VehicleBody3D::_update_wheel(int p_idx, PhysicsDirectBodyState3D *s) {
VehicleWheel3D &wheel = *wheels[p_idx];
_update_wheel_transform(wheel, s);
@@ -430,7 +430,7 @@ void VehicleBody3D::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
wheel.m_raycastInfo.m_hardPointWS + wheel.m_raycastInfo.m_wheelDirectionWS * wheel.m_raycastInfo.m_suspensionLength);
}
-real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
+real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState3D *s) {
VehicleWheel3D &wheel = *wheels[p_idx];
@@ -448,13 +448,13 @@ real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
real_t param = real_t(0.);
- PhysicsDirectSpaceState::RayResult rr;
+ PhysicsDirectSpaceState3D::RayResult rr;
- PhysicsDirectSpaceState *ss = s->get_space_state();
+ PhysicsDirectSpaceState3D *ss = s->get_space_state();
bool col = ss->intersect_ray(source, target, rr, exclude);
- wheel.m_raycastInfo.m_groundObject = 0;
+ wheel.m_raycastInfo.m_groundObject = nullptr;
if (col) {
param = source.distance_to(rr.position) / source.distance_to(target);
@@ -513,7 +513,7 @@ real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState *s) {
return depth;
}
-void VehicleBody3D::_update_suspension(PhysicsDirectBodyState *s) {
+void VehicleBody3D::_update_suspension(PhysicsDirectBodyState3D *s) {
real_t chassisMass = mass;
@@ -558,7 +558,7 @@ void VehicleBody3D::_update_suspension(PhysicsDirectBodyState *s) {
}
//bilateral constraint between two dynamic objects
-void VehicleBody3D::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1,
+void VehicleBody3D::_resolve_single_bilateral(PhysicsDirectBodyState3D *s, const Vector3 &pos1,
PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence) {
real_t normalLenSqr = normal.length_squared();
@@ -636,7 +636,7 @@ void VehicleBody3D::_resolve_single_bilateral(PhysicsDirectBodyState *s, const V
#endif
}
-VehicleBody3D::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) :
+VehicleBody3D::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirectBodyState3D *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse) :
m_s(s),
m_body1(body1),
m_frictionPositionWorld(frictionPosWorld),
@@ -698,7 +698,7 @@ real_t VehicleBody3D::_calc_rolling_friction(btVehicleWheelContactPoint &contact
}
static const real_t sideFrictionStiffness2 = real_t(1.0);
-void VehicleBody3D::_update_friction(PhysicsDirectBodyState *s) {
+void VehicleBody3D::_update_friction(PhysicsDirectBodyState3D *s) {
//calculate the impulse, so that the wheels don't move sidewards
int numWheel = wheels.size();
@@ -854,7 +854,7 @@ void VehicleBody3D::_direct_state_changed(Object *p_state) {
RigidBody3D::_direct_state_changed(p_state);
- state = Object::cast_to<PhysicsDirectBodyState>(p_state);
+ state = Object::cast_to<PhysicsDirectBodyState3D>(p_state);
float step = state->get_step();
@@ -917,7 +917,7 @@ void VehicleBody3D::_direct_state_changed(Object *p_state) {
wheel.m_deltaRotation *= real_t(0.99); //damping of rotation when not in contact
}
- state = NULL;
+ state = nullptr;
}
void VehicleBody3D::set_engine_force(float p_engine_force) {
@@ -988,11 +988,11 @@ VehicleBody3D::VehicleBody3D() {
engine_force = 0;
brake = 0;
- state = NULL;
+ state = nullptr;
ccd = false;
exclude.insert(get_rid());
- //PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ //PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
set_mass(40);
}
diff --git a/scene/3d/vehicle_body_3d.h b/scene/3d/vehicle_body_3d.h
index 1ca9b6253f..d5e896263d 100644
--- a/scene/3d/vehicle_body_3d.h
+++ b/scene/3d/vehicle_body_3d.h
@@ -91,7 +91,7 @@ class VehicleWheel3D : public Node3D {
PhysicsBody3D *m_groundObject; //could be general void* ptr
} m_raycastInfo;
- void _update(PhysicsDirectBodyState *s);
+ void _update(PhysicsDirectBodyState3D *s);
protected:
void _notification(int p_what);
@@ -170,24 +170,24 @@ class VehicleBody3D : public RigidBody3D {
Vector<real_t> m_sideImpulse;
struct btVehicleWheelContactPoint {
- PhysicsDirectBodyState *m_s;
+ PhysicsDirectBodyState3D *m_s;
PhysicsBody3D *m_body1;
Vector3 m_frictionPositionWorld;
Vector3 m_frictionDirectionWorld;
real_t m_jacDiagABInv;
real_t m_maxImpulse;
- btVehicleWheelContactPoint(PhysicsDirectBodyState *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse);
+ btVehicleWheelContactPoint(PhysicsDirectBodyState3D *s, PhysicsBody3D *body1, const Vector3 &frictionPosWorld, const Vector3 &frictionDirectionWorld, real_t maxImpulse);
};
- void _resolve_single_bilateral(PhysicsDirectBodyState *s, const Vector3 &pos1, PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence);
+ void _resolve_single_bilateral(PhysicsDirectBodyState3D *s, const Vector3 &pos1, PhysicsBody3D *body2, const Vector3 &pos2, const Vector3 &normal, real_t &impulse, const real_t p_rollInfluence);
real_t _calc_rolling_friction(btVehicleWheelContactPoint &contactPoint);
- void _update_friction(PhysicsDirectBodyState *s);
- void _update_suspension(PhysicsDirectBodyState *s);
- real_t _ray_cast(int p_idx, PhysicsDirectBodyState *s);
- void _update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState *s);
- void _update_wheel(int p_idx, PhysicsDirectBodyState *s);
+ void _update_friction(PhysicsDirectBodyState3D *s);
+ void _update_suspension(PhysicsDirectBodyState3D *s);
+ real_t _ray_cast(int p_idx, PhysicsDirectBodyState3D *s);
+ void _update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState3D *s);
+ void _update_wheel(int p_idx, PhysicsDirectBodyState3D *s);
friend class VehicleWheel3D;
Vector<VehicleWheel3D *> wheels;
diff --git a/scene/3d/visual_instance_3d.cpp b/scene/3d/visual_instance_3d.cpp
index 14a975c023..775a9b76e2 100644
--- a/scene/3d/visual_instance_3d.cpp
+++ b/scene/3d/visual_instance_3d.cpp
@@ -31,7 +31,7 @@
#include "visual_instance_3d.h"
#include "scene/scene_string_names.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
#include "skeleton_3d.h"
AABB VisualInstance3D::get_transformed_aabb() const {
@@ -45,7 +45,7 @@ void VisualInstance3D::_update_visibility() {
return;
_change_notify("visible");
- VS::get_singleton()->instance_set_visible(get_instance(), is_visible_in_tree());
+ RS::get_singleton()->instance_set_visible(get_instance(), is_visible_in_tree());
}
void VisualInstance3D::_notification(int p_what) {
@@ -58,23 +58,23 @@ void VisualInstance3D::_notification(int p_what) {
/*
Skeleton *skeleton=Object::cast_to<Skeleton>(get_parent());
if (skeleton)
- VisualServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() );
+ RenderingServer::get_singleton()->instance_attach_skeleton( instance, skeleton->get_skeleton() );
*/
ERR_FAIL_COND(get_world().is_null());
- VisualServer::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario());
+ RenderingServer::get_singleton()->instance_set_scenario(instance, get_world()->get_scenario());
_update_visibility();
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
Transform gt = get_global_transform();
- VisualServer::get_singleton()->instance_set_transform(instance, gt);
+ RenderingServer::get_singleton()->instance_set_transform(instance, gt);
} break;
case NOTIFICATION_EXIT_WORLD: {
- VisualServer::get_singleton()->instance_set_scenario(instance, RID());
- VisualServer::get_singleton()->instance_attach_skeleton(instance, RID());
- //VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
+ RenderingServer::get_singleton()->instance_set_scenario(instance, RID());
+ RenderingServer::get_singleton()->instance_attach_skeleton(instance, RID());
+ //RS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -97,7 +97,7 @@ RID VisualInstance3D::_get_visual_instance_rid() const {
void VisualInstance3D::set_layer_mask(uint32_t p_mask) {
layers = p_mask;
- VisualServer::get_singleton()->instance_set_layer_mask(instance, p_mask);
+ RenderingServer::get_singleton()->instance_set_layer_mask(instance, p_mask);
}
uint32_t VisualInstance3D::get_layer_mask() const {
@@ -137,7 +137,7 @@ void VisualInstance3D::_bind_methods() {
void VisualInstance3D::set_base(const RID &p_base) {
- VisualServer::get_singleton()->instance_set_base(instance, p_base);
+ RenderingServer::get_singleton()->instance_set_base(instance, p_base);
base = p_base;
}
@@ -148,21 +148,21 @@ RID VisualInstance3D::get_base() const {
VisualInstance3D::VisualInstance3D() {
- instance = VisualServer::get_singleton()->instance_create();
- VisualServer::get_singleton()->instance_attach_object_instance_id(instance, get_instance_id());
+ instance = RenderingServer::get_singleton()->instance_create();
+ RenderingServer::get_singleton()->instance_attach_object_instance_id(instance, get_instance_id());
layers = 1;
set_notify_transform(true);
}
VisualInstance3D::~VisualInstance3D() {
- VisualServer::get_singleton()->free(instance);
+ RenderingServer::get_singleton()->free(instance);
}
void GeometryInstance3D::set_material_override(const Ref<Material> &p_material) {
material_override = p_material;
- VS::get_singleton()->instance_geometry_set_material_override(get_instance(), p_material.is_valid() ? p_material->get_rid() : RID());
+ RS::get_singleton()->instance_geometry_set_material_override(get_instance(), p_material.is_valid() ? p_material->get_rid() : RID());
}
Ref<Material> GeometryInstance3D::get_material_override() const {
@@ -173,7 +173,7 @@ Ref<Material> GeometryInstance3D::get_material_override() const {
void GeometryInstance3D::set_lod_min_distance(float p_dist) {
lod_min_distance = p_dist;
- VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+ RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}
float GeometryInstance3D::get_lod_min_distance() const {
@@ -184,7 +184,7 @@ float GeometryInstance3D::get_lod_min_distance() const {
void GeometryInstance3D::set_lod_max_distance(float p_dist) {
lod_max_distance = p_dist;
- VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+ RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}
float GeometryInstance3D::get_lod_max_distance() const {
@@ -195,7 +195,7 @@ float GeometryInstance3D::get_lod_max_distance() const {
void GeometryInstance3D::set_lod_min_hysteresis(float p_dist) {
lod_min_hysteresis = p_dist;
- VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+ RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}
float GeometryInstance3D::get_lod_min_hysteresis() const {
@@ -206,7 +206,7 @@ float GeometryInstance3D::get_lod_min_hysteresis() const {
void GeometryInstance3D::set_lod_max_hysteresis(float p_dist) {
lod_max_hysteresis = p_dist;
- VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
+ RS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
}
float GeometryInstance3D::get_lod_max_hysteresis() const {
@@ -224,7 +224,7 @@ void GeometryInstance3D::set_flag(Flags p_flag, bool p_value) {
return;
flags[p_flag] = p_value;
- VS::get_singleton()->instance_geometry_set_flag(get_instance(), (VS::InstanceFlags)p_flag, p_value);
+ RS::get_singleton()->instance_geometry_set_flag(get_instance(), (RS::InstanceFlags)p_flag, p_value);
}
bool GeometryInstance3D::get_flag(Flags p_flag) const {
@@ -238,7 +238,7 @@ void GeometryInstance3D::set_cast_shadows_setting(ShadowCastingSetting p_shadow_
shadow_casting_setting = p_shadow_casting_setting;
- VS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (VS::ShadowCastingSetting)p_shadow_casting_setting);
+ RS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (RS::ShadowCastingSetting)p_shadow_casting_setting);
}
GeometryInstance3D::ShadowCastingSetting GeometryInstance3D::get_cast_shadows_setting() const {
@@ -250,7 +250,7 @@ void GeometryInstance3D::set_extra_cull_margin(float p_margin) {
ERR_FAIL_COND(p_margin < 0);
extra_cull_margin = p_margin;
- VS::get_singleton()->instance_set_extra_visibility_margin(get_instance(), extra_cull_margin);
+ RS::get_singleton()->instance_set_extra_visibility_margin(get_instance(), extra_cull_margin);
}
float GeometryInstance3D::get_extra_cull_margin() const {
@@ -260,7 +260,7 @@ float GeometryInstance3D::get_extra_cull_margin() const {
void GeometryInstance3D::set_custom_aabb(AABB aabb) {
- VS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
+ RS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
}
void GeometryInstance3D::_bind_methods() {
@@ -331,5 +331,5 @@ GeometryInstance3D::GeometryInstance3D() {
shadow_casting_setting = SHADOW_CASTING_SETTING_ON;
extra_cull_margin = 0;
- //VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
+ //RS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
}
diff --git a/scene/3d/visual_instance_3d.h b/scene/3d/visual_instance_3d.h
index 59a935fdee..9476c28848 100644
--- a/scene/3d/visual_instance_3d.h
+++ b/scene/3d/visual_instance_3d.h
@@ -86,17 +86,17 @@ class GeometryInstance3D : public VisualInstance3D {
public:
enum Flags {
- FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT,
- FLAG_USE_DYNAMIC_GI = VS::INSTANCE_FLAG_USE_DYNAMIC_GI,
- FLAG_DRAW_NEXT_FRAME_IF_VISIBLE = VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE,
- FLAG_MAX = VS::INSTANCE_FLAG_MAX,
+ FLAG_USE_BAKED_LIGHT = RS::INSTANCE_FLAG_USE_BAKED_LIGHT,
+ FLAG_USE_DYNAMIC_GI = RS::INSTANCE_FLAG_USE_DYNAMIC_GI,
+ FLAG_DRAW_NEXT_FRAME_IF_VISIBLE = RS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE,
+ FLAG_MAX = RS::INSTANCE_FLAG_MAX,
};
enum ShadowCastingSetting {
- SHADOW_CASTING_SETTING_OFF = VS::SHADOW_CASTING_SETTING_OFF,
- SHADOW_CASTING_SETTING_ON = VS::SHADOW_CASTING_SETTING_ON,
- SHADOW_CASTING_SETTING_DOUBLE_SIDED = VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED,
- SHADOW_CASTING_SETTING_SHADOWS_ONLY = VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY
+ SHADOW_CASTING_SETTING_OFF = RS::SHADOW_CASTING_SETTING_OFF,
+ SHADOW_CASTING_SETTING_ON = RS::SHADOW_CASTING_SETTING_ON,
+ SHADOW_CASTING_SETTING_DOUBLE_SIDED = RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED,
+ SHADOW_CASTING_SETTING_SHADOWS_ONLY = RS::SHADOW_CASTING_SETTING_SHADOWS_ONLY
};
private: