diff options
Diffstat (limited to 'scene')
129 files changed, 2094 insertions, 2095 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index b99c4c88bf..4ccff07416 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -32,12 +32,12 @@ #include "scene/scene_string_names.h" #include "servers/audio_server.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" void Area2D::set_space_override_mode(SpaceOverride p_mode) { space_override = p_mode; - Physics2DServer::get_singleton()->area_set_space_override_mode(get_rid(), Physics2DServer::AreaSpaceOverrideMode(p_mode)); + PhysicsServer2D::get_singleton()->area_set_space_override_mode(get_rid(), PhysicsServer2D::AreaSpaceOverrideMode(p_mode)); } Area2D::SpaceOverride Area2D::get_space_override_mode() const { @@ -47,7 +47,7 @@ Area2D::SpaceOverride Area2D::get_space_override_mode() const { void Area2D::set_gravity_is_point(bool p_enabled) { gravity_is_point = p_enabled; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_GRAVITY_IS_POINT, p_enabled); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT, p_enabled); } bool Area2D::is_gravity_a_point() const { @@ -57,7 +57,7 @@ bool Area2D::is_gravity_a_point() const { void Area2D::set_gravity_distance_scale(real_t p_scale) { gravity_distance_scale = p_scale; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE, p_scale); } real_t Area2D::get_gravity_distance_scale() const { @@ -67,7 +67,7 @@ real_t Area2D::get_gravity_distance_scale() const { void Area2D::set_gravity_vector(const Vector2 &p_vec) { gravity_vec = p_vec; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_GRAVITY_VECTOR, p_vec); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR, p_vec); } Vector2 Area2D::get_gravity_vector() const { @@ -77,7 +77,7 @@ Vector2 Area2D::get_gravity_vector() const { void Area2D::set_gravity(real_t p_gravity) { gravity = p_gravity; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_GRAVITY, p_gravity); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY, p_gravity); } real_t Area2D::get_gravity() const { @@ -87,7 +87,7 @@ real_t Area2D::get_gravity() const { void Area2D::set_linear_damp(real_t p_linear_damp) { linear_damp = p_linear_damp; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_LINEAR_DAMP, p_linear_damp); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_LINEAR_DAMP, p_linear_damp); } real_t Area2D::get_linear_damp() const { @@ -97,7 +97,7 @@ real_t Area2D::get_linear_damp() const { void Area2D::set_angular_damp(real_t p_angular_damp) { angular_damp = p_angular_damp; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_ANGULAR_DAMP, p_angular_damp); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP, p_angular_damp); } real_t Area2D::get_angular_damp() const { @@ -108,7 +108,7 @@ real_t Area2D::get_angular_damp() const { void Area2D::set_priority(real_t p_priority) { priority = p_priority; - Physics2DServer::get_singleton()->area_set_param(get_rid(), Physics2DServer::AREA_PARAM_PRIORITY, p_priority); + PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_PRIORITY, p_priority); } real_t Area2D::get_priority() const { @@ -151,7 +151,7 @@ void Area2D::_body_exit_tree(ObjectID p_id) { void Area2D::_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 == Physics2DServer::AREA_BODY_ADDED; + bool body_in = p_status == PhysicsServer2D::AREA_BODY_ADDED; ObjectID objid = p_instance; Object *obj = ObjectDB::get_instance(objid); @@ -254,7 +254,7 @@ void Area2D::_area_exit_tree(ObjectID p_id) { void Area2D::_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 == Physics2DServer::AREA_BODY_ADDED; + bool area_in = p_status == PhysicsServer2D::AREA_BODY_ADDED; ObjectID objid = p_instance; Object *obj = ObjectDB::get_instance(objid); @@ -403,12 +403,12 @@ void Area2D::set_monitoring(bool p_enable) { if (monitoring) { - Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout); - Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout); + PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout); + PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout); } else { - Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName()); - Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName()); + PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName()); + PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName()); _clear_monitoring(); } } @@ -420,14 +420,14 @@ bool Area2D::is_monitoring() const { void Area2D::set_monitorable(bool p_enable) { - ERR_FAIL_COND_MSG(locked || (is_inside_tree() && Physics2DServer::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() && PhysicsServer2D::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; - Physics2DServer::get_singleton()->area_set_monitorable(get_rid(), monitorable); + PhysicsServer2D::get_singleton()->area_set_monitorable(get_rid(), monitorable); } bool Area2D::is_monitorable() const { @@ -492,7 +492,7 @@ bool Area2D::overlaps_body(Node *p_body) const { void Area2D::set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; - Physics2DServer::get_singleton()->area_set_collision_mask(get_rid(), p_mask); + PhysicsServer2D::get_singleton()->area_set_collision_mask(get_rid(), p_mask); } uint32_t Area2D::get_collision_mask() const { @@ -503,7 +503,7 @@ uint32_t Area2D::get_collision_mask() const { void Area2D::set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; - Physics2DServer::get_singleton()->area_set_collision_layer(get_rid(), p_layer); + PhysicsServer2D::get_singleton()->area_set_collision_layer(get_rid(), p_layer); } uint32_t Area2D::get_collision_layer() const { @@ -676,7 +676,7 @@ void Area2D::_bind_methods() { } Area2D::Area2D() : - CollisionObject2D(Physics2DServer::get_singleton()->area_create(), true) { + CollisionObject2D(PhysicsServer2D::get_singleton()->area_create(), true) { space_override = SPACE_OVERRIDE_DISABLED; set_gravity(98); diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index df0b17800f..55d111439a 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -187,9 +187,9 @@ void AudioStreamPlayer2D::_notification(int p_what) { //check if any area is diverting sound into a bus - Physics2DDirectSpaceState *space_state = Physics2DServer::get_singleton()->space_get_direct_state(world_2d->get_space()); + PhysicsDirectSpaceState2D *space_state = PhysicsServer2D::get_singleton()->space_get_direct_state(world_2d->get_space()); - Physics2DDirectSpaceState::ShapeResult sr[MAX_INTERSECT_AREAS]; + PhysicsDirectSpaceState2D::ShapeResult sr[MAX_INTERSECT_AREAS]; int areas = space_state->intersect_point(global_pos, sr, MAX_INTERSECT_AREAS, Set<RID>(), area_mask, false, true); diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp index faeb6b7169..4c952b7ca6 100644 --- a/scene/2d/back_buffer_copy.cpp +++ b/scene/2d/back_buffer_copy.cpp @@ -36,15 +36,15 @@ void BackBufferCopy::_update_copy_mode() { case COPY_MODE_DISABLED: { - VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), false, Rect2()); + RS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), false, Rect2()); } break; case COPY_MODE_RECT: { - VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), true, rect); + RS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), true, rect); } break; case COPY_MODE_VIEWPORT: { - VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), true, Rect2()); + RS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(), true, Rect2()); } break; } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index a8860c3d81..6d8d981974 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -33,7 +33,7 @@ #include "core/engine.h" #include "core/math/math_funcs.h" #include "scene/scene_string_names.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" void Camera2D::_update_scroll() { diff --git a/scene/2d/canvas_modulate.cpp b/scene/2d/canvas_modulate.cpp index 25db434918..05f8804e2a 100644 --- a/scene/2d/canvas_modulate.cpp +++ b/scene/2d/canvas_modulate.cpp @@ -35,23 +35,23 @@ void CanvasModulate::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_CANVAS) { if (is_visible_in_tree()) { - VS::get_singleton()->canvas_set_modulate(get_canvas(), color); + RS::get_singleton()->canvas_set_modulate(get_canvas(), color); add_to_group("_canvas_modulate_" + itos(get_canvas().get_id())); } } else if (p_what == NOTIFICATION_EXIT_CANVAS) { if (is_visible_in_tree()) { - VS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1)); + RS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1)); remove_from_group("_canvas_modulate_" + itos(get_canvas().get_id())); } } else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { if (is_visible_in_tree()) { - VS::get_singleton()->canvas_set_modulate(get_canvas(), color); + RS::get_singleton()->canvas_set_modulate(get_canvas(), color); add_to_group("_canvas_modulate_" + itos(get_canvas().get_id())); } else { - VS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1)); + RS::get_singleton()->canvas_set_modulate(get_canvas(), Color(1, 1, 1, 1)); remove_from_group("_canvas_modulate_" + itos(get_canvas().get_id())); } @@ -71,7 +71,7 @@ void CanvasModulate::set_color(const Color &p_color) { color = p_color; if (is_visible_in_tree()) { - VS::get_singleton()->canvas_set_modulate(get_canvas(), color); + RS::get_singleton()->canvas_set_modulate(get_canvas(), color); } } Color CanvasModulate::get_color() const { diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 4af2e846f7..5535043432 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -31,7 +31,7 @@ #include "collision_object_2d.h" #include "scene/scene_string_names.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" void CollisionObject2D::_notification(int p_what) { @@ -42,15 +42,15 @@ void CollisionObject2D::_notification(int p_what) { Transform2D global_transform = get_global_transform(); if (area) - Physics2DServer::get_singleton()->area_set_transform(rid, global_transform); + PhysicsServer2D::get_singleton()->area_set_transform(rid, global_transform); else - Physics2DServer::get_singleton()->body_set_state(rid, Physics2DServer::BODY_STATE_TRANSFORM, global_transform); + PhysicsServer2D::get_singleton()->body_set_state(rid, PhysicsServer2D::BODY_STATE_TRANSFORM, global_transform); RID space = get_world_2d()->get_space(); if (area) { - Physics2DServer::get_singleton()->area_set_space(rid, space); + PhysicsServer2D::get_singleton()->area_set_space(rid, space); } else - Physics2DServer::get_singleton()->body_set_space(rid, space); + PhysicsServer2D::get_singleton()->body_set_space(rid, space); _update_pickable(); @@ -60,9 +60,9 @@ void CollisionObject2D::_notification(int p_what) { case NOTIFICATION_ENTER_CANVAS: { if (area) - Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, get_canvas_layer_instance_id()); + PhysicsServer2D::get_singleton()->area_attach_canvas_instance_id(rid, get_canvas_layer_instance_id()); else - Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, get_canvas_layer_instance_id()); + PhysicsServer2D::get_singleton()->body_attach_canvas_instance_id(rid, get_canvas_layer_instance_id()); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -78,26 +78,26 @@ void CollisionObject2D::_notification(int p_what) { Transform2D global_transform = get_global_transform(); if (area) - Physics2DServer::get_singleton()->area_set_transform(rid, global_transform); + PhysicsServer2D::get_singleton()->area_set_transform(rid, global_transform); else - Physics2DServer::get_singleton()->body_set_state(rid, Physics2DServer::BODY_STATE_TRANSFORM, global_transform); + PhysicsServer2D::get_singleton()->body_set_state(rid, PhysicsServer2D::BODY_STATE_TRANSFORM, global_transform); } break; case NOTIFICATION_EXIT_TREE: { if (area) { - Physics2DServer::get_singleton()->area_set_space(rid, RID()); + PhysicsServer2D::get_singleton()->area_set_space(rid, RID()); } else - Physics2DServer::get_singleton()->body_set_space(rid, RID()); + PhysicsServer2D::get_singleton()->body_set_space(rid, RID()); } break; case NOTIFICATION_EXIT_CANVAS: { if (area) - Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, ObjectID()); + PhysicsServer2D::get_singleton()->area_attach_canvas_instance_id(rid, ObjectID()); else - Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, ObjectID()); + PhysicsServer2D::get_singleton()->body_attach_canvas_instance_id(rid, ObjectID()); } break; } } @@ -136,9 +136,9 @@ void CollisionObject2D::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) { - Physics2DServer::get_singleton()->area_set_shape_disabled(rid, sd.shapes[i].index, p_disabled); + PhysicsServer2D::get_singleton()->area_set_shape_disabled(rid, sd.shapes[i].index, p_disabled); } else { - Physics2DServer::get_singleton()->body_set_shape_disabled(rid, sd.shapes[i].index, p_disabled); + PhysicsServer2D::get_singleton()->body_set_shape_disabled(rid, sd.shapes[i].index, p_disabled); } } } @@ -160,7 +160,7 @@ void CollisionObject2D::shape_owner_set_one_way_collision(uint32_t p_owner, bool ShapeData &sd = shapes[p_owner]; sd.one_way_collision = p_enable; for (int i = 0; i < sd.shapes.size(); i++) { - Physics2DServer::get_singleton()->body_set_shape_as_one_way_collision(rid, sd.shapes[i].index, sd.one_way_collision, sd.one_way_collision_margin); + PhysicsServer2D::get_singleton()->body_set_shape_as_one_way_collision(rid, sd.shapes[i].index, sd.one_way_collision, sd.one_way_collision_margin); } } @@ -181,7 +181,7 @@ void CollisionObject2D::shape_owner_set_one_way_collision_margin(uint32_t p_owne ShapeData &sd = shapes[p_owner]; sd.one_way_collision_margin = p_margin; for (int i = 0; i < sd.shapes.size(); i++) { - Physics2DServer::get_singleton()->body_set_shape_as_one_way_collision(rid, sd.shapes[i].index, sd.one_way_collision, sd.one_way_collision_margin); + PhysicsServer2D::get_singleton()->body_set_shape_as_one_way_collision(rid, sd.shapes[i].index, sd.one_way_collision, sd.one_way_collision_margin); } } @@ -218,9 +218,9 @@ void CollisionObject2D::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) { - Physics2DServer::get_singleton()->area_set_shape_transform(rid, sd.shapes[i].index, sd.xform); + PhysicsServer2D::get_singleton()->area_set_shape_transform(rid, sd.shapes[i].index, sd.xform); } else { - Physics2DServer::get_singleton()->body_set_shape_transform(rid, sd.shapes[i].index, sd.xform); + PhysicsServer2D::get_singleton()->body_set_shape_transform(rid, sd.shapes[i].index, sd.xform); } } } @@ -248,9 +248,9 @@ void CollisionObject2D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape2 s.index = total_subshapes; s.shape = p_shape; if (area) { - Physics2DServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled); + PhysicsServer2D::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled); } else { - Physics2DServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled); + PhysicsServer2D::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled); } sd.shapes.push_back(s); @@ -284,9 +284,9 @@ void CollisionObject2D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) int index_to_remove = shapes[p_owner].shapes[p_shape].index; if (area) { - Physics2DServer::get_singleton()->area_remove_shape(rid, index_to_remove); + PhysicsServer2D::get_singleton()->area_remove_shape(rid, index_to_remove); } else { - Physics2DServer::get_singleton()->body_remove_shape(rid, index_to_remove); + PhysicsServer2D::get_singleton()->body_remove_shape(rid, index_to_remove); } shapes[p_owner].shapes.remove(p_shape); @@ -375,9 +375,9 @@ void CollisionObject2D::_update_pickable() { bool is_pickable = pickable && is_visible_in_tree(); if (area) - Physics2DServer::get_singleton()->area_set_pickable(rid, is_pickable); + PhysicsServer2D::get_singleton()->area_set_pickable(rid, is_pickable); else - Physics2DServer::get_singleton()->body_set_pickable(rid, is_pickable); + PhysicsServer2D::get_singleton()->body_set_pickable(rid, is_pickable); } String CollisionObject2D::get_configuration_warning() const { @@ -442,9 +442,9 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) { if (p_area) { - Physics2DServer::get_singleton()->area_attach_object_instance_id(rid, get_instance_id()); + PhysicsServer2D::get_singleton()->area_attach_object_instance_id(rid, get_instance_id()); } else { - Physics2DServer::get_singleton()->body_attach_object_instance_id(rid, get_instance_id()); + PhysicsServer2D::get_singleton()->body_attach_object_instance_id(rid, get_instance_id()); } } @@ -457,5 +457,5 @@ CollisionObject2D::CollisionObject2D() { CollisionObject2D::~CollisionObject2D() { - Physics2DServer::get_singleton()->free(rid); + PhysicsServer2D::get_singleton()->free(rid); } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index e9dfb94cb2..5880045e90 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -106,7 +106,7 @@ void CollisionPolygon2D::_notification(int p_what) { /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); - set_z_index(VS::CANVAS_ITEM_Z_MAX - 1); + set_z_index(RS::CANVAS_ITEM_Z_MAX - 1); }*/ } break; diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index b2ad040654..cb2953cc15 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -73,7 +73,7 @@ void CollisionShape2D::_notification(int p_what) { /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); - set_z_index(VS::CANVAS_ITEM_Z_MAX - 1); + set_z_index(RS::CANVAS_ITEM_Z_MAX - 1); }*/ } break; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 8678e5a1f4..ba604c086e 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -34,7 +34,7 @@ #include "scene/2d/gpu_particles_2d.h" #include "scene/main/canvas_item.h" #include "scene/resources/particles_material.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" void CPUParticles2D::set_emitting(bool p_emitting) { @@ -60,7 +60,7 @@ void CPUParticles2D::set_amount(int p_amount) { } particle_data.resize((8 + 4 + 4) * p_amount); - VS::get_singleton()->multimesh_allocate(multimesh, p_amount, VS::MULTIMESH_TRANSFORM_2D, true, true); + RS::get_singleton()->multimesh_allocate(multimesh, p_amount, RS::MULTIMESH_TRANSFORM_2D, true, true); particle_order.resize(p_amount); } @@ -198,14 +198,14 @@ void CPUParticles2D::_update_mesh_texture() { indices.push_back(0); Array arr; - arr.resize(VS::ARRAY_MAX); - arr[VS::ARRAY_VERTEX] = vertices; - arr[VS::ARRAY_TEX_UV] = uvs; - arr[VS::ARRAY_COLOR] = colors; - arr[VS::ARRAY_INDEX] = indices; + arr.resize(RS::ARRAY_MAX); + arr[RS::ARRAY_VERTEX] = vertices; + arr[RS::ARRAY_TEX_UV] = uvs; + arr[RS::ARRAY_COLOR] = colors; + arr[RS::ARRAY_INDEX] = indices; - VS::get_singleton()->mesh_clear(mesh); - VS::get_singleton()->mesh_add_surface_from_arrays(mesh, VS::PRIMITIVE_TRIANGLES, arr); + RS::get_singleton()->mesh_clear(mesh); + RS::get_singleton()->mesh_add_surface_from_arrays(mesh, RS::PRIMITIVE_TRIANGLES, arr); } void CPUParticles2D::set_texture(const Ref<Texture2D> &p_texture) { @@ -1046,17 +1046,17 @@ void CPUParticles2D::_set_redraw(bool p_redraw) { MutexLock lock(update_mutex); if (redraw) { - VS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread)); - VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true); + RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread)); + RS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true); - VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1); + RS::get_singleton()->multimesh_set_visible_instances(multimesh, -1); } else { - if (VS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread))) { - VS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread)); + if (RS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread))) { + RS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &CPUParticles2D::_update_render_thread)); } - VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), false); + RS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), false); - VS::get_singleton()->multimesh_set_visible_instances(multimesh, 0); + RS::get_singleton()->multimesh_set_visible_instances(multimesh, 0); } } @@ -1067,7 +1067,7 @@ void CPUParticles2D::_update_render_thread() { MutexLock lock(update_mutex); - VS::get_singleton()->multimesh_set_buffer(multimesh, particle_data); + RS::get_singleton()->multimesh_set_buffer(multimesh, particle_data); } void CPUParticles2D::_notification(int p_what) { @@ -1098,7 +1098,7 @@ void CPUParticles2D::_notification(int p_what) { normrid = normalmap->get_rid(); } - VS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid, normrid); + RS::get_singleton()->canvas_item_add_multimesh(get_canvas_item(), multimesh, texrid, normrid); } if (p_what == NOTIFICATION_INTERNAL_PROCESS) { @@ -1428,9 +1428,9 @@ CPUParticles2D::CPUParticles2D() { redraw = false; emitting = false; - mesh = VisualServer::get_singleton()->mesh_create(); - multimesh = VisualServer::get_singleton()->multimesh_create(); - VisualServer::get_singleton()->multimesh_set_mesh(multimesh, mesh); + mesh = RenderingServer::get_singleton()->mesh_create(); + multimesh = RenderingServer::get_singleton()->multimesh_create(); + RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh); set_emitting(true); set_one_shot(false); @@ -1481,6 +1481,6 @@ CPUParticles2D::CPUParticles2D() { } CPUParticles2D::~CPUParticles2D() { - VS::get_singleton()->free(multimesh); - VS::get_singleton()->free(mesh); + RS::get_singleton()->free(multimesh); + RS::get_singleton()->free(mesh); } diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index d3d1326018..fd9706eb2a 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -40,7 +40,7 @@ void GPUParticles2D::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); @@ -53,25 +53,25 @@ void GPUParticles2D::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 GPUParticles2D::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 GPUParticles2D::set_one_shot(bool p_enable) { one_shot = p_enable; - 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) @@ -80,17 +80,17 @@ void GPUParticles2D::set_one_shot(bool p_enable) { void GPUParticles2D::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 GPUParticles2D::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 GPUParticles2D::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 GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { @@ -101,7 +101,7 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { aabb.size.x = p_visibility_rect.size.x; aabb.size.y = p_visibility_rect.size.y; - VS::get_singleton()->particles_set_custom_aabb(particles, aabb); + RS::get_singleton()->particles_set_custom_aabb(particles, aabb); _change_notify("visibility_rect"); update(); @@ -109,7 +109,7 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) { void GPUParticles2D::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); set_notify_transform(!p_enable); if (!p_enable && is_inside_tree()) { _update_particle_emission_transform(); @@ -124,7 +124,7 @@ void GPUParticles2D::_update_particle_emission_transform() { xf.basis.set_axis(1, Vector3(xf2d.get_axis(1).x, xf2d.get_axis(1).y, 0)); xf.set_origin(Vector3(xf2d.get_origin().x, xf2d.get_origin().y, 0)); - VS::get_singleton()->particles_set_emission_transform(particles, xf); + RS::get_singleton()->particles_set_emission_transform(particles, xf); } void GPUParticles2D::set_process_material(const Ref<Material> &p_material) { @@ -139,7 +139,7 @@ void GPUParticles2D::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(); } @@ -147,12 +147,12 @@ void GPUParticles2D::set_process_material(const Ref<Material> &p_material) { void GPUParticles2D::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 GPUParticles2D::is_emitting() const { - return VS::get_singleton()->particles_get_emitting(particles); + return RS::get_singleton()->particles_get_emitting(particles); } int GPUParticles2D::get_amount() const { @@ -200,7 +200,7 @@ float GPUParticles2D::get_speed_scale() const { void GPUParticles2D::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)); } GPUParticles2D::DrawOrder GPUParticles2D::get_draw_order() const { @@ -210,7 +210,7 @@ GPUParticles2D::DrawOrder GPUParticles2D::get_draw_order() const { void GPUParticles2D::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 GPUParticles2D::get_fixed_fps() const { @@ -219,7 +219,7 @@ int GPUParticles2D::get_fixed_fps() const { void GPUParticles2D::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 GPUParticles2D::get_fractional_delta() const { @@ -228,7 +228,7 @@ bool GPUParticles2D::get_fractional_delta() const { String GPUParticles2D::get_configuration_warning() const { - if (VisualServer::get_singleton()->is_low_end()) { + if (RenderingServer::get_singleton()->is_low_end()) { return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose."); } @@ -259,7 +259,7 @@ String GPUParticles2D::get_configuration_warning() const { Rect2 GPUParticles2D::capture_rect() const { - AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles); + AABB aabb = RS::get_singleton()->particles_get_current_aabb(particles); Rect2 r; r.position.x = aabb.position.x; r.position.y = aabb.position.y; @@ -291,8 +291,8 @@ void GPUParticles2D::_validate_property(PropertyInfo &property) const { } void GPUParticles2D::restart() { - VS::get_singleton()->particles_restart(particles); - VS::get_singleton()->particles_set_emitting(particles, true); + RS::get_singleton()->particles_restart(particles); + RS::get_singleton()->particles_set_emitting(particles, true); } void GPUParticles2D::_notification(int p_what) { @@ -306,7 +306,7 @@ void GPUParticles2D::_notification(int p_what) { if (normal_map.is_valid()) normal_rid = normal_map->get_rid(); - VS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid, normal_rid); + RS::get_singleton()->canvas_item_add_particles(get_canvas_item(), particles, texture_rid, normal_rid); #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && (this == get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) { @@ -318,10 +318,10 @@ void GPUParticles2D::_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); } } @@ -408,7 +408,7 @@ void GPUParticles2D::_bind_methods() { GPUParticles2D::GPUParticles2D() { - particles = VS::get_singleton()->particles_create(); + particles = RS::get_singleton()->particles_create(); one_shot = false; // Needed so that set_emitting doesn't access uninitialized values set_emitting(true); @@ -428,5 +428,5 @@ GPUParticles2D::GPUParticles2D() { GPUParticles2D::~GPUParticles2D() { - VS::get_singleton()->free(particles); + RS::get_singleton()->free(particles); } diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp index 9cc9ab25ac..6cbb0d2a39 100644 --- a/scene/2d/joints_2d.cpp +++ b/scene/2d/joints_2d.cpp @@ -32,15 +32,15 @@ #include "core/engine.h" #include "physics_body_2d.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" void Joint2D::_update_joint(bool p_only_free) { if (joint.is_valid()) { if (ba.is_valid() && bb.is_valid() && exclude_from_collision) - Physics2DServer::get_singleton()->joint_disable_collisions_between_bodies(joint, false); + PhysicsServer2D::get_singleton()->joint_disable_collisions_between_bodies(joint, false); - Physics2DServer::get_singleton()->free(joint); + PhysicsServer2D::get_singleton()->free(joint); joint = RID(); ba = RID(); bb = RID(); @@ -66,12 +66,12 @@ void Joint2D::_update_joint(bool p_only_free) { if (!joint.is_valid()) return; - Physics2DServer::get_singleton()->get_singleton()->joint_set_param(joint, Physics2DServer::JOINT_PARAM_BIAS, bias); + PhysicsServer2D::get_singleton()->get_singleton()->joint_set_param(joint, PhysicsServer2D::JOINT_PARAM_BIAS, bias); ba = body_a->get_rid(); bb = body_b->get_rid(); - Physics2DServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision); + PhysicsServer2D::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision); } void Joint2D::set_node_a(const NodePath &p_node_a) { @@ -119,7 +119,7 @@ void Joint2D::set_bias(real_t p_bias) { bias = p_bias; if (joint.is_valid()) - Physics2DServer::get_singleton()->get_singleton()->joint_set_param(joint, Physics2DServer::JOINT_PARAM_BIAS, bias); + PhysicsServer2D::get_singleton()->get_singleton()->joint_set_param(joint, PhysicsServer2D::JOINT_PARAM_BIAS, bias); } real_t Joint2D::get_bias() const { @@ -192,8 +192,8 @@ void PinJoint2D::_notification(int p_what) { RID PinJoint2D::_configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b) { - RID pj = Physics2DServer::get_singleton()->pin_joint_create(get_global_transform().get_origin(), body_a->get_rid(), body_b ? body_b->get_rid() : RID()); - Physics2DServer::get_singleton()->pin_joint_set_param(pj, Physics2DServer::PIN_JOINT_SOFTNESS, softness); + RID pj = PhysicsServer2D::get_singleton()->pin_joint_create(get_global_transform().get_origin(), body_a->get_rid(), body_b ? body_b->get_rid() : RID()); + PhysicsServer2D::get_singleton()->pin_joint_set_param(pj, PhysicsServer2D::PIN_JOINT_SOFTNESS, softness); return pj; } @@ -202,7 +202,7 @@ void PinJoint2D::set_softness(real_t p_softness) { softness = p_softness; update(); if (get_joint().is_valid()) - Physics2DServer::get_singleton()->pin_joint_set_param(get_joint(), Physics2DServer::PIN_JOINT_SOFTNESS, p_softness); + PhysicsServer2D::get_singleton()->pin_joint_set_param(get_joint(), PhysicsServer2D::PIN_JOINT_SOFTNESS, p_softness); } real_t PinJoint2D::get_softness() const { @@ -253,7 +253,7 @@ RID GrooveJoint2D::_configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b Vector2 groove_A2 = gt.xform(Vector2(0, length)); Vector2 anchor_B = gt.xform(Vector2(0, initial_offset)); - return Physics2DServer::get_singleton()->groove_joint_create(groove_A1, groove_A2, anchor_B, body_a->get_rid(), body_b->get_rid()); + return PhysicsServer2D::get_singleton()->groove_joint_create(groove_A1, groove_A2, anchor_B, body_a->get_rid(), body_b->get_rid()); } void GrooveJoint2D::set_length(real_t p_length) { @@ -324,11 +324,11 @@ RID DampedSpringJoint2D::_configure_joint(PhysicsBody2D *body_a, PhysicsBody2D * Vector2 anchor_A = gt.get_origin(); Vector2 anchor_B = gt.xform(Vector2(0, length)); - RID dsj = Physics2DServer::get_singleton()->damped_spring_joint_create(anchor_A, anchor_B, body_a->get_rid(), body_b->get_rid()); + RID dsj = PhysicsServer2D::get_singleton()->damped_spring_joint_create(anchor_A, anchor_B, body_a->get_rid(), body_b->get_rid()); if (rest_length) - Physics2DServer::get_singleton()->damped_string_joint_set_param(dsj, Physics2DServer::DAMPED_STRING_REST_LENGTH, rest_length); - Physics2DServer::get_singleton()->damped_string_joint_set_param(dsj, Physics2DServer::DAMPED_STRING_STIFFNESS, stiffness); - Physics2DServer::get_singleton()->damped_string_joint_set_param(dsj, Physics2DServer::DAMPED_STRING_DAMPING, damping); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_REST_LENGTH, rest_length); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_STIFFNESS, stiffness); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(dsj, PhysicsServer2D::DAMPED_STRING_DAMPING, damping); return dsj; } @@ -349,7 +349,7 @@ void DampedSpringJoint2D::set_rest_length(real_t p_rest_length) { rest_length = p_rest_length; update(); if (get_joint().is_valid()) - Physics2DServer::get_singleton()->damped_string_joint_set_param(get_joint(), Physics2DServer::DAMPED_STRING_REST_LENGTH, p_rest_length ? p_rest_length : length); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_REST_LENGTH, p_rest_length ? p_rest_length : length); } real_t DampedSpringJoint2D::get_rest_length() const { @@ -362,7 +362,7 @@ void DampedSpringJoint2D::set_stiffness(real_t p_stiffness) { stiffness = p_stiffness; update(); if (get_joint().is_valid()) - Physics2DServer::get_singleton()->damped_string_joint_set_param(get_joint(), Physics2DServer::DAMPED_STRING_STIFFNESS, p_stiffness); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_STIFFNESS, p_stiffness); } real_t DampedSpringJoint2D::get_stiffness() const { @@ -375,7 +375,7 @@ void DampedSpringJoint2D::set_damping(real_t p_damping) { damping = p_damping; update(); if (get_joint().is_valid()) - Physics2DServer::get_singleton()->damped_string_joint_set_param(get_joint(), Physics2DServer::DAMPED_STRING_DAMPING, p_damping); + PhysicsServer2D::get_singleton()->damped_string_joint_set_param(get_joint(), PhysicsServer2D::DAMPED_STRING_DAMPING, p_damping); } real_t DampedSpringJoint2D::get_damping() const { diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index e61b1fa339..b3d54b81f8 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -31,7 +31,7 @@ #include "light_2d.h" #include "core/engine.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #ifdef TOOLS_ENABLED Dictionary Light2D::_edit_get_state() const { @@ -100,7 +100,7 @@ void Light2D::_update_light_visibility() { } #endif - VS::get_singleton()->canvas_light_set_enabled(canvas_light, enabled && is_visible_in_tree() && editor_ok); + RS::get_singleton()->canvas_light_set_enabled(canvas_light, enabled && is_visible_in_tree() && editor_ok); } void Light2D::set_enabled(bool p_enabled) { @@ -129,9 +129,9 @@ void Light2D::set_texture(const Ref<Texture2D> &p_texture) { texture = p_texture; if (texture.is_valid()) - VS::get_singleton()->canvas_light_set_texture(canvas_light, texture->get_rid()); + RS::get_singleton()->canvas_light_set_texture(canvas_light, texture->get_rid()); else - VS::get_singleton()->canvas_light_set_texture(canvas_light, RID()); + RS::get_singleton()->canvas_light_set_texture(canvas_light, RID()); update_configuration_warning(); } @@ -144,7 +144,7 @@ Ref<Texture2D> Light2D::get_texture() const { void Light2D::set_texture_offset(const Vector2 &p_offset) { texture_offset = p_offset; - VS::get_singleton()->canvas_light_set_texture_offset(canvas_light, texture_offset); + RS::get_singleton()->canvas_light_set_texture_offset(canvas_light, texture_offset); item_rect_changed(); _change_notify("offset"); } @@ -157,7 +157,7 @@ Vector2 Light2D::get_texture_offset() const { void Light2D::set_color(const Color &p_color) { color = p_color; - VS::get_singleton()->canvas_light_set_color(canvas_light, color); + RS::get_singleton()->canvas_light_set_color(canvas_light, color); } Color Light2D::get_color() const { @@ -167,7 +167,7 @@ Color Light2D::get_color() const { void Light2D::set_height(float p_height) { height = p_height; - VS::get_singleton()->canvas_light_set_height(canvas_light, height); + RS::get_singleton()->canvas_light_set_height(canvas_light, height); } float Light2D::get_height() const { @@ -178,7 +178,7 @@ float Light2D::get_height() const { void Light2D::set_energy(float p_energy) { energy = p_energy; - VS::get_singleton()->canvas_light_set_energy(canvas_light, energy); + RS::get_singleton()->canvas_light_set_energy(canvas_light, energy); } float Light2D::get_energy() const { @@ -193,7 +193,7 @@ void Light2D::set_texture_scale(float p_scale) { if (_scale == 0) { _scale = CMP_EPSILON; } - VS::get_singleton()->canvas_light_set_scale(canvas_light, _scale); + RS::get_singleton()->canvas_light_set_scale(canvas_light, _scale); item_rect_changed(); } @@ -205,7 +205,7 @@ float Light2D::get_texture_scale() const { void Light2D::set_z_range_min(int p_min_z) { z_min = p_min_z; - VS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max); + RS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max); } int Light2D::get_z_range_min() const { @@ -215,7 +215,7 @@ int Light2D::get_z_range_min() const { void Light2D::set_z_range_max(int p_max_z) { z_max = p_max_z; - VS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max); + RS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max); } int Light2D::get_z_range_max() const { @@ -225,7 +225,7 @@ int Light2D::get_z_range_max() const { void Light2D::set_layer_range_min(int p_min_layer) { layer_min = p_min_layer; - VS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max); + RS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max); } int Light2D::get_layer_range_min() const { @@ -235,7 +235,7 @@ int Light2D::get_layer_range_min() const { void Light2D::set_layer_range_max(int p_max_layer) { layer_max = p_max_layer; - VS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max); + RS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max); } int Light2D::get_layer_range_max() const { @@ -245,7 +245,7 @@ int Light2D::get_layer_range_max() const { void Light2D::set_item_cull_mask(int p_mask) { item_mask = p_mask; - VS::get_singleton()->canvas_light_set_item_cull_mask(canvas_light, item_mask); + RS::get_singleton()->canvas_light_set_item_cull_mask(canvas_light, item_mask); } int Light2D::get_item_cull_mask() const { @@ -256,7 +256,7 @@ int Light2D::get_item_cull_mask() const { void Light2D::set_item_shadow_cull_mask(int p_mask) { item_shadow_mask = p_mask; - VS::get_singleton()->canvas_light_set_item_shadow_cull_mask(canvas_light, item_shadow_mask); + RS::get_singleton()->canvas_light_set_item_shadow_cull_mask(canvas_light, item_shadow_mask); } int Light2D::get_item_shadow_cull_mask() const { @@ -267,7 +267,7 @@ int Light2D::get_item_shadow_cull_mask() const { void Light2D::set_mode(Mode p_mode) { mode = p_mode; - VS::get_singleton()->canvas_light_set_mode(canvas_light, VS::CanvasLightMode(p_mode)); + RS::get_singleton()->canvas_light_set_mode(canvas_light, RS::CanvasLightMode(p_mode)); } Light2D::Mode Light2D::get_mode() const { @@ -278,7 +278,7 @@ Light2D::Mode Light2D::get_mode() const { void Light2D::set_shadow_enabled(bool p_enabled) { shadow = p_enabled; - VS::get_singleton()->canvas_light_set_shadow_enabled(canvas_light, shadow); + RS::get_singleton()->canvas_light_set_shadow_enabled(canvas_light, shadow); } bool Light2D::is_shadow_enabled() const { @@ -288,7 +288,7 @@ bool Light2D::is_shadow_enabled() const { void Light2D::set_shadow_buffer_size(int p_size) { shadow_buffer_size = p_size; - VS::get_singleton()->canvas_light_set_shadow_buffer_size(canvas_light, shadow_buffer_size); + RS::get_singleton()->canvas_light_set_shadow_buffer_size(canvas_light, shadow_buffer_size); } int Light2D::get_shadow_buffer_size() const { @@ -299,7 +299,7 @@ int Light2D::get_shadow_buffer_size() const { void Light2D::set_shadow_filter(ShadowFilter p_filter) { ERR_FAIL_INDEX(p_filter, SHADOW_FILTER_MAX); shadow_filter = p_filter; - VS::get_singleton()->canvas_light_set_shadow_filter(canvas_light, VS::CanvasLightShadowFilter(p_filter)); + RS::get_singleton()->canvas_light_set_shadow_filter(canvas_light, RS::CanvasLightShadowFilter(p_filter)); } Light2D::ShadowFilter Light2D::get_shadow_filter() const { @@ -309,7 +309,7 @@ Light2D::ShadowFilter Light2D::get_shadow_filter() const { void Light2D::set_shadow_color(const Color &p_shadow_color) { shadow_color = p_shadow_color; - VS::get_singleton()->canvas_light_set_shadow_color(canvas_light, shadow_color); + RS::get_singleton()->canvas_light_set_shadow_color(canvas_light, shadow_color); } Color Light2D::get_shadow_color() const { @@ -320,13 +320,13 @@ void Light2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - VS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, get_canvas()); + RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, get_canvas()); _update_light_visibility(); } if (p_what == NOTIFICATION_TRANSFORM_CHANGED) { - VS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform()); + RS::get_singleton()->canvas_light_set_transform(canvas_light, get_global_transform()); } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { @@ -335,7 +335,7 @@ void Light2D::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - VS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, RID()); + RS::get_singleton()->canvas_light_attach_to_canvas(canvas_light, RID()); _update_light_visibility(); } } @@ -352,7 +352,7 @@ String Light2D::get_configuration_warning() const { void Light2D::set_shadow_smooth(float p_amount) { shadow_smooth = p_amount; - VS::get_singleton()->canvas_light_set_shadow_smooth(canvas_light, shadow_smooth); + RS::get_singleton()->canvas_light_set_shadow_smooth(canvas_light, shadow_smooth); } float Light2D::get_shadow_smooth() const { @@ -432,8 +432,8 @@ void Light2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Add,Sub,Mix,Mask"), "set_mode", "get_mode"); ADD_GROUP("Range", "range_"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "range_height", PROPERTY_HINT_RANGE, "-2048,2048,0.1,or_lesser,or_greater"), "set_height", "get_height"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "range_z_min", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_range_min", "get_z_range_min"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "range_z_max", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_range_max", "get_z_range_max"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "range_z_min", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_range_min", "get_z_range_min"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "range_z_max", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_range_max", "get_z_range_max"); ADD_PROPERTY(PropertyInfo(Variant::INT, "range_layer_min", PROPERTY_HINT_RANGE, "-512,512,1"), "set_layer_range_min", "get_layer_range_min"); ADD_PROPERTY(PropertyInfo(Variant::INT, "range_layer_max", PROPERTY_HINT_RANGE, "-512,512,1"), "set_layer_range_max", "get_layer_range_max"); ADD_PROPERTY(PropertyInfo(Variant::INT, "range_item_cull_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_item_cull_mask", "get_item_cull_mask"); @@ -458,7 +458,7 @@ void Light2D::_bind_methods() { Light2D::Light2D() { - canvas_light = VisualServer::get_singleton()->canvas_light_create(); + canvas_light = RenderingServer::get_singleton()->canvas_light_create(); enabled = true; editor_only = false; shadow = false; @@ -483,5 +483,5 @@ Light2D::Light2D() { Light2D::~Light2D() { - VisualServer::get_singleton()->free(canvas_light); + RenderingServer::get_singleton()->free(canvas_light); } diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index d4a5c93823..bd1a820aec 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -88,7 +88,7 @@ void OccluderPolygon2D::set_polygon(const Vector<Vector2> &p_polygon) { polygon = p_polygon; rect_cache_dirty = true; - VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon, p_polygon, closed); + RS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon, p_polygon, closed); emit_changed(); } @@ -103,7 +103,7 @@ void OccluderPolygon2D::set_closed(bool p_closed) { return; closed = p_closed; if (polygon.size()) - VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon, polygon, closed); + RS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon, polygon, closed); emit_changed(); } @@ -115,7 +115,7 @@ bool OccluderPolygon2D::is_closed() const { void OccluderPolygon2D::set_cull_mode(CullMode p_mode) { cull = p_mode; - VS::get_singleton()->canvas_occluder_polygon_set_cull_mode(occ_polygon, VS::CanvasOccluderPolygonCullMode(p_mode)); + RS::get_singleton()->canvas_occluder_polygon_set_cull_mode(occ_polygon, RS::CanvasOccluderPolygonCullMode(p_mode)); } OccluderPolygon2D::CullMode OccluderPolygon2D::get_cull_mode() const { @@ -150,7 +150,7 @@ void OccluderPolygon2D::_bind_methods() { OccluderPolygon2D::OccluderPolygon2D() { - occ_polygon = VS::get_singleton()->canvas_occluder_polygon_create(); + occ_polygon = RS::get_singleton()->canvas_occluder_polygon_create(); closed = true; cull = CULL_DISABLED; rect_cache_dirty = true; @@ -158,7 +158,7 @@ OccluderPolygon2D::OccluderPolygon2D() { OccluderPolygon2D::~OccluderPolygon2D() { - VS::get_singleton()->free(occ_polygon); + RS::get_singleton()->free(occ_polygon); } void LightOccluder2D::_poly_changed() { @@ -172,17 +172,17 @@ void LightOccluder2D::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_CANVAS) { - VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, get_canvas()); - VS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform()); - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree()); + RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, get_canvas()); + RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform()); + RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree()); } if (p_what == NOTIFICATION_TRANSFORM_CHANGED) { - VS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform()); + RS::get_singleton()->canvas_light_occluder_set_transform(occluder, get_global_transform()); } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - VS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree()); + RS::get_singleton()->canvas_light_occluder_set_enabled(occluder, is_visible_in_tree()); } if (p_what == NOTIFICATION_DRAW) { @@ -214,7 +214,7 @@ void LightOccluder2D::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_CANVAS) { - VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, RID()); + RS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder, RID()); } } @@ -239,9 +239,9 @@ void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polyg occluder_polygon = p_polygon; if (occluder_polygon.is_valid()) - VS::get_singleton()->canvas_light_occluder_set_polygon(occluder, occluder_polygon->get_rid()); + RS::get_singleton()->canvas_light_occluder_set_polygon(occluder, occluder_polygon->get_rid()); else - VS::get_singleton()->canvas_light_occluder_set_polygon(occluder, RID()); + RS::get_singleton()->canvas_light_occluder_set_polygon(occluder, RID()); #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) @@ -258,7 +258,7 @@ Ref<OccluderPolygon2D> LightOccluder2D::get_occluder_polygon() const { void LightOccluder2D::set_occluder_light_mask(int p_mask) { mask = p_mask; - VS::get_singleton()->canvas_light_occluder_set_light_mask(occluder, mask); + RS::get_singleton()->canvas_light_occluder_set_light_mask(occluder, mask); } int LightOccluder2D::get_occluder_light_mask() const { @@ -293,12 +293,12 @@ void LightOccluder2D::_bind_methods() { LightOccluder2D::LightOccluder2D() { - occluder = VS::get_singleton()->canvas_light_occluder_create(); + occluder = RS::get_singleton()->canvas_light_occluder_create(); mask = 1; set_notify_transform(true); } LightOccluder2D::~LightOccluder2D() { - VS::get_singleton()->free(occluder); + RS::get_singleton()->free(occluder); } diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 873c901c0a..c45eab70df 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -311,7 +311,7 @@ void Line2D::_draw() { lb.build(); - VS::get_singleton()->canvas_item_add_triangle_array( + RS::get_singleton()->canvas_item_add_triangle_array( get_canvas_item(), lb.indices, lb.vertices, diff --git a/scene/2d/navigation_2d.cpp b/scene/2d/navigation_2d.cpp index bbabfa16c7..ae9fc0f32c 100644 --- a/scene/2d/navigation_2d.cpp +++ b/scene/2d/navigation_2d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "navigation_2d.h" -#include "servers/navigation_2d_server.h" +#include "servers/navigation_server_2d.h" void Navigation2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &Navigation2D::get_rid); @@ -51,44 +51,44 @@ void Navigation2D::_bind_methods() { void Navigation2D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - Navigation2DServer::get_singleton()->map_set_active(map, true); + NavigationServer2D::get_singleton()->map_set_active(map, true); } break; case NOTIFICATION_EXIT_TREE: { - Navigation2DServer::get_singleton()->map_set_active(map, false); + NavigationServer2D::get_singleton()->map_set_active(map, false); } break; } } void Navigation2D::set_cell_size(float p_cell_size) { cell_size = p_cell_size; - Navigation2DServer::get_singleton()->map_set_cell_size(map, cell_size); + NavigationServer2D::get_singleton()->map_set_cell_size(map, cell_size); } void Navigation2D::set_edge_connection_margin(float p_edge_connection_margin) { edge_connection_margin = p_edge_connection_margin; - Navigation2DServer::get_singleton()->map_set_edge_connection_margin(map, edge_connection_margin); + NavigationServer2D::get_singleton()->map_set_edge_connection_margin(map, edge_connection_margin); } Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vector2 &p_end, bool p_optimize) const { - return Navigation2DServer::get_singleton()->map_get_path(map, p_start, p_end, p_optimize); + return NavigationServer2D::get_singleton()->map_get_path(map, p_start, p_end, p_optimize); } Vector2 Navigation2D::get_closest_point(const Vector2 &p_point) const { - return Navigation2DServer::get_singleton()->map_get_closest_point(map, p_point); + return NavigationServer2D::get_singleton()->map_get_closest_point(map, p_point); } RID Navigation2D::get_closest_point_owner(const Vector2 &p_point) const { - return Navigation2DServer::get_singleton()->map_get_closest_point_owner(map, p_point); + return NavigationServer2D::get_singleton()->map_get_closest_point_owner(map, p_point); } Navigation2D::Navigation2D() { - map = Navigation2DServer::get_singleton()->map_create(); + map = NavigationServer2D::get_singleton()->map_create(); set_cell_size(10); // Ten pixels set_edge_connection_margin(100); } Navigation2D::~Navigation2D() { - Navigation2DServer::get_singleton()->free(map); + NavigationServer2D::get_singleton()->free(map); } diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index e345a076ae..c70d5ab1fe 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -32,7 +32,7 @@ #include "core/engine.h" #include "scene/2d/navigation_2d.h" -#include "servers/navigation_2d_server.h" +#include "servers/navigation_server_2d.h" void NavigationAgent2D::_bind_methods() { @@ -94,7 +94,7 @@ void NavigationAgent2D::_notification(int p_what) { agent_parent = Object::cast_to<Node2D>(get_parent()); - Navigation2DServer::get_singleton()->agent_set_callback(agent, this, "_avoidance_done"); + NavigationServer2D::get_singleton()->agent_set_callback(agent, this, "_avoidance_done"); // Search the navigation node and set it { @@ -121,7 +121,7 @@ void NavigationAgent2D::_notification(int p_what) { case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (agent_parent) { - Navigation2DServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().get_origin()); + NavigationServer2D::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().get_origin()); if (!target_reached) { if (distance_to_target() < target_desired_distance) { emit_signal("target_reached"); @@ -142,7 +142,7 @@ NavigationAgent2D::NavigationAgent2D() : velocity_submitted(false), target_reached(false), navigation_finished(true) { - agent = Navigation2DServer::get_singleton()->agent_create(); + agent = NavigationServer2D::get_singleton()->agent_create(); set_neighbor_dist(500.0); set_max_neighbors(10); set_time_horizon(20.0); @@ -151,7 +151,7 @@ NavigationAgent2D::NavigationAgent2D() : } NavigationAgent2D::~NavigationAgent2D() { - Navigation2DServer::get_singleton()->free(agent); + NavigationServer2D::get_singleton()->free(agent); agent = RID(); // Pointless } @@ -160,7 +160,7 @@ void NavigationAgent2D::set_navigation(Navigation2D *p_nav) { return; // Pointless navigation = p_nav; - Navigation2DServer::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); } void NavigationAgent2D::set_navigation_node(Node *p_nav) { @@ -179,27 +179,27 @@ void NavigationAgent2D::set_target_desired_distance(real_t p_dd) { void NavigationAgent2D::set_radius(real_t p_radius) { radius = p_radius; - Navigation2DServer::get_singleton()->agent_set_radius(agent, radius); + NavigationServer2D::get_singleton()->agent_set_radius(agent, radius); } void NavigationAgent2D::set_neighbor_dist(real_t p_dist) { neighbor_dist = p_dist; - Navigation2DServer::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist); + NavigationServer2D::get_singleton()->agent_set_neighbor_dist(agent, neighbor_dist); } void NavigationAgent2D::set_max_neighbors(int p_count) { max_neighbors = p_count; - Navigation2DServer::get_singleton()->agent_set_max_neighbors(agent, max_neighbors); + NavigationServer2D::get_singleton()->agent_set_max_neighbors(agent, max_neighbors); } void NavigationAgent2D::set_time_horizon(real_t p_time) { time_horizon = p_time; - Navigation2DServer::get_singleton()->agent_set_time_horizon(agent, time_horizon); + NavigationServer2D::get_singleton()->agent_set_time_horizon(agent, time_horizon); } void NavigationAgent2D::set_max_speed(real_t p_max_speed) { max_speed = p_max_speed; - Navigation2DServer::get_singleton()->agent_set_max_speed(agent, max_speed); + NavigationServer2D::get_singleton()->agent_set_max_speed(agent, max_speed); } void NavigationAgent2D::set_path_max_distance(real_t p_pmd) { @@ -260,8 +260,8 @@ Vector2 NavigationAgent2D::get_final_location() { void NavigationAgent2D::set_velocity(Vector2 p_velocity) { target_velocity = p_velocity; - Navigation2DServer::get_singleton()->agent_set_target_velocity(agent, target_velocity); - Navigation2DServer::get_singleton()->agent_set_velocity(agent, prev_safe_velocity); + NavigationServer2D::get_singleton()->agent_set_target_velocity(agent, target_velocity); + NavigationServer2D::get_singleton()->agent_set_velocity(agent, prev_safe_velocity); velocity_submitted = true; } @@ -298,7 +298,7 @@ void NavigationAgent2D::update_navigation() { bool reload_path = false; - if (Navigation2DServer::get_singleton()->agent_is_map_changed(agent)) { + if (NavigationServer2D::get_singleton()->agent_is_map_changed(agent)) { reload_path = true; } else if (navigation_path.size() == 0) { reload_path = true; @@ -317,7 +317,7 @@ void NavigationAgent2D::update_navigation() { } if (reload_path) { - navigation_path = Navigation2DServer::get_singleton()->map_get_path(navigation->get_rid(), o, target_location, true); + navigation_path = NavigationServer2D::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/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index cc9f5740a9..4c6e777e73 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -33,7 +33,7 @@ #include "scene/2d/collision_shape_2d.h" #include "scene/2d/navigation_2d.h" #include "scene/2d/physics_body_2d.h" -#include "servers/navigation_2d_server.h" +#include "servers/navigation_server_2d.h" void NavigationObstacle2D::_bind_methods() { @@ -71,7 +71,7 @@ void NavigationObstacle2D::_notification(int p_what) { case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { Node2D *node = Object::cast_to<Node2D>(get_parent()); if (node) { - Navigation2DServer::get_singleton()->agent_set_position(agent, node->get_global_transform().get_origin()); + NavigationServer2D::get_singleton()->agent_set_position(agent, node->get_global_transform().get_origin()); } } break; @@ -81,11 +81,11 @@ void NavigationObstacle2D::_notification(int p_what) { NavigationObstacle2D::NavigationObstacle2D() : navigation(NULL), agent(RID()) { - agent = Navigation2DServer::get_singleton()->agent_create(); + agent = NavigationServer2D::get_singleton()->agent_create(); } NavigationObstacle2D::~NavigationObstacle2D() { - Navigation2DServer::get_singleton()->free(agent); + NavigationServer2D::get_singleton()->free(agent); agent = RID(); // Pointless } @@ -94,7 +94,7 @@ void NavigationObstacle2D::set_navigation(Navigation2D *p_nav) { return; // Pointless navigation = p_nav; - Navigation2DServer::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); + NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid()); } void NavigationObstacle2D::set_navigation_node(Node *p_nav) { @@ -146,9 +146,9 @@ void NavigationObstacle2D::update_agent_shape() { radius = 1.0; // Never a 0 radius // Initialize the Agent as an object - Navigation2DServer::get_singleton()->agent_set_neighbor_dist(agent, 0.0); - Navigation2DServer::get_singleton()->agent_set_max_neighbors(agent, 0); - Navigation2DServer::get_singleton()->agent_set_time_horizon(agent, 0.0); - Navigation2DServer::get_singleton()->agent_set_radius(agent, radius); - Navigation2DServer::get_singleton()->agent_set_max_speed(agent, 0.0); + NavigationServer2D::get_singleton()->agent_set_neighbor_dist(agent, 0.0); + NavigationServer2D::get_singleton()->agent_set_max_neighbors(agent, 0); + NavigationServer2D::get_singleton()->agent_set_time_horizon(agent, 0.0); + NavigationServer2D::get_singleton()->agent_set_radius(agent, radius); + NavigationServer2D::get_singleton()->agent_set_max_speed(agent, 0.0); } diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index bc3e305281..f0839b4597 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -34,7 +34,7 @@ #include "core/engine.h" #include "core/os/mutex.h" #include "navigation_2d.h" -#include "servers/navigation_2d_server.h" +#include "servers/navigation_server_2d.h" #include "thirdparty/misc/triangulator.h" @@ -385,12 +385,12 @@ void NavigationRegion2D::set_enabled(bool p_enabled) { if (!enabled) { - Navigation2DServer::get_singleton()->region_set_map(region, RID()); + NavigationServer2D::get_singleton()->region_set_map(region, RID()); } else { if (navigation) { - Navigation2DServer::get_singleton()->region_set_map(region, navigation->get_rid()); + NavigationServer2D::get_singleton()->region_set_map(region, navigation->get_rid()); } } @@ -429,7 +429,7 @@ void NavigationRegion2D::_notification(int p_what) { if (enabled) { - Navigation2DServer::get_singleton()->region_set_map(region, navigation->get_rid()); + NavigationServer2D::get_singleton()->region_set_map(region, navigation->get_rid()); } break; } @@ -440,14 +440,14 @@ void NavigationRegion2D::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - Navigation2DServer::get_singleton()->region_set_transform(region, get_global_transform()); + NavigationServer2D::get_singleton()->region_set_transform(region, get_global_transform()); } break; case NOTIFICATION_EXIT_TREE: { if (navigation) { - Navigation2DServer::get_singleton()->region_set_map(region, RID()); + NavigationServer2D::get_singleton()->region_set_map(region, RID()); } navigation = NULL; } break; @@ -494,7 +494,7 @@ void NavigationRegion2D::_notification(int p_what) { } } } - VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, vertices, colors); + RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, vertices, colors); } } break; } @@ -511,7 +511,7 @@ void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_ } navpoly = p_navpoly; - Navigation2DServer::get_singleton()->region_set_navpoly(region, p_navpoly); + NavigationServer2D::get_singleton()->region_set_navpoly(region, p_navpoly); if (navpoly.is_valid()) { navpoly->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navpoly_changed)); @@ -572,11 +572,11 @@ NavigationRegion2D::NavigationRegion2D() { enabled = true; set_notify_transform(true); - region = Navigation2DServer::get_singleton()->region_create(); + region = NavigationServer2D::get_singleton()->region_create(); navigation = NULL; } NavigationRegion2D::~NavigationRegion2D() { - Navigation2DServer::get_singleton()->free(region); + NavigationServer2D::get_singleton()->free(region); } diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 0b0b9820d3..ac8a77b6cb 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -33,7 +33,7 @@ #include "core/message_queue.h" #include "scene/gui/control.h" #include "scene/main/window.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #ifdef TOOLS_ENABLED Dictionary Node2D::_edit_get_state() const { @@ -136,7 +136,7 @@ void Node2D::_update_transform() { _mat.set_rotation_and_scale(angle, _scale); _mat.elements[2] = pos; - VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), _mat); + RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), _mat); if (!is_inside_tree()) return; @@ -315,7 +315,7 @@ void Node2D::set_transform(const Transform2D &p_transform) { _mat = p_transform; _xform_dirty = true; - VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), _mat); + RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), _mat); if (!is_inside_tree()) return; @@ -334,10 +334,10 @@ void Node2D::set_global_transform(const Transform2D &p_transform) { void Node2D::set_z_index(int p_z) { - ERR_FAIL_COND(p_z < VS::CANVAS_ITEM_Z_MIN); - ERR_FAIL_COND(p_z > VS::CANVAS_ITEM_Z_MAX); + ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN); + ERR_FAIL_COND(p_z > RS::CANVAS_ITEM_Z_MAX); z_index = p_z; - VS::get_singleton()->canvas_item_set_z_index(get_canvas_item(), z_index); + RS::get_singleton()->canvas_item_set_z_index(get_canvas_item(), z_index); _change_notify("z_index"); } @@ -346,7 +346,7 @@ void Node2D::set_z_as_relative(bool p_enabled) { if (z_relative == p_enabled) return; z_relative = p_enabled; - VS::get_singleton()->canvas_item_set_z_as_relative_to_parent(get_canvas_item(), p_enabled); + RS::get_singleton()->canvas_item_set_z_as_relative_to_parent(get_canvas_item(), p_enabled); } bool Node2D::is_z_relative() const { @@ -452,7 +452,7 @@ void Node2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform"); ADD_GROUP("Z Index", ""); - ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative"); } diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 5aea1025ef..181f0f158c 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -78,7 +78,7 @@ void ParallaxLayer::_update_mirroring() { RID c = pb->get_canvas(); RID ci = get_canvas_item(); Point2 mirrorScale = mirroring * get_scale(); - VisualServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirrorScale); + RenderingServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirrorScale); } } diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 9bfeca7e56..289860d9c6 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -82,7 +82,7 @@ void PhysicsBody2D::_bind_methods() { void PhysicsBody2D::set_collision_layer(uint32_t p_layer) { collision_layer = p_layer; - Physics2DServer::get_singleton()->body_set_collision_layer(get_rid(), p_layer); + PhysicsServer2D::get_singleton()->body_set_collision_layer(get_rid(), p_layer); } uint32_t PhysicsBody2D::get_collision_layer() const { @@ -93,7 +93,7 @@ uint32_t PhysicsBody2D::get_collision_layer() const { void PhysicsBody2D::set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; - Physics2DServer::get_singleton()->body_set_collision_mask(get_rid(), p_mask); + PhysicsServer2D::get_singleton()->body_set_collision_mask(get_rid(), p_mask); } uint32_t PhysicsBody2D::get_collision_mask() const { @@ -130,10 +130,10 @@ bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const { return get_collision_layer() & (1 << p_bit); } -PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : - CollisionObject2D(Physics2DServer::get_singleton()->body_create(), false) { +PhysicsBody2D::PhysicsBody2D(PhysicsServer2D::BodyMode p_mode) : + CollisionObject2D(PhysicsServer2D::get_singleton()->body_create(), false) { - Physics2DServer::get_singleton()->body_set_mode(get_rid(), p_mode); + PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), p_mode); collision_layer = 1; collision_mask = 1; set_pickable(false); @@ -141,11 +141,11 @@ PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : Array PhysicsBody2D::get_collision_exceptions() { List<RID> exceptions; - Physics2DServer::get_singleton()->body_get_collision_exceptions(get_rid(), &exceptions); + PhysicsServer2D::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 = Physics2DServer::get_singleton()->body_get_object_instance_id(body); + ObjectID instance_id = PhysicsServer2D::get_singleton()->body_get_object_instance_id(body); Object *obj = ObjectDB::get_instance(instance_id); PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(obj); ret.append(physics_body); @@ -158,7 +158,7 @@ void PhysicsBody2D::add_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node); ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type."); - Physics2DServer::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid()); + PhysicsServer2D::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid()); } void PhysicsBody2D::remove_collision_exception_with(Node *p_node) { @@ -166,19 +166,19 @@ void PhysicsBody2D::remove_collision_exception_with(Node *p_node) { ERR_FAIL_NULL(p_node); PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node); ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type."); - Physics2DServer::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid()); + PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid()); } void StaticBody2D::set_constant_linear_velocity(const Vector2 &p_vel) { constant_linear_velocity = p_vel; - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_LINEAR_VELOCITY, constant_linear_velocity); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_LINEAR_VELOCITY, constant_linear_velocity); } void StaticBody2D::set_constant_angular_velocity(real_t p_vel) { constant_angular_velocity = p_vel; - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_ANGULAR_VELOCITY, constant_angular_velocity); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_ANGULAR_VELOCITY, constant_angular_velocity); } Vector2 StaticBody2D::get_constant_linear_velocity() const { @@ -225,7 +225,7 @@ void StaticBody2D::_bind_methods() { } StaticBody2D::StaticBody2D() : - PhysicsBody2D(Physics2DServer::BODY_MODE_STATIC) { + PhysicsBody2D(PhysicsServer2D::BODY_MODE_STATIC) { constant_angular_velocity = 0; } @@ -235,11 +235,11 @@ StaticBody2D::~StaticBody2D() { void StaticBody2D::_reload_physics_characteristics() { if (physics_material_override.is_null()) { - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_BOUNCE, 0); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_FRICTION, 1); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_BOUNCE, 0); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_FRICTION, 1); } else { - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce()); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_FRICTION, physics_material_override->computed_friction()); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce()); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_FRICTION, physics_material_override->computed_friction()); } } @@ -362,16 +362,16 @@ struct _RigidBody2DInOut { bool RigidBody2D::_test_motion(const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<Physics2DTestMotionResult> &p_result) { - Physics2DServer::MotionResult *r = NULL; + PhysicsServer2D::MotionResult *r = NULL; if (p_result.is_valid()) r = p_result->get_result_ptr(); - return Physics2DServer::get_singleton()->body_test_motion(get_rid(), get_global_transform(), p_motion, p_infinite_inertia, p_margin, r); + return PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), get_global_transform(), p_motion, p_infinite_inertia, p_margin, r); } void RigidBody2D::_direct_state_changed(Object *p_state) { #ifdef DEBUG_ENABLED - state = Object::cast_to<Physics2DDirectBodyState>(p_state); + state = Object::cast_to<PhysicsDirectBodyState2D>(p_state); #else state = (Physics2DDirectBodyState *)p_state; //trust it #endif @@ -484,20 +484,20 @@ void RigidBody2D::set_mode(Mode p_mode) { case MODE_RIGID: { - Physics2DServer::get_singleton()->body_set_mode(get_rid(), Physics2DServer::BODY_MODE_RIGID); + PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), PhysicsServer2D::BODY_MODE_RIGID); } break; case MODE_STATIC: { - Physics2DServer::get_singleton()->body_set_mode(get_rid(), Physics2DServer::BODY_MODE_STATIC); + PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), PhysicsServer2D::BODY_MODE_STATIC); } break; case MODE_KINEMATIC: { - Physics2DServer::get_singleton()->body_set_mode(get_rid(), Physics2DServer::BODY_MODE_KINEMATIC); + PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), PhysicsServer2D::BODY_MODE_KINEMATIC); } break; case MODE_CHARACTER: { - Physics2DServer::get_singleton()->body_set_mode(get_rid(), Physics2DServer::BODY_MODE_CHARACTER); + PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), PhysicsServer2D::BODY_MODE_CHARACTER); } break; } @@ -514,7 +514,7 @@ void RigidBody2D::set_mass(real_t p_mass) { mass = p_mass; _change_notify("mass"); _change_notify("weight"); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_MASS, mass); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_MASS, mass); } real_t RigidBody2D::get_mass() const { @@ -524,12 +524,12 @@ real_t RigidBody2D::get_mass() const { void RigidBody2D::set_inertia(real_t p_inertia) { ERR_FAIL_COND(p_inertia < 0); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_INERTIA, p_inertia); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_INERTIA, p_inertia); } real_t RigidBody2D::get_inertia() const { - return Physics2DServer::get_singleton()->body_get_param(get_rid(), Physics2DServer::BODY_PARAM_INERTIA); + return PhysicsServer2D::get_singleton()->body_get_param(get_rid(), PhysicsServer2D::BODY_PARAM_INERTIA); } void RigidBody2D::set_weight(real_t p_weight) { @@ -564,7 +564,7 @@ Ref<PhysicsMaterial> RigidBody2D::get_physics_material_override() const { void RigidBody2D::set_gravity_scale(real_t p_gravity_scale) { gravity_scale = p_gravity_scale; - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_GRAVITY_SCALE, gravity_scale); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE, gravity_scale); } real_t RigidBody2D::get_gravity_scale() const { @@ -575,7 +575,7 @@ void RigidBody2D::set_linear_damp(real_t p_linear_damp) { ERR_FAIL_COND(p_linear_damp < -1); linear_damp = p_linear_damp; - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_LINEAR_DAMP, linear_damp); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_LINEAR_DAMP, linear_damp); } real_t RigidBody2D::get_linear_damp() const { @@ -586,7 +586,7 @@ void RigidBody2D::set_angular_damp(real_t p_angular_damp) { ERR_FAIL_COND(p_angular_damp < -1); angular_damp = p_angular_damp; - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_ANGULAR_DAMP, angular_damp); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_ANGULAR_DAMP, angular_damp); } real_t RigidBody2D::get_angular_damp() const { @@ -602,7 +602,7 @@ void RigidBody2D::set_axis_velocity(const Vector2 &p_axis) { if (state) { set_linear_velocity(v); } else { - Physics2DServer::get_singleton()->body_set_axis_velocity(get_rid(), p_axis); + PhysicsServer2D::get_singleton()->body_set_axis_velocity(get_rid(), p_axis); linear_velocity = v; } } @@ -614,7 +614,7 @@ void RigidBody2D::set_linear_velocity(const Vector2 &p_velocity) { state->set_linear_velocity(linear_velocity); else { - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_LINEAR_VELOCITY, linear_velocity); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_LINEAR_VELOCITY, linear_velocity); } } @@ -629,7 +629,7 @@ void RigidBody2D::set_angular_velocity(real_t p_velocity) { if (state) state->set_angular_velocity(angular_velocity); else - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_ANGULAR_VELOCITY, angular_velocity); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_ANGULAR_VELOCITY, angular_velocity); } real_t RigidBody2D::get_angular_velocity() const { @@ -642,7 +642,7 @@ void RigidBody2D::set_use_custom_integrator(bool p_enable) { return; custom_integrator = p_enable; - Physics2DServer::get_singleton()->body_set_omit_force_integration(get_rid(), p_enable); + PhysicsServer2D::get_singleton()->body_set_omit_force_integration(get_rid(), p_enable); } bool RigidBody2D::is_using_custom_integrator() { @@ -652,13 +652,13 @@ bool RigidBody2D::is_using_custom_integrator() { void RigidBody2D::set_sleeping(bool p_sleeping) { sleeping = p_sleeping; - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_SLEEPING, sleeping); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_SLEEPING, sleeping); } void RigidBody2D::set_can_sleep(bool p_active) { can_sleep = p_active; - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_CAN_SLEEP, p_active); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_CAN_SLEEP, p_active); } bool RigidBody2D::is_able_to_sleep() const { @@ -674,7 +674,7 @@ bool RigidBody2D::is_sleeping() const { void RigidBody2D::set_max_contacts_reported(int p_amount) { max_contacts_reported = p_amount; - Physics2DServer::get_singleton()->body_set_max_contacts_reported(get_rid(), p_amount); + PhysicsServer2D::get_singleton()->body_set_max_contacts_reported(get_rid(), p_amount); } int RigidBody2D::get_max_contacts_reported() const { @@ -683,55 +683,55 @@ int RigidBody2D::get_max_contacts_reported() const { } void RigidBody2D::apply_central_impulse(const Vector2 &p_impulse) { - Physics2DServer::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse); + PhysicsServer2D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse); } void RigidBody2D::apply_impulse(const Vector2 &p_offset, const Vector2 &p_impulse) { - Physics2DServer::get_singleton()->body_apply_impulse(get_rid(), p_offset, p_impulse); + PhysicsServer2D::get_singleton()->body_apply_impulse(get_rid(), p_offset, p_impulse); } void RigidBody2D::apply_torque_impulse(float p_torque) { - Physics2DServer::get_singleton()->body_apply_torque_impulse(get_rid(), p_torque); + PhysicsServer2D::get_singleton()->body_apply_torque_impulse(get_rid(), p_torque); } void RigidBody2D::set_applied_force(const Vector2 &p_force) { - Physics2DServer::get_singleton()->body_set_applied_force(get_rid(), p_force); + PhysicsServer2D::get_singleton()->body_set_applied_force(get_rid(), p_force); }; Vector2 RigidBody2D::get_applied_force() const { - return Physics2DServer::get_singleton()->body_get_applied_force(get_rid()); + return PhysicsServer2D::get_singleton()->body_get_applied_force(get_rid()); }; void RigidBody2D::set_applied_torque(const float p_torque) { - Physics2DServer::get_singleton()->body_set_applied_torque(get_rid(), p_torque); + PhysicsServer2D::get_singleton()->body_set_applied_torque(get_rid(), p_torque); }; float RigidBody2D::get_applied_torque() const { - return Physics2DServer::get_singleton()->body_get_applied_torque(get_rid()); + return PhysicsServer2D::get_singleton()->body_get_applied_torque(get_rid()); }; void RigidBody2D::add_central_force(const Vector2 &p_force) { - Physics2DServer::get_singleton()->body_add_central_force(get_rid(), p_force); + PhysicsServer2D::get_singleton()->body_add_central_force(get_rid(), p_force); } void RigidBody2D::add_force(const Vector2 &p_offset, const Vector2 &p_force) { - Physics2DServer::get_singleton()->body_add_force(get_rid(), p_offset, p_force); + PhysicsServer2D::get_singleton()->body_add_force(get_rid(), p_offset, p_force); } void RigidBody2D::add_torque(const float p_torque) { - Physics2DServer::get_singleton()->body_add_torque(get_rid(), p_torque); + PhysicsServer2D::get_singleton()->body_add_torque(get_rid(), p_torque); } void RigidBody2D::set_continuous_collision_detection_mode(CCDMode p_mode) { ccd_mode = p_mode; - Physics2DServer::get_singleton()->body_set_continuous_collision_detection_mode(get_rid(), Physics2DServer::CCDMode(p_mode)); + PhysicsServer2D::get_singleton()->body_set_continuous_collision_detection_mode(get_rid(), PhysicsServer2D::CCDMode(p_mode)); } RigidBody2D::CCDMode RigidBody2D::get_continuous_collision_detection_mode() const { @@ -939,7 +939,7 @@ void RigidBody2D::_bind_methods() { } RigidBody2D::RigidBody2D() : - PhysicsBody2D(Physics2DServer::BODY_MODE_RIGID) { + PhysicsBody2D(PhysicsServer2D::BODY_MODE_RIGID) { mode = MODE_RIGID; @@ -960,7 +960,7 @@ RigidBody2D::RigidBody2D() : contact_monitor = NULL; can_sleep = true; - Physics2DServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); + PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); } RigidBody2D::~RigidBody2D() { @@ -971,11 +971,11 @@ RigidBody2D::~RigidBody2D() { void RigidBody2D::_reload_physics_characteristics() { if (physics_material_override.is_null()) { - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_BOUNCE, 0); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_FRICTION, 1); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_BOUNCE, 0); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_FRICTION, 1); } else { - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce()); - Physics2DServer::get_singleton()->body_set_param(get_rid(), Physics2DServer::BODY_PARAM_FRICTION, physics_material_override->computed_friction()); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_BOUNCE, physics_material_override->computed_bounce()); + PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_FRICTION, physics_material_override->computed_friction()); } } @@ -1001,12 +1001,12 @@ Ref<KinematicCollision2D> KinematicBody2D::_move(const Vector2 &p_motion, bool p bool KinematicBody2D::separate_raycast_shapes(bool p_infinite_inertia, Collision &r_collision) { - Physics2DServer::SeparationResult sep_res[8]; //max 8 rays + PhysicsServer2D::SeparationResult sep_res[8]; //max 8 rays Transform2D gt = get_global_transform(); Vector2 recover; - int hits = Physics2DServer::get_singleton()->body_test_ray_separation(get_rid(), gt, p_infinite_inertia, recover, sep_res, 8, margin); + int hits = PhysicsServer2D::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++) { @@ -1042,8 +1042,8 @@ bool KinematicBody2D::move_and_collide(const Vector2 &p_motion, bool p_infinite_ ERR_PRINT("Functions move_and_slide and move_and_collide do not work together with 'sync to physics' option. Please read the documentation."); } Transform2D gt = get_global_transform(); - Physics2DServer::MotionResult result; - bool colliding = Physics2DServer::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_infinite_inertia, margin, &result, p_exclude_raycast_shapes); + PhysicsServer2D::MotionResult result; + bool colliding = PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), gt, p_motion, p_infinite_inertia, margin, &result, p_exclude_raycast_shapes); if (colliding) { r_collision.collider_metadata = result.collider_metadata; @@ -1077,7 +1077,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 current_floor_velocity = floor_velocity; if (on_floor && on_floor_body.is_valid()) { //this approach makes sure there is less delay between the actual body velocity and the one we saved - Physics2DDirectBodyState *bs = Physics2DServer::get_singleton()->body_get_direct_state(on_floor_body); + PhysicsDirectBodyState2D *bs = PhysicsServer2D::get_singleton()->body_get_direct_state(on_floor_body); if (bs) { current_floor_velocity = bs->get_linear_velocity(); } @@ -1227,7 +1227,7 @@ bool KinematicBody2D::test_move(const Transform2D &p_from, const Vector2 &p_moti ERR_FAIL_COND_V(!is_inside_tree(), false); - return Physics2DServer::get_singleton()->body_test_motion(get_rid(), p_from, p_motion, p_infinite_inertia, margin); + return PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), p_from, p_motion, p_infinite_inertia, margin); } void KinematicBody2D::set_safe_margin(float p_margin) { @@ -1277,11 +1277,11 @@ void KinematicBody2D::set_sync_to_physics(bool p_enable) { return; if (p_enable) { - Physics2DServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); + PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); set_only_update_transform_changes(true); set_notify_local_transform(true); } else { - Physics2DServer::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, ""); + PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, ""); set_only_update_transform_changes(false); set_notify_local_transform(false); } @@ -1296,7 +1296,7 @@ void KinematicBody2D::_direct_state_changed(Object *p_state) { if (!sync_to_physics) return; - Physics2DDirectBodyState *state = Object::cast_to<Physics2DDirectBodyState>(p_state); + PhysicsDirectBodyState2D *state = Object::cast_to<PhysicsDirectBodyState2D>(p_state); last_valid_transform = state->get_transform(); set_notify_local_transform(false); @@ -1320,7 +1320,7 @@ void KinematicBody2D::_notification(int p_what) { if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { //used by sync to physics, send the new transform to the physics Transform2D new_transform = get_global_transform(); - Physics2DServer::get_singleton()->body_set_state(get_rid(), Physics2DServer::BODY_STATE_TRANSFORM, new_transform); + PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_TRANSFORM, new_transform); //but then revert changes set_notify_local_transform(false); set_global_transform(last_valid_transform); @@ -1357,7 +1357,7 @@ void KinematicBody2D::_bind_methods() { } KinematicBody2D::KinematicBody2D() : - PhysicsBody2D(Physics2DServer::BODY_MODE_KINEMATIC) { + PhysicsBody2D(PhysicsServer2D::BODY_MODE_KINEMATIC) { margin = 0.08; diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index eb7aefb495..5bce5f6be3 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -34,7 +34,7 @@ #include "core/vset.h" #include "scene/2d/collision_object_2d.h" #include "scene/resources/physics_material.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" class KinematicCollision2D; @@ -50,7 +50,7 @@ class PhysicsBody2D : public CollisionObject2D { protected: void _notification(int p_what); - PhysicsBody2D(Physics2DServer::BodyMode p_mode); + PhysicsBody2D(PhysicsServer2D::BodyMode p_mode); static void _bind_methods(); @@ -123,7 +123,7 @@ public: private: bool can_sleep; - Physics2DDirectBodyState *state; + PhysicsDirectBodyState2D *state; Mode mode; real_t mass; @@ -303,7 +303,7 @@ private: Vector<Ref<KinematicCollision2D>> slide_colliders; Ref<KinematicCollision2D> motion_cache; - _FORCE_INLINE_ bool _ignores_mode(Physics2DServer::BodyMode) const; + _FORCE_INLINE_ bool _ignores_mode(PhysicsServer2D::BodyMode) const; Ref<KinematicCollision2D> _move(const Vector2 &p_motion, bool p_infinite_inertia = true, bool p_exclude_raycast_shapes = true, bool p_test_only = false); Ref<KinematicCollision2D> _get_slide_collision(int p_bounce); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 95656b9610..8d20053c6e 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -111,10 +111,10 @@ void Polygon2D::_notification(int p_what) { ObjectID new_skeleton_id; if (skeleton_node) { - VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton()); + RS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton()); new_skeleton_id = skeleton_node->get_instance_id(); } else { - VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID()); + RS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID()); } if (new_skeleton_id != current_skeleton_id) { @@ -307,7 +307,7 @@ void Polygon2D::_notification(int p_what) { if (invert || polygons.size() == 0) { Vector<int> indices = Geometry::triangulate_polygon(points); if (indices.size()) { - VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1, normal_map.is_valid() ? normal_map->get_rid() : RID(), specular_map.is_valid() ? specular_map->get_rid() : RID(), Color(specular_color.r, specular_color.g, specular_color.b, shininess)); + RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID(), -1, normal_map.is_valid() ? normal_map->get_rid() : RID(), specular_map.is_valid() ? specular_map->get_rid() : RID(), Color(specular_color.r, specular_color.g, specular_color.b, shininess)); } } else { //draw individual polygons @@ -341,7 +341,7 @@ void Polygon2D::_notification(int p_what) { } if (total_indices.size()) { - VS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), total_indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID()); + RS::get_singleton()->canvas_item_add_triangle_array(get_canvas_item(), total_indices, points, colors, uvs, bones, weights, texture.is_valid() ? texture->get_rid() : RID()); } } diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index fd6e0aebcc..ed971b1c3a 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -33,7 +33,7 @@ #include "collision_object_2d.h" #include "core/engine.h" #include "physics_body_2d.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" void RayCast2D::set_cast_to(const Vector2 &p_point) { @@ -205,7 +205,7 @@ void RayCast2D::_update_raycast_state() { Ref<World2D> w2d = get_world_2d(); ERR_FAIL_COND(w2d.is_null()); - Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space()); + PhysicsDirectSpaceState2D *dss = PhysicsServer2D::get_singleton()->space_get_direct_state(w2d->get_space()); ERR_FAIL_COND(!dss); Transform2D gt = get_global_transform(); @@ -214,7 +214,7 @@ void RayCast2D::_update_raycast_state() { if (to == Vector2()) to = Vector2(0, 0.01); - Physics2DDirectSpaceState::RayResult rr; + PhysicsDirectSpaceState2D::RayResult rr; if (dss->intersect_ray(gt.get_origin(), gt.xform(to), rr, exclude, collision_mask, collide_with_bodies, collide_with_areas)) { diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp index 9ebaf23c3a..2be6b6a75c 100644 --- a/scene/2d/skeleton_2d.cpp +++ b/scene/2d/skeleton_2d.cpp @@ -186,7 +186,7 @@ void Skeleton2D::_update_bone_setup() { return; bone_setup_dirty = false; - VS::get_singleton()->skeleton_allocate(skeleton, bones.size(), true); + RS::get_singleton()->skeleton_allocate(skeleton, bones.size(), true); bones.sort(); //sorty so they are always in the same order/index @@ -240,7 +240,7 @@ void Skeleton2D::_update_transform() { for (int i = 0; i < bones.size(); i++) { Transform2D final_xform = bones[i].accum_transform * bones[i].rest_inverse; - VS::get_singleton()->skeleton_bone_set_transform_2d(skeleton, i, final_xform); + RS::get_singleton()->skeleton_bone_set_transform_2d(skeleton, i, final_xform); } } @@ -276,7 +276,7 @@ void Skeleton2D::_notification(int p_what) { } if (p_what == NOTIFICATION_TRANSFORM_CHANGED) { - VS::get_singleton()->skeleton_set_base_transform_2d(skeleton, get_global_transform()); + RS::get_singleton()->skeleton_set_base_transform_2d(skeleton, get_global_transform()); } } @@ -300,11 +300,11 @@ Skeleton2D::Skeleton2D() { bone_setup_dirty = true; transform_dirty = true; - skeleton = VS::get_singleton()->skeleton_create(); + skeleton = RS::get_singleton()->skeleton_create(); set_notify_transform(true); } Skeleton2D::~Skeleton2D() { - VS::get_singleton()->free(skeleton); + RS::get_singleton()->free(skeleton); } diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index d45fe9a2a5..df8859bd9a 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -131,7 +131,7 @@ void Sprite2D::_notification(int p_what) { Rect2 src_rect, dst_rect; bool filter_clip; _get_rects(src_rect, dst_rect, filter_clip); - texture->draw_rect_region(ci, dst_rect, src_rect, Color(1, 1, 1), false, normal_map, specular, Color(specular_color.r, specular_color.g, specular_color.b, shininess), VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, filter_clip); + texture->draw_rect_region(ci, dst_rect, src_rect, Color(1, 1, 1), false, normal_map, specular, Color(specular_color.r, specular_color.g, specular_color.b, shininess), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, filter_clip); } break; } diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 601be17274..c468389040 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -35,8 +35,8 @@ #include "core/method_bind_ext.gen.inc" #include "core/os/os.h" #include "scene/2d/area_2d.h" -#include "servers/navigation_2d_server.h" -#include "servers/physics_2d_server.h" +#include "servers/navigation_server_2d.h" +#include "servers/physics_server_2d.h" int TileMap::_get_quadrant_size() const { @@ -87,7 +87,7 @@ void TileMap::_notification(int p_what) { if (navigation) { for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) { - Navigation2DServer::get_singleton()->region_set_map(F->get().region, RID()); + NavigationServer2D::get_singleton()->region_set_map(F->get().region, RID()); } q.navpoly_ids.clear(); } @@ -98,7 +98,7 @@ void TileMap::_notification(int p_what) { } for (Map<PosKey, Quadrant::Occluder>::Element *F = q.occluder_instances.front(); F; F = F->next()) { - VS::get_singleton()->free(F->get().id); + RS::get_singleton()->free(F->get().id); } q.occluder_instances.clear(); } @@ -130,7 +130,7 @@ void TileMap::_update_quadrant_space(const RID &p_space) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_space(q.body, p_space); + PhysicsServer2D::get_singleton()->body_set_space(q.body, p_space); } } } @@ -158,18 +158,18 @@ void TileMap::_update_quadrant_transform() { if (!use_parent) { xform = global_transform * xform; - Physics2DServer::get_singleton()->body_set_state(q.body, Physics2DServer::BODY_STATE_TRANSFORM, xform); + PhysicsServer2D::get_singleton()->body_set_state(q.body, PhysicsServer2D::BODY_STATE_TRANSFORM, xform); } if (navigation) { for (Map<PosKey, Quadrant::NavPoly>::Element *F = q.navpoly_ids.front(); F; F = F->next()) { - Navigation2DServer::get_singleton()->region_set_transform(F->get().region, nav_rel * F->get().xform); + NavigationServer2D::get_singleton()->region_set_transform(F->get().region, nav_rel * F->get().xform); } } for (Map<PosKey, Quadrant::Occluder>::Element *F = q.occluder_instances.front(); F; F = F->next()) { - VS::get_singleton()->canvas_light_occluder_set_transform(F->get().id, global_transform * F->get().xform); + RS::get_singleton()->canvas_light_occluder_set_transform(F->get().id, global_transform * F->get().xform); } } } @@ -298,7 +298,7 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const } void TileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D> &p_shape, const TileSet::ShapeData &p_shape_data, const Transform2D &p_xform, const Vector2 &p_metadata) { - Physics2DServer *ps = Physics2DServer::get_singleton(); + PhysicsServer2D *ps = PhysicsServer2D::get_singleton(); if (!use_parent) { ps->body_add_shape(p_q.body, p_shape->get_rid(), p_xform); @@ -334,8 +334,8 @@ void TileMap::update_dirty_quadrants() { return; } - VisualServer *vs = VisualServer::get_singleton(); - Physics2DServer *ps = Physics2DServer::get_singleton(); + RenderingServer *vs = RenderingServer::get_singleton(); + PhysicsServer2D *ps = PhysicsServer2D::get_singleton(); Vector2 tofs = get_cell_draw_offset(); Transform2D nav_rel; if (navigation) @@ -378,13 +378,13 @@ void TileMap::update_dirty_quadrants() { if (navigation) { for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) { - Navigation2DServer::get_singleton()->region_set_map(E->get().region, RID()); + NavigationServer2D::get_singleton()->region_set_map(E->get().region, RID()); } q.navpoly_ids.clear(); } for (Map<PosKey, Quadrant::Occluder>::Element *E = q.occluder_instances.front(); E; E = E->next()) { - VS::get_singleton()->free(E->get().id); + RS::get_singleton()->free(E->get().id); } q.occluder_instances.clear(); Ref<ShaderMaterial> prev_material; @@ -439,7 +439,7 @@ void TileMap::update_dirty_quadrants() { debug_canvas_item = vs->canvas_item_create(); vs->canvas_item_set_parent(debug_canvas_item, canvas_item); vs->canvas_item_set_z_as_relative_to_parent(debug_canvas_item, false); - vs->canvas_item_set_z_index(debug_canvas_item, VS::CANVAS_ITEM_Z_MAX - 1); + vs->canvas_item_set_z_index(debug_canvas_item, RS::CANVAS_ITEM_Z_MAX - 1); q.canvas_items.push_back(debug_canvas_item); prev_debug_canvas_item = debug_canvas_item; } @@ -550,7 +550,7 @@ void TileMap::update_dirty_quadrants() { if (r == Rect2()) { tex->draw_rect(canvas_item, rect, false, modulate, c.transpose, normal_map); } else { - tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, normal_map, Ref<Texture2D>(), Color(1, 1, 1, 1), VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, clip_uv); + tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, normal_map, Ref<Texture2D>(), Color(1, 1, 1, 1), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, clip_uv); } Vector<TileSet::ShapeData> shapes = tile_set->tile_get_shapes(c.id); @@ -612,10 +612,10 @@ void TileMap::update_dirty_quadrants() { xform.set_origin(offset.floor() + q.pos); _fix_cell_transform(xform, c, npoly_ofs, s); - RID region = Navigation2DServer::get_singleton()->region_create(); - Navigation2DServer::get_singleton()->region_set_map(region, navigation->get_rid()); - Navigation2DServer::get_singleton()->region_set_transform(region, nav_rel * xform); - Navigation2DServer::get_singleton()->region_set_navpoly(region, navpoly); + RID region = NavigationServer2D::get_singleton()->region_create(); + NavigationServer2D::get_singleton()->region_set_map(region, navigation->get_rid()); + NavigationServer2D::get_singleton()->region_set_transform(region, nav_rel * xform); + NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly); Quadrant::NavPoly np; np.region = region; @@ -626,7 +626,7 @@ void TileMap::update_dirty_quadrants() { RID debug_navigation_item = vs->canvas_item_create(); vs->canvas_item_set_parent(debug_navigation_item, canvas_item); vs->canvas_item_set_z_as_relative_to_parent(debug_navigation_item, false); - vs->canvas_item_set_z_index(debug_navigation_item, VS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug + vs->canvas_item_set_z_index(debug_navigation_item, RS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug if (debug_navigation_item.is_valid()) { Vector<Vector2> navigation_polygon_vertices = navpoly->get_vertices(); @@ -685,11 +685,11 @@ void TileMap::update_dirty_quadrants() { xform.set_origin(offset.floor() + q.pos); _fix_cell_transform(xform, c, occluder_ofs, s); - RID orid = VS::get_singleton()->canvas_light_occluder_create(); - VS::get_singleton()->canvas_light_occluder_set_transform(orid, get_global_transform() * xform); - VS::get_singleton()->canvas_light_occluder_set_polygon(orid, occluder->get_rid()); - VS::get_singleton()->canvas_light_occluder_attach_to_canvas(orid, get_canvas()); - VS::get_singleton()->canvas_light_occluder_set_light_mask(orid, occluder_light_mask); + RID orid = RS::get_singleton()->canvas_light_occluder_create(); + RS::get_singleton()->canvas_light_occluder_set_transform(orid, get_global_transform() * xform); + RS::get_singleton()->canvas_light_occluder_set_polygon(orid, occluder->get_rid()); + RS::get_singleton()->canvas_light_occluder_attach_to_canvas(orid, get_canvas()); + RS::get_singleton()->canvas_light_occluder_set_light_mask(orid, occluder_light_mask); Quadrant::Occluder oc; oc.xform = xform; oc.id = orid; @@ -711,7 +711,7 @@ void TileMap::update_dirty_quadrants() { Quadrant &q = E->get(); for (List<RID>::Element *F = q.canvas_items.front(); F; F = F->next()) { - VS::get_singleton()->canvas_item_set_draw_index(F->get(), index++); + RS::get_singleton()->canvas_item_set_draw_index(F->get(), index++); } } @@ -763,24 +763,24 @@ Map<TileMap::PosKey, TileMap::Quadrant>::Element *TileMap::_create_quadrant(cons q.pos.y += cell_size.y; xform.set_origin(q.pos); - //q.canvas_item = VisualServer::get_singleton()->canvas_item_create(); + //q.canvas_item = RenderingServer::get_singleton()->canvas_item_create(); if (!use_parent) { - q.body = Physics2DServer::get_singleton()->body_create(); - Physics2DServer::get_singleton()->body_set_mode(q.body, use_kinematic ? Physics2DServer::BODY_MODE_KINEMATIC : Physics2DServer::BODY_MODE_STATIC); + q.body = PhysicsServer2D::get_singleton()->body_create(); + PhysicsServer2D::get_singleton()->body_set_mode(q.body, use_kinematic ? PhysicsServer2D::BODY_MODE_KINEMATIC : PhysicsServer2D::BODY_MODE_STATIC); - Physics2DServer::get_singleton()->body_attach_object_instance_id(q.body, get_instance_id()); - Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer); - Physics2DServer::get_singleton()->body_set_collision_mask(q.body, collision_mask); - Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_FRICTION, friction); - Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_BOUNCE, bounce); + PhysicsServer2D::get_singleton()->body_attach_object_instance_id(q.body, get_instance_id()); + PhysicsServer2D::get_singleton()->body_set_collision_layer(q.body, collision_layer); + PhysicsServer2D::get_singleton()->body_set_collision_mask(q.body, collision_mask); + PhysicsServer2D::get_singleton()->body_set_param(q.body, PhysicsServer2D::BODY_PARAM_FRICTION, friction); + PhysicsServer2D::get_singleton()->body_set_param(q.body, PhysicsServer2D::BODY_PARAM_BOUNCE, bounce); if (is_inside_tree()) { xform = get_global_transform() * xform; RID space = get_world_2d()->get_space(); - Physics2DServer::get_singleton()->body_set_space(q.body, space); + PhysicsServer2D::get_singleton()->body_set_space(q.body, space); } - Physics2DServer::get_singleton()->body_set_state(q.body, Physics2DServer::BODY_STATE_TRANSFORM, xform); + PhysicsServer2D::get_singleton()->body_set_state(q.body, PhysicsServer2D::BODY_STATE_TRANSFORM, xform); } else if (collision_parent) { xform = get_transform() * xform; q.shape_owner_id = collision_parent->create_shape_owner(this); @@ -797,14 +797,14 @@ void TileMap::_erase_quadrant(Map<PosKey, Quadrant>::Element *Q) { Quadrant &q = Q->get(); if (!use_parent) { - Physics2DServer::get_singleton()->free(q.body); + PhysicsServer2D::get_singleton()->free(q.body); } else if (collision_parent) { collision_parent->remove_shape_owner(q.shape_owner_id); } for (List<RID>::Element *E = q.canvas_items.front(); E; E = E->next()) { - VisualServer::get_singleton()->free(E->get()); + RenderingServer::get_singleton()->free(E->get()); } q.canvas_items.clear(); if (q.dirty_list.in_list()) @@ -813,13 +813,13 @@ void TileMap::_erase_quadrant(Map<PosKey, Quadrant>::Element *Q) { if (navigation) { for (Map<PosKey, Quadrant::NavPoly>::Element *E = q.navpoly_ids.front(); E; E = E->next()) { - Navigation2DServer::get_singleton()->region_set_map(E->get().region, RID()); + NavigationServer2D::get_singleton()->region_set_map(E->get().region, RID()); } q.navpoly_ids.clear(); } for (Map<PosKey, Quadrant::Occluder>::Element *E = q.occluder_instances.front(); E; E = E->next()) { - VS::get_singleton()->free(E->get().id); + RS::get_singleton()->free(E->get().id); } q.occluder_instances.clear(); @@ -1197,7 +1197,7 @@ void TileMap::_update_all_items_material_state() { void TileMap::_update_item_material_state(const RID &p_canvas_item) { - VS::get_singleton()->canvas_item_set_use_parent_material(p_canvas_item, get_use_parent_material() || get_material().is_valid()); + RS::get_singleton()->canvas_item_set_use_parent_material(p_canvas_item, get_use_parent_material() || get_material().is_valid()); } void TileMap::clear() { @@ -1302,7 +1302,7 @@ void TileMap::set_collision_layer(uint32_t p_layer) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_collision_layer(q.body, collision_layer); + PhysicsServer2D::get_singleton()->body_set_collision_layer(q.body, collision_layer); } } } @@ -1314,7 +1314,7 @@ void TileMap::set_collision_mask(uint32_t p_mask) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_collision_mask(q.body, collision_mask); + PhysicsServer2D::get_singleton()->body_set_collision_mask(q.body, collision_mask); } } } @@ -1383,7 +1383,7 @@ void TileMap::set_collision_friction(float p_friction) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_FRICTION, p_friction); + PhysicsServer2D::get_singleton()->body_set_param(q.body, PhysicsServer2D::BODY_PARAM_FRICTION, p_friction); } } } @@ -1400,7 +1400,7 @@ void TileMap::set_collision_bounce(float p_bounce) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); - Physics2DServer::get_singleton()->body_set_param(q.body, Physics2DServer::BODY_PARAM_BOUNCE, p_bounce); + PhysicsServer2D::get_singleton()->body_set_param(q.body, PhysicsServer2D::BODY_PARAM_BOUNCE, p_bounce); } } } @@ -1655,7 +1655,7 @@ void TileMap::set_y_sort_mode(bool p_enable) { _clear_quadrants(); y_sort_mode = p_enable; - VS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), y_sort_mode); + RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), y_sort_mode); _recreate_quadrants(); emit_signal("settings_changed"); } @@ -1746,7 +1746,7 @@ void TileMap::set_occluder_light_mask(int p_mask) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { for (Map<PosKey, Quadrant::Occluder>::Element *F = E->get().occluder_instances.front(); F; F = F->next()) { - VisualServer::get_singleton()->canvas_light_occluder_set_light_mask(F->get().id, occluder_light_mask); + RenderingServer::get_singleton()->canvas_light_occluder_set_light_mask(F->get().id, occluder_light_mask); } } } @@ -1762,7 +1762,7 @@ void TileMap::set_light_mask(int p_light_mask) { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { for (List<RID>::Element *F = E->get().canvas_items.front(); F; F = F->next()) { - VisualServer::get_singleton()->canvas_item_set_light_mask(F->get(), get_light_mask()); + RenderingServer::get_singleton()->canvas_item_set_light_mask(F->get(), get_light_mask()); } } } diff --git a/scene/2d/y_sort.cpp b/scene/2d/y_sort.cpp index 62f10a5c96..15d97eeaa0 100644 --- a/scene/2d/y_sort.cpp +++ b/scene/2d/y_sort.cpp @@ -33,7 +33,7 @@ void YSort::set_sort_enabled(bool p_enabled) { sort_enabled = p_enabled; - VS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), sort_enabled); + RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), sort_enabled); } bool YSort::is_sort_enabled() const { @@ -53,5 +53,5 @@ void YSort::_bind_methods() { YSort::YSort() { sort_enabled = true; - VS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), true); + RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), true); } diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp index beeaf7125a..5b02a91793 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(), NULL, StringName()); + PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, 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/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 807515219f..bddf748be7 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -395,9 +395,9 @@ 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; diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 73b1d450f0..05e3f3fefa 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,14 +181,14 @@ 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); } /////////////////////////// @@ -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..7980c15f89 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 /* @@ -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(); } @@ -418,12 +418,12 @@ void Camera::_camera_make_current(Node *p_camera) { if (p_camera==this) { - VisualServer::get_singleton()->viewport_attach_camera(viewport_id,camera); + RenderingServer::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()); + RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,RID()); } active=false; } @@ -434,9 +434,9 @@ 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 +449,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 +462,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 +628,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,7 +696,7 @@ 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(); @@ -711,7 +711,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 +721,7 @@ Camera3D::Camera3D() { Camera3D::~Camera3D() { - VisualServer::get_singleton()->free(camera); + RenderingServer::get_singleton()->free(camera); } //////////////////////////////////////// @@ -760,7 +760,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 +791,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 +945,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..da37ca8ae2 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); } } } @@ -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); } @@ -392,5 +392,5 @@ CollisionObject3D::CollisionObject3D() { CollisionObject3D::~CollisionObject3D() { - PhysicsServer::get_singleton()->free(rid); + PhysicsServer3D::get_singleton()->free(rid); } diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp index eab09883cd..e736f20614 100644 --- a/scene/3d/collision_shape_3d.cpp +++ b/scene/3d/collision_shape_3d.cpp @@ -36,7 +36,7 @@ #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" @@ -196,7 +196,7 @@ 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; @@ -207,7 +207,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() { diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 71e869e6e9..4350d4da25 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()); } } @@ -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 } } @@ -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..a46cd90612 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; } @@ -294,12 +294,12 @@ GIProbeData::GIProbeData() { anisotropy_strength = 0.5; interior = 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 +308,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; @@ -526,7 +526,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 +563,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/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index a283ec41b2..ad45228ca8 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,7 +240,7 @@ bool GPUParticles3D::get_fractional_delta() const { String GPUParticles3D::get_configuration_warning() const { - if (VisualServer::get_singleton()->is_low_end()) { + if (RenderingServer::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."); } @@ -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..7fc7fe2bf5 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; + type = RenderingServer::LIGHT_DIRECTIONAL; ERR_PRINT("Light should not be instanced directly; use the DirectionalLight, OmniLight or SpotLight 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); } 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/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 5f826505b4..284bbd7091 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()); } } @@ -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 { 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..76f1d4688d 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,7 +102,7 @@ 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 { @@ -129,7 +129,7 @@ void NavigationAgent3D::_notification(int p_what) { 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"); @@ -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,7 +170,7 @@ 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 == NULL ? RID() : navigation->get_rid()); } void NavigationAgent3D::set_navigation_node(Node *p_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) { @@ -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; } @@ -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..63c273b4ca 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() { @@ -71,15 +71,15 @@ void NavigationObstacle3D::_notification(int p_what) { 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; @@ -89,11 +89,11 @@ void NavigationObstacle3D::_notification(int p_what) { NavigationObstacle3D::NavigationObstacle3D() : navigation(NULL), 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,7 +102,7 @@ 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 == NULL ? RID() : navigation->get_rid()); } void NavigationObstacle3D::set_navigation_node(Node *p_nav) { @@ -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..4bb2c72172 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -32,7 +32,7 @@ #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 +45,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 +86,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,14 +110,14 @@ 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) { @@ -144,7 +144,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 +171,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 { @@ -244,7 +244,7 @@ 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; @@ -254,5 +254,5 @@ NavigationRegion3D::NavigationRegion3D() { 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/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index ce1643aa6c..1f3e2b8373 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); @@ -129,7 +129,7 @@ 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()); + PhysicsServer3D::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid()); } void PhysicsBody3D::remove_collision_exception_with(Node *p_node) { @@ -137,7 +137,7 @@ 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()); + 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,7 +372,7 @@ 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 #endif @@ -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 { @@ -757,12 +757,12 @@ bool RigidBody3D::is_contact_monitor_enabled() const { return contact_monitor != NULL; } -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 { @@ -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,7 +904,7 @@ void RigidBody3D::_bind_methods() { } RigidBody3D::RigidBody3D() : - PhysicsBody3D(PhysicsServer::BODY_MODE_RIGID) { + PhysicsBody3D(PhysicsServer3D::BODY_MODE_RIGID) { mode = MODE_RIGID; @@ -924,7 +924,7 @@ RigidBody3D::RigidBody3D() : contact_monitor = NULL; 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,16 +1289,16 @@ 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 #endif @@ -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,7 +1316,7 @@ 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() { @@ -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; @@ -2080,7 +2080,7 @@ void PhysicalBone3D::_notification(int p_what) { } parent_skeleton = NULL; if (joint.is_valid()) { - PhysicsServer::get_singleton()->free(joint); + PhysicsServer3D::get_singleton()->free(joint); joint = RID(); } break; @@ -2101,10 +2101,10 @@ 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 #endif @@ -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; @@ -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,7 +2497,7 @@ 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 @@ -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(), NULL, ""); 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..ed7cfa8733 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; @@ -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..f6b3e79300 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(); @@ -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..d00af3b128 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) { @@ -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)) { 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..1b05641c9d 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(); @@ -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/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index 6c93c3c1c7..ee9ce1dd71 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -36,11 +36,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 +51,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,28 +72,28 @@ 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() : @@ -120,7 +120,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 +270,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 +285,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 +301,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; } @@ -418,7 +418,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 +427,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 +439,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 +451,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, NULL); return; } @@ -461,13 +461,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, NULL); + 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 +508,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 +516,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 +570,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); @@ -586,90 +586,90 @@ 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()); + 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()); + 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 +701,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 +709,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 +747,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 +761,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 +773,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 +793,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)); } } 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..360e95e76a 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -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(); @@ -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; @@ -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..5984b776b2 100644 --- a/scene/3d/vehicle_body_3d.cpp +++ b/scene/3d/vehicle_body_3d.cpp @@ -111,7 +111,7 @@ String VehicleWheel3D::get_configuration_warning() const { return String(); } -void VehicleWheel3D::_update(PhysicsDirectBodyState *s) { +void VehicleWheel3D::_update(PhysicsDirectBodyState3D *s) { if (m_raycastInfo.m_isInContact) @@ -388,7 +388,7 @@ VehicleWheel3D::VehicleWheel3D() { body = NULL; } -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,9 +448,9 @@ 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); @@ -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(); @@ -992,7 +992,7 @@ VehicleBody3D::VehicleBody3D() { 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: diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp index ce9b8bd213..f993127b07 100644 --- a/scene/animation/root_motion_view.cpp +++ b/scene/animation/root_motion_view.cpp @@ -79,7 +79,7 @@ void RootMotionView::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - VS::get_singleton()->immediate_set_material(immediate, StandardMaterial3D::get_material_rid_for_2d(false, true, false, false, false)); + RS::get_singleton()->immediate_set_material(immediate, StandardMaterial3D::get_material_rid_for_2d(false, true, false, false, false)); first = true; } @@ -122,11 +122,11 @@ void RootMotionView::_notification(int p_what) { } accumulated.origin.z = Math::fposmod(accumulated.origin.z, cell_size); - VS::get_singleton()->immediate_clear(immediate); + RS::get_singleton()->immediate_clear(immediate); int cells_in_radius = int((radius / cell_size) + 1.0); - VS::get_singleton()->immediate_begin(immediate, VS::PRIMITIVE_LINES); + RS::get_singleton()->immediate_begin(immediate, RS::PRIMITIVE_LINES); for (int i = -cells_in_radius; i < cells_in_radius; i++) { for (int j = -cells_in_radius; j < cells_in_radius; j++) { @@ -142,21 +142,21 @@ void RootMotionView::_notification(int p_what) { c_i.a *= MAX(0, 1.0 - from_i.length() / radius); c_j.a *= MAX(0, 1.0 - from_j.length() / radius); - VS::get_singleton()->immediate_color(immediate, c); - VS::get_singleton()->immediate_vertex(immediate, from); + RS::get_singleton()->immediate_color(immediate, c); + RS::get_singleton()->immediate_vertex(immediate, from); - VS::get_singleton()->immediate_color(immediate, c_i); - VS::get_singleton()->immediate_vertex(immediate, from_i); + RS::get_singleton()->immediate_color(immediate, c_i); + RS::get_singleton()->immediate_vertex(immediate, from_i); - VS::get_singleton()->immediate_color(immediate, c); - VS::get_singleton()->immediate_vertex(immediate, from); + RS::get_singleton()->immediate_color(immediate, c); + RS::get_singleton()->immediate_vertex(immediate, from); - VS::get_singleton()->immediate_color(immediate, c_j); - VS::get_singleton()->immediate_vertex(immediate, from_j); + RS::get_singleton()->immediate_color(immediate, c_j); + RS::get_singleton()->immediate_vertex(immediate, from_j); } } - VS::get_singleton()->immediate_end(immediate); + RS::get_singleton()->immediate_end(immediate); } } @@ -197,12 +197,12 @@ RootMotionView::RootMotionView() { radius = 10; cell_size = 1; set_process_internal(true); - immediate = VisualServer::get_singleton()->immediate_create(); + immediate = RenderingServer::get_singleton()->immediate_create(); set_base(immediate); color = Color(0.5, 0.5, 1.0); } RootMotionView::~RootMotionView() { set_base(RID()); - VisualServer::get_singleton()->free(immediate); + RenderingServer::get_singleton()->free(immediate); } diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index f71d322412..1f8487c173 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -31,7 +31,7 @@ #include "button.h" #include "core/translation.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" Size2 Button::get_minimum_size() const { diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp index d68bd4fe4e..470450e3ed 100644 --- a/scene/gui/check_box.cpp +++ b/scene/gui/check_box.cpp @@ -30,7 +30,7 @@ #include "check_box.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" Size2 CheckBox::get_icon_size() const { Ref<Texture2D> checked = Control::get_theme_icon("checked"); diff --git a/scene/gui/check_button.cpp b/scene/gui/check_button.cpp index ac967a128c..96484424f8 100644 --- a/scene/gui/check_button.cpp +++ b/scene/gui/check_button.cpp @@ -31,7 +31,7 @@ #include "check_button.h" #include "core/print_string.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" Size2 CheckButton::get_icon_size() const { diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 14bca0e2c8..0d982dbc02 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -40,7 +40,7 @@ #include "scene/main/canvas_layer.h" #include "scene/main/window.h" #include "scene/scene_string_names.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #ifdef TOOLS_ENABLED #include "editor/editor_settings.h" @@ -470,7 +470,7 @@ void Control::_update_canvas_item_transform() { Transform2D xform = _get_internal_transform(); xform[2] += get_position(); - VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform); + RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform); } void Control::_notification(int p_notification) { @@ -588,8 +588,8 @@ void Control::_notification(int p_notification) { case NOTIFICATION_DRAW: { _update_canvas_item_transform(); - VisualServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), !data.disable_visibility_clip, Rect2(Point2(), get_size())); - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents); + RenderingServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), !data.disable_visibility_clip, Rect2(Point2(), get_size())); + RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), data.clip_contents); //emit_signal(SceneStringNames::get_singleton()->draw); } break; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 2db44d0b66..47a5ac68d2 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -859,9 +859,9 @@ void ItemList::_notification(int p_what) { } if (has_focus()) { - VisualServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true); draw_style_box(get_theme_stylebox("bg_focus"), Rect2(Point2(), size)); - VisualServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false); } if (shape_changed) { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index ef1bb958f6..1ffc9712cc 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -84,7 +84,7 @@ void Label::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { if (clip) { - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); + RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); } if (word_cache_dirty) @@ -105,7 +105,7 @@ void Label::_notification(int p_what) { style->draw(ci, Rect2(Point2(0, 0), get_size())); - VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(), font.is_valid() && font->is_distance_field_hint()); + RenderingServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(), font.is_valid() && font->is_distance_field_hint()); int font_h = font->get_height() + line_spacing; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 734e27b1b6..6c5f77f874 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -815,9 +815,9 @@ void LineEdit::_notification(int p_what) { bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; if (selected) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); } drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color); @@ -839,7 +839,7 @@ void LineEdit::_notification(int p_what) { bool selected = selection.enabled && char_ofs >= selection.begin && char_ofs < selection.end; if (selected) - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(char_width, caret_height)), selection_color); int yofs = y_ofs + (caret_height - font->get_height()) / 2; drawer.draw_char(ci, Point2(x_ofs, yofs + font_ascent), cchar, next, selected ? font_color_selected : font_color); @@ -847,9 +847,9 @@ void LineEdit::_notification(int p_what) { if (char_ofs == cursor_pos && draw_caret && !using_placeholder) { if (ime_text.length() == 0) { #ifdef TOOLS_ENABLED - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color); #else - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); #endif } } @@ -874,9 +874,9 @@ void LineEdit::_notification(int p_what) { bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; if (selected) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 3)), font_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(x_ofs, y_ofs + caret_height), Size2(im_char_width, 1)), font_color); } drawer.draw_char(ci, Point2(x_ofs, y_ofs + font_ascent), cchar, next, font_color); @@ -905,9 +905,9 @@ void LineEdit::_notification(int p_what) { } } #ifdef TOOLS_ENABLED - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(caret_x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(caret_x_ofs, y_ofs), Size2(Math::round(EDSCALE), caret_height)), cursor_color); #else - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(caret_x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(caret_x_ofs, y_ofs), Size2(1, caret_height)), cursor_color); #endif } } diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index 0ef1f53006..cf10c4cfbd 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -30,7 +30,7 @@ #include "nine_patch_rect.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" void NinePatchRect::_notification(int p_what) { @@ -45,7 +45,7 @@ void NinePatchRect::_notification(int p_what) { texture->get_rect_region(rect, src_rect, rect, src_rect); RID ci = get_canvas_item(); - VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NinePatchAxisMode(axis_h), VS::NinePatchAxisMode(axis_v), draw_center); + RS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center); } } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index df28a4c12f..d17eec4050 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -603,7 +603,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & #ifdef TOOLS_ENABLED underline_width *= EDSCALE; #endif - VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, underline_width); + RS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, underline_width); } else if (strikethrough) { Color uc = color; uc.a *= 0.5; @@ -612,7 +612,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & #ifdef TOOLS_ENABLED strikethrough_width *= EDSCALE; #endif - VS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, strikethrough_width); + RS::get_singleton()->canvas_item_add_line(ci, p_ofs + Point2(align_ofs + wofs, uy), p_ofs + Point2(align_ofs + wofs + w, uy), uc, strikethrough_width); } } @@ -991,9 +991,9 @@ void RichTextLabel::_notification(int p_what) { draw_style_box(get_theme_stylebox("normal"), Rect2(Point2(), size)); if (has_focus()) { - VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, true); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true); draw_style_box(get_theme_stylebox("focus"), Rect2(Point2(), size)); - VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, false); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false); } int ofs = vscroll->get_value(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index fb477ee3b4..7071652f2a 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -728,7 +728,7 @@ void TextEdit::_notification(int p_what) { _update_scrollbars(); RID ci = get_canvas_item(); - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); + RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); int xmargin_beg = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width + cache.info_gutter_width; int xmargin_end = size.width - cache.style_normal->get_margin(MARGIN_RIGHT) - cache.minimap_width; @@ -749,14 +749,14 @@ void TextEdit::_notification(int p_what) { if (syntax_coloring) { if (cache.background_color.a > 0.01) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(), get_size()), cache.background_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(), get_size()), cache.background_color); } } if (line_length_guidelines) { const int hard_x = xmargin_beg + (int)cache.font->get_char_size('0').width * line_length_guideline_hard_col - cursor.x_ofs; if (hard_x > xmargin_beg && hard_x < xmargin_end) { - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(hard_x, 0), Point2(hard_x, size.height), cache.line_length_guideline_color); + RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2(hard_x, 0), Point2(hard_x, size.height), cache.line_length_guideline_color); } // Draw a "Soft" line length guideline, less visible than the hard line length guideline. @@ -764,7 +764,7 @@ void TextEdit::_notification(int p_what) { // Only drawn if its column differs from the hard line length guideline. const int soft_x = xmargin_beg + (int)cache.font->get_char_size('0').width * line_length_guideline_soft_col - cursor.x_ofs; if (hard_x != soft_x && soft_x > xmargin_beg && soft_x < xmargin_end) { - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(soft_x, 0), Point2(soft_x, size.height), cache.line_length_guideline_color * Color(1, 1, 1, 0.5)); + RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2(soft_x, 0), Point2(soft_x, size.height), cache.line_length_guideline_color * Color(1, 1, 1, 0.5)); } } @@ -955,7 +955,7 @@ void TextEdit::_notification(int p_what) { // draw the minimap Color viewport_color = (cache.background_color.get_v() < 0.5) ? Color(1, 1, 1, 0.1) : Color(0, 0, 0, 0.1); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2((xmargin_end + 2), viewport_offset_y, cache.minimap_width, viewport_height), viewport_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2((xmargin_end + 2), viewport_offset_y, cache.minimap_width, viewport_height), viewport_color); for (int i = 0; i < minimap_draw_amount; i++) { minimap_line++; @@ -1008,7 +1008,7 @@ void TextEdit::_notification(int p_what) { } if (minimap_line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2((xmargin_end + 2), i * 3, cache.minimap_width, 2), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2((xmargin_end + 2), i * 3, cache.minimap_width, 2), cache.current_line_color); } Color previous_color; @@ -1057,7 +1057,7 @@ void TextEdit::_notification(int p_what) { // take one for zero indexing, and if we hit whitespace / the end of a word. int chars = MAX(0, (j - (characters - 1)) - (is_whitespace ? 1 : 0)) + 1; int char_x_ofs = indent_px + ((xmargin_end + minimap_char_size.x) + (minimap_char_size.x * chars)) + tabs; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_x_ofs, minimap_line_height * i), Point2(minimap_char_size.x * characters, minimap_char_size.y)), previous_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_x_ofs, minimap_line_height * i), Point2(minimap_char_size.x * characters, minimap_char_size.y)), previous_color); } if (out_of_bounds) { @@ -1164,24 +1164,24 @@ void TextEdit::_notification(int p_what) { } if (text.is_marked(line)) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.mark_color); } if (str.length() == 0) { // Draw line background if empty as we won't loop at at all. if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(ofs_x, ofs_y, xmargin_end, get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(ofs_x, ofs_y, xmargin_end, get_row_height()), cache.current_line_color); } // Give visual indication of empty selected line. if (selection.active && line >= selection.from_line && line <= selection.to_line && char_margin >= xmargin_beg) { int char_w = cache.font->get_char_size(' ').width; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, char_w, get_row_height()), cache.selection_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, char_w, get_row_height()), cache.selection_color); } } else { // If it has text, then draw current line marker in the margin, as line number etc will draw over it, draw the rest of line marker later. if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg + ofs_x, get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(0, ofs_y, xmargin_beg + ofs_x, get_row_height()), cache.current_line_color); } } @@ -1190,9 +1190,9 @@ void TextEdit::_notification(int p_what) { if (text.is_breakpoint(line) && !draw_breakpoint_gutter) { #ifdef TOOLS_ENABLED - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.breakpoint_color); #else - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.breakpoint_color); #endif } @@ -1202,7 +1202,7 @@ void TextEdit::_notification(int p_what) { int vertical_gap = (get_row_height() * 40) / 100; int horizontal_gap = (cache.breakpoint_gutter_width * 30) / 100; int marker_radius = get_row_height() - (vertical_gap * 2); - VisualServer::get_singleton()->canvas_item_add_circle(ci, Point2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2 + marker_radius / 2, ofs_y + vertical_gap + marker_radius / 2), marker_radius, Color(cache.bookmark_color.r, cache.bookmark_color.g, cache.bookmark_color.b)); + RenderingServer::get_singleton()->canvas_item_add_circle(ci, Point2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2 + marker_radius / 2, ofs_y + vertical_gap + marker_radius / 2), marker_radius, Color(cache.bookmark_color.r, cache.bookmark_color.g, cache.bookmark_color.b)); } } @@ -1214,7 +1214,7 @@ void TextEdit::_notification(int p_what) { int marker_height = get_row_height() - (vertical_gap * 2); int marker_width = cache.breakpoint_gutter_width - (horizontal_gap * 2); // No transparency on marker. - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2, ofs_y + vertical_gap, marker_width, marker_height), Color(cache.breakpoint_color.r, cache.breakpoint_color.g, cache.breakpoint_color.b)); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2, ofs_y + vertical_gap, marker_width, marker_height), Color(cache.breakpoint_color.r, cache.breakpoint_color.g, cache.breakpoint_color.b)); } } @@ -1254,9 +1254,9 @@ void TextEdit::_notification(int p_what) { cache.executing_icon->draw_rect(ci, Rect2(cache.style_normal->get_margin(MARGIN_LEFT) + horizontal_gap - 2 - icon_extra_size / 2, ofs_y + vertical_gap - icon_extra_size / 2, marker_width, marker_height), false, Color(cache.executing_line_color.r, cache.executing_line_color.g, cache.executing_line_color.b)); } else { #ifdef TOOLS_ENABLED - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.executing_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y + get_row_height() - EDSCALE, xmargin_end - xmargin_beg, EDSCALE), cache.executing_line_color); #else - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.executing_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - xmargin_beg, get_row_height()), cache.executing_line_color); #endif } } @@ -1315,10 +1315,10 @@ void TextEdit::_notification(int p_what) { if (j == str.length() - 1) { // End of line when last char is skipped. - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color); } else if ((char_ofs + char_margin) > xmargin_beg) { // Char next to margin is skipped. - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(xmargin_beg + ofs_x, ofs_y, (char_ofs + char_margin) - (xmargin_beg + ofs_x), get_row_height()), cache.current_line_color); } } continue; @@ -1338,7 +1338,7 @@ void TextEdit::_notification(int p_what) { in_search_result = j >= search_text_col && j < search_text_col + search_text.length(); if (in_search_result) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin, ofs_y), Size2i(char_w, get_row_height())), cache.search_result_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin, ofs_y), Size2i(char_w, get_row_height())), cache.search_result_color); } } @@ -1348,32 +1348,32 @@ void TextEdit::_notification(int p_what) { if (line == cursor.line && cursor_wrap_index == line_wrap_index && highlight_current_line) { // Draw the wrap indent offset highlight. if (line_wrap_index != 0 && j == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + ofs_x - indent_px, ofs_y, indent_px, get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + ofs_x - indent_px, ofs_y, indent_px, get_row_height()), cache.current_line_color); } // If its the last char draw to end of the line. if (j == str.length() - 1) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + char_w + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(char_ofs + char_margin + char_w + ofs_x, ofs_y, xmargin_end - (char_ofs + char_margin + char_w), get_row_height()), cache.current_line_color); } // Actual text. if (!in_selection) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.current_line_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.current_line_color); } } if (in_selection) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.selection_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.selection_color); } if (in_search_result) { Color border_color = (line == search_result_line && j >= search_result_col && j < search_result_col + search_text.length()) ? cache.font_color : cache.search_result_border_color; - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, 1)), border_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y + get_row_height() - 1), Size2i(char_w, 1)), border_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, 1)), border_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y + get_row_height() - 1), Size2i(char_w, 1)), border_color); if (j == search_text_col) - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(1, get_row_height())), border_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(1, get_row_height())), border_color); if (j == search_text_col + search_text.length() - 1) - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color); } if (highlight_all_occurrences && !only_whitespaces_highlighted) { @@ -1392,7 +1392,7 @@ void TextEdit::_notification(int p_what) { } if (in_highlighted_word) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.word_highlighted_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + ofs_x, ofs_y), Size2i(char_w, get_row_height())), cache.word_highlighted_color); } } } @@ -1449,9 +1449,9 @@ void TextEdit::_notification(int p_what) { bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; if (selected) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); } drawer.draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color); @@ -1468,7 +1468,7 @@ void TextEdit::_notification(int p_what) { #else int caret_h = (block_caret) ? 4 : 2; #endif - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, caret_h)), cache.caret_color); } else { #ifdef TOOLS_ENABLED caret_w = (block_caret) ? caret_w : 2 * EDSCALE; @@ -1476,7 +1476,7 @@ void TextEdit::_notification(int p_what) { caret_w = (block_caret) ? caret_w : 2; #endif - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, cache.font->get_height())), cache.caret_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, cache.font->get_height())), cache.caret_color); } } } @@ -1544,9 +1544,9 @@ void TextEdit::_notification(int p_what) { bool selected = ofs >= ime_selection.x && ofs < ime_selection.x + ime_selection.y; if (selected) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 3)), color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(char_ofs + char_margin, ofs_y + get_row_height()), Size2(im_char_width, 1)), color); } drawer.draw_char(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + ascent), cchar, next, color); @@ -1564,7 +1564,7 @@ void TextEdit::_notification(int p_what) { #else int caret_h = (block_caret) ? 4 : 2; #endif - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(char_w, caret_h)), cache.caret_color); } else { int char_w = cache.font->get_char_size(' ').width; #ifdef TOOLS_ENABLED @@ -1573,7 +1573,7 @@ void TextEdit::_notification(int p_what) { int caret_w = (block_caret) ? char_w : 2; #endif - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, cache.font->get_height())), cache.caret_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(cursor_pos, Size2i(caret_w, cache.font->get_height())), cache.caret_color); } } } @@ -1634,10 +1634,10 @@ void TextEdit::_notification(int p_what) { draw_style_box(csb, Rect2(completion_rect.position - csb->get_offset(), completion_rect.size + csb->get_minimum_size() + Size2(scrollw, 0))); if (cache.completion_background_color.a > 0.01) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.position, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.position, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color); } int line_from = CLAMP(completion_index - lines / 2, 0, completion_options_size - lines); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); draw_rect(Rect2(completion_rect.position + Vector2(icon_area_size.x + icon_hsep, 0), Size2(MIN(nofs, completion_rect.size.width - (icon_area_size.x + icon_hsep)), completion_rect.size.height)), cache.completion_existing_color); for (int i = 0; i < lines; i++) { diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index abf6b2ed49..0dd43e4a35 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -300,7 +300,7 @@ void TextureProgress::draw_nine_patch_stretched(const Ref<Texture2D> &p_texture, p_texture->get_rect_region(dst_rect, src_rect, dst_rect, src_rect); RID ci = get_canvas_item(); - VS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, true, p_modulate); + RS::get_singleton()->canvas_item_add_nine_patch(ci, dst_rect, src_rect, p_texture->get_rid(), topleft, bottomright, RS::NINE_PATCH_STRETCH, RS::NINE_PATCH_STRETCH, true, p_modulate); } void TextureProgress::_notification(int p_what) { diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 6dafd3bf4f..baa138847f 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -30,7 +30,7 @@ #include "texture_rect.h" #include "core/core_string_names.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" void TextureRect::_notification(int p_what) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 653ac74164..87425b49cd 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1220,7 +1220,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } if (cache.draw_guides) { - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1); + RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1); } if (i == 0) { @@ -1266,12 +1266,12 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 r.size.x += cache.hseparation; } if (p_item->cells[i].custom_bg_outline) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y - 1, r.size.x, 1), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), p_item->cells[i].bg_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y - 1, r.size.x, 1), p_item->cells[i].bg_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci, r, p_item->cells[i].bg_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, r, p_item->cells[i].bg_color); } } @@ -1280,16 +1280,16 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Rect2 r = cell_rect; if (drop_mode_section == -1 || drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), cache.drop_position_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), cache.drop_position_color); } if (drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), cache.drop_position_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), cache.drop_position_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), cache.drop_position_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), cache.drop_position_color); } if (drop_mode_section == 1 || drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y, r.size.x, 1), cache.drop_position_color); + RenderingServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y, r.size.x, 1), cache.drop_position_color); } } @@ -1509,8 +1509,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + cache.arrow->get_height() / 2) - cache.offset + p_draw_ofs; if (root_pos.y + line_width >= 0) { - VisualServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x - Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width); - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), Point2i(parent_pos.x, prev_ofs), cache.relationship_line_color, line_width); + RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x - Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width); + RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), Point2i(parent_pos.x, prev_ofs), cache.relationship_line_color, line_width); } if (htotal < 0) { @@ -3030,9 +3030,9 @@ void Tree::_notification(int p_what) { bg->draw(ci, Rect2(Point2(), get_size())); if (has_focus()) { - VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, true); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, true); bg_focus->draw(ci, Rect2(Point2(), get_size())); - VisualServer::get_singleton()->canvas_item_add_clip_ignore(ci, false); + RenderingServer::get_singleton()->canvas_item_add_clip_ignore(ci, false); } int tbh = _get_title_button_height(); diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 7a0fc3352b..4a415415f1 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -40,8 +40,7 @@ #include "scene/resources/style_box.h" #include "scene/resources/texture.h" #include "scene/scene_string_names.h" -#include "servers/visual/visual_server_raster.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" Mutex CanvasItemMaterial::material_mutex; SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = NULL; @@ -78,7 +77,7 @@ void CanvasItemMaterial::_update_shader() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } } @@ -87,7 +86,7 @@ void CanvasItemMaterial::_update_shader() { if (shader_map.has(mk)) { - VS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); shader_map[mk].users++; return; } @@ -138,14 +137,14 @@ void CanvasItemMaterial::_update_shader() { } ShaderData shader_data; - shader_data.shader = VS::get_singleton()->shader_create(); + shader_data.shader = RS::get_singleton()->shader_create(); shader_data.users = 1; - VS::get_singleton()->shader_set_code(shader_data.shader, code); + RS::get_singleton()->shader_set_code(shader_data.shader, code); shader_map[mk] = shader_data; - VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); } void CanvasItemMaterial::flush_changes() { @@ -207,7 +206,7 @@ bool CanvasItemMaterial::get_particles_animation() const { void CanvasItemMaterial::set_particles_anim_h_frames(int p_frames) { particles_anim_h_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames); } int CanvasItemMaterial::get_particles_anim_h_frames() const { @@ -217,7 +216,7 @@ int CanvasItemMaterial::get_particles_anim_h_frames() const { void CanvasItemMaterial::set_particles_anim_v_frames(int p_frames) { particles_anim_v_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames); } int CanvasItemMaterial::get_particles_anim_v_frames() const { @@ -228,7 +227,7 @@ int CanvasItemMaterial::get_particles_anim_v_frames() const { void CanvasItemMaterial::set_particles_anim_loop(bool p_loop) { particles_anim_loop = p_loop; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, particles_anim_loop); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, particles_anim_loop); } bool CanvasItemMaterial::get_particles_anim_loop() const { @@ -316,11 +315,11 @@ CanvasItemMaterial::~CanvasItemMaterial() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } } @@ -388,7 +387,7 @@ void CanvasItem::show() { return; visible = true; - VisualServer::get_singleton()->canvas_item_set_visible(canvas_item, true); + RenderingServer::get_singleton()->canvas_item_set_visible(canvas_item, true); if (!is_inside_tree()) return; @@ -403,7 +402,7 @@ void CanvasItem::hide() { return; visible = false; - VisualServer::get_singleton()->canvas_item_set_visible(canvas_item, false); + RenderingServer::get_singleton()->canvas_item_set_visible(canvas_item, false); if (!is_inside_tree()) return; @@ -424,7 +423,7 @@ void CanvasItem::_update_callback() { return; } - VisualServer::get_singleton()->canvas_item_clear(get_canvas_item()); + RenderingServer::get_singleton()->canvas_item_clear(get_canvas_item()); //todo updating = true - only allow drawing here if (is_visible_in_tree()) { //todo optimize this!! if (first_draw) { @@ -494,9 +493,9 @@ void CanvasItem::_toplevel_raise_self() { return; if (canvas_layer) - VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item, canvas_layer->get_sort_index()); + RenderingServer::get_singleton()->canvas_item_set_draw_index(canvas_item, canvas_layer->get_sort_index()); else - VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_viewport()->gui_get_canvas_sort_index()); + RenderingServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_viewport()->gui_get_canvas_sort_index()); } void CanvasItem::_enter_canvas() { @@ -525,7 +524,7 @@ void CanvasItem::_enter_canvas() { else canvas = get_viewport()->find_world_2d()->get_canvas(); - VisualServer::get_singleton()->canvas_item_set_parent(canvas_item, canvas); + RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, canvas); group = "root_canvas" + itos(canvas.get_id()); @@ -541,8 +540,8 @@ void CanvasItem::_enter_canvas() { CanvasItem *parent = get_parent_item(); canvas_layer = parent->canvas_layer; - VisualServer::get_singleton()->canvas_item_set_parent(canvas_item, parent->get_canvas_item()); - VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_index()); + RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, parent->get_canvas_item()); + RenderingServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_index()); } pending_update = false; @@ -554,7 +553,7 @@ void CanvasItem::_enter_canvas() { void CanvasItem::_exit_canvas() { notification(NOTIFICATION_EXIT_CANVAS, true); //reverse the notification - VisualServer::get_singleton()->canvas_item_set_parent(canvas_item, RID()); + RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, RID()); canvas_layer = NULL; group = ""; } @@ -608,7 +607,7 @@ void CanvasItem::_notification(int p_what) { } else { CanvasItem *p = get_parent_item(); ERR_FAIL_COND(!p); - VisualServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_index()); + RenderingServer::get_singleton()->canvas_item_set_draw_index(canvas_item, get_index()); } } break; @@ -674,7 +673,7 @@ void CanvasItem::set_modulate(const Color &p_modulate) { return; modulate = p_modulate; - VisualServer::get_singleton()->canvas_item_set_modulate(canvas_item, modulate); + RenderingServer::get_singleton()->canvas_item_set_modulate(canvas_item, modulate); } Color CanvasItem::get_modulate() const { @@ -715,7 +714,7 @@ void CanvasItem::set_self_modulate(const Color &p_self_modulate) { return; self_modulate = p_self_modulate; - VisualServer::get_singleton()->canvas_item_set_self_modulate(canvas_item, self_modulate); + RenderingServer::get_singleton()->canvas_item_set_self_modulate(canvas_item, self_modulate); } Color CanvasItem::get_self_modulate() const { @@ -728,7 +727,7 @@ void CanvasItem::set_light_mask(int p_light_mask) { return; light_mask = p_light_mask; - VS::get_singleton()->canvas_item_set_light_mask(canvas_item, p_light_mask); + RS::get_singleton()->canvas_item_set_light_mask(canvas_item, p_light_mask); } int CanvasItem::get_light_mask() const { @@ -747,7 +746,7 @@ void CanvasItem::draw_line(const Point2 &p_from, const Point2 &p_to, const Color ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - VisualServer::get_singleton()->canvas_item_add_line(canvas_item, p_from, p_to, p_color, p_width); + RenderingServer::get_singleton()->canvas_item_add_line(canvas_item, p_from, p_to, p_color, p_width); } void CanvasItem::draw_polyline(const Vector<Point2> &p_points, const Color &p_color, float p_width) { @@ -756,14 +755,14 @@ void CanvasItem::draw_polyline(const Vector<Point2> &p_points, const Color &p_co Vector<Color> colors; colors.push_back(p_color); - VisualServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, colors, p_width); + RenderingServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, colors, p_width); } void CanvasItem::draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - VisualServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, p_colors, p_width); + RenderingServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, p_colors, p_width); } void CanvasItem::draw_arc(const Vector2 &p_center, float p_radius, float p_start_angle, float p_end_angle, int p_point_count, const Color &p_color, float p_width) { @@ -785,14 +784,14 @@ void CanvasItem::draw_multiline(const Vector<Point2> &p_points, const Color &p_c Vector<Color> colors; colors.push_back(p_color); - VisualServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, colors, p_width); + RenderingServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, colors, p_width); } void CanvasItem::draw_multiline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - VisualServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, p_colors, p_width); + RenderingServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, p_colors, p_width); } void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled, float p_width) { @@ -804,7 +803,7 @@ void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_fil WARN_PRINT("The draw_rect() \"width\" argument has no effect when \"filled\" is \"true\"."); } - VisualServer::get_singleton()->canvas_item_add_rect(canvas_item, p_rect, p_color); + RenderingServer::get_singleton()->canvas_item_add_rect(canvas_item, p_rect, p_color); } else { // Thick lines are offset depending on their width to avoid partial overlapping. // Thin lines don't require an offset, so don't apply one in this case @@ -815,25 +814,25 @@ void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_fil offset = 0.0; } - VisualServer::get_singleton()->canvas_item_add_line( + RenderingServer::get_singleton()->canvas_item_add_line( canvas_item, p_rect.position + Size2(-offset, 0), p_rect.position + Size2(p_rect.size.width + offset, 0), p_color, p_width); - VisualServer::get_singleton()->canvas_item_add_line( + RenderingServer::get_singleton()->canvas_item_add_line( canvas_item, p_rect.position + Size2(p_rect.size.width, offset), p_rect.position + Size2(p_rect.size.width, p_rect.size.height - offset), p_color, p_width); - VisualServer::get_singleton()->canvas_item_add_line( + RenderingServer::get_singleton()->canvas_item_add_line( canvas_item, p_rect.position + Size2(p_rect.size.width + offset, p_rect.size.height), p_rect.position + Size2(-offset, p_rect.size.height), p_color, p_width); - VisualServer::get_singleton()->canvas_item_add_line( + RenderingServer::get_singleton()->canvas_item_add_line( canvas_item, p_rect.position + Size2(0, p_rect.size.height - offset), p_rect.position + Size2(0, offset), @@ -846,7 +845,7 @@ void CanvasItem::draw_circle(const Point2 &p_pos, float p_radius, const Color &p ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - VisualServer::get_singleton()->canvas_item_add_circle(canvas_item, p_pos, p_radius, p_color); + RenderingServer::get_singleton()->canvas_item_add_circle(canvas_item, p_pos, p_radius, p_color); } void CanvasItem::draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_pos, const Color &p_modulate, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -855,7 +854,7 @@ void CanvasItem::draw_texture(const Ref<Texture2D> &p_texture, const Point2 &p_p ERR_FAIL_COND(p_texture.is_null()); - p_texture->draw(canvas_item, p_pos, p_modulate, false, p_normal_map, p_specular_map, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + p_texture->draw(canvas_item, p_pos, p_modulate, false, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -863,13 +862,13 @@ void CanvasItem::draw_texture_rect(const Ref<Texture2D> &p_texture, const Rect2 ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); ERR_FAIL_COND(p_texture.is_null()); - p_texture->draw_rect(canvas_item, p_rect, p_tile, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + p_texture->draw_rect(canvas_item, p_rect, p_tile, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_texture_rect_region(const Ref<Texture2D> &p_texture, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, bool p_clip_uv, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); ERR_FAIL_COND(p_texture.is_null()); - p_texture->draw_rect_region(canvas_item, p_rect, p_src_rect, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat), p_clip_uv); + p_texture->draw_rect_region(canvas_item, p_rect, p_src_rect, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat), p_clip_uv); } void CanvasItem::draw_style_box(const Ref<StyleBox> &p_style_box, const Rect2 &p_rect) { @@ -887,7 +886,7 @@ void CanvasItem::draw_primitive(const Vector<Point2> &p_points, const Vector<Col RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_primitive(canvas_item, p_points, p_colors, p_uvs, rid, p_width, rid_normal, rid_specular, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + RenderingServer::get_singleton()->canvas_item_add_primitive(canvas_item, p_points, p_colors, p_uvs, rid, p_width, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_set_transform(const Point2 &p_offset, float p_rot, const Size2 &p_scale) { @@ -895,14 +894,14 @@ void CanvasItem::draw_set_transform(const Point2 &p_offset, float p_rot, const S Transform2D xform(p_rot, p_offset); xform.scale_basis(p_scale); - VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item, xform); + RenderingServer::get_singleton()->canvas_item_add_set_transform(canvas_item, xform); } void CanvasItem::draw_set_transform_matrix(const Transform2D &p_matrix) { ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal."); - VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item, p_matrix); + RenderingServer::get_singleton()->canvas_item_add_set_transform(canvas_item, p_matrix); } void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -913,7 +912,7 @@ void CanvasItem::draw_polygon(const Vector<Point2> &p_points, const Vector<Color RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, p_colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Color &p_color, const Vector<Point2> &p_uvs, Ref<Texture2D> p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -926,7 +925,7 @@ void CanvasItem::draw_colored_polygon(const Vector<Point2> &p_points, const Colo RID rid_normal = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID rid_specular = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + RenderingServer::get_singleton()->canvas_item_add_polygon(canvas_item, p_points, colors, p_uvs, rid, rid_normal, rid_specular, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, const Transform2D &p_transform, const Color &p_modulate, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -936,7 +935,7 @@ void CanvasItem::draw_mesh(const Ref<Mesh> &p_mesh, const Ref<Texture2D> &p_text RID normal_map_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_map_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_mesh(canvas_item, p_mesh->get_rid(), p_transform, p_modulate, texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + RenderingServer::get_singleton()->canvas_item_add_mesh(canvas_item, p_mesh->get_rid(), p_transform, p_modulate, texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Texture2D> &p_texture, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, TextureFilter p_texture_filter, TextureRepeat p_texture_repeat) { @@ -945,7 +944,7 @@ void CanvasItem::draw_multimesh(const Ref<MultiMesh> &p_multimesh, const Ref<Tex RID normal_map_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_map_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_multimesh(canvas_item, p_multimesh->get_rid(), texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, VS::CanvasItemTextureFilter(p_texture_filter), VS::CanvasItemTextureRepeat(p_texture_repeat)); + RenderingServer::get_singleton()->canvas_item_add_multimesh(canvas_item, p_multimesh->get_rid(), texture_rid, normal_map_rid, specular_map_rid, p_specular_color_shininess, RS::CanvasItemTextureFilter(p_texture_filter), RS::CanvasItemTextureRepeat(p_texture_repeat)); } void CanvasItem::draw_string(const Ref<Font> &p_font, const Point2 &p_pos, const String &p_text, const Color &p_modulate, int p_clip_w) { @@ -1067,7 +1066,7 @@ void CanvasItem::set_draw_behind_parent(bool p_enable) { if (behind == p_enable) return; behind = p_enable; - VisualServer::get_singleton()->canvas_item_set_draw_behind_parent(canvas_item, behind); + RenderingServer::get_singleton()->canvas_item_set_draw_behind_parent(canvas_item, behind); } bool CanvasItem::is_draw_behind_parent_enabled() const { @@ -1081,14 +1080,14 @@ void CanvasItem::set_material(const Ref<Material> &p_material) { RID rid; if (material.is_valid()) rid = material->get_rid(); - VS::get_singleton()->canvas_item_set_material(canvas_item, rid); + RS::get_singleton()->canvas_item_set_material(canvas_item, rid); _change_notify(); //properties for material exposed } void CanvasItem::set_use_parent_material(bool p_use_parent_material) { use_parent_material = p_use_parent_material; - VS::get_singleton()->canvas_item_set_use_parent_material(canvas_item, p_use_parent_material); + RS::get_singleton()->canvas_item_set_use_parent_material(canvas_item, p_use_parent_material); } bool CanvasItem::get_use_parent_material() const { @@ -1373,18 +1372,18 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) { } else { //from viewport switch (get_viewport()->get_default_canvas_item_texture_filter()) { - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST: texture_filter_cache = VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST; break; - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR: texture_filter_cache = VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; break; - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texture_filter_cache = VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS; break; - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texture_filter_cache = VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS; break; default: { } } } } else { - texture_filter_cache = VS::CanvasItemTextureFilter(texture_filter); + texture_filter_cache = RS::CanvasItemTextureFilter(texture_filter); } - VS::get_singleton()->canvas_item_set_default_texture_filter(get_canvas_item(), texture_filter_cache); + RS::get_singleton()->canvas_item_set_default_texture_filter(get_canvas_item(), texture_filter_cache); update(); if (p_propagate) { @@ -1422,17 +1421,17 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) { } else { //from viewport switch (get_viewport()->get_default_canvas_item_texture_repeat()) { - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: texture_repeat_cache = VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; break; - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: texture_repeat_cache = VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED; break; - case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: texture_repeat_cache = VS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED; break; + case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR; break; default: { } } } } else { - texture_repeat_cache = VS::CanvasItemTextureRepeat(texture_repeat); + texture_repeat_cache = RS::CanvasItemTextureRepeat(texture_repeat); } - VS::get_singleton()->canvas_item_set_default_texture_repeat(get_canvas_item(), texture_repeat_cache); + RS::get_singleton()->canvas_item_set_default_texture_repeat(get_canvas_item(), texture_repeat_cache); update(); if (p_propagate) { for (List<CanvasItem *>::Element *E = children_items.front(); E; E = E->next()) { @@ -1460,7 +1459,7 @@ CanvasItem::CanvasItem() : xform_change(this) { window = nullptr; - canvas_item = VisualServer::get_singleton()->canvas_item_create(); + canvas_item = RenderingServer::get_singleton()->canvas_item_create(); visible = true; pending_update = false; modulate = Color(1, 1, 1, 1); @@ -1479,13 +1478,13 @@ CanvasItem::CanvasItem() : light_mask = 1; texture_repeat = TEXTURE_REPEAT_PARENT_NODE; texture_filter = TEXTURE_FILTER_PARENT_NODE; - texture_filter_cache = VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; - texture_repeat_cache = VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; + texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; + texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; C = NULL; } CanvasItem::~CanvasItem() { - VisualServer::get_singleton()->free(canvas_item); + RenderingServer::get_singleton()->free(canvas_item); } diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 3f176e5f60..dc17c5283b 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -213,8 +213,8 @@ private: bool notify_local_transform; bool notify_transform; - VS::CanvasItemTextureFilter texture_filter_cache; - VS::CanvasItemTextureRepeat texture_repeat_cache; + RS::CanvasItemTextureFilter texture_filter_cache; + RS::CanvasItemTextureRepeat texture_repeat_cache; TextureFilter texture_filter; TextureRepeat texture_repeat; diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 2085fa3a60..e6a665d035 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -35,7 +35,7 @@ void CanvasLayer::set_layer(int p_xform) { layer = p_xform; if (viewport.is_valid()) - VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); + RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); } int CanvasLayer::get_layer() const { @@ -48,7 +48,7 @@ void CanvasLayer::set_transform(const Transform2D &p_xform) { transform = p_xform; locrotscale_dirty = true; if (viewport.is_valid()) - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); } Transform2D CanvasLayer::get_transform() const { @@ -61,7 +61,7 @@ void CanvasLayer::_update_xform() { transform.set_rotation_and_scale(rot, scale); transform.set_origin(ofs); if (viewport.is_valid()) - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); } void CanvasLayer::_update_locrotscale() { @@ -150,16 +150,16 @@ void CanvasLayer::_notification(int p_what) { vp->_canvas_layer_add(this); viewport = vp->get_viewport_rid(); - VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas); - VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); + RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas); + RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); _update_follow_viewport(); } break; case NOTIFICATION_EXIT_TREE: { vp->_canvas_layer_remove(this); - VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas); + RenderingServer::get_singleton()->viewport_remove_canvas(viewport, canvas); viewport = RID(); _update_follow_viewport(false); @@ -167,7 +167,7 @@ void CanvasLayer::_notification(int p_what) { case NOTIFICATION_MOVED_IN_PARENT: { if (is_inside_tree()) - VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); + RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); } break; } @@ -191,7 +191,7 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) { ERR_FAIL_NULL(p_viewport); if (is_inside_tree()) { vp->_canvas_layer_remove(this); - VisualServer::get_singleton()->viewport_remove_canvas(viewport, canvas); + RenderingServer::get_singleton()->viewport_remove_canvas(viewport, canvas); viewport = RID(); } @@ -213,9 +213,9 @@ void CanvasLayer::set_custom_viewport(Node *p_viewport) { vp->_canvas_layer_add(this); viewport = vp->get_viewport_rid(); - VisualServer::get_singleton()->viewport_attach_canvas(viewport, canvas); - VisualServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); + RenderingServer::get_singleton()->viewport_attach_canvas(viewport, canvas); + RenderingServer::get_singleton()->viewport_set_canvas_stacking(viewport, canvas, layer, get_position_in_parent()); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, canvas, transform); } } @@ -266,9 +266,9 @@ void CanvasLayer::_update_follow_viewport(bool p_force_exit) { return; } if (p_force_exit || !follow_viewport) { - VS::get_singleton()->canvas_set_parent(canvas, RID(), 1.0); + RS::get_singleton()->canvas_set_parent(canvas, RID(), 1.0); } else { - VS::get_singleton()->canvas_set_parent(canvas, vp->get_world_2d()->get_canvas(), follow_viewport_scale); + RS::get_singleton()->canvas_set_parent(canvas, vp->get_world_2d()->get_canvas(), follow_viewport_scale); } } @@ -325,7 +325,7 @@ CanvasLayer::CanvasLayer() { rot = 0; locrotscale_dirty = false; layer = 1; - canvas = VS::get_singleton()->canvas_create(); + canvas = RS::get_singleton()->canvas_create(); custom_viewport = NULL; sort_index = 0; @@ -335,5 +335,5 @@ CanvasLayer::CanvasLayer() { CanvasLayer::~CanvasLayer() { - VS::get_singleton()->free(canvas); + RS::get_singleton()->free(canvas); } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index d6c0323f25..15c0a7666e 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -48,9 +48,9 @@ #include "scene/resources/packed_scene.h" #include "scene/scene_string_names.h" #include "servers/display_server.h" -#include "servers/navigation_server.h" -#include "servers/physics_2d_server.h" -#include "servers/physics_server.h" +#include "servers/navigation_server_3d.h" +#include "servers/physics_server_2d.h" +#include "servers/physics_server_3d.h" #include "window.h" #include <stdio.h> @@ -435,7 +435,7 @@ bool SceneTree::idle(float p_time) { //print_line("ram: "+itos(OS::get_singleton()->get_static_memory_usage())+" sram: "+itos(OS::get_singleton()->get_dynamic_memory_usage())); //print_line("node count: "+itos(get_node_count())); - //print_line("TEXTURE RAM: "+itos(VS::get_singleton()->get_render_info(VS::INFO_TEXTURE_MEM_USED))); + //print_line("TEXTURE RAM: "+itos(RS::get_singleton()->get_render_info(RS::INFO_TEXTURE_MEM_USED))); root_lock++; @@ -796,9 +796,9 @@ void SceneTree::set_pause(bool p_enabled) { if (p_enabled == pause) return; pause = p_enabled; - NavigationServer::get_singleton()->set_active(!p_enabled); - PhysicsServer::get_singleton()->set_active(!p_enabled); - Physics2DServer::get_singleton()->set_active(!p_enabled); + NavigationServer3D::get_singleton()->set_active(!p_enabled); + PhysicsServer3D::get_singleton()->set_active(!p_enabled); + PhysicsServer2D::get_singleton()->set_active(!p_enabled); if (get_root()) get_root()->propagate_notification(p_enabled ? Node::NOTIFICATION_PAUSED : Node::NOTIFICATION_UNPAUSED); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index d293a3cd32..b95e81a702 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -53,7 +53,7 @@ #include "scene/resources/mesh.h" #include "scene/scene_string_names.h" #include "servers/display_server.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" void ViewportTexture::setup_local_to_scene() { @@ -78,11 +78,11 @@ void ViewportTexture::setup_local_to_scene() { vp->viewport_textures.insert(this); if (proxy_ph.is_valid()) { - VS::get_singleton()->texture_proxy_update(proxy, vp->texture_rid); - VS::get_singleton()->free(proxy_ph); + RS::get_singleton()->texture_proxy_update(proxy, vp->texture_rid); + RS::get_singleton()->free(proxy_ph); } else { ERR_FAIL_COND(proxy.is_valid()); //should be invalid - proxy = VS::get_singleton()->texture_proxy_create(vp->texture_rid); + proxy = RS::get_singleton()->texture_proxy_create(vp->texture_rid); } } @@ -122,8 +122,8 @@ RID ViewportTexture::get_rid() const { //ERR_FAIL_COND_V_MSG(!vp, RID(), "Viewport Texture must be set to use it."); if (proxy.is_null()) { - proxy_ph = VS::get_singleton()->texture_2d_placeholder_create(); - proxy = VS::get_singleton()->texture_proxy_create(proxy_ph); + proxy_ph = RS::get_singleton()->texture_2d_placeholder_create(); + proxy = RS::get_singleton()->texture_proxy_create(proxy_ph); } return proxy; } @@ -135,7 +135,7 @@ bool ViewportTexture::has_alpha() const { Ref<Image> ViewportTexture::get_data() const { ERR_FAIL_COND_V_MSG(!vp, Ref<Image>(), "Viewport Texture must be set to use it."); - return VS::get_singleton()->texture_2d_get(vp->texture_rid); + return RS::get_singleton()->texture_2d_get(vp->texture_rid); } void ViewportTexture::_bind_methods() { @@ -159,10 +159,10 @@ ViewportTexture::~ViewportTexture() { } if (proxy_ph.is_valid()) { - VS::get_singleton()->free(proxy_ph); + RS::get_singleton()->free(proxy_ph); } if (proxy.is_valid()) { - VS::get_singleton()->free(proxy); + RS::get_singleton()->free(proxy); } } @@ -240,7 +240,7 @@ void Viewport::_collision_object_input_event(CollisionObject3D *p_object, Camera void Viewport::_sub_window_update_order() { for (int i = 0; i < gui.sub_windows.size(); i++) { - VS::get_singleton()->canvas_item_set_draw_index(gui.sub_windows[i].canvas_item, i); + RS::get_singleton()->canvas_item_set_draw_index(gui.sub_windows[i].canvas_item, i); } } @@ -252,19 +252,19 @@ void Viewport::_sub_window_register(Window *p_window) { } if (gui.sub_windows.size() == 0) { - subwindow_canvas = VS::get_singleton()->canvas_create(); - VS::get_singleton()->viewport_attach_canvas(viewport, subwindow_canvas); - VS::get_singleton()->viewport_set_canvas_stacking(viewport, subwindow_canvas, SUBWINDOW_CANVAS_LAYER, 0); + subwindow_canvas = RS::get_singleton()->canvas_create(); + RS::get_singleton()->viewport_attach_canvas(viewport, subwindow_canvas); + RS::get_singleton()->viewport_set_canvas_stacking(viewport, subwindow_canvas, SUBWINDOW_CANVAS_LAYER, 0); } SubWindow sw; - sw.canvas_item = VS::get_singleton()->canvas_item_create(); - VS::get_singleton()->canvas_item_set_parent(sw.canvas_item, subwindow_canvas); + sw.canvas_item = RS::get_singleton()->canvas_item_create(); + RS::get_singleton()->canvas_item_set_parent(sw.canvas_item, subwindow_canvas); sw.window = p_window; gui.sub_windows.push_back(sw); _sub_window_grab_focus(p_window); - VisualServer::get_singleton()->viewport_set_parent_viewport(p_window->viewport, viewport); + RenderingServer::get_singleton()->viewport_set_parent_viewport(p_window->viewport, viewport); } void Viewport::_sub_window_update(Window *p_window) { @@ -283,7 +283,7 @@ void Viewport::_sub_window_update(Window *p_window) { Transform2D pos; pos.set_origin(p_window->get_position()); - VS::get_singleton()->canvas_item_clear(sw.canvas_item); + RS::get_singleton()->canvas_item_clear(sw.canvas_item); Rect2i r = Rect2i(p_window->get_position(), sw.window->get_size()); if (!p_window->get_flag(Window::FLAG_BORDERLESS)) { @@ -309,7 +309,7 @@ void Viewport::_sub_window_update(Window *p_window) { close_icon->draw(sw.canvas_item, r.position + Vector2(r.size.width - close_h_ofs, -close_v_ofs)); } - VS::get_singleton()->canvas_item_add_texture_rect(sw.canvas_item, r, sw.window->get_texture()->get_rid()); + RS::get_singleton()->canvas_item_add_texture_rect(sw.canvas_item, r, sw.window->get_texture()->get_rid()); } void Viewport::_sub_window_grab_focus(Window *p_window) { @@ -388,14 +388,14 @@ void Viewport::_sub_window_remove(Window *p_window) { for (int i = 0; i < gui.sub_windows.size(); i++) { if (gui.sub_windows[i].window == p_window) { - VS::get_singleton()->free(gui.sub_windows[i].canvas_item); + RS::get_singleton()->free(gui.sub_windows[i].canvas_item); gui.sub_windows.remove(i); break; } } if (gui.sub_windows.size() == 0) { - VS::get_singleton()->free(subwindow_canvas); + RS::get_singleton()->free(subwindow_canvas); subwindow_canvas = RID(); } @@ -419,7 +419,7 @@ void Viewport::_sub_window_remove(Window *p_window) { } } - VisualServer::get_singleton()->viewport_set_parent_viewport(p_window->viewport, p_window->parent ? p_window->parent->viewport : RID()); + RenderingServer::get_singleton()->viewport_set_parent_viewport(p_window->viewport, p_window->parent ? p_window->parent->viewport : RID()); } void Viewport::_own_world_changed() { @@ -437,7 +437,7 @@ void Viewport::_own_world_changed() { } if (is_inside_tree()) { - VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); } _update_listener(); @@ -453,14 +453,14 @@ void Viewport::_notification(int p_what) { if (get_parent()) { parent = get_parent()->get_viewport(); - VisualServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid()); + RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid()); } else { parent = NULL; } current_canvas = find_world_2d()->get_canvas(); - VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); - VisualServer::get_singleton()->viewport_attach_canvas(viewport, current_canvas); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_attach_canvas(viewport, current_canvas); _update_listener(); _update_listener_2d(); @@ -470,19 +470,19 @@ void Viewport::_notification(int p_what) { add_to_group("_viewports"); if (get_tree()->is_debugging_collisions_hint()) { //2D - Physics2DServer::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count()); - contact_2d_debug = VisualServer::get_singleton()->canvas_item_create(); - VisualServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas()); + PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count()); + contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create(); + RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas()); //3D - PhysicsServer::get_singleton()->space_set_debug_contacts(find_world()->get_space(), get_tree()->get_collision_debug_contact_count()); - contact_3d_debug_multimesh = VisualServer::get_singleton()->multimesh_create(); - VisualServer::get_singleton()->multimesh_allocate(contact_3d_debug_multimesh, get_tree()->get_collision_debug_contact_count(), VS::MULTIMESH_TRANSFORM_3D, true); - VisualServer::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, 0); - VisualServer::get_singleton()->multimesh_set_mesh(contact_3d_debug_multimesh, get_tree()->get_debug_contact_mesh()->get_rid()); - contact_3d_debug_instance = VisualServer::get_singleton()->instance_create(); - VisualServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh); - VisualServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world()->get_scenario()); - //VisualServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true); + PhysicsServer3D::get_singleton()->space_set_debug_contacts(find_world()->get_space(), get_tree()->get_collision_debug_contact_count()); + contact_3d_debug_multimesh = RenderingServer::get_singleton()->multimesh_create(); + RenderingServer::get_singleton()->multimesh_allocate(contact_3d_debug_multimesh, get_tree()->get_collision_debug_contact_count(), RS::MULTIMESH_TRANSFORM_3D, true); + RenderingServer::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, 0); + RenderingServer::get_singleton()->multimesh_set_mesh(contact_3d_debug_multimesh, get_tree()->get_debug_contact_mesh()->get_rid()); + contact_3d_debug_instance = RenderingServer::get_singleton()->instance_create(); + RenderingServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh); + RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world()->get_scenario()); + //RenderingServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, RS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true); } } break; @@ -527,24 +527,24 @@ void Viewport::_notification(int p_what) { if (world_2d.is_valid()) world_2d->_remove_viewport(this); - VisualServer::get_singleton()->viewport_set_scenario(viewport, RID()); - VisualServer::get_singleton()->viewport_remove_canvas(viewport, current_canvas); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, RID()); + RenderingServer::get_singleton()->viewport_remove_canvas(viewport, current_canvas); if (contact_2d_debug.is_valid()) { - VisualServer::get_singleton()->free(contact_2d_debug); + RenderingServer::get_singleton()->free(contact_2d_debug); contact_2d_debug = RID(); } if (contact_3d_debug_multimesh.is_valid()) { - VisualServer::get_singleton()->free(contact_3d_debug_multimesh); - VisualServer::get_singleton()->free(contact_3d_debug_instance); + RenderingServer::get_singleton()->free(contact_3d_debug_multimesh); + RenderingServer::get_singleton()->free(contact_3d_debug_instance); contact_3d_debug_instance = RID(); contact_3d_debug_multimesh = RID(); } remove_from_group("_viewports"); - VS::get_singleton()->viewport_set_active(viewport, false); - VisualServer::get_singleton()->viewport_set_parent_viewport(viewport, RID()); + RS::get_singleton()->viewport_set_active(viewport, false); + RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, RID()); } break; case NOTIFICATION_INTERNAL_PROCESS: { @@ -561,25 +561,25 @@ void Viewport::_notification(int p_what) { if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) { - VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug); - VisualServer::get_singleton()->canvas_item_set_draw_index(contact_2d_debug, 0xFFFFF); //very high index + RenderingServer::get_singleton()->canvas_item_clear(contact_2d_debug); + RenderingServer::get_singleton()->canvas_item_set_draw_index(contact_2d_debug, 0xFFFFF); //very high index - Vector<Vector2> points = Physics2DServer::get_singleton()->space_get_contacts(find_world_2d()->get_space()); - int point_count = Physics2DServer::get_singleton()->space_get_contact_count(find_world_2d()->get_space()); + Vector<Vector2> points = PhysicsServer2D::get_singleton()->space_get_contacts(find_world_2d()->get_space()); + int point_count = PhysicsServer2D::get_singleton()->space_get_contact_count(find_world_2d()->get_space()); Color ccol = get_tree()->get_debug_collision_contact_color(); for (int i = 0; i < point_count; i++) { - VisualServer::get_singleton()->canvas_item_add_rect(contact_2d_debug, Rect2(points[i] - Vector2(2, 2), Vector2(5, 5)), ccol); + RenderingServer::get_singleton()->canvas_item_add_rect(contact_2d_debug, Rect2(points[i] - Vector2(2, 2), Vector2(5, 5)), ccol); } } if (get_tree()->is_debugging_collisions_hint() && contact_3d_debug_multimesh.is_valid()) { - Vector<Vector3> points = PhysicsServer::get_singleton()->space_get_contacts(find_world()->get_space()); - int point_count = PhysicsServer::get_singleton()->space_get_contact_count(find_world()->get_space()); + Vector<Vector3> points = PhysicsServer3D::get_singleton()->space_get_contacts(find_world()->get_space()); + int point_count = PhysicsServer3D::get_singleton()->space_get_contact_count(find_world()->get_space()); - VS::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, point_count); + RS::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh, point_count); } if (physics_object_picking && (to_screen_rect == Rect2i() || InputFilter::get_singleton()->get_mouse_mode() != InputFilter::MOUSE_MODE_CAPTURED)) { @@ -589,8 +589,8 @@ void Viewport::_notification(int p_what) { CollisionObject3D *last_object = NULL; ObjectID last_id; #endif - PhysicsDirectSpaceState::RayResult result; - Physics2DDirectSpaceState *ss2d = Physics2DServer::get_singleton()->space_get_direct_state(find_world_2d()->get_space()); + PhysicsDirectSpaceState3D::RayResult result; + PhysicsDirectSpaceState2D *ss2d = PhysicsServer2D::get_singleton()->space_get_direct_state(find_world_2d()->get_space()); if (physics_has_last_mousepos) { // if no mouse event exists, create a motion one. This is necessary because objects or camera may have moved. @@ -697,7 +697,7 @@ void Viewport::_notification(int p_what) { uint64_t frame = get_tree()->get_frame(); - Physics2DDirectSpaceState::ShapeResult res[64]; + PhysicsDirectSpaceState2D::ShapeResult res[64]; for (Set<CanvasLayer *>::Element *E = canvas_layers.front(); E; E = E->next()) { Transform2D canvas_transform; ObjectID canvas_layer_id; @@ -805,7 +805,7 @@ void Viewport::_notification(int p_what) { Vector3 from = camera->project_ray_origin(pos); Vector3 dir = camera->project_ray_normal(pos); - PhysicsDirectSpaceState *space = PhysicsServer::get_singleton()->space_get_direct_state(find_world()->get_space()); + PhysicsDirectSpaceState3D *space = PhysicsServer3D::get_singleton()->space_get_direct_state(find_world()->get_space()); if (space) { bool col = space->intersect_ray(from, from + dir * 10000, result, Set<RID>(), 0xFFFFFFFF, true, true, true); @@ -890,9 +890,9 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_override, co to_screen_rect = p_to_screen_rect; if (p_allocated) { - VS::get_singleton()->viewport_set_size(viewport, size.width, size.height); + RS::get_singleton()->viewport_set_size(viewport, size.width, size.height); } else { - VS::get_singleton()->viewport_set_size(viewport, 0, 0); + RS::get_singleton()->viewport_set_size(viewport, 0, 0); } _update_global_transform(); @@ -974,9 +974,9 @@ void Viewport::enable_canvas_transform_override(bool p_enable) { override_canvas_transform = p_enable; if (p_enable) { - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform_override); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform_override); } else { - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform); } } @@ -991,7 +991,7 @@ void Viewport::set_canvas_transform_override(const Transform2D &p_transform) { canvas_transform_override = p_transform; if (override_canvas_transform) { - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform_override); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform_override); } } @@ -1004,7 +1004,7 @@ void Viewport::set_canvas_transform(const Transform2D &p_transform) { canvas_transform = p_transform; if (!override_canvas_transform) { - VisualServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform); + RenderingServer::get_singleton()->viewport_set_canvas_transform(viewport, find_world_2d()->get_canvas(), canvas_transform); } } @@ -1017,7 +1017,7 @@ void Viewport::_update_global_transform() { Transform2D sxform = stretch_transform * global_canvas_transform; - VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport, sxform); + RenderingServer::get_singleton()->viewport_set_global_canvas_transform(viewport, sxform); } void Viewport::set_global_canvas_transform(const Transform2D &p_transform) { @@ -1109,9 +1109,9 @@ void Viewport::_camera_set(Camera3D *p_camera) { if (!camera_override) { if (camera) - VisualServer::get_singleton()->viewport_attach_camera(viewport, camera->get_camera()); + RenderingServer::get_singleton()->viewport_attach_camera(viewport, camera->get_camera()); else - VisualServer::get_singleton()->viewport_attach_camera(viewport, RID()); + RenderingServer::get_singleton()->viewport_attach_camera(viewport, RID()); } if (camera) { @@ -1168,7 +1168,7 @@ void Viewport::_canvas_layer_remove(CanvasLayer *p_canvas_layer) { void Viewport::set_transparent_background(bool p_enable) { transparent_bg = p_enable; - VS::get_singleton()->viewport_set_transparent_background(viewport, p_enable); + RS::get_singleton()->viewport_set_transparent_background(viewport, p_enable); } bool Viewport::has_transparent_background() const { @@ -1187,7 +1187,7 @@ void Viewport::set_world_2d(const Ref<World2D> &p_world_2d) { if (is_inside_tree()) { find_world_2d()->_remove_viewport(this); - VisualServer::get_singleton()->viewport_remove_canvas(viewport, current_canvas); + RenderingServer::get_singleton()->viewport_remove_canvas(viewport, current_canvas); } if (p_world_2d.is_valid()) @@ -1201,7 +1201,7 @@ void Viewport::set_world_2d(const Ref<World2D> &p_world_2d) { if (is_inside_tree()) { current_canvas = find_world_2d()->get_canvas(); - VisualServer::get_singleton()->viewport_attach_canvas(viewport, current_canvas); + RenderingServer::get_singleton()->viewport_attach_canvas(viewport, current_canvas); find_world_2d()->_register_viewport(this, Rect2()); } } @@ -1312,7 +1312,7 @@ void Viewport::set_world(const Ref<World3D> &p_world) { _propagate_enter_world(this); if (is_inside_tree()) { - VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); } _update_listener(); @@ -1357,18 +1357,18 @@ void Viewport::enable_camera_override(bool p_enable) { } if (p_enable) { - camera_override.rid = VisualServer::get_singleton()->camera_create(); + camera_override.rid = RenderingServer::get_singleton()->camera_create(); } else { - VisualServer::get_singleton()->free(camera_override.rid); + RenderingServer::get_singleton()->free(camera_override.rid); camera_override.rid = RID(); } if (p_enable) { - VisualServer::get_singleton()->viewport_attach_camera(viewport, camera_override.rid); + RenderingServer::get_singleton()->viewport_attach_camera(viewport, camera_override.rid); } else if (camera) { - VisualServer::get_singleton()->viewport_attach_camera(viewport, camera->get_camera()); + RenderingServer::get_singleton()->viewport_attach_camera(viewport, camera->get_camera()); } else { - VisualServer::get_singleton()->viewport_attach_camera(viewport, RID()); + RenderingServer::get_singleton()->viewport_attach_camera(viewport, RID()); } #endif } @@ -1380,7 +1380,7 @@ bool Viewport::is_camera_override_enabled() const { void Viewport::set_camera_override_transform(const Transform &p_transform) { if (camera_override) { camera_override.transform = p_transform; - VisualServer::get_singleton()->camera_set_transform(camera_override.rid, p_transform); + RenderingServer::get_singleton()->camera_set_transform(camera_override.rid, p_transform); } } @@ -1403,7 +1403,7 @@ void Viewport::set_camera_override_perspective(float p_fovy_degrees, float p_z_n camera_override.z_far = p_z_far; camera_override.projection = CameraOverrideData::PROJECTION_PERSPECTIVE; - VisualServer::get_singleton()->camera_set_perspective(camera_override.rid, camera_override.fov, camera_override.z_near, camera_override.z_far); + RenderingServer::get_singleton()->camera_set_perspective(camera_override.rid, camera_override.fov, camera_override.z_near, camera_override.z_far); } } @@ -1418,7 +1418,7 @@ void Viewport::set_camera_override_orthogonal(float p_size, float p_z_near, floa camera_override.z_far = p_z_far; camera_override.projection = CameraOverrideData::PROJECTION_ORTHOGONAL; - VisualServer::get_singleton()->camera_set_orthogonal(camera_override.rid, camera_override.size, camera_override.z_near, camera_override.z_far); + RenderingServer::get_singleton()->camera_set_orthogonal(camera_override.rid, camera_override.size, camera_override.z_near, camera_override.z_far); } } @@ -1458,7 +1458,7 @@ void Viewport::set_shadow_atlas_size(int p_size) { return; shadow_atlas_size = p_size; - VS::get_singleton()->viewport_set_shadow_atlas_size(viewport, p_size); + RS::get_singleton()->viewport_set_shadow_atlas_size(viewport, p_size); } int Viewport::get_shadow_atlas_size() const { @@ -1477,7 +1477,7 @@ void Viewport::set_shadow_atlas_quadrant_subdiv(int p_quadrant, ShadowAtlasQuadr shadow_atlas_quadrant_subdiv[p_quadrant] = p_subdiv; static const int subdiv[SHADOW_ATLAS_QUADRANT_SUBDIV_MAX] = { 0, 1, 4, 16, 64, 256, 1024 }; - VS::get_singleton()->viewport_set_shadow_atlas_quadrant_subdivision(viewport, p_quadrant, subdiv[p_subdiv]); + RS::get_singleton()->viewport_set_shadow_atlas_quadrant_subdivision(viewport, p_quadrant, subdiv[p_subdiv]); } Viewport::ShadowAtlasQuadrantSubdiv Viewport::get_shadow_atlas_quadrant_subdiv(int p_quadrant) const { @@ -3109,7 +3109,7 @@ void Viewport::set_use_own_world(bool p_world) { _propagate_enter_world(this); if (is_inside_tree()) { - VisualServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); + RenderingServer::get_singleton()->viewport_set_scenario(viewport, find_world()->get_scenario()); } _update_listener(); @@ -3183,7 +3183,7 @@ void Viewport::set_msaa(MSAA p_msaa) { if (msaa == p_msaa) return; msaa = p_msaa; - VS::get_singleton()->viewport_set_msaa(viewport, VS::ViewportMSAA(p_msaa)); + RS::get_singleton()->viewport_set_msaa(viewport, RS::ViewportMSAA(p_msaa)); } Viewport::MSAA Viewport::get_msaa() const { @@ -3194,7 +3194,7 @@ Viewport::MSAA Viewport::get_msaa() const { void Viewport::set_debug_draw(DebugDraw p_debug_draw) { debug_draw = p_debug_draw; - VS::get_singleton()->viewport_set_debug_draw(viewport, VS::ViewportDebugDraw(p_debug_draw)); + RS::get_singleton()->viewport_set_debug_draw(viewport, RS::ViewportDebugDraw(p_debug_draw)); } Viewport::DebugDraw Viewport::get_debug_draw() const { @@ -3204,7 +3204,7 @@ Viewport::DebugDraw Viewport::get_debug_draw() const { int Viewport::get_render_info(RenderInfo p_info) { - return VS::get_singleton()->viewport_get_render_info(viewport, VS::ViewportRenderInfo(p_info)); + return RS::get_singleton()->viewport_get_render_info(viewport, RS::ViewportRenderInfo(p_info)); } void Viewport::set_snap_controls_to_pixels(bool p_enable) { @@ -3527,13 +3527,13 @@ Viewport::Viewport() { world_2d = Ref<World2D>(memnew(World2D)); - viewport = VisualServer::get_singleton()->viewport_create(); - texture_rid = VisualServer::get_singleton()->viewport_get_texture(viewport); + viewport = RenderingServer::get_singleton()->viewport_create(); + texture_rid = RenderingServer::get_singleton()->viewport_get_texture(viewport); default_texture.instance(); default_texture->vp = const_cast<Viewport *>(this); viewport_textures.insert(default_texture.ptr()); - default_texture->proxy = VS::get_singleton()->texture_proxy_create(texture_rid); + default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid); audio_listener = false; //internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create(); @@ -3614,7 +3614,7 @@ Viewport::~Viewport() { for (Set<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) { E->get()->vp = NULL; } - VisualServer::get_singleton()->free(viewport); + RenderingServer::get_singleton()->free(viewport); } ///////////////////////////////// @@ -3622,7 +3622,7 @@ Viewport::~Viewport() { void SubViewport::set_use_arvr(bool p_use_arvr) { arvr = p_use_arvr; - VS::get_singleton()->viewport_set_use_arvr(get_viewport_rid(), arvr); + RS::get_singleton()->viewport_set_use_arvr(get_viewport_rid(), arvr); } bool SubViewport::is_using_arvr() { @@ -3639,7 +3639,7 @@ Size2i SubViewport::get_size() const { void SubViewport::set_update_mode(UpdateMode p_mode) { update_mode = p_mode; - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::ViewportUpdateMode(p_mode)); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::ViewportUpdateMode(p_mode)); } SubViewport::UpdateMode SubViewport::get_update_mode() const { @@ -3649,7 +3649,7 @@ SubViewport::UpdateMode SubViewport::get_update_mode() const { void SubViewport::set_clear_mode(ClearMode p_mode) { clear_mode = p_mode; - VS::get_singleton()->viewport_set_clear_mode(get_viewport_rid(), VS::ViewportClearMode(p_mode)); + RS::get_singleton()->viewport_set_clear_mode(get_viewport_rid(), RS::ViewportClearMode(p_mode)); } SubViewport::ClearMode SubViewport::get_clear_mode() const { @@ -3664,10 +3664,10 @@ DisplayServer::WindowID SubViewport::get_window_id() const { void SubViewport::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - VS::get_singleton()->viewport_set_active(get_viewport_rid(), true); + RS::get_singleton()->viewport_set_active(get_viewport_rid(), true); } if (p_what == NOTIFICATION_EXIT_TREE) { - VS::get_singleton()->viewport_set_active(get_viewport_rid(), false); + RS::get_singleton()->viewport_set_active(get_viewport_rid(), false); } } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 8a56caea52..d0b22b5553 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -36,7 +36,7 @@ #include "scene/resources/texture.h" #include "scene/resources/world_2d.h" #include "servers/display_server.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class Camera3D; class Camera2D; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index b22b99c50c..3a8f7ebb60 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -249,7 +249,7 @@ void Window::_make_window() { } } - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_WHEN_VISIBLE); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE); } void Window::_update_from_window() { @@ -279,7 +279,7 @@ void Window::_clear_window() { window_id = DisplayServer::INVALID_WINDOW_ID; _update_viewport_size(); - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_DISABLED); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); } void Window::_rect_changed_callback(const Rect2i &p_callback) { @@ -387,11 +387,11 @@ void Window::set_visible(bool p_visible) { if (visible) { embedder = embedder_vp; embedder->_sub_window_register(this); - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE); } else { embedder->_sub_window_remove(this); embedder = nullptr; - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_DISABLED); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); } _update_window_size(); } @@ -402,7 +402,7 @@ void Window::set_visible(bool p_visible) { notification(NOTIFICATION_VISIBILITY_CHANGED); emit_signal(SceneStringNames::get_singleton()->visibility_changed); - VS::get_singleton()->viewport_set_active(get_viewport_rid(), visible); + RS::get_singleton()->viewport_set_active(get_viewport_rid(), visible); } void Window::_clear_transient() { @@ -606,14 +606,14 @@ void Window::_update_viewport_size() { //black bars and margin if (content_scale_aspect != CONTENT_SCALE_ASPECT_EXPAND && screen_size.x < video_mode.x) { margin.x = Math::round((video_mode.x - screen_size.x) / 2.0); - //VisualServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0); + //RenderingServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0); offset.x = Math::round(margin.x * viewport_size.y / screen_size.y); } else if (content_scale_aspect != CONTENT_SCALE_ASPECT_EXPAND && screen_size.y < video_mode.y) { margin.y = Math::round((video_mode.y - screen_size.y) / 2.0); - //VisualServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y); + //RenderingServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y); offset.y = Math::round(margin.y * viewport_size.x / screen_size.x); } else { - //VisualServer::get_singleton()->black_bars_set_margins(0, 0, 0, 0); + //RenderingServer::get_singleton()->black_bars_set_margins(0, 0, 0, 0); } switch (content_scale_mode) { @@ -646,9 +646,9 @@ void Window::_update_viewport_size() { _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform, allocate); if (window_id != DisplayServer::INVALID_WINDOW_ID) { - VisualServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), attach_to_screen_rect, window_id); + RenderingServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), attach_to_screen_rect, window_id); } else { - VisualServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), Rect2i(), DisplayServer::INVALID_WINDOW_ID); + RenderingServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), Rect2i(), DisplayServer::INVALID_WINDOW_ID); } if (window_id == DisplayServer::MAIN_WINDOW_ID) { @@ -718,7 +718,7 @@ void Window::_notification(int p_what) { //create as embedded if (embedder) { embedder->_sub_window_register(this); - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE); _update_window_size(); } @@ -736,7 +736,7 @@ void Window::_notification(int p_what) { } _update_viewport_size(); //then feed back to the viewport _update_window_callbacks(); - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_WHEN_VISIBLE); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE); } else { //create if (visible) { @@ -752,7 +752,7 @@ void Window::_notification(int p_what) { if (visible) { notification(NOTIFICATION_VISIBILITY_CHANGED); emit_signal(SceneStringNames::get_singleton()->visibility_changed); - VS::get_singleton()->viewport_set_active(get_viewport_rid(), true); + RS::get_singleton()->viewport_set_active(get_viewport_rid(), true); } } @@ -773,7 +773,7 @@ void Window::_notification(int p_what) { if (window_id == DisplayServer::MAIN_WINDOW_ID) { - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_DISABLED); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); _update_window_callbacks(); } else { _clear_window(); @@ -783,12 +783,12 @@ void Window::_notification(int p_what) { if (embedder) { embedder->_sub_window_remove(this); embedder = nullptr; - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_DISABLED); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); } _update_viewport_size(); //called by clear and make, which does not happen here } - VS::get_singleton()->viewport_set_active(get_viewport_rid(), false); + RS::get_singleton()->viewport_set_active(get_viewport_rid(), false); } } @@ -1400,7 +1400,7 @@ Window::Window() { } content_scale_mode = CONTENT_SCALE_MODE_DISABLED; content_scale_aspect = CONTENT_SCALE_ASPECT_IGNORE; - VS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), VS::VIEWPORT_UPDATE_DISABLED); + RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED); } Window::~Window() { } diff --git a/scene/resources/box_shape_3d.cpp b/scene/resources/box_shape_3d.cpp index 3ac29642d7..64c821a011 100644 --- a/scene/resources/box_shape_3d.cpp +++ b/scene/resources/box_shape_3d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "box_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> BoxShape3D::get_debug_mesh_lines() { @@ -54,7 +54,7 @@ real_t BoxShape3D::get_enclosing_radius() const { void BoxShape3D::_update_shape() { - PhysicsServer::get_singleton()->shape_set_data(get_shape(), extents); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), extents); Shape3D::_update_shape(); } @@ -80,7 +80,7 @@ void BoxShape3D::_bind_methods() { } BoxShape3D::BoxShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_BOX)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_BOX)) { set_extents(Vector3(1, 1, 1)); } diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp index 9b8083de97..ab2657c892 100644 --- a/scene/resources/capsule_shape_2d.cpp +++ b/scene/resources/capsule_shape_2d.cpp @@ -30,8 +30,8 @@ #include "capsule_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" Vector<Vector2> CapsuleShape2D::_get_points() const { @@ -54,7 +54,7 @@ bool CapsuleShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_ void CapsuleShape2D::_update_shape() { - Physics2DServer::get_singleton()->shape_set_data(get_rid(), Vector2(radius, height)); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), Vector2(radius, height)); emit_changed(); } @@ -85,7 +85,7 @@ void CapsuleShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector<Vector2> points = _get_points(); Vector<Color> col; col.push_back(p_color); - VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); + RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); } Rect2 CapsuleShape2D::get_rect() const { @@ -114,7 +114,7 @@ void CapsuleShape2D::_bind_methods() { } CapsuleShape2D::CapsuleShape2D() : - Shape2D(Physics2DServer::get_singleton()->capsule_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->capsule_shape_create()) { radius = 10; height = 20; diff --git a/scene/resources/capsule_shape_3d.cpp b/scene/resources/capsule_shape_3d.cpp index a929caa275..da3ffcb306 100644 --- a/scene/resources/capsule_shape_3d.cpp +++ b/scene/resources/capsule_shape_3d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "capsule_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> CapsuleShape3D::get_debug_mesh_lines() { @@ -78,7 +78,7 @@ void CapsuleShape3D::_update_shape() { Dictionary d; d["radius"] = radius; d["height"] = height; - PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), d); Shape3D::_update_shape(); } @@ -120,7 +120,7 @@ void CapsuleShape3D::_bind_methods() { } CapsuleShape3D::CapsuleShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CAPSULE)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CAPSULE)) { radius = 1.0; height = 1.0; diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp index 37874e17ef..afb7597280 100644 --- a/scene/resources/circle_shape_2d.cpp +++ b/scene/resources/circle_shape_2d.cpp @@ -30,8 +30,8 @@ #include "circle_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" bool CircleShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { @@ -40,7 +40,7 @@ bool CircleShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_t void CircleShape2D::_update_shape() { - Physics2DServer::get_singleton()->shape_set_data(get_rid(), radius); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), radius); emit_changed(); } @@ -84,11 +84,11 @@ void CircleShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector<Color> col; col.push_back(p_color); - VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); + RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); } CircleShape2D::CircleShape2D() : - Shape2D(Physics2DServer::get_singleton()->circle_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->circle_shape_create()) { radius = 10; _update_shape(); diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index c3e9e19721..c8fec3b72d 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -30,8 +30,8 @@ #include "concave_polygon_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { @@ -52,13 +52,13 @@ bool ConcavePolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, do void ConcavePolygonShape2D::set_segments(const Vector<Vector2> &p_segments) { - Physics2DServer::get_singleton()->shape_set_data(get_rid(), p_segments); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), p_segments); emit_changed(); } Vector<Vector2> ConcavePolygonShape2D::get_segments() const { - return Physics2DServer::get_singleton()->shape_get_data(get_rid()); + return PhysicsServer2D::get_singleton()->shape_get_data(get_rid()); } void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { @@ -70,7 +70,7 @@ void ConcavePolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { const Vector2 *r = s.ptr(); for (int i = 0; i < len; i += 2) { - VisualServer::get_singleton()->canvas_item_add_line(p_to_rid, r[i], r[i + 1], p_color, 2); + RenderingServer::get_singleton()->canvas_item_add_line(p_to_rid, r[i], r[i + 1], p_color, 2); } } @@ -113,7 +113,7 @@ void ConcavePolygonShape2D::_bind_methods() { } ConcavePolygonShape2D::ConcavePolygonShape2D() : - Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->concave_polygon_shape_create()) { Vector<Vector2> empty; set_segments(empty); } diff --git a/scene/resources/concave_polygon_shape_3d.cpp b/scene/resources/concave_polygon_shape_3d.cpp index 6be4a087ad..42e06a49b6 100644 --- a/scene/resources/concave_polygon_shape_3d.cpp +++ b/scene/resources/concave_polygon_shape_3d.cpp @@ -30,7 +30,7 @@ #include "concave_polygon_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> ConcavePolygonShape3D::get_debug_mesh_lines() { @@ -80,13 +80,13 @@ void ConcavePolygonShape3D::_update_shape() { void ConcavePolygonShape3D::set_faces(const Vector<Vector3> &p_faces) { - PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_faces); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), p_faces); notify_change_to_owners(); } Vector<Vector3> ConcavePolygonShape3D::get_faces() const { - return PhysicsServer::get_singleton()->shape_get_data(get_shape()); + return PhysicsServer3D::get_singleton()->shape_get_data(get_shape()); } void ConcavePolygonShape3D::_bind_methods() { @@ -97,7 +97,7 @@ void ConcavePolygonShape3D::_bind_methods() { } ConcavePolygonShape3D::ConcavePolygonShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONCAVE_POLYGON)) { //set_planes(Vector3(1,1,1)); } diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index 95967429c9..6b1ddec507 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -31,8 +31,8 @@ #include "convex_polygon_shape_2d.h" #include "core/math/geometry.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" bool ConvexPolygonShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { @@ -45,7 +45,7 @@ void ConvexPolygonShape2D::_update_shape() { if (Geometry::is_polygon_clockwise(final_points)) { //needs to be counter clockwise final_points.invert(); } - Physics2DServer::get_singleton()->shape_set_data(get_rid(), final_points); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), final_points); emit_changed(); } @@ -81,7 +81,7 @@ void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector<Color> col; col.push_back(p_color); - VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); + RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); } Rect2 ConvexPolygonShape2D::get_rect() const { @@ -106,5 +106,5 @@ real_t ConvexPolygonShape2D::get_enclosing_radius() const { } ConvexPolygonShape2D::ConvexPolygonShape2D() : - Shape2D(Physics2DServer::get_singleton()->convex_polygon_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->convex_polygon_shape_create()) { } diff --git a/scene/resources/convex_polygon_shape_3d.cpp b/scene/resources/convex_polygon_shape_3d.cpp index e25301b2eb..ec9ab68015 100644 --- a/scene/resources/convex_polygon_shape_3d.cpp +++ b/scene/resources/convex_polygon_shape_3d.cpp @@ -30,7 +30,7 @@ #include "convex_polygon_shape_3d.h" #include "core/math/quick_hull.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> ConvexPolygonShape3D::get_debug_mesh_lines() { @@ -67,7 +67,7 @@ real_t ConvexPolygonShape3D::get_enclosing_radius() const { void ConvexPolygonShape3D::_update_shape() { - PhysicsServer::get_singleton()->shape_set_data(get_shape(), points); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), points); Shape3D::_update_shape(); } @@ -92,5 +92,5 @@ void ConvexPolygonShape3D::_bind_methods() { } ConvexPolygonShape3D::ConvexPolygonShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON)) { } diff --git a/scene/resources/cylinder_shape_3d.cpp b/scene/resources/cylinder_shape_3d.cpp index 7636c55346..19f0542818 100644 --- a/scene/resources/cylinder_shape_3d.cpp +++ b/scene/resources/cylinder_shape_3d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "cylinder_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> CylinderShape3D::get_debug_mesh_lines() { @@ -71,7 +71,7 @@ void CylinderShape3D::_update_shape() { Dictionary d; d["radius"] = radius; d["height"] = height; - PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), d); Shape3D::_update_shape(); } @@ -113,7 +113,7 @@ void CylinderShape3D::_bind_methods() { } CylinderShape3D::CylinderShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CYLINDER)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CYLINDER)) { radius = 1.0; height = 2.0; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 410c4990a2..107f07ec7d 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -336,7 +336,7 @@ float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharT modulate.r = modulate.g = modulate.b = 1.0; } RID texture = font->textures[ch->texture_idx].texture->get_rid(); - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, RID(), RID(), Color(1, 1, 1, 1), false); + RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, ch->rect.size), texture, ch->rect_uv, modulate, false, RID(), RID(), Color(1, 1, 1, 1), false); } advance = ch->advance; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index d407dd3722..89937238c1 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -30,7 +30,7 @@ #include "environment.h" #include "core/project_settings.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #include "texture.h" RID Environment::get_rid() const { @@ -41,7 +41,7 @@ RID Environment::get_rid() const { void Environment::set_background(BGMode p_bg) { bg_mode = p_bg; - VS::get_singleton()->environment_set_background(environment, VS::EnvironmentBG(p_bg)); + RS::get_singleton()->environment_set_background(environment, RS::EnvironmentBG(p_bg)); _change_notify(); } @@ -53,56 +53,56 @@ void Environment::set_sky(const Ref<Sky> &p_sky) { if (bg_sky.is_valid()) sb_rid = bg_sky->get_rid(); - VS::get_singleton()->environment_set_sky(environment, sb_rid); + RS::get_singleton()->environment_set_sky(environment, sb_rid); } void Environment::set_sky_custom_fov(float p_scale) { bg_sky_custom_fov = p_scale; - VS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale); + RS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale); } void Environment::set_bg_color(const Color &p_color) { bg_color = p_color; - VS::get_singleton()->environment_set_bg_color(environment, p_color); + RS::get_singleton()->environment_set_bg_color(environment, p_color); } void Environment::set_bg_energy(float p_energy) { bg_energy = p_energy; - VS::get_singleton()->environment_set_bg_energy(environment, p_energy); + RS::get_singleton()->environment_set_bg_energy(environment, p_energy); } void Environment::set_canvas_max_layer(int p_max_layer) { bg_canvas_max_layer = p_max_layer; - VS::get_singleton()->environment_set_canvas_max_layer(environment, p_max_layer); + RS::get_singleton()->environment_set_canvas_max_layer(environment, p_max_layer); } void Environment::set_ambient_light_color(const Color &p_color) { ambient_color = p_color; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } void Environment::set_ambient_light_energy(float p_energy) { ambient_energy = p_energy; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } void Environment::set_ambient_light_sky_contribution(float p_energy) { ambient_sky_contribution = p_energy; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } void Environment::set_camera_feed_id(int p_camera_feed_id) { camera_feed_id = p_camera_feed_id; // FIXME: Disabled during Vulkan refactoring, should be ported. #if 0 - VS::get_singleton()->environment_set_camera_feed_id(environment, camera_feed_id); + RS::get_singleton()->environment_set_camera_feed_id(environment, camera_feed_id); #endif }; void Environment::set_ambient_source(AmbientSource p_source) { ambient_source = p_source; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } Environment::AmbientSource Environment::get_ambient_source() const { @@ -110,7 +110,7 @@ Environment::AmbientSource Environment::get_ambient_source() const { } void Environment::set_reflection_source(ReflectionSource p_source) { reflection_source = p_source; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } Environment::ReflectionSource Environment::get_reflection_source() const { return reflection_source; @@ -132,7 +132,7 @@ float Environment::get_sky_custom_fov() const { void Environment::set_sky_rotation(const Vector3 &p_rotation) { sky_rotation = p_rotation; - VS::get_singleton()->environment_set_sky_orientation(environment, Basis(p_rotation)); + RS::get_singleton()->environment_set_sky_orientation(environment, Basis(p_rotation)); } Vector3 Environment::get_sky_rotation() const { @@ -172,7 +172,7 @@ int Environment::get_camera_feed_id(void) const { void Environment::set_tonemapper(ToneMapper p_tone_mapper) { tone_mapper = p_tone_mapper; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } Environment::ToneMapper Environment::get_tonemapper() const { @@ -183,7 +183,7 @@ Environment::ToneMapper Environment::get_tonemapper() const { void Environment::set_tonemap_exposure(float p_exposure) { tonemap_exposure = p_exposure; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_exposure() const { @@ -194,7 +194,7 @@ float Environment::get_tonemap_exposure() const { void Environment::set_tonemap_white(float p_white) { tonemap_white = p_white; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_white() const { @@ -204,7 +204,7 @@ float Environment::get_tonemap_white() const { void Environment::set_tonemap_auto_exposure(bool p_enabled) { tonemap_auto_exposure = p_enabled; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); _change_notify(); } bool Environment::get_tonemap_auto_exposure() const { @@ -215,7 +215,7 @@ bool Environment::get_tonemap_auto_exposure() const { void Environment::set_tonemap_auto_exposure_max(float p_auto_exposure_max) { tonemap_auto_exposure_max = p_auto_exposure_max; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_max() const { @@ -225,7 +225,7 @@ float Environment::get_tonemap_auto_exposure_max() const { void Environment::set_tonemap_auto_exposure_min(float p_auto_exposure_min) { tonemap_auto_exposure_min = p_auto_exposure_min; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_min() const { @@ -235,7 +235,7 @@ float Environment::get_tonemap_auto_exposure_min() const { void Environment::set_tonemap_auto_exposure_speed(float p_auto_exposure_speed) { tonemap_auto_exposure_speed = p_auto_exposure_speed; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_speed() const { @@ -245,7 +245,7 @@ float Environment::get_tonemap_auto_exposure_speed() const { void Environment::set_tonemap_auto_exposure_grey(float p_auto_exposure_grey) { tonemap_auto_exposure_grey = p_auto_exposure_grey; - VS::get_singleton()->environment_set_tonemap(environment, VS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); + RS::get_singleton()->environment_set_tonemap(environment, RS::EnvironmentToneMapper(tone_mapper), tonemap_exposure, tonemap_white, tonemap_auto_exposure, tonemap_auto_exposure_min, tonemap_auto_exposure_max, tonemap_auto_exposure_speed, tonemap_auto_exposure_grey); } float Environment::get_tonemap_auto_exposure_grey() const { @@ -255,7 +255,7 @@ float Environment::get_tonemap_auto_exposure_grey() const { void Environment::set_adjustment_enable(bool p_enable) { adjustment_enabled = p_enable; - VS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); + RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); _change_notify(); } @@ -267,7 +267,7 @@ bool Environment::is_adjustment_enabled() const { void Environment::set_adjustment_brightness(float p_brightness) { adjustment_brightness = p_brightness; - VS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); + RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } float Environment::get_adjustment_brightness() const { @@ -277,7 +277,7 @@ float Environment::get_adjustment_brightness() const { void Environment::set_adjustment_contrast(float p_contrast) { adjustment_contrast = p_contrast; - VS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); + RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } float Environment::get_adjustment_contrast() const { @@ -287,7 +287,7 @@ float Environment::get_adjustment_contrast() const { void Environment::set_adjustment_saturation(float p_saturation) { adjustment_saturation = p_saturation; - VS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); + RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } float Environment::get_adjustment_saturation() const { @@ -297,7 +297,7 @@ float Environment::get_adjustment_saturation() const { void Environment::set_adjustment_color_correction(const Ref<Texture2D> &p_ramp) { adjustment_color_correction = p_ramp; - VS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); + RS::get_singleton()->environment_set_adjustment(environment, adjustment_enabled, adjustment_brightness, adjustment_contrast, adjustment_saturation, adjustment_color_correction.is_valid() ? adjustment_color_correction->get_rid() : RID()); } Ref<Texture2D> Environment::get_adjustment_color_correction() const { @@ -371,7 +371,7 @@ void Environment::_validate_property(PropertyInfo &property) const { prefixes++; } - if (VisualServer::get_singleton()->is_low_end()) { + if (RenderingServer::get_singleton()->is_low_end()) { prefixes = high_end_prefixes; while (*prefixes) { String prefix = String(*prefixes); @@ -389,7 +389,7 @@ void Environment::_validate_property(PropertyInfo &property) const { void Environment::set_ssr_enabled(bool p_enable) { ssr_enabled = p_enable; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); _change_notify(); } @@ -401,7 +401,7 @@ bool Environment::is_ssr_enabled() const { void Environment::set_ssr_max_steps(int p_steps) { ssr_max_steps = p_steps; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); } int Environment::get_ssr_max_steps() const { @@ -411,7 +411,7 @@ int Environment::get_ssr_max_steps() const { void Environment::set_ssr_fade_in(float p_fade_in) { ssr_fade_in = p_fade_in; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); } float Environment::get_ssr_fade_in() const { @@ -421,7 +421,7 @@ float Environment::get_ssr_fade_in() const { void Environment::set_ssr_fade_out(float p_fade_out) { ssr_fade_out = p_fade_out; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); } float Environment::get_ssr_fade_out() const { @@ -431,7 +431,7 @@ float Environment::get_ssr_fade_out() const { void Environment::set_ssr_depth_tolerance(float p_depth_tolerance) { ssr_depth_tolerance = p_depth_tolerance; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); } float Environment::get_ssr_depth_tolerance() const { @@ -441,7 +441,7 @@ float Environment::get_ssr_depth_tolerance() const { void Environment::set_ssr_rough(bool p_enable) { ssr_roughness = p_enable; - VS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); + RS::get_singleton()->environment_set_ssr(environment, ssr_enabled, ssr_max_steps, ssr_fade_in, ssr_fade_out, ssr_depth_tolerance, ssr_roughness); } bool Environment::is_ssr_rough() const { @@ -451,7 +451,7 @@ bool Environment::is_ssr_rough() const { void Environment::set_ssao_enabled(bool p_enable) { ssao_enabled = p_enable; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); _change_notify(); } @@ -463,7 +463,7 @@ bool Environment::is_ssao_enabled() const { void Environment::set_ssao_radius(float p_radius) { ssao_radius = p_radius; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_radius() const { @@ -473,7 +473,7 @@ float Environment::get_ssao_radius() const { void Environment::set_ssao_intensity(float p_intensity) { ssao_intensity = p_intensity; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_intensity() const { @@ -484,7 +484,7 @@ float Environment::get_ssao_intensity() const { void Environment::set_ssao_bias(float p_bias) { ssao_bias = p_bias; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_bias() const { @@ -494,7 +494,7 @@ float Environment::get_ssao_bias() const { void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) { ssao_direct_light_affect = p_direct_light_affect; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_direct_light_affect() const { @@ -504,7 +504,7 @@ float Environment::get_ssao_direct_light_affect() const { void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) { ssao_ao_channel_affect = p_ao_channel_affect; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_ao_channel_affect() const { @@ -514,7 +514,7 @@ float Environment::get_ssao_ao_channel_affect() const { void Environment::set_ao_color(const Color &p_color) { ao_color = p_color; - VS::get_singleton()->environment_set_ambient_light(environment, ambient_color, VS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, VS::EnvironmentReflectionSource(reflection_source), ao_color); + RS::get_singleton()->environment_set_ambient_light(environment, ambient_color, RS::EnvironmentAmbientSource(ambient_source), ambient_energy, ambient_sky_contribution, RS::EnvironmentReflectionSource(reflection_source), ao_color); } Color Environment::get_ao_color() const { @@ -525,7 +525,7 @@ Color Environment::get_ao_color() const { void Environment::set_ssao_blur(SSAOBlur p_blur) { ssao_blur = p_blur; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } Environment::SSAOBlur Environment::get_ssao_blur() const { @@ -535,7 +535,7 @@ Environment::SSAOBlur Environment::get_ssao_blur() const { void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) { ssao_edge_sharpness = p_edge_sharpness; - VS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, VS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); + RS::get_singleton()->environment_set_ssao(environment, ssao_enabled, ssao_radius, ssao_intensity, ssao_bias, ssao_direct_light_affect, ssao_ao_channel_affect, RS::EnvironmentSSAOBlur(ssao_blur), ssao_edge_sharpness); } float Environment::get_ssao_edge_sharpness() const { @@ -546,7 +546,7 @@ float Environment::get_ssao_edge_sharpness() const { void Environment::set_glow_enabled(bool p_enabled) { glow_enabled = p_enabled; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); _change_notify(); } @@ -557,18 +557,18 @@ bool Environment::is_glow_enabled() const { void Environment::set_glow_level(int p_level, bool p_enabled) { - ERR_FAIL_INDEX(p_level, VS::MAX_GLOW_LEVELS); + ERR_FAIL_INDEX(p_level, RS::MAX_GLOW_LEVELS); if (p_enabled) glow_levels |= (1 << p_level); else glow_levels &= ~(1 << p_level); - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } bool Environment::is_glow_level_enabled(int p_level) const { - ERR_FAIL_INDEX_V(p_level, VS::MAX_GLOW_LEVELS, false); + ERR_FAIL_INDEX_V(p_level, RS::MAX_GLOW_LEVELS, false); return glow_levels & (1 << p_level); } @@ -577,7 +577,7 @@ void Environment::set_glow_intensity(float p_intensity) { glow_intensity = p_intensity; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_intensity() const { @@ -587,7 +587,7 @@ float Environment::get_glow_intensity() const { void Environment::set_glow_strength(float p_strength) { glow_strength = p_strength; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_strength() const { @@ -597,7 +597,7 @@ float Environment::get_glow_strength() const { void Environment::set_glow_mix(float p_mix) { glow_mix = p_mix; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_mix() const { @@ -608,7 +608,7 @@ void Environment::set_glow_bloom(float p_threshold) { glow_bloom = p_threshold; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_bloom() const { @@ -619,7 +619,7 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode) { glow_blend_mode = p_mode; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); _change_notify(); } Environment::GlowBlendMode Environment::get_glow_blend_mode() const { @@ -631,7 +631,7 @@ void Environment::set_glow_hdr_bleed_threshold(float p_threshold) { glow_hdr_bleed_threshold = p_threshold; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_hdr_bleed_threshold() const { @@ -642,7 +642,7 @@ void Environment::set_glow_hdr_luminance_cap(float p_amount) { glow_hdr_luminance_cap = p_amount; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_hdr_luminance_cap() const { @@ -653,7 +653,7 @@ void Environment::set_glow_hdr_bleed_scale(float p_scale) { glow_hdr_bleed_scale = p_scale; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } float Environment::get_glow_hdr_bleed_scale() const { @@ -663,7 +663,7 @@ float Environment::get_glow_hdr_bleed_scale() const { void Environment::set_glow_bicubic_upscale(bool p_enable) { glow_bicubic_upscale = p_enable; - VS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, VS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); + RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale); } bool Environment::is_glow_bicubic_upscale_enabled() const { @@ -674,7 +674,7 @@ bool Environment::is_glow_bicubic_upscale_enabled() const { void Environment::set_fog_enabled(bool p_enabled) { fog_enabled = p_enabled; - VS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); + RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); _change_notify(); } @@ -686,7 +686,7 @@ bool Environment::is_fog_enabled() const { void Environment::set_fog_color(const Color &p_color) { fog_color = p_color; - VS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); + RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } Color Environment::get_fog_color() const { @@ -696,7 +696,7 @@ Color Environment::get_fog_color() const { void Environment::set_fog_sun_color(const Color &p_color) { fog_sun_color = p_color; - VS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); + RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } Color Environment::get_fog_sun_color() const { @@ -706,7 +706,7 @@ Color Environment::get_fog_sun_color() const { void Environment::set_fog_sun_amount(float p_amount) { fog_sun_amount = p_amount; - VS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); + RS::get_singleton()->environment_set_fog(environment, fog_enabled, fog_color, fog_sun_color, fog_sun_amount); } float Environment::get_fog_sun_amount() const { @@ -716,7 +716,7 @@ float Environment::get_fog_sun_amount() const { void Environment::set_fog_depth_enabled(bool p_enabled) { fog_depth_enabled = p_enabled; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } bool Environment::is_fog_depth_enabled() const { @@ -726,7 +726,7 @@ bool Environment::is_fog_depth_enabled() const { void Environment::set_fog_depth_begin(float p_distance) { fog_depth_begin = p_distance; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } float Environment::get_fog_depth_begin() const { @@ -736,7 +736,7 @@ float Environment::get_fog_depth_begin() const { void Environment::set_fog_depth_end(float p_distance) { fog_depth_end = p_distance; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } float Environment::get_fog_depth_end() const { @@ -747,7 +747,7 @@ float Environment::get_fog_depth_end() const { void Environment::set_fog_depth_curve(float p_curve) { fog_depth_curve = p_curve; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } float Environment::get_fog_depth_curve() const { @@ -757,7 +757,7 @@ float Environment::get_fog_depth_curve() const { void Environment::set_fog_transmit_enabled(bool p_enabled) { fog_transmit_enabled = p_enabled; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } bool Environment::is_fog_transmit_enabled() const { @@ -767,7 +767,7 @@ bool Environment::is_fog_transmit_enabled() const { void Environment::set_fog_transmit_curve(float p_curve) { fog_transmit_curve = p_curve; - VS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); + RS::get_singleton()->environment_set_fog_depth(environment, fog_depth_enabled, fog_depth_begin, fog_depth_end, fog_depth_curve, fog_transmit_enabled, fog_transmit_curve); } float Environment::get_fog_transmit_curve() const { @@ -777,7 +777,7 @@ float Environment::get_fog_transmit_curve() const { void Environment::set_fog_height_enabled(bool p_enabled) { fog_height_enabled = p_enabled; - VS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); + RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } bool Environment::is_fog_height_enabled() const { @@ -787,7 +787,7 @@ bool Environment::is_fog_height_enabled() const { void Environment::set_fog_height_min(float p_distance) { fog_height_min = p_distance; - VS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); + RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } float Environment::get_fog_height_min() const { @@ -797,7 +797,7 @@ float Environment::get_fog_height_min() const { void Environment::set_fog_height_max(float p_distance) { fog_height_max = p_distance; - VS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); + RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } float Environment::get_fog_height_max() const { @@ -807,7 +807,7 @@ float Environment::get_fog_height_max() const { void Environment::set_fog_height_curve(float p_distance) { fog_height_curve = p_distance; - VS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); + RS::get_singleton()->environment_set_fog_height(environment, fog_height_enabled, fog_height_min, fog_height_max, fog_height_curve); } float Environment::get_fog_height_curve() const { @@ -1152,7 +1152,7 @@ Environment::Environment() : ssao_blur(SSAO_BLUR_3x3), glow_blend_mode(GLOW_BLEND_MODE_ADDITIVE) { - environment = VS::get_singleton()->environment_create(); + environment = RS::get_singleton()->environment_create(); bg_mode = BG_CLEAR_COLOR; bg_sky_custom_fov = 0; @@ -1236,7 +1236,7 @@ Environment::Environment() : Environment::~Environment() { - VS::get_singleton()->free(environment); + RS::get_singleton()->free(environment); } ////////////////////// @@ -1244,7 +1244,7 @@ Environment::~Environment() { void CameraEffects::set_dof_blur_far_enabled(bool p_enable) { dof_blur_far_enabled = p_enable; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } bool CameraEffects::is_dof_blur_far_enabled() const { @@ -1255,7 +1255,7 @@ bool CameraEffects::is_dof_blur_far_enabled() const { void CameraEffects::set_dof_blur_far_distance(float p_distance) { dof_blur_far_distance = p_distance; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } float CameraEffects::get_dof_blur_far_distance() const { @@ -1265,7 +1265,7 @@ float CameraEffects::get_dof_blur_far_distance() const { void CameraEffects::set_dof_blur_far_transition(float p_distance) { dof_blur_far_transition = p_distance; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } float CameraEffects::get_dof_blur_far_transition() const { @@ -1275,7 +1275,7 @@ float CameraEffects::get_dof_blur_far_transition() const { void CameraEffects::set_dof_blur_near_enabled(bool p_enable) { dof_blur_near_enabled = p_enable; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); _change_notify(); } @@ -1287,7 +1287,7 @@ bool CameraEffects::is_dof_blur_near_enabled() const { void CameraEffects::set_dof_blur_near_distance(float p_distance) { dof_blur_near_distance = p_distance; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } float CameraEffects::get_dof_blur_near_distance() const { @@ -1298,7 +1298,7 @@ float CameraEffects::get_dof_blur_near_distance() const { void CameraEffects::set_dof_blur_near_transition(float p_distance) { dof_blur_near_transition = p_distance; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } float CameraEffects::get_dof_blur_near_transition() const { @@ -1309,7 +1309,7 @@ float CameraEffects::get_dof_blur_near_transition() const { void CameraEffects::set_dof_blur_amount(float p_amount) { dof_blur_amount = p_amount; - VS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); + RS::get_singleton()->camera_effects_set_dof_blur(camera_effects, dof_blur_far_enabled, dof_blur_far_distance, dof_blur_far_transition, dof_blur_near_enabled, dof_blur_near_distance, dof_blur_near_transition, dof_blur_amount); } float CameraEffects::get_dof_blur_amount() const { @@ -1318,7 +1318,7 @@ float CameraEffects::get_dof_blur_amount() const { void CameraEffects::set_override_exposure_enabled(bool p_enabled) { override_exposure_enabled = p_enabled; - VS::get_singleton()->camera_effects_set_custom_exposure(camera_effects, override_exposure_enabled, override_exposure); + RS::get_singleton()->camera_effects_set_custom_exposure(camera_effects, override_exposure_enabled, override_exposure); } bool CameraEffects::is_override_exposure_enabled() const { @@ -1327,7 +1327,7 @@ bool CameraEffects::is_override_exposure_enabled() const { void CameraEffects::set_override_exposure(float p_exposure) { override_exposure = p_exposure; - VS::get_singleton()->camera_effects_set_custom_exposure(camera_effects, override_exposure_enabled, override_exposure); + RS::get_singleton()->camera_effects_set_custom_exposure(camera_effects, override_exposure_enabled, override_exposure); } float CameraEffects::get_override_exposure() const { @@ -1382,7 +1382,7 @@ void CameraEffects::_bind_methods() { CameraEffects::CameraEffects() { - camera_effects = VS::get_singleton()->camera_effects_create(); + camera_effects = RS::get_singleton()->camera_effects_create(); dof_blur_far_enabled = false; dof_blur_far_distance = 10; @@ -1400,5 +1400,5 @@ CameraEffects::CameraEffects() { CameraEffects::~CameraEffects() { - VS::get_singleton()->free(camera_effects); + RS::get_singleton()->free(camera_effects); } diff --git a/scene/resources/environment.h b/scene/resources/environment.h index f9fe26f792..657c7190e5 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -34,7 +34,7 @@ #include "core/resource.h" #include "scene/resources/sky.h" #include "scene/resources/texture.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class Environment : public Resource { diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 1f5e4b647a..8914cf8097 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -556,7 +556,7 @@ float BitmapFont::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_c cpos.x += c->h_align; cpos.y -= ascent; cpos.y += c->v_align; - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, RID(), RID(), Color(1, 1, 1, 1), false); + RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(cpos, c->rect.size), textures[c->texture_idx]->get_rid(), c->rect, p_modulate, false, RID(), RID(), Color(1, 1, 1, 1), false); } return get_char_size(p_char, p_next).width; diff --git a/scene/resources/height_map_shape_3d.cpp b/scene/resources/height_map_shape_3d.cpp index 85c081238d..33b6063299 100644 --- a/scene/resources/height_map_shape_3d.cpp +++ b/scene/resources/height_map_shape_3d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "height_map_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() { Vector<Vector3> points; @@ -88,7 +88,7 @@ void HeightMapShape3D::_update_shape() { d["heights"] = map_data; d["min_height"] = min_height; d["max_height"] = max_height; - PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), d); Shape3D::_update_shape(); } @@ -192,7 +192,7 @@ void HeightMapShape3D::_bind_methods() { } HeightMapShape3D::HeightMapShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_HEIGHTMAP)) { map_width = 2; map_depth = 2; diff --git a/scene/resources/line_shape_2d.cpp b/scene/resources/line_shape_2d.cpp index 3b30b4528a..a1c1b2f9f4 100644 --- a/scene/resources/line_shape_2d.cpp +++ b/scene/resources/line_shape_2d.cpp @@ -30,8 +30,8 @@ #include "line_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" bool LineShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { @@ -52,7 +52,7 @@ void LineShape2D::_update_shape() { Array arr; arr.push_back(normal); arr.push_back(d); - Physics2DServer::get_singleton()->shape_set_data(get_rid(), arr); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), arr); emit_changed(); } @@ -82,9 +82,9 @@ void LineShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector2 point = get_d() * get_normal(); Vector2 l1[2] = { point - get_normal().tangent() * 100, point + get_normal().tangent() * 100 }; - VS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, 3); + RS::get_singleton()->canvas_item_add_line(p_to_rid, l1[0], l1[1], p_color, 3); Vector2 l2[2] = { point, point + get_normal() * 30 }; - VS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, 3); + RS::get_singleton()->canvas_item_add_line(p_to_rid, l2[0], l2[1], p_color, 3); } Rect2 LineShape2D::get_rect() const { @@ -117,7 +117,7 @@ void LineShape2D::_bind_methods() { } LineShape2D::LineShape2D() : - Shape2D(Physics2DServer::get_singleton()->line_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->line_shape_create()) { normal = Vector2(0, 1); d = 0; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index d387a39dbe..f52b755ed3 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -51,7 +51,7 @@ void Material::set_next_pass(const Ref<Material> &p_pass) { RID next_pass_rid; if (next_pass.is_valid()) next_pass_rid = next_pass->get_rid(); - VS::get_singleton()->material_set_next_pass(material, next_pass_rid); + RS::get_singleton()->material_set_next_pass(material, next_pass_rid); } Ref<Material> Material::get_next_pass() const { @@ -64,7 +64,7 @@ void Material::set_render_priority(int p_priority) { ERR_FAIL_COND(p_priority < RENDER_PRIORITY_MIN); ERR_FAIL_COND(p_priority > RENDER_PRIORITY_MAX); render_priority = p_priority; - VS::get_singleton()->material_set_render_priority(material, p_priority); + RS::get_singleton()->material_set_render_priority(material, p_priority); } int Material::get_render_priority() const { @@ -100,13 +100,13 @@ void Material::_bind_methods() { Material::Material() { - material = VisualServer::get_singleton()->material_create(); + material = RenderingServer::get_singleton()->material_create(); render_priority = 0; } Material::~Material() { - VisualServer::get_singleton()->free(material); + RenderingServer::get_singleton()->free(material); } /////////////////////////////////// @@ -126,7 +126,7 @@ bool ShaderMaterial::_set(const StringName &p_name, const Variant &p_value) { } } if (pr) { - VisualServer::get_singleton()->material_set_param(_get_material(), pr, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), pr, p_value); return true; } } @@ -150,7 +150,7 @@ bool ShaderMaterial::_get(const StringName &p_name, Variant &r_ret) const { } if (pr) { - r_ret = VisualServer::get_singleton()->material_get_param(_get_material(), pr); + r_ret = RenderingServer::get_singleton()->material_get_param(_get_material(), pr); return true; } } @@ -171,7 +171,7 @@ bool ShaderMaterial::property_can_revert(const String &p_name) { StringName pr = shader->remap_param(p_name); if (pr) { - Variant default_value = VisualServer::get_singleton()->shader_get_param_default(shader->get_rid(), pr); + Variant default_value = RenderingServer::get_singleton()->shader_get_param_default(shader->get_rid(), pr); Variant current_value; _get(p_name, current_value); return default_value.get_type() != Variant::NIL && default_value != current_value; @@ -185,7 +185,7 @@ Variant ShaderMaterial::property_get_revert(const String &p_name) { if (shader.is_valid()) { StringName pr = shader->remap_param(p_name); if (pr) { - r_ret = VisualServer::get_singleton()->shader_get_param_default(shader->get_rid(), pr); + r_ret = RenderingServer::get_singleton()->shader_get_param_default(shader->get_rid(), pr); } } return r_ret; @@ -211,7 +211,7 @@ void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) { } } - VS::get_singleton()->material_set_shader(_get_material(), rid); + RS::get_singleton()->material_set_shader(_get_material(), rid); _change_notify(); //properties for shader exposed emit_changed(); } @@ -223,12 +223,12 @@ Ref<Shader> ShaderMaterial::get_shader() const { void ShaderMaterial::set_shader_param(const StringName &p_param, const Variant &p_value) { - VS::get_singleton()->material_set_param(_get_material(), p_param, p_value); + RS::get_singleton()->material_set_param(_get_material(), p_param, p_value); } Variant ShaderMaterial::get_shader_param(const StringName &p_param) const { - return VS::get_singleton()->material_get_param(_get_material(), p_param); + return RS::get_singleton()->material_get_param(_get_material(), p_param); } void ShaderMaterial::_shader_changed() { @@ -392,7 +392,7 @@ void BaseMaterial3D::_update_shader() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } } @@ -401,7 +401,7 @@ void BaseMaterial3D::_update_shader() { if (shader_map.has(mk)) { - VS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); shader_map[mk].users++; return; } @@ -773,7 +773,7 @@ void BaseMaterial3D::_update_shader() { code += "\tvec2 base_uv2 = UV2;\n"; } - if (!VisualServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //heightmap not supported with triplanar + if (!RenderingServer::get_singleton()->is_low_end() && features[FEATURE_HEIGHT_MAPPING] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //heightmap not supported with triplanar code += "\t{\n"; code += "\t\tvec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT*heightmap_flip.x,-BINORMAL*heightmap_flip.y,NORMAL));\n"; // binormal is negative due to mikktspace, flip 'unflips' it ;-) @@ -953,7 +953,7 @@ void BaseMaterial3D::_update_shader() { if (distance_fade != DISTANCE_FADE_DISABLED) { if ((distance_fade == DISTANCE_FADE_OBJECT_DITHER || distance_fade == DISTANCE_FADE_PIXEL_DITHER)) { - if (!VisualServer::get_singleton()->is_low_end()) { + if (!RenderingServer::get_singleton()->is_low_end()) { code += "\t{\n"; if (distance_fade == DISTANCE_FADE_OBJECT_DITHER) { code += "\t\tfloat fade_distance = abs((INV_CAMERA_MATRIX * WORLD_MATRIX[3]).z);\n"; @@ -1112,14 +1112,14 @@ void BaseMaterial3D::_update_shader() { code += "}\n"; ShaderData shader_data; - shader_data.shader = VS::get_singleton()->shader_create(); + shader_data.shader = RS::get_singleton()->shader_create(); shader_data.users = 1; - VS::get_singleton()->shader_set_code(shader_data.shader, code); + RS::get_singleton()->shader_set_code(shader_data.shader, code); shader_map[mk] = shader_data; - VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); } void BaseMaterial3D::flush_changes() { @@ -1151,7 +1151,7 @@ void BaseMaterial3D::set_albedo(const Color &p_albedo) { albedo = p_albedo; - VS::get_singleton()->material_set_param(_get_material(), shader_names->albedo, p_albedo); + RS::get_singleton()->material_set_param(_get_material(), shader_names->albedo, p_albedo); } Color BaseMaterial3D::get_albedo() const { @@ -1162,7 +1162,7 @@ Color BaseMaterial3D::get_albedo() const { void BaseMaterial3D::set_specular(float p_specular) { specular = p_specular; - VS::get_singleton()->material_set_param(_get_material(), shader_names->specular, p_specular); + RS::get_singleton()->material_set_param(_get_material(), shader_names->specular, p_specular); } float BaseMaterial3D::get_specular() const { @@ -1173,7 +1173,7 @@ float BaseMaterial3D::get_specular() const { void BaseMaterial3D::set_roughness(float p_roughness) { roughness = p_roughness; - VS::get_singleton()->material_set_param(_get_material(), shader_names->roughness, p_roughness); + RS::get_singleton()->material_set_param(_get_material(), shader_names->roughness, p_roughness); } float BaseMaterial3D::get_roughness() const { @@ -1184,7 +1184,7 @@ float BaseMaterial3D::get_roughness() const { void BaseMaterial3D::set_metallic(float p_metallic) { metallic = p_metallic; - VS::get_singleton()->material_set_param(_get_material(), shader_names->metallic, p_metallic); + RS::get_singleton()->material_set_param(_get_material(), shader_names->metallic, p_metallic); } float BaseMaterial3D::get_metallic() const { @@ -1195,7 +1195,7 @@ float BaseMaterial3D::get_metallic() const { void BaseMaterial3D::set_emission(const Color &p_emission) { emission = p_emission; - VS::get_singleton()->material_set_param(_get_material(), shader_names->emission, p_emission); + RS::get_singleton()->material_set_param(_get_material(), shader_names->emission, p_emission); } Color BaseMaterial3D::get_emission() const { @@ -1205,7 +1205,7 @@ Color BaseMaterial3D::get_emission() const { void BaseMaterial3D::set_emission_energy(float p_emission_energy) { emission_energy = p_emission_energy; - VS::get_singleton()->material_set_param(_get_material(), shader_names->emission_energy, p_emission_energy); + RS::get_singleton()->material_set_param(_get_material(), shader_names->emission_energy, p_emission_energy); } float BaseMaterial3D::get_emission_energy() const { @@ -1215,7 +1215,7 @@ float BaseMaterial3D::get_emission_energy() const { void BaseMaterial3D::set_normal_scale(float p_normal_scale) { normal_scale = p_normal_scale; - VS::get_singleton()->material_set_param(_get_material(), shader_names->normal_scale, p_normal_scale); + RS::get_singleton()->material_set_param(_get_material(), shader_names->normal_scale, p_normal_scale); } float BaseMaterial3D::get_normal_scale() const { @@ -1225,7 +1225,7 @@ float BaseMaterial3D::get_normal_scale() const { void BaseMaterial3D::set_rim(float p_rim) { rim = p_rim; - VS::get_singleton()->material_set_param(_get_material(), shader_names->rim, p_rim); + RS::get_singleton()->material_set_param(_get_material(), shader_names->rim, p_rim); } float BaseMaterial3D::get_rim() const { @@ -1235,7 +1235,7 @@ float BaseMaterial3D::get_rim() const { void BaseMaterial3D::set_rim_tint(float p_rim_tint) { rim_tint = p_rim_tint; - VS::get_singleton()->material_set_param(_get_material(), shader_names->rim_tint, p_rim_tint); + RS::get_singleton()->material_set_param(_get_material(), shader_names->rim_tint, p_rim_tint); } float BaseMaterial3D::get_rim_tint() const { @@ -1245,7 +1245,7 @@ float BaseMaterial3D::get_rim_tint() const { void BaseMaterial3D::set_ao_light_affect(float p_ao_light_affect) { ao_light_affect = p_ao_light_affect; - VS::get_singleton()->material_set_param(_get_material(), shader_names->ao_light_affect, p_ao_light_affect); + RS::get_singleton()->material_set_param(_get_material(), shader_names->ao_light_affect, p_ao_light_affect); } float BaseMaterial3D::get_ao_light_affect() const { @@ -1255,7 +1255,7 @@ float BaseMaterial3D::get_ao_light_affect() const { void BaseMaterial3D::set_clearcoat(float p_clearcoat) { clearcoat = p_clearcoat; - VS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat, p_clearcoat); + RS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat, p_clearcoat); } float BaseMaterial3D::get_clearcoat() const { @@ -1266,7 +1266,7 @@ float BaseMaterial3D::get_clearcoat() const { void BaseMaterial3D::set_clearcoat_gloss(float p_clearcoat_gloss) { clearcoat_gloss = p_clearcoat_gloss; - VS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat_gloss, p_clearcoat_gloss); + RS::get_singleton()->material_set_param(_get_material(), shader_names->clearcoat_gloss, p_clearcoat_gloss); } float BaseMaterial3D::get_clearcoat_gloss() const { @@ -1277,7 +1277,7 @@ float BaseMaterial3D::get_clearcoat_gloss() const { void BaseMaterial3D::set_anisotropy(float p_anisotropy) { anisotropy = p_anisotropy; - VS::get_singleton()->material_set_param(_get_material(), shader_names->anisotropy, p_anisotropy); + RS::get_singleton()->material_set_param(_get_material(), shader_names->anisotropy, p_anisotropy); } float BaseMaterial3D::get_anisotropy() const { @@ -1287,7 +1287,7 @@ float BaseMaterial3D::get_anisotropy() const { void BaseMaterial3D::set_heightmap_scale(float p_heightmap_scale) { heightmap_scale = p_heightmap_scale; - VS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_scale, p_heightmap_scale); + RS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_scale, p_heightmap_scale); } float BaseMaterial3D::get_heightmap_scale() const { @@ -1298,7 +1298,7 @@ float BaseMaterial3D::get_heightmap_scale() const { void BaseMaterial3D::set_subsurface_scattering_strength(float p_subsurface_scattering_strength) { subsurface_scattering_strength = p_subsurface_scattering_strength; - VS::get_singleton()->material_set_param(_get_material(), shader_names->subsurface_scattering_strength, subsurface_scattering_strength); + RS::get_singleton()->material_set_param(_get_material(), shader_names->subsurface_scattering_strength, subsurface_scattering_strength); } float BaseMaterial3D::get_subsurface_scattering_strength() const { @@ -1309,7 +1309,7 @@ float BaseMaterial3D::get_subsurface_scattering_strength() const { void BaseMaterial3D::set_transmission(const Color &p_transmission) { transmission = p_transmission; - VS::get_singleton()->material_set_param(_get_material(), shader_names->transmission, transmission); + RS::get_singleton()->material_set_param(_get_material(), shader_names->transmission, transmission); } Color BaseMaterial3D::get_transmission() const { @@ -1320,7 +1320,7 @@ Color BaseMaterial3D::get_transmission() const { void BaseMaterial3D::set_refraction(float p_refraction) { refraction = p_refraction; - VS::get_singleton()->material_set_param(_get_material(), shader_names->refraction, refraction); + RS::get_singleton()->material_set_param(_get_material(), shader_names->refraction, refraction); } float BaseMaterial3D::get_refraction() const { @@ -1488,7 +1488,7 @@ void BaseMaterial3D::set_texture(TextureParam p_param, const Ref<Texture2D> &p_t ERR_FAIL_INDEX(p_param, TEXTURE_MAX); textures[p_param] = p_texture; RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID(); - VS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid); + RS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid); _change_notify(); _queue_shader_change(); } @@ -1637,7 +1637,7 @@ void BaseMaterial3D::_validate_property(PropertyInfo &property) const { void BaseMaterial3D::set_point_size(float p_point_size) { point_size = p_point_size; - VS::get_singleton()->material_set_param(_get_material(), shader_names->point_size, p_point_size); + RS::get_singleton()->material_set_param(_get_material(), shader_names->point_size, p_point_size); } float BaseMaterial3D::get_point_size() const { @@ -1648,7 +1648,7 @@ float BaseMaterial3D::get_point_size() const { void BaseMaterial3D::set_uv1_scale(const Vector3 &p_scale) { uv1_scale = p_scale; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_scale, p_scale); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_scale, p_scale); } Vector3 BaseMaterial3D::get_uv1_scale() const { @@ -1659,7 +1659,7 @@ Vector3 BaseMaterial3D::get_uv1_scale() const { void BaseMaterial3D::set_uv1_offset(const Vector3 &p_offset) { uv1_offset = p_offset; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_offset, p_offset); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_offset, p_offset); } Vector3 BaseMaterial3D::get_uv1_offset() const { @@ -1669,7 +1669,7 @@ Vector3 BaseMaterial3D::get_uv1_offset() const { void BaseMaterial3D::set_uv1_triplanar_blend_sharpness(float p_sharpness) { uv1_triplanar_sharpness = p_sharpness; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_blend_sharpness, p_sharpness); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv1_blend_sharpness, p_sharpness); } float BaseMaterial3D::get_uv1_triplanar_blend_sharpness() const { @@ -1680,7 +1680,7 @@ float BaseMaterial3D::get_uv1_triplanar_blend_sharpness() const { void BaseMaterial3D::set_uv2_scale(const Vector3 &p_scale) { uv2_scale = p_scale; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_scale, p_scale); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_scale, p_scale); } Vector3 BaseMaterial3D::get_uv2_scale() const { @@ -1691,7 +1691,7 @@ Vector3 BaseMaterial3D::get_uv2_scale() const { void BaseMaterial3D::set_uv2_offset(const Vector3 &p_offset) { uv2_offset = p_offset; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_offset, p_offset); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_offset, p_offset); } Vector3 BaseMaterial3D::get_uv2_offset() const { @@ -1702,7 +1702,7 @@ Vector3 BaseMaterial3D::get_uv2_offset() const { void BaseMaterial3D::set_uv2_triplanar_blend_sharpness(float p_sharpness) { uv2_triplanar_sharpness = p_sharpness; - VS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_blend_sharpness, p_sharpness); + RS::get_singleton()->material_set_param(_get_material(), shader_names->uv2_blend_sharpness, p_sharpness); } float BaseMaterial3D::get_uv2_triplanar_blend_sharpness() const { @@ -1725,7 +1725,7 @@ BaseMaterial3D::BillboardMode BaseMaterial3D::get_billboard_mode() const { void BaseMaterial3D::set_particles_anim_h_frames(int p_frames) { particles_anim_h_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_h_frames, p_frames); } int BaseMaterial3D::get_particles_anim_h_frames() const { @@ -1735,7 +1735,7 @@ int BaseMaterial3D::get_particles_anim_h_frames() const { void BaseMaterial3D::set_particles_anim_v_frames(int p_frames) { particles_anim_v_frames = p_frames; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_v_frames, p_frames); } int BaseMaterial3D::get_particles_anim_v_frames() const { @@ -1746,7 +1746,7 @@ int BaseMaterial3D::get_particles_anim_v_frames() const { void BaseMaterial3D::set_particles_anim_loop(bool p_loop) { particles_anim_loop = p_loop; - VS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, particles_anim_loop); + RS::get_singleton()->material_set_param(_get_material(), shader_names->particles_anim_loop, particles_anim_loop); } bool BaseMaterial3D::get_particles_anim_loop() const { @@ -1769,7 +1769,7 @@ bool BaseMaterial3D::is_heightmap_deep_parallax_enabled() const { void BaseMaterial3D::set_heightmap_deep_parallax_min_layers(int p_layer) { deep_parallax_min_layers = p_layer; - VS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_min_layers, p_layer); + RS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_min_layers, p_layer); } int BaseMaterial3D::get_heightmap_deep_parallax_min_layers() const { @@ -1779,7 +1779,7 @@ int BaseMaterial3D::get_heightmap_deep_parallax_min_layers() const { void BaseMaterial3D::set_heightmap_deep_parallax_max_layers(int p_layer) { deep_parallax_max_layers = p_layer; - VS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_max_layers, p_layer); + RS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_max_layers, p_layer); } int BaseMaterial3D::get_heightmap_deep_parallax_max_layers() const { @@ -1789,7 +1789,7 @@ int BaseMaterial3D::get_heightmap_deep_parallax_max_layers() const { void BaseMaterial3D::set_heightmap_deep_parallax_flip_tangent(bool p_flip) { heightmap_parallax_flip_tangent = p_flip; - VS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_flip, Vector2(heightmap_parallax_flip_tangent ? -1 : 1, heightmap_parallax_flip_binormal ? -1 : 1)); + RS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_flip, Vector2(heightmap_parallax_flip_tangent ? -1 : 1, heightmap_parallax_flip_binormal ? -1 : 1)); } bool BaseMaterial3D::get_heightmap_deep_parallax_flip_tangent() const { @@ -1800,7 +1800,7 @@ bool BaseMaterial3D::get_heightmap_deep_parallax_flip_tangent() const { void BaseMaterial3D::set_heightmap_deep_parallax_flip_binormal(bool p_flip) { heightmap_parallax_flip_binormal = p_flip; - VS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_flip, Vector2(heightmap_parallax_flip_tangent ? -1 : 1, heightmap_parallax_flip_binormal ? -1 : 1)); + RS::get_singleton()->material_set_param(_get_material(), shader_names->heightmap_flip, Vector2(heightmap_parallax_flip_tangent ? -1 : 1, heightmap_parallax_flip_binormal ? -1 : 1)); } bool BaseMaterial3D::get_heightmap_deep_parallax_flip_binormal() const { @@ -1820,7 +1820,7 @@ bool BaseMaterial3D::is_grow_enabled() const { void BaseMaterial3D::set_alpha_scissor_threshold(float p_threshold) { alpha_scissor_threshold = p_threshold; - VS::get_singleton()->material_set_param(_get_material(), shader_names->alpha_scissor_threshold, p_threshold); + RS::get_singleton()->material_set_param(_get_material(), shader_names->alpha_scissor_threshold, p_threshold); } float BaseMaterial3D::get_alpha_scissor_threshold() const { @@ -1830,7 +1830,7 @@ float BaseMaterial3D::get_alpha_scissor_threshold() const { void BaseMaterial3D::set_grow(float p_grow) { grow = p_grow; - VS::get_singleton()->material_set_param(_get_material(), shader_names->grow, p_grow); + RS::get_singleton()->material_set_param(_get_material(), shader_names->grow, p_grow); } float BaseMaterial3D::get_grow() const { @@ -1853,7 +1853,7 @@ static Plane _get_texture_mask(BaseMaterial3D::TextureChannel p_channel) { void BaseMaterial3D::set_metallic_texture_channel(TextureChannel p_channel) { ERR_FAIL_INDEX(p_channel, 5); metallic_texture_channel = p_channel; - VS::get_singleton()->material_set_param(_get_material(), shader_names->metallic_texture_channel, _get_texture_mask(p_channel)); + RS::get_singleton()->material_set_param(_get_material(), shader_names->metallic_texture_channel, _get_texture_mask(p_channel)); } BaseMaterial3D::TextureChannel BaseMaterial3D::get_metallic_texture_channel() const { @@ -1875,7 +1875,7 @@ void BaseMaterial3D::set_ao_texture_channel(TextureChannel p_channel) { ERR_FAIL_INDEX(p_channel, 5); ao_texture_channel = p_channel; - VS::get_singleton()->material_set_param(_get_material(), shader_names->ao_texture_channel, _get_texture_mask(p_channel)); + RS::get_singleton()->material_set_param(_get_material(), shader_names->ao_texture_channel, _get_texture_mask(p_channel)); } BaseMaterial3D::TextureChannel BaseMaterial3D::get_ao_texture_channel() const { @@ -1886,7 +1886,7 @@ void BaseMaterial3D::set_refraction_texture_channel(TextureChannel p_channel) { ERR_FAIL_INDEX(p_channel, 5); refraction_texture_channel = p_channel; - VS::get_singleton()->material_set_param(_get_material(), shader_names->refraction_texture_channel, _get_texture_mask(p_channel)); + RS::get_singleton()->material_set_param(_get_material(), shader_names->refraction_texture_channel, _get_texture_mask(p_channel)); } BaseMaterial3D::TextureChannel BaseMaterial3D::get_refraction_texture_channel() const { @@ -1954,7 +1954,7 @@ bool BaseMaterial3D::is_proximity_fade_enabled() const { void BaseMaterial3D::set_proximity_fade_distance(float p_distance) { proximity_fade_distance = p_distance; - VS::get_singleton()->material_set_param(_get_material(), shader_names->proximity_fade_distance, p_distance); + RS::get_singleton()->material_set_param(_get_material(), shader_names->proximity_fade_distance, p_distance); } float BaseMaterial3D::get_proximity_fade_distance() const { @@ -1975,7 +1975,7 @@ BaseMaterial3D::DistanceFadeMode BaseMaterial3D::get_distance_fade() const { void BaseMaterial3D::set_distance_fade_max_distance(float p_distance) { distance_fade_max_distance = p_distance; - VS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_max, distance_fade_max_distance); + RS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_max, distance_fade_max_distance); } float BaseMaterial3D::get_distance_fade_max_distance() const { @@ -1985,7 +1985,7 @@ float BaseMaterial3D::get_distance_fade_max_distance() const { void BaseMaterial3D::set_distance_fade_min_distance(float p_distance) { distance_fade_min_distance = p_distance; - VS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_min, distance_fade_min_distance); + RS::get_singleton()->material_set_param(_get_material(), shader_names->distance_fade_min, distance_fade_min_distance); } float BaseMaterial3D::get_distance_fade_min_distance() const { @@ -2561,11 +2561,11 @@ BaseMaterial3D::~BaseMaterial3D() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } } diff --git a/scene/resources/material.h b/scene/resources/material.h index fc77226fb9..0c9352baf4 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -35,8 +35,8 @@ #include "core/self_list.h" #include "scene/resources/shader.h" #include "scene/resources/texture.h" -#include "servers/visual/shader_language.h" -#include "servers/visual_server.h" +#include "servers/rendering/shader_language.h" +#include "servers/rendering_server.h" class Material : public Resource { @@ -57,8 +57,8 @@ protected: public: enum { - RENDER_PRIORITY_MAX = VS::MATERIAL_RENDER_PRIORITY_MAX, - RENDER_PRIORITY_MIN = VS::MATERIAL_RENDER_PRIORITY_MIN, + RENDER_PRIORITY_MAX = RS::MATERIAL_RENDER_PRIORITY_MAX, + RENDER_PRIORITY_MIN = RS::MATERIAL_RENDER_PRIORITY_MIN, }; void set_next_pass(const Ref<Material> &p_pass); Ref<Material> get_next_pass() const; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 0d32fdb0fa..b37b7f9751 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -169,20 +169,20 @@ Vector<Face3> Mesh::get_faces() const { /* for (int i=0;i<surfaces.size();i++) { - if (VisualServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != VisualServer::PRIMITIVE_TRIANGLES ) + if (RenderingServer::get_singleton()->mesh_surface_get_primitive_type( mesh, i ) != RenderingServer::PRIMITIVE_TRIANGLES ) continue; Vector<int> indices; Vector<Vector3> vertices; - vertices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_VERTEX); + vertices=RenderingServer::get_singleton()->mesh_surface_get_array(mesh, i,RenderingServer::ARRAY_VERTEX); - int len=VisualServer::get_singleton()->mesh_surface_get_array_index_len(mesh, i); + int len=RenderingServer::get_singleton()->mesh_surface_get_array_index_len(mesh, i); bool has_indices; if (len>0) { - indices=VisualServer::get_singleton()->mesh_surface_get_array(mesh, i,VisualServer::ARRAY_INDEX); + indices=RenderingServer::get_singleton()->mesh_surface_get_array(mesh, i,RenderingServer::ARRAY_INDEX); has_indices=true; } else { @@ -846,7 +846,7 @@ Array ArrayMesh::_get_surfaces() const { Array ret; for (int i = 0; i < surfaces.size(); i++) { - VisualServer::SurfaceData surface = VS::get_singleton()->mesh_get_surface(mesh, i); + RenderingServer::SurfaceData surface = RS::get_singleton()->mesh_get_surface(mesh, i); Dictionary data; data["format"] = surface.format; data["primitive"] = surface.primitive; @@ -902,20 +902,20 @@ Array ArrayMesh::_get_surfaces() const { void ArrayMesh::_create_if_empty() const { if (!mesh.is_valid()) { - mesh = VS::get_singleton()->mesh_create(); - VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)blend_shape_mode); + mesh = RS::get_singleton()->mesh_create(); + RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode); } } void ArrayMesh::_set_surfaces(const Array &p_surfaces) { - Vector<VS::SurfaceData> surface_data; + Vector<RS::SurfaceData> surface_data; Vector<Ref<Material>> surface_materials; Vector<String> surface_names; Vector<bool> surface_2d; for (int i = 0; i < p_surfaces.size(); i++) { - VS::SurfaceData surface; + RS::SurfaceData surface; Dictionary d = p_surfaces[i]; ERR_FAIL_COND(!d.has("format")); ERR_FAIL_COND(!d.has("primitive")); @@ -923,7 +923,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) { ERR_FAIL_COND(!d.has("vertex_count")); ERR_FAIL_COND(!d.has("aabb")); surface.format = d["format"]; - surface.primitive = VS::PrimitiveType(int(d["primitive"])); + surface.primitive = RS::PrimitiveType(int(d["primitive"])); surface.vertex_data = d["vertex_data"]; surface.vertex_count = d["vertex_count"]; surface.aabb = d["aabb"]; @@ -938,7 +938,7 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) { Array lods = d["lods"]; ERR_FAIL_COND(lods.size() & 1); //must be even for (int j = 0; j < lods.size(); j += 2) { - VS::SurfaceData::LOD lod; + RS::SurfaceData::LOD lod; lod.edge_length = lods[j + 0]; lod.index_data = lods[j + 1]; surface.lods.push_back(lod); @@ -993,15 +993,15 @@ void ArrayMesh::_set_surfaces(const Array &p_surfaces) { if (mesh.is_valid()) { //if mesh exists, it needs to be updated - VS::get_singleton()->mesh_clear(mesh); + RS::get_singleton()->mesh_clear(mesh); for (int i = 0; i < surface_data.size(); i++) { - VS::get_singleton()->mesh_add_surface(mesh, surface_data[i]); + RS::get_singleton()->mesh_add_surface(mesh, surface_data[i]); } } else { // if mesh does not exist (first time this is loaded, most likely), // we can create it with a single call, which is a lot more efficient and thread friendly - mesh = VS::get_singleton()->mesh_create_from_surfaces(surface_data); - VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)blend_shape_mode); + mesh = RS::get_singleton()->mesh_create_from_surfaces(surface_data); + RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)blend_shape_mode); } surfaces.clear(); @@ -1102,7 +1102,7 @@ void ArrayMesh::_recompute_aabb() { #ifndef _MSC_VER #warning need to add binding to add_surface using future MeshSurfaceData object #endif -void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<VS::SurfaceData::LOD> &p_lods) { +void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes, const Vector<AABB> &p_bone_aabb, const Vector<RS::SurfaceData::LOD> &p_lods) { _create_if_empty(); @@ -1117,9 +1117,9 @@ void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const surfaces.push_back(s); _recompute_aabb(); - VS::SurfaceData sd; + RS::SurfaceData sd; sd.format = p_format; - sd.primitive = VS::PrimitiveType(p_primitive); + sd.primitive = RS::PrimitiveType(p_primitive); sd.aabb = p_aabb; sd.vertex_count = p_vertex_count; sd.vertex_data = p_array; @@ -1129,7 +1129,7 @@ void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const sd.bone_aabbs = p_bone_aabb; sd.lods = p_lods; - VisualServer::get_singleton()->mesh_add_surface(mesh, sd); + RenderingServer::get_singleton()->mesh_add_surface(mesh, sd); clear_cache(); _change_notify(); @@ -1140,9 +1140,9 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array & ERR_FAIL_COND(p_arrays.size() != ARRAY_MAX); - VS::SurfaceData surface; + RS::SurfaceData surface; - Error err = VS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (VisualServer::PrimitiveType)p_primitive, p_arrays, p_blend_shapes, p_lods, p_flags); + Error err = RS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (RenderingServer::PrimitiveType)p_primitive, p_arrays, p_blend_shapes, p_lods, p_flags); ERR_FAIL_COND(err != OK); /* print_line("format: " + itos(surface.format)); @@ -1159,16 +1159,16 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array & Array ArrayMesh::surface_get_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Array()); - return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh, p_surface); + return RenderingServer::get_singleton()->mesh_surface_get_arrays(mesh, p_surface); } Array ArrayMesh::surface_get_blend_shape_arrays(int p_surface) const { ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Array()); - return VisualServer::get_singleton()->mesh_surface_get_blend_shape_arrays(mesh, p_surface); + return RenderingServer::get_singleton()->mesh_surface_get_blend_shape_arrays(mesh, p_surface); } Dictionary ArrayMesh::surface_get_lods(int p_surface) const { ERR_FAIL_INDEX_V(p_surface, surfaces.size(), Dictionary()); - return VisualServer::get_singleton()->mesh_surface_get_lods(mesh, p_surface); + return RenderingServer::get_singleton()->mesh_surface_get_lods(mesh, p_surface); } int ArrayMesh::get_surface_count() const { @@ -1193,7 +1193,7 @@ void ArrayMesh::add_blend_shape(const StringName &p_name) { } blend_shapes.push_back(name); - //VS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size()); + //RS::get_singleton()->mesh_set_blend_shape_count(mesh, blend_shapes.size()); } int ArrayMesh::get_blend_shape_count() const { @@ -1215,7 +1215,7 @@ void ArrayMesh::set_blend_shape_mode(BlendShapeMode p_mode) { blend_shape_mode = p_mode; if (mesh.is_valid()) { - VS::get_singleton()->mesh_set_blend_shape_mode(mesh, (VS::BlendShapeMode)p_mode); + RS::get_singleton()->mesh_set_blend_shape_mode(mesh, (RS::BlendShapeMode)p_mode); } } @@ -1254,7 +1254,7 @@ void ArrayMesh::surface_set_material(int p_idx, const Ref<Material> &p_material) if (surfaces[p_idx].material == p_material) return; surfaces.write[p_idx].material = p_material; - VisualServer::get_singleton()->mesh_surface_set_material(mesh, p_idx, p_material.is_null() ? RID() : p_material->get_rid()); + RenderingServer::get_singleton()->mesh_surface_set_material(mesh, p_idx, p_material.is_null() ? RID() : p_material->get_rid()); _change_notify("material"); emit_changed(); @@ -1286,7 +1286,7 @@ String ArrayMesh::surface_get_name(int p_idx) const { void ArrayMesh::surface_update_region(int p_surface, int p_offset, const Vector<uint8_t> &p_data) { ERR_FAIL_INDEX(p_surface, surfaces.size()); - VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data); + RS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data); emit_changed(); } @@ -1318,7 +1318,7 @@ void ArrayMesh::clear_surfaces() { if (!mesh.is_valid()) { return; } - VS::get_singleton()->mesh_clear(mesh); + RS::get_singleton()->mesh_clear(mesh); surfaces.clear(); aabb = AABB(); } @@ -1327,7 +1327,7 @@ void ArrayMesh::set_custom_aabb(const AABB &p_custom) { _create_if_empty(); custom_aabb = p_custom; - VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); + RS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); emit_changed(); } @@ -1609,7 +1609,7 @@ void ArrayMesh::_bind_methods() { } void ArrayMesh::reload_from_file() { - VisualServer::get_singleton()->mesh_clear(mesh); + RenderingServer::get_singleton()->mesh_clear(mesh); surfaces.clear(); clear_blend_shapes(); clear_cache(); @@ -1622,13 +1622,13 @@ void ArrayMesh::reload_from_file() { ArrayMesh::ArrayMesh() { //mesh is now created on demand - //mesh = VisualServer::get_singleton()->mesh_create(); + //mesh = RenderingServer::get_singleton()->mesh_create(); blend_shape_mode = BLEND_SHAPE_MODE_RELATIVE; } ArrayMesh::~ArrayMesh() { if (mesh.is_valid()) { - VisualServer::get_singleton()->free(mesh); + RenderingServer::get_singleton()->free(mesh); } } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index e5f87dbbe5..25a9722046 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -36,7 +36,7 @@ #include "core/resource.h" #include "scene/resources/material.h" #include "scene/resources/shape_3d.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class Mesh : public Resource { GDCLASS(Mesh, Resource); @@ -51,22 +51,22 @@ protected: public: enum { - NO_INDEX_ARRAY = VisualServer::NO_INDEX_ARRAY, - ARRAY_WEIGHTS_SIZE = VisualServer::ARRAY_WEIGHTS_SIZE + NO_INDEX_ARRAY = RenderingServer::NO_INDEX_ARRAY, + ARRAY_WEIGHTS_SIZE = RenderingServer::ARRAY_WEIGHTS_SIZE }; enum ArrayType { - ARRAY_VERTEX = VisualServer::ARRAY_VERTEX, - ARRAY_NORMAL = VisualServer::ARRAY_NORMAL, - ARRAY_TANGENT = VisualServer::ARRAY_TANGENT, - ARRAY_COLOR = VisualServer::ARRAY_COLOR, - ARRAY_TEX_UV = VisualServer::ARRAY_TEX_UV, - ARRAY_TEX_UV2 = VisualServer::ARRAY_TEX_UV2, - ARRAY_BONES = VisualServer::ARRAY_BONES, - ARRAY_WEIGHTS = VisualServer::ARRAY_WEIGHTS, - ARRAY_INDEX = VisualServer::ARRAY_INDEX, - ARRAY_MAX = VisualServer::ARRAY_MAX + ARRAY_VERTEX = RenderingServer::ARRAY_VERTEX, + ARRAY_NORMAL = RenderingServer::ARRAY_NORMAL, + ARRAY_TANGENT = RenderingServer::ARRAY_TANGENT, + ARRAY_COLOR = RenderingServer::ARRAY_COLOR, + ARRAY_TEX_UV = RenderingServer::ARRAY_TEX_UV, + ARRAY_TEX_UV2 = RenderingServer::ARRAY_TEX_UV2, + ARRAY_BONES = RenderingServer::ARRAY_BONES, + ARRAY_WEIGHTS = RenderingServer::ARRAY_WEIGHTS, + ARRAY_INDEX = RenderingServer::ARRAY_INDEX, + ARRAY_MAX = RenderingServer::ARRAY_MAX }; @@ -98,18 +98,18 @@ public: }; enum PrimitiveType { - PRIMITIVE_POINTS = VisualServer::PRIMITIVE_POINTS, - PRIMITIVE_LINES = VisualServer::PRIMITIVE_LINES, - PRIMITIVE_LINE_STRIP = VisualServer::PRIMITIVE_LINE_STRIP, - PRIMITIVE_TRIANGLES = VisualServer::PRIMITIVE_TRIANGLES, - PRIMITIVE_TRIANGLE_STRIP = VisualServer::PRIMITIVE_TRIANGLE_STRIP, - PRIMITIVE_MAX = VisualServer::PRIMITIVE_MAX, + PRIMITIVE_POINTS = RenderingServer::PRIMITIVE_POINTS, + PRIMITIVE_LINES = RenderingServer::PRIMITIVE_LINES, + PRIMITIVE_LINE_STRIP = RenderingServer::PRIMITIVE_LINE_STRIP, + PRIMITIVE_TRIANGLES = RenderingServer::PRIMITIVE_TRIANGLES, + PRIMITIVE_TRIANGLE_STRIP = RenderingServer::PRIMITIVE_TRIANGLE_STRIP, + PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX, }; enum BlendShapeMode { - BLEND_SHAPE_MODE_NORMALIZED = VS::BLEND_SHAPE_MODE_NORMALIZED, - BLEND_SHAPE_MODE_RELATIVE = VS::BLEND_SHAPE_MODE_RELATIVE, + BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED, + BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE, }; virtual int get_surface_count() const = 0; @@ -193,7 +193,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), const Dictionary &p_lods = Dictionary(), uint32_t p_flags = ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<VS::SurfaceData::LOD> &p_lods = Vector<VS::SurfaceData::LOD>()); + void add_surface(uint32_t p_format, PrimitiveType p_primitive, const Vector<uint8_t> &p_array, int p_vertex_count, const Vector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<Vector<uint8_t>> &p_blend_shapes = Vector<Vector<uint8_t>>(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>(), const Vector<RS::SurfaceData::LOD> &p_lods = Vector<RS::SurfaceData::LOD>()); Array surface_get_arrays(int p_surface) const; Array surface_get_blend_shape_arrays(int p_surface) const; diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index aa8be326f5..ce561bfaaf 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -30,7 +30,7 @@ #include "multimesh.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" #ifndef DISABLE_DEPRECATED // Kept for compatibility from 3.x to 4.0. @@ -198,20 +198,20 @@ Vector<Color> MultiMesh::_get_custom_data_array() const { #endif // DISABLE_DEPRECATED void MultiMesh::set_buffer(const Vector<float> &p_buffer) { - VS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer); + RS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer); } Vector<float> MultiMesh::get_buffer() const { - return VS::get_singleton()->multimesh_get_buffer(multimesh); + return RS::get_singleton()->multimesh_get_buffer(multimesh); } void MultiMesh::set_mesh(const Ref<Mesh> &p_mesh) { mesh = p_mesh; if (!mesh.is_null()) - VisualServer::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid()); + RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid()); else - VisualServer::get_singleton()->multimesh_set_mesh(multimesh, RID()); + RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, RID()); } Ref<Mesh> MultiMesh::get_mesh() const { @@ -221,7 +221,7 @@ Ref<Mesh> MultiMesh::get_mesh() const { void MultiMesh::set_instance_count(int p_count) { ERR_FAIL_COND(p_count < 0); - VisualServer::get_singleton()->multimesh_allocate(multimesh, p_count, VS::MultimeshTransformFormat(transform_format), use_colors, use_custom_data); + RenderingServer::get_singleton()->multimesh_allocate(multimesh, p_count, RS::MultimeshTransformFormat(transform_format), use_colors, use_custom_data); instance_count = p_count; } int MultiMesh::get_instance_count() const { @@ -232,7 +232,7 @@ int MultiMesh::get_instance_count() const { void MultiMesh::set_visible_instance_count(int p_count) { ERR_FAIL_COND(p_count < -1); ERR_FAIL_COND(p_count > instance_count); - VisualServer::get_singleton()->multimesh_set_visible_instances(multimesh, p_count); + RenderingServer::get_singleton()->multimesh_set_visible_instances(multimesh, p_count); visible_instance_count = p_count; } int MultiMesh::get_visible_instance_count() const { @@ -242,45 +242,45 @@ int MultiMesh::get_visible_instance_count() const { void MultiMesh::set_instance_transform(int p_instance, const Transform &p_transform) { - VisualServer::get_singleton()->multimesh_instance_set_transform(multimesh, p_instance, p_transform); + RenderingServer::get_singleton()->multimesh_instance_set_transform(multimesh, p_instance, p_transform); } void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) { - VisualServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform); + RenderingServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform); } Transform MultiMesh::get_instance_transform(int p_instance) const { - return VisualServer::get_singleton()->multimesh_instance_get_transform(multimesh, p_instance); + return RenderingServer::get_singleton()->multimesh_instance_get_transform(multimesh, p_instance); } Transform2D MultiMesh::get_instance_transform_2d(int p_instance) const { - return VisualServer::get_singleton()->multimesh_instance_get_transform_2d(multimesh, p_instance); + return RenderingServer::get_singleton()->multimesh_instance_get_transform_2d(multimesh, p_instance); } void MultiMesh::set_instance_color(int p_instance, const Color &p_color) { - VisualServer::get_singleton()->multimesh_instance_set_color(multimesh, p_instance, p_color); + RenderingServer::get_singleton()->multimesh_instance_set_color(multimesh, p_instance, p_color); } Color MultiMesh::get_instance_color(int p_instance) const { - return VisualServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance); + return RenderingServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance); } void MultiMesh::set_instance_custom_data(int p_instance, const Color &p_custom_data) { - VisualServer::get_singleton()->multimesh_instance_set_custom_data(multimesh, p_instance, p_custom_data); + RenderingServer::get_singleton()->multimesh_instance_set_custom_data(multimesh, p_instance, p_custom_data); } Color MultiMesh::get_instance_custom_data(int p_instance) const { - return VisualServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance); + return RenderingServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance); } AABB MultiMesh::get_aabb() const { - return VisualServer::get_singleton()->multimesh_get_aabb(multimesh); + return RenderingServer::get_singleton()->multimesh_get_aabb(multimesh); } RID MultiMesh::get_rid() const { @@ -375,7 +375,7 @@ void MultiMesh::_bind_methods() { MultiMesh::MultiMesh() { - multimesh = VisualServer::get_singleton()->multimesh_create(); + multimesh = RenderingServer::get_singleton()->multimesh_create(); use_colors = false; use_custom_data = false; transform_format = TRANSFORM_2D; @@ -385,5 +385,5 @@ MultiMesh::MultiMesh() { MultiMesh::~MultiMesh() { - VisualServer::get_singleton()->free(multimesh); + RenderingServer::get_singleton()->free(multimesh); } diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 8ca30a5b88..c1e52bc981 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -32,7 +32,7 @@ #define MULTIMESH_H #include "scene/resources/mesh.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class MultiMesh : public Resource { @@ -41,8 +41,8 @@ class MultiMesh : public Resource { public: enum TransformFormat { - TRANSFORM_2D = VS::MULTIMESH_TRANSFORM_2D, - TRANSFORM_3D = VS::MULTIMESH_TRANSFORM_3D + TRANSFORM_2D = RS::MULTIMESH_TRANSFORM_2D, + TRANSFORM_3D = RS::MULTIMESH_TRANSFORM_3D }; private: diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index f18e8956f1..63766c1756 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -121,7 +121,7 @@ void ParticlesMaterial::_update_shader() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } } @@ -130,7 +130,7 @@ void ParticlesMaterial::_update_shader() { if (shader_map.has(mk)) { - VS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_map[mk].shader); shader_map[mk].users++; return; } @@ -592,14 +592,14 @@ void ParticlesMaterial::_update_shader() { code += "\n"; ShaderData shader_data; - shader_data.shader = VS::get_singleton()->shader_create(); + shader_data.shader = RS::get_singleton()->shader_create(); shader_data.users = 1; - VS::get_singleton()->shader_set_code(shader_data.shader, code); + RS::get_singleton()->shader_set_code(shader_data.shader, code); shader_map[mk] = shader_data; - VS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); + RS::get_singleton()->material_set_shader(_get_material(), shader_data.shader); } void ParticlesMaterial::flush_changes() { @@ -631,7 +631,7 @@ bool ParticlesMaterial::_is_shader_dirty() const { void ParticlesMaterial::set_direction(Vector3 p_direction) { direction = p_direction; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->direction, direction); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->direction, direction); } Vector3 ParticlesMaterial::get_direction() const { @@ -642,7 +642,7 @@ Vector3 ParticlesMaterial::get_direction() const { void ParticlesMaterial::set_spread(float p_spread) { spread = p_spread; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->spread, p_spread); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->spread, p_spread); } float ParticlesMaterial::get_spread() const { @@ -653,7 +653,7 @@ float ParticlesMaterial::get_spread() const { void ParticlesMaterial::set_flatness(float p_flatness) { flatness = p_flatness; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->flatness, p_flatness); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->flatness, p_flatness); } float ParticlesMaterial::get_flatness() const { @@ -668,40 +668,40 @@ void ParticlesMaterial::set_param(Parameter p_param, float p_value) { switch (p_param) { case PARAM_INITIAL_LINEAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity, p_value); } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity, p_value); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity, p_value); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel, p_value); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel, p_value); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel, p_value); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping, p_value); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle, p_value); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale, p_value); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation, p_value); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed, p_value); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset, p_value); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -721,40 +721,40 @@ void ParticlesMaterial::set_param_randomness(Parameter p_param, float p_value) { switch (p_param) { case PARAM_INITIAL_LINEAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_linear_velocity_random, p_value); } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_random, p_value); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_random, p_value); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_random, p_value); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_random, p_value); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_random, p_value); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_random, p_value); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->initial_angle_random, p_value); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_random, p_value); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_random, p_value); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_random, p_value); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_random, p_value); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -786,47 +786,47 @@ void ParticlesMaterial::set_param_texture(Parameter p_param, const Ref<Texture2D //do none for this one } break; case PARAM_ANGULAR_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angular_velocity_texture, p_texture); _adjust_curve_range(p_texture, -360, 360); } break; case PARAM_ORBIT_VELOCITY: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->orbit_velocity_texture, p_texture); _adjust_curve_range(p_texture, -500, 500); } break; case PARAM_LINEAR_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->linear_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_RADIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->radial_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_TANGENTIAL_ACCEL: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->tangent_accel_texture, p_texture); _adjust_curve_range(p_texture, -200, 200); } break; case PARAM_DAMPING: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->damping_texture, p_texture); _adjust_curve_range(p_texture, 0, 100); } break; case PARAM_ANGLE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->angle_texture, p_texture); _adjust_curve_range(p_texture, -360, 360); } break; case PARAM_SCALE: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->scale_texture, p_texture); _adjust_curve_range(p_texture, 0, 1); } break; case PARAM_HUE_VARIATION: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->hue_variation_texture, p_texture); _adjust_curve_range(p_texture, -1, 1); } break; case PARAM_ANIM_SPEED: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_speed_texture, p_texture); _adjust_curve_range(p_texture, 0, 200); } break; case PARAM_ANIM_OFFSET: { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->anim_offset_texture, p_texture); } break; case PARAM_MAX: break; // Can't happen, but silences warning } @@ -842,7 +842,7 @@ Ref<Texture2D> ParticlesMaterial::get_param_texture(Parameter p_param) const { void ParticlesMaterial::set_color(const Color &p_color) { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color, p_color); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color, p_color); color = p_color; } @@ -854,7 +854,7 @@ Color ParticlesMaterial::get_color() const { void ParticlesMaterial::set_color_ramp(const Ref<Texture2D> &p_texture) { color_ramp = p_texture; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, p_texture); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->color_ramp, p_texture); _queue_shader_change(); _change_notify(); } @@ -888,38 +888,38 @@ void ParticlesMaterial::set_emission_shape(EmissionShape p_shape) { void ParticlesMaterial::set_emission_sphere_radius(float p_radius) { emission_sphere_radius = p_radius; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius); } void ParticlesMaterial::set_emission_box_extents(Vector3 p_extents) { emission_box_extents = p_extents; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_box_extents, p_extents); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_box_extents, p_extents); } void ParticlesMaterial::set_emission_point_texture(const Ref<Texture2D> &p_points) { emission_point_texture = p_points; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, p_points); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_points, p_points); } void ParticlesMaterial::set_emission_normal_texture(const Ref<Texture2D> &p_normals) { emission_normal_texture = p_normals; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, p_normals); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_normal, p_normals); } void ParticlesMaterial::set_emission_color_texture(const Ref<Texture2D> &p_colors) { emission_color_texture = p_colors; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, p_colors); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_color, p_colors); _queue_shader_change(); } void ParticlesMaterial::set_emission_point_count(int p_count) { emission_point_count = p_count; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_point_count, p_count); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_texture_point_count, p_count); } ParticlesMaterial::EmissionShape ParticlesMaterial::get_emission_shape() const { @@ -957,7 +957,7 @@ int ParticlesMaterial::get_emission_point_count() const { void ParticlesMaterial::set_trail_divisor(int p_divisor) { trail_divisor = p_divisor; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); } int ParticlesMaterial::get_trail_divisor() const { @@ -974,7 +974,7 @@ void ParticlesMaterial::set_trail_size_modifier(const Ref<CurveTexture> &p_trail curve->ensure_default_setup(); } - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, curve); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_size_modifier, curve); _queue_shader_change(); } @@ -986,7 +986,7 @@ Ref<CurveTexture> ParticlesMaterial::get_trail_size_modifier() const { void ParticlesMaterial::set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier) { trail_color_modifier = p_trail_color_modifier; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, p_trail_color_modifier); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_color_modifier, p_trail_color_modifier); _queue_shader_change(); } @@ -1002,7 +1002,7 @@ void ParticlesMaterial::set_gravity(const Vector3 &p_gravity) { if (gset == Vector3()) { gset = Vector3(0, -0.000001, 0); //as gravity is used as upvector in some calculations } - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset); } Vector3 ParticlesMaterial::get_gravity() const { @@ -1013,7 +1013,7 @@ Vector3 ParticlesMaterial::get_gravity() const { void ParticlesMaterial::set_lifetime_randomness(float p_lifetime) { lifetime_randomness = p_lifetime; - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->lifetime_randomness, lifetime_randomness); + RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->lifetime_randomness, lifetime_randomness); } float ParticlesMaterial::get_lifetime_randomness() const { @@ -1280,10 +1280,10 @@ ParticlesMaterial::~ParticlesMaterial() { shader_map[current_key].users--; if (shader_map[current_key].users == 0) { //deallocate shader, as it's no longer in use - VS::get_singleton()->free(shader_map[current_key].shader); + RS::get_singleton()->free(shader_map[current_key].shader); shader_map.erase(current_key); } - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } } diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h index 2f7f4424b2..f4a77d9854 100644 --- a/scene/resources/physics_material.h +++ b/scene/resources/physics_material.h @@ -32,7 +32,7 @@ #define physics_material_override_H #include "core/resource.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" class PhysicsMaterial : public Resource { diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 959ee214a2..0792af2143 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "primitive_meshes.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" /** PrimitiveMesh @@ -37,10 +37,10 @@ void PrimitiveMesh::_update() const { Array arr; - arr.resize(VS::ARRAY_MAX); + arr.resize(RS::ARRAY_MAX); _create_mesh_array(arr); - Vector<Vector3> points = arr[VS::ARRAY_VERTEX]; + Vector<Vector3> points = arr[RS::ARRAY_VERTEX]; aabb = AABB(); @@ -57,10 +57,10 @@ void PrimitiveMesh::_update() const { } } - Vector<int> indices = arr[VS::ARRAY_INDEX]; + Vector<int> indices = arr[RS::ARRAY_INDEX]; if (flip_faces) { - Vector<Vector3> normals = arr[VS::ARRAY_NORMAL]; + Vector<Vector3> normals = arr[RS::ARRAY_NORMAL]; if (normals.size() && indices.size()) { @@ -79,17 +79,17 @@ void PrimitiveMesh::_update() const { SWAP(w[i + 0], w[i + 1]); } } - arr[VS::ARRAY_NORMAL] = normals; - arr[VS::ARRAY_INDEX] = indices; + arr[RS::ARRAY_NORMAL] = normals; + arr[RS::ARRAY_INDEX] = indices; } } array_len = pc; index_array_len = indices.size(); // in with the new - VisualServer::get_singleton()->mesh_clear(mesh); - VisualServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (VisualServer::PrimitiveType)primitive_type, arr); - VisualServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid()); + RenderingServer::get_singleton()->mesh_clear(mesh); + RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh, (RenderingServer::PrimitiveType)primitive_type, arr); + RenderingServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid()); pending_request = false; @@ -136,7 +136,7 @@ Array PrimitiveMesh::surface_get_arrays(int p_surface) const { _update(); } - return VisualServer::get_singleton()->mesh_surface_get_arrays(mesh, 0); + return RenderingServer::get_singleton()->mesh_surface_get_arrays(mesh, 0); } Dictionary PrimitiveMesh::surface_get_lods(int p_surface) const { @@ -150,7 +150,7 @@ Array PrimitiveMesh::surface_get_blend_shape_arrays(int p_surface) const { uint32_t PrimitiveMesh::surface_get_format(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, 1, 0); - return VS::ARRAY_FORMAT_VERTEX | VS::ARRAY_FORMAT_NORMAL | VS::ARRAY_FORMAT_TANGENT | VS::ARRAY_FORMAT_TEX_UV | VS::ARRAY_FORMAT_INDEX | VS::ARRAY_COMPRESS_DEFAULT; + return RS::ARRAY_FORMAT_VERTEX | RS::ARRAY_FORMAT_NORMAL | RS::ARRAY_FORMAT_TANGENT | RS::ARRAY_FORMAT_TEX_UV | RS::ARRAY_FORMAT_INDEX | RS::ARRAY_COMPRESS_DEFAULT; } Mesh::PrimitiveType PrimitiveMesh::surface_get_primitive_type(int p_idx) const { @@ -215,7 +215,7 @@ void PrimitiveMesh::set_material(const Ref<Material> &p_material) { material = p_material; if (!pending_request) { // just apply it, else it'll happen when _update is called. - VisualServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid()); + RenderingServer::get_singleton()->mesh_surface_set_material(mesh, 0, material.is_null() ? RID() : material->get_rid()); _change_notify(); emit_changed(); }; @@ -232,7 +232,7 @@ Array PrimitiveMesh::get_mesh_arrays() const { void PrimitiveMesh::set_custom_aabb(const AABB &p_custom) { custom_aabb = p_custom; - VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); + RS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); emit_changed(); } @@ -254,7 +254,7 @@ PrimitiveMesh::PrimitiveMesh() { flip_faces = false; // defaults - mesh = VisualServer::get_singleton()->mesh_create(); + mesh = RenderingServer::get_singleton()->mesh_create(); // assume primitive triangles as the type, correct for all but one and it will change this :) primitive_type = Mesh::PRIMITIVE_TRIANGLES; @@ -267,7 +267,7 @@ PrimitiveMesh::PrimitiveMesh() { } PrimitiveMesh::~PrimitiveMesh() { - VisualServer::get_singleton()->free(mesh); + RenderingServer::get_singleton()->free(mesh); } /** @@ -413,11 +413,11 @@ void CapsuleMesh::_create_mesh_array(Array &p_arr) const { thisrow = point; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void CapsuleMesh::_bind_methods() { @@ -670,11 +670,11 @@ void CubeMesh::_create_mesh_array(Array &p_arr) const { thisrow = point; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void CubeMesh::_bind_methods() { @@ -871,11 +871,11 @@ void CylinderMesh::_create_mesh_array(Array &p_arr) const { }; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void CylinderMesh::_bind_methods() { @@ -1010,11 +1010,11 @@ void PlaneMesh::_create_mesh_array(Array &p_arr) const { thisrow = point; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void PlaneMesh::_bind_methods() { @@ -1270,11 +1270,11 @@ void PrismMesh::_create_mesh_array(Array &p_arr) const { thisrow = point; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void PrismMesh::_bind_methods() { @@ -1401,10 +1401,10 @@ void QuadMesh::_create_mesh_array(Array &p_arr) const { uvs.set(i, quad_uv[j]); } - p_arr[VS::ARRAY_VERTEX] = faces; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_VERTEX] = faces; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; } void QuadMesh::_bind_methods() { @@ -1494,11 +1494,11 @@ void SphereMesh::_create_mesh_array(Array &p_arr) const { thisrow = point; }; - p_arr[VS::ARRAY_VERTEX] = points; - p_arr[VS::ARRAY_NORMAL] = normals; - p_arr[VS::ARRAY_TANGENT] = tangents; - p_arr[VS::ARRAY_TEX_UV] = uvs; - p_arr[VS::ARRAY_INDEX] = indices; + p_arr[RS::ARRAY_VERTEX] = points; + p_arr[RS::ARRAY_NORMAL] = normals; + p_arr[RS::ARRAY_TANGENT] = tangents; + p_arr[RS::ARRAY_TEX_UV] = uvs; + p_arr[RS::ARRAY_INDEX] = indices; } void SphereMesh::_bind_methods() { @@ -1585,7 +1585,7 @@ void PointMesh::_create_mesh_array(Array &p_arr) const { faces.resize(1); faces.set(0, Vector3(0.0, 0.0, 0.0)); - p_arr[VS::ARRAY_VERTEX] = faces; + p_arr[RS::ARRAY_VERTEX] = faces; } PointMesh::PointMesh() { diff --git a/scene/resources/ray_shape_3d.cpp b/scene/resources/ray_shape_3d.cpp index ad927afd58..0211c55f46 100644 --- a/scene/resources/ray_shape_3d.cpp +++ b/scene/resources/ray_shape_3d.cpp @@ -30,7 +30,7 @@ #include "ray_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> RayShape3D::get_debug_mesh_lines() { @@ -50,7 +50,7 @@ void RayShape3D::_update_shape() { Dictionary d; d["length"] = length; d["slips_on_slope"] = slips_on_slope; - PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), d); Shape3D::_update_shape(); } @@ -92,7 +92,7 @@ void RayShape3D::_bind_methods() { } RayShape3D::RayShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_RAY)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_RAY)) { length = 1.0; slips_on_slope = false; diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp index f8c8ffb289..19e72a65b0 100644 --- a/scene/resources/rectangle_shape_2d.cpp +++ b/scene/resources/rectangle_shape_2d.cpp @@ -30,11 +30,11 @@ #include "rectangle_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" void RectangleShape2D::_update_shape() { - Physics2DServer::get_singleton()->shape_set_data(get_rid(), extents); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), extents); emit_changed(); } @@ -51,7 +51,7 @@ Vector2 RectangleShape2D::get_extents() const { void RectangleShape2D::draw(const RID &p_to_rid, const Color &p_color) { - VisualServer::get_singleton()->canvas_item_add_rect(p_to_rid, Rect2(-extents, extents * 2.0), p_color); + RenderingServer::get_singleton()->canvas_item_add_rect(p_to_rid, Rect2(-extents, extents * 2.0), p_color); } Rect2 RectangleShape2D::get_rect() const { @@ -72,7 +72,7 @@ void RectangleShape2D::_bind_methods() { } RectangleShape2D::RectangleShape2D() : - Shape2D(Physics2DServer::get_singleton()->rectangle_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->rectangle_shape_create()) { extents = Vector2(10, 10); _update_shape(); diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp index 2e78a4fccf..814c349784 100644 --- a/scene/resources/segment_shape_2d.cpp +++ b/scene/resources/segment_shape_2d.cpp @@ -30,8 +30,8 @@ #include "segment_shape_2d.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" bool SegmentShape2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { @@ -45,7 +45,7 @@ void SegmentShape2D::_update_shape() { Rect2 r; r.position = a; r.size = b; - Physics2DServer::get_singleton()->shape_set_data(get_rid(), r); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), r); emit_changed(); } @@ -71,7 +71,7 @@ Vector2 SegmentShape2D::get_b() const { void SegmentShape2D::draw(const RID &p_to_rid, const Color &p_color) { - VisualServer::get_singleton()->canvas_item_add_line(p_to_rid, a, b, p_color, 3); + RenderingServer::get_singleton()->canvas_item_add_line(p_to_rid, a, b, p_color, 3); } Rect2 SegmentShape2D::get_rect() const { @@ -99,7 +99,7 @@ void SegmentShape2D::_bind_methods() { } SegmentShape2D::SegmentShape2D() : - Shape2D(Physics2DServer::get_singleton()->segment_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->segment_shape_create()) { a = Vector2(); b = Vector2(0, 10); @@ -113,14 +113,14 @@ void RayShape2D::_update_shape() { Dictionary d; d["length"] = length; d["slips_on_slope"] = slips_on_slope; - Physics2DServer::get_singleton()->shape_set_data(get_rid(), d); + PhysicsServer2D::get_singleton()->shape_set_data(get_rid(), d); emit_changed(); } void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { Vector2 tip = Vector2(0, get_length()); - VS::get_singleton()->canvas_item_add_line(p_to_rid, Vector2(), tip, p_color, 3); + RS::get_singleton()->canvas_item_add_line(p_to_rid, Vector2(), tip, p_color, 3); Vector<Vector2> pts; float tsize = 4; pts.push_back(tip + Vector2(0, tsize)); @@ -130,7 +130,7 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { for (int i = 0; i < 3; i++) cols.push_back(p_color); - VS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID()); + RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID()); } Rect2 RayShape2D::get_rect() const { @@ -179,7 +179,7 @@ bool RayShape2D::get_slips_on_slope() const { } RayShape2D::RayShape2D() : - Shape2D(Physics2DServer::get_singleton()->ray_shape_create()) { + Shape2D(PhysicsServer2D::get_singleton()->ray_shape_create()) { length = 20; slips_on_slope = false; diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 47f6d673ae..a62e7ded16 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -31,8 +31,8 @@ #include "shader.h" #include "core/os/file_access.h" #include "scene/scene_string_names.h" -#include "servers/visual/shader_language.h" -#include "servers/visual_server.h" +#include "servers/rendering/shader_language.h" +#include "servers/rendering_server.h" #include "texture.h" Shader::Mode Shader::get_mode() const { @@ -54,7 +54,7 @@ void Shader::set_code(const String &p_code) { mode = MODE_SPATIAL; } - VisualServer::get_singleton()->shader_set_code(shader, p_code); + RenderingServer::get_singleton()->shader_set_code(shader, p_code); params_cache_dirty = true; emit_changed(); @@ -63,7 +63,7 @@ void Shader::set_code(const String &p_code) { String Shader::get_code() const { _update_shader(); - return VisualServer::get_singleton()->shader_get_code(shader); + return RenderingServer::get_singleton()->shader_get_code(shader); } void Shader::get_param_list(List<PropertyInfo> *p_params) const { @@ -71,7 +71,7 @@ void Shader::get_param_list(List<PropertyInfo> *p_params) const { _update_shader(); List<PropertyInfo> local; - VisualServer::get_singleton()->shader_get_param_list(shader, &local); + RenderingServer::get_singleton()->shader_get_param_list(shader, &local); params_cache.clear(); params_cache_dirty = false; @@ -104,10 +104,10 @@ void Shader::set_default_texture_param(const StringName &p_param, const Ref<Text if (p_texture.is_valid()) { default_textures[p_param] = p_texture; - VS::get_singleton()->shader_set_default_texture_param(shader, p_param, p_texture->get_rid()); + RS::get_singleton()->shader_set_default_texture_param(shader, p_param, p_texture->get_rid()); } else { default_textures.erase(p_param); - VS::get_singleton()->shader_set_default_texture_param(shader, p_param, RID()); + RS::get_singleton()->shader_set_default_texture_param(shader, p_param, RID()); } emit_changed(); @@ -166,13 +166,13 @@ void Shader::_bind_methods() { Shader::Shader() { mode = MODE_SPATIAL; - shader = VisualServer::get_singleton()->shader_create(); + shader = RenderingServer::get_singleton()->shader_create(); params_cache_dirty = true; } Shader::~Shader() { - VisualServer::get_singleton()->free(shader); + RenderingServer::get_singleton()->free(shader); } //////////// diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 5804fe8fef..e65457ed76 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -56,7 +56,7 @@ private: Mode mode; // hack the name of performance - // shaders keep a list of ShaderMaterial -> VisualServer name translations, to make + // shaders keep a list of ShaderMaterial -> RenderingServer name translations, to make // conversion fast and save memory. mutable bool params_cache_dirty; mutable Map<StringName, StringName> params_cache; //map a shader param to a material param.. diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp index 64930c3117..7984dadbc5 100644 --- a/scene/resources/shape_2d.cpp +++ b/scene/resources/shape_2d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "shape_2d.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" RID Shape2D::get_rid() const { return shape; @@ -38,7 +38,7 @@ RID Shape2D::get_rid() const { void Shape2D::set_custom_solver_bias(real_t p_bias) { custom_bias = p_bias; - Physics2DServer::get_singleton()->shape_set_custom_solver_bias(shape, custom_bias); + PhysicsServer2D::get_singleton()->shape_set_custom_solver_bias(shape, custom_bias); } real_t Shape2D::get_custom_solver_bias() const { @@ -50,13 +50,13 @@ bool Shape2D::collide_with_motion(const Transform2D &p_local_xform, const Vector ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return Physics2DServer::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, NULL, 0, r); } bool Shape2D::collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform) { ERR_FAIL_COND_V(p_shape.is_null(), false); int r; - return Physics2DServer::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), NULL, 0, r); + return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), NULL, 0, r); } Array Shape2D::collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion) { @@ -66,7 +66,7 @@ Array Shape2D::collide_with_motion_and_get_contacts(const Transform2D &p_local_x Vector2 result[max_contacts * 2]; int contacts = 0; - if (!Physics2DServer::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, result, max_contacts, contacts)) + if (!PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, result, max_contacts, contacts)) return Array(); Array results; @@ -84,7 +84,7 @@ Array Shape2D::collide_and_get_contacts(const Transform2D &p_local_xform, const Vector2 result[max_contacts * 2]; int contacts = 0; - if (!Physics2DServer::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), result, max_contacts, contacts)) + if (!PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), result, max_contacts, contacts)) return Array(); Array results; @@ -115,5 +115,5 @@ Shape2D::Shape2D(const RID &p_rid) { Shape2D::~Shape2D() { - Physics2DServer::get_singleton()->free(shape); + PhysicsServer2D::get_singleton()->free(shape); } diff --git a/scene/resources/shape_3d.cpp b/scene/resources/shape_3d.cpp index c3aeba857a..f4a5d91e52 100644 --- a/scene/resources/shape_3d.cpp +++ b/scene/resources/shape_3d.cpp @@ -33,7 +33,7 @@ #include "core/os/os.h" #include "scene/main/scene_tree.h" #include "scene/resources/mesh.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" void Shape3D::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform) { @@ -56,7 +56,7 @@ real_t Shape3D::get_margin() const { void Shape3D::set_margin(real_t p_margin) { margin = p_margin; - PhysicsServer::get_singleton()->shape_set_margin(shape, margin); + PhysicsServer3D::get_singleton()->shape_set_margin(shape, margin); } Ref<ArrayMesh> Shape3D::get_debug_mesh() { @@ -123,5 +123,5 @@ Shape3D::Shape3D(RID p_shape) : Shape3D::~Shape3D() { - PhysicsServer::get_singleton()->free(shape); + PhysicsServer3D::get_singleton()->free(shape); } diff --git a/scene/resources/sky.cpp b/scene/resources/sky.cpp index 1185b693b7..cbe86b16b2 100644 --- a/scene/resources/sky.cpp +++ b/scene/resources/sky.cpp @@ -39,7 +39,7 @@ void Sky::set_radiance_size(RadianceSize p_size) { static const int size[RADIANCE_SIZE_MAX] = { 32, 64, 128, 256, 512, 1024, 2048 }; - VS::get_singleton()->sky_set_radiance_size(sky, size[radiance_size]); + RS::get_singleton()->sky_set_radiance_size(sky, size[radiance_size]); } Sky::RadianceSize Sky::get_radiance_size() const { @@ -49,7 +49,7 @@ Sky::RadianceSize Sky::get_radiance_size() const { void Sky::set_process_mode(ProcessMode p_mode) { mode = p_mode; - VS::get_singleton()->sky_set_mode(sky, VS::SkyMode(mode)); + RS::get_singleton()->sky_set_mode(sky, RS::SkyMode(mode)); } Sky::ProcessMode Sky::get_process_mode() const { @@ -61,7 +61,7 @@ void Sky::set_material(const Ref<Material> &p_material) { RID material_rid; if (sky_material.is_valid()) material_rid = sky_material->get_rid(); - VS::get_singleton()->sky_set_material(sky, material_rid); + RS::get_singleton()->sky_set_material(sky, material_rid); } Ref<Material> Sky::get_material() const { @@ -104,10 +104,10 @@ void Sky::_bind_methods() { Sky::Sky() { mode = PROCESS_MODE_QUALITY; radiance_size = RADIANCE_SIZE_256; - sky = VS::get_singleton()->sky_create(); + sky = RS::get_singleton()->sky_create(); } Sky::~Sky() { - VS::get_singleton()->free(sky); + RS::get_singleton()->free(sky); }
\ No newline at end of file diff --git a/scene/resources/sky_material.cpp b/scene/resources/sky_material.cpp index c3e51460c6..cf11da784d 100644 --- a/scene/resources/sky_material.cpp +++ b/scene/resources/sky_material.cpp @@ -33,7 +33,7 @@ void ProceduralSkyMaterial::set_sky_top_color(const Color &p_sky_top) { sky_top_color = p_sky_top; - VS::get_singleton()->material_set_param(_get_material(), "sky_top_color", sky_top_color.to_linear()); + RS::get_singleton()->material_set_param(_get_material(), "sky_top_color", sky_top_color.to_linear()); } Color ProceduralSkyMaterial::get_sky_top_color() const { @@ -44,7 +44,7 @@ Color ProceduralSkyMaterial::get_sky_top_color() const { void ProceduralSkyMaterial::set_sky_horizon_color(const Color &p_sky_horizon) { sky_horizon_color = p_sky_horizon; - VS::get_singleton()->material_set_param(_get_material(), "sky_horizon_color", sky_horizon_color.to_linear()); + RS::get_singleton()->material_set_param(_get_material(), "sky_horizon_color", sky_horizon_color.to_linear()); } Color ProceduralSkyMaterial::get_sky_horizon_color() const { @@ -54,7 +54,7 @@ Color ProceduralSkyMaterial::get_sky_horizon_color() const { void ProceduralSkyMaterial::set_sky_curve(float p_curve) { sky_curve = p_curve; - VS::get_singleton()->material_set_param(_get_material(), "sky_curve", sky_curve); + RS::get_singleton()->material_set_param(_get_material(), "sky_curve", sky_curve); } float ProceduralSkyMaterial::get_sky_curve() const { @@ -64,7 +64,7 @@ float ProceduralSkyMaterial::get_sky_curve() const { void ProceduralSkyMaterial::set_sky_energy(float p_energy) { sky_energy = p_energy; - VS::get_singleton()->material_set_param(_get_material(), "sky_energy", sky_energy); + RS::get_singleton()->material_set_param(_get_material(), "sky_energy", sky_energy); } float ProceduralSkyMaterial::get_sky_energy() const { @@ -74,7 +74,7 @@ float ProceduralSkyMaterial::get_sky_energy() const { void ProceduralSkyMaterial::set_ground_bottom_color(const Color &p_ground_bottom) { ground_bottom_color = p_ground_bottom; - VS::get_singleton()->material_set_param(_get_material(), "ground_bottom_color", ground_bottom_color.to_linear()); + RS::get_singleton()->material_set_param(_get_material(), "ground_bottom_color", ground_bottom_color.to_linear()); } Color ProceduralSkyMaterial::get_ground_bottom_color() const { @@ -84,7 +84,7 @@ Color ProceduralSkyMaterial::get_ground_bottom_color() const { void ProceduralSkyMaterial::set_ground_horizon_color(const Color &p_ground_horizon) { ground_horizon_color = p_ground_horizon; - VS::get_singleton()->material_set_param(_get_material(), "ground_horizon_color", ground_horizon_color.to_linear()); + RS::get_singleton()->material_set_param(_get_material(), "ground_horizon_color", ground_horizon_color.to_linear()); } Color ProceduralSkyMaterial::get_ground_horizon_color() const { @@ -94,7 +94,7 @@ Color ProceduralSkyMaterial::get_ground_horizon_color() const { void ProceduralSkyMaterial::set_ground_curve(float p_curve) { ground_curve = p_curve; - VS::get_singleton()->material_set_param(_get_material(), "ground_curve", ground_curve); + RS::get_singleton()->material_set_param(_get_material(), "ground_curve", ground_curve); } float ProceduralSkyMaterial::get_ground_curve() const { @@ -104,7 +104,7 @@ float ProceduralSkyMaterial::get_ground_curve() const { void ProceduralSkyMaterial::set_ground_energy(float p_energy) { ground_energy = p_energy; - VS::get_singleton()->material_set_param(_get_material(), "ground_energy", ground_energy); + RS::get_singleton()->material_set_param(_get_material(), "ground_energy", ground_energy); } float ProceduralSkyMaterial::get_ground_energy() const { @@ -114,7 +114,7 @@ float ProceduralSkyMaterial::get_ground_energy() const { void ProceduralSkyMaterial::set_sun_angle_min(float p_angle) { sun_angle_min = p_angle; - VS::get_singleton()->material_set_param(_get_material(), "sun_angle_min", Math::deg2rad(sun_angle_min)); + RS::get_singleton()->material_set_param(_get_material(), "sun_angle_min", Math::deg2rad(sun_angle_min)); } float ProceduralSkyMaterial::get_sun_angle_min() const { @@ -124,7 +124,7 @@ float ProceduralSkyMaterial::get_sun_angle_min() const { void ProceduralSkyMaterial::set_sun_angle_max(float p_angle) { sun_angle_max = p_angle; - VS::get_singleton()->material_set_param(_get_material(), "sun_angle_max", Math::deg2rad(sun_angle_max)); + RS::get_singleton()->material_set_param(_get_material(), "sun_angle_max", Math::deg2rad(sun_angle_max)); } float ProceduralSkyMaterial::get_sun_angle_max() const { @@ -134,7 +134,7 @@ float ProceduralSkyMaterial::get_sun_angle_max() const { void ProceduralSkyMaterial::set_sun_curve(float p_curve) { sun_curve = p_curve; - VS::get_singleton()->material_set_param(_get_material(), "sun_curve", sun_curve); + RS::get_singleton()->material_set_param(_get_material(), "sun_curve", sun_curve); } float ProceduralSkyMaterial::get_sun_curve() const { @@ -271,11 +271,11 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() { code += "\tCOLOR = mix(ground, sky, step(0.0, EYEDIR.y));\n"; code += "}\n"; - shader = VS::get_singleton()->shader_create(); + shader = RS::get_singleton()->shader_create(); - VS::get_singleton()->shader_set_code(shader, code); + RS::get_singleton()->shader_set_code(shader, code); - VS::get_singleton()->material_set_shader(_get_material(), shader); + RS::get_singleton()->material_set_shader(_get_material(), shader); set_sky_top_color(Color(0.35, 0.46, 0.71)); set_sky_horizon_color(Color(0.55, 0.69, 0.81)); @@ -293,8 +293,8 @@ ProceduralSkyMaterial::ProceduralSkyMaterial() { } ProceduralSkyMaterial::~ProceduralSkyMaterial() { - VS::get_singleton()->free(shader); - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->free(shader); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } ///////////////////////////////////////// @@ -303,7 +303,7 @@ ProceduralSkyMaterial::~ProceduralSkyMaterial() { void PanoramaSkyMaterial::set_panorama(const Ref<Texture2D> &p_panorama) { panorama = p_panorama; - VS::get_singleton()->material_set_param(_get_material(), "source_panorama", panorama); + RS::get_singleton()->material_set_param(_get_material(), "source_panorama", panorama); } Ref<Texture2D> PanoramaSkyMaterial::get_panorama() const { @@ -341,16 +341,16 @@ PanoramaSkyMaterial::PanoramaSkyMaterial() { code += "\tCOLOR = texture(source_panorama, SKY_COORDS).rgb;\n"; code += "}"; - shader = VS::get_singleton()->shader_create(); + shader = RS::get_singleton()->shader_create(); - VS::get_singleton()->shader_set_code(shader, code); + RS::get_singleton()->shader_set_code(shader, code); - VS::get_singleton()->material_set_shader(_get_material(), shader); + RS::get_singleton()->material_set_shader(_get_material(), shader); } PanoramaSkyMaterial::~PanoramaSkyMaterial() { - VS::get_singleton()->free(shader); - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->free(shader); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } ////////////////////////////////// /* PhysicalSkyMaterial */ @@ -358,7 +358,7 @@ PanoramaSkyMaterial::~PanoramaSkyMaterial() { void PhysicalSkyMaterial::set_rayleigh_coefficient(float p_rayleigh) { rayleigh = p_rayleigh; - VS::get_singleton()->material_set_param(_get_material(), "rayleigh", rayleigh); + RS::get_singleton()->material_set_param(_get_material(), "rayleigh", rayleigh); } float PhysicalSkyMaterial::get_rayleigh_coefficient() const { @@ -368,7 +368,7 @@ float PhysicalSkyMaterial::get_rayleigh_coefficient() const { void PhysicalSkyMaterial::set_rayleigh_color(Color p_rayleigh_color) { rayleigh_color = p_rayleigh_color; - VS::get_singleton()->material_set_param(_get_material(), "rayleigh_color", rayleigh_color); + RS::get_singleton()->material_set_param(_get_material(), "rayleigh_color", rayleigh_color); } Color PhysicalSkyMaterial::get_rayleigh_color() const { @@ -378,7 +378,7 @@ Color PhysicalSkyMaterial::get_rayleigh_color() const { void PhysicalSkyMaterial::set_mie_coefficient(float p_mie) { mie = p_mie; - VS::get_singleton()->material_set_param(_get_material(), "mie", mie); + RS::get_singleton()->material_set_param(_get_material(), "mie", mie); } float PhysicalSkyMaterial::get_mie_coefficient() const { @@ -388,7 +388,7 @@ float PhysicalSkyMaterial::get_mie_coefficient() const { void PhysicalSkyMaterial::set_mie_eccentricity(float p_eccentricity) { mie_eccentricity = p_eccentricity; - VS::get_singleton()->material_set_param(_get_material(), "mie_eccentricity", mie_eccentricity); + RS::get_singleton()->material_set_param(_get_material(), "mie_eccentricity", mie_eccentricity); } float PhysicalSkyMaterial::get_mie_eccentricity() const { @@ -398,7 +398,7 @@ float PhysicalSkyMaterial::get_mie_eccentricity() const { void PhysicalSkyMaterial::set_mie_color(Color p_mie_color) { mie_color = p_mie_color; - VS::get_singleton()->material_set_param(_get_material(), "mie_color", mie_color); + RS::get_singleton()->material_set_param(_get_material(), "mie_color", mie_color); } Color PhysicalSkyMaterial::get_mie_color() const { return mie_color; @@ -407,7 +407,7 @@ Color PhysicalSkyMaterial::get_mie_color() const { void PhysicalSkyMaterial::set_turbidity(float p_turbidity) { turbidity = p_turbidity; - VS::get_singleton()->material_set_param(_get_material(), "turbidity", turbidity); + RS::get_singleton()->material_set_param(_get_material(), "turbidity", turbidity); } float PhysicalSkyMaterial::get_turbidity() const { @@ -417,7 +417,7 @@ float PhysicalSkyMaterial::get_turbidity() const { void PhysicalSkyMaterial::set_sun_disk_scale(float p_sun_disk_scale) { sun_disk_scale = p_sun_disk_scale; - VS::get_singleton()->material_set_param(_get_material(), "sun_disk_scale", sun_disk_scale); + RS::get_singleton()->material_set_param(_get_material(), "sun_disk_scale", sun_disk_scale); } float PhysicalSkyMaterial::get_sun_disk_scale() const { @@ -427,7 +427,7 @@ float PhysicalSkyMaterial::get_sun_disk_scale() const { void PhysicalSkyMaterial::set_ground_color(Color p_ground_color) { ground_color = p_ground_color; - VS::get_singleton()->material_set_param(_get_material(), "ground_color", ground_color); + RS::get_singleton()->material_set_param(_get_material(), "ground_color", ground_color); } Color PhysicalSkyMaterial::get_ground_color() const { @@ -437,7 +437,7 @@ Color PhysicalSkyMaterial::get_ground_color() const { void PhysicalSkyMaterial::set_exposure(float p_exposure) { exposure = p_exposure; - VS::get_singleton()->material_set_param(_get_material(), "exposure", exposure); + RS::get_singleton()->material_set_param(_get_material(), "exposure", exposure); } float PhysicalSkyMaterial::get_exposure() const { @@ -447,7 +447,7 @@ float PhysicalSkyMaterial::get_exposure() const { void PhysicalSkyMaterial::set_dither_strength(float p_dither_strength) { dither_strength = p_dither_strength; - VS::get_singleton()->material_set_param(_get_material(), "dither_strength", dither_strength); + RS::get_singleton()->material_set_param(_get_material(), "dither_strength", dither_strength); } float PhysicalSkyMaterial::get_dither_strength() const { @@ -604,11 +604,11 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() { code += "\tCOLOR += (hash(EYEDIR * 1741.9782) * 0.08 - 0.04) * 0.008 * dither_strength;\n"; code += "}\n"; - shader = VS::get_singleton()->shader_create(); + shader = RS::get_singleton()->shader_create(); - VS::get_singleton()->shader_set_code(shader, code); + RS::get_singleton()->shader_set_code(shader, code); - VS::get_singleton()->material_set_shader(_get_material(), shader); + RS::get_singleton()->material_set_shader(_get_material(), shader); set_rayleigh_coefficient(2.0); set_rayleigh_color(Color(0.056, 0.14, 0.3)); @@ -623,6 +623,6 @@ PhysicalSkyMaterial::PhysicalSkyMaterial() { } PhysicalSkyMaterial::~PhysicalSkyMaterial() { - VS::get_singleton()->free(shader); - VS::get_singleton()->material_set_shader(_get_material(), RID()); + RS::get_singleton()->free(shader); + RS::get_singleton()->material_set_shader(_get_material(), RID()); } diff --git a/scene/resources/sphere_shape_3d.cpp b/scene/resources/sphere_shape_3d.cpp index 46f7c96ce1..153db4c291 100644 --- a/scene/resources/sphere_shape_3d.cpp +++ b/scene/resources/sphere_shape_3d.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "sphere_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> SphereShape3D::get_debug_mesh_lines() { @@ -61,7 +61,7 @@ real_t SphereShape3D::get_enclosing_radius() const { void SphereShape3D::_update_shape() { - PhysicsServer::get_singleton()->shape_set_data(get_shape(), radius); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), radius); Shape3D::_update_shape(); } @@ -87,7 +87,7 @@ void SphereShape3D::_bind_methods() { } SphereShape3D::SphereShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_SPHERE)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_SPHERE)) { set_radius(1.0); } diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 0cd2bed71d..56fb5d441f 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -202,7 +202,7 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { if (normal_map.is_valid()) normal_rid = normal_map->get_rid(); - VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NinePatchAxisMode(axis_h), VS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid); + RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid); } void StyleBoxTexture::set_draw_center(bool p_enabled) { @@ -853,7 +853,7 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { } //DRAWING - VisualServer *vs = VisualServer::get_singleton(); + RenderingServer *vs = RenderingServer::get_singleton(); vs->canvas_item_add_triangle_array(p_canvas_item, indices, verts, colors, uvs); } @@ -1050,7 +1050,7 @@ Size2 StyleBoxLine::get_center_size() const { } void StyleBoxLine::draw(RID p_canvas_item, const Rect2 &p_rect) const { - VisualServer *vs = VisualServer::get_singleton(); + RenderingServer *vs = RenderingServer::get_singleton(); Rect2i r = p_rect; if (vertical) { diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index 1aa1a00c55..f19b93d00d 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -33,7 +33,7 @@ #include "core/resource.h" #include "scene/resources/texture.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class CanvasItem; diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index fa177d03fb..fee6bd1b54 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -519,7 +519,7 @@ void SurfaceTool::deindex() { void SurfaceTool::_create_list(const Ref<Mesh> &p_existing, int p_surface, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) { Array arr = p_existing->surface_get_arrays(p_surface); - ERR_FAIL_COND(arr.size() != VS::ARRAY_MAX); + ERR_FAIL_COND(arr.size() != RS::ARRAY_MAX); _create_list_from_arrays(arr, r_vertex, r_index, lformat); } @@ -527,14 +527,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array Vector<SurfaceTool::Vertex> ret; - Vector<Vector3> varr = p_arrays[VS::ARRAY_VERTEX]; - Vector<Vector3> narr = p_arrays[VS::ARRAY_NORMAL]; - Vector<float> tarr = p_arrays[VS::ARRAY_TANGENT]; - Vector<Color> carr = p_arrays[VS::ARRAY_COLOR]; - Vector<Vector2> uvarr = p_arrays[VS::ARRAY_TEX_UV]; - Vector<Vector2> uv2arr = p_arrays[VS::ARRAY_TEX_UV2]; - Vector<int> barr = p_arrays[VS::ARRAY_BONES]; - Vector<float> warr = p_arrays[VS::ARRAY_WEIGHTS]; + Vector<Vector3> varr = p_arrays[RS::ARRAY_VERTEX]; + Vector<Vector3> narr = p_arrays[RS::ARRAY_NORMAL]; + Vector<float> tarr = p_arrays[RS::ARRAY_TANGENT]; + Vector<Color> carr = p_arrays[RS::ARRAY_COLOR]; + Vector<Vector2> uvarr = p_arrays[RS::ARRAY_TEX_UV]; + Vector<Vector2> uv2arr = p_arrays[RS::ARRAY_TEX_UV2]; + Vector<int> barr = p_arrays[RS::ARRAY_BONES]; + Vector<float> warr = p_arrays[RS::ARRAY_WEIGHTS]; int vc = varr.size(); if (vc == 0) @@ -542,48 +542,48 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array int lformat = 0; if (varr.size()) { - lformat |= VS::ARRAY_FORMAT_VERTEX; + lformat |= RS::ARRAY_FORMAT_VERTEX; } if (narr.size()) { - lformat |= VS::ARRAY_FORMAT_NORMAL; + lformat |= RS::ARRAY_FORMAT_NORMAL; } if (tarr.size()) { - lformat |= VS::ARRAY_FORMAT_TANGENT; + lformat |= RS::ARRAY_FORMAT_TANGENT; } if (carr.size()) { - lformat |= VS::ARRAY_FORMAT_COLOR; + lformat |= RS::ARRAY_FORMAT_COLOR; } if (uvarr.size()) { - lformat |= VS::ARRAY_FORMAT_TEX_UV; + lformat |= RS::ARRAY_FORMAT_TEX_UV; } if (uv2arr.size()) { - lformat |= VS::ARRAY_FORMAT_TEX_UV2; + lformat |= RS::ARRAY_FORMAT_TEX_UV2; } if (barr.size()) { - lformat |= VS::ARRAY_FORMAT_BONES; + lformat |= RS::ARRAY_FORMAT_BONES; } if (warr.size()) { - lformat |= VS::ARRAY_FORMAT_WEIGHTS; + lformat |= RS::ARRAY_FORMAT_WEIGHTS; } for (int i = 0; i < vc; i++) { Vertex v; - if (lformat & VS::ARRAY_FORMAT_VERTEX) + if (lformat & RS::ARRAY_FORMAT_VERTEX) v.vertex = varr[i]; - if (lformat & VS::ARRAY_FORMAT_NORMAL) + if (lformat & RS::ARRAY_FORMAT_NORMAL) v.normal = narr[i]; - if (lformat & VS::ARRAY_FORMAT_TANGENT) { + if (lformat & RS::ARRAY_FORMAT_TANGENT) { Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]); v.tangent = p.normal; v.binormal = p.normal.cross(v.tangent).normalized() * p.d; } - if (lformat & VS::ARRAY_FORMAT_COLOR) + if (lformat & RS::ARRAY_FORMAT_COLOR) v.color = carr[i]; - if (lformat & VS::ARRAY_FORMAT_TEX_UV) + if (lformat & RS::ARRAY_FORMAT_TEX_UV) v.uv = uvarr[i]; - if (lformat & VS::ARRAY_FORMAT_TEX_UV2) + if (lformat & RS::ARRAY_FORMAT_TEX_UV2) v.uv2 = uv2arr[i]; - if (lformat & VS::ARRAY_FORMAT_BONES) { + if (lformat & RS::ARRAY_FORMAT_BONES) { Vector<int> b; b.resize(4); b.write[0] = barr[i * 4 + 0]; @@ -592,7 +592,7 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array b.write[3] = barr[i * 4 + 3]; v.bones = b; } - if (lformat & VS::ARRAY_FORMAT_WEIGHTS) { + if (lformat & RS::ARRAY_FORMAT_WEIGHTS) { Vector<float> w; w.resize(4); w.write[0] = warr[i * 4 + 0]; @@ -610,14 +610,14 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, List<int> *r_index, int &lformat) { - Vector<Vector3> varr = arr[VS::ARRAY_VERTEX]; - Vector<Vector3> narr = arr[VS::ARRAY_NORMAL]; - Vector<float> tarr = arr[VS::ARRAY_TANGENT]; - Vector<Color> carr = arr[VS::ARRAY_COLOR]; - Vector<Vector2> uvarr = arr[VS::ARRAY_TEX_UV]; - Vector<Vector2> uv2arr = arr[VS::ARRAY_TEX_UV2]; - Vector<int> barr = arr[VS::ARRAY_BONES]; - Vector<float> warr = arr[VS::ARRAY_WEIGHTS]; + Vector<Vector3> varr = arr[RS::ARRAY_VERTEX]; + Vector<Vector3> narr = arr[RS::ARRAY_NORMAL]; + Vector<float> tarr = arr[RS::ARRAY_TANGENT]; + Vector<Color> carr = arr[RS::ARRAY_COLOR]; + Vector<Vector2> uvarr = arr[RS::ARRAY_TEX_UV]; + Vector<Vector2> uv2arr = arr[RS::ARRAY_TEX_UV2]; + Vector<int> barr = arr[RS::ARRAY_BONES]; + Vector<float> warr = arr[RS::ARRAY_WEIGHTS]; int vc = varr.size(); if (vc == 0) @@ -625,48 +625,48 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li lformat = 0; if (varr.size()) { - lformat |= VS::ARRAY_FORMAT_VERTEX; + lformat |= RS::ARRAY_FORMAT_VERTEX; } if (narr.size()) { - lformat |= VS::ARRAY_FORMAT_NORMAL; + lformat |= RS::ARRAY_FORMAT_NORMAL; } if (tarr.size()) { - lformat |= VS::ARRAY_FORMAT_TANGENT; + lformat |= RS::ARRAY_FORMAT_TANGENT; } if (carr.size()) { - lformat |= VS::ARRAY_FORMAT_COLOR; + lformat |= RS::ARRAY_FORMAT_COLOR; } if (uvarr.size()) { - lformat |= VS::ARRAY_FORMAT_TEX_UV; + lformat |= RS::ARRAY_FORMAT_TEX_UV; } if (uv2arr.size()) { - lformat |= VS::ARRAY_FORMAT_TEX_UV2; + lformat |= RS::ARRAY_FORMAT_TEX_UV2; } if (barr.size()) { - lformat |= VS::ARRAY_FORMAT_BONES; + lformat |= RS::ARRAY_FORMAT_BONES; } if (warr.size()) { - lformat |= VS::ARRAY_FORMAT_WEIGHTS; + lformat |= RS::ARRAY_FORMAT_WEIGHTS; } for (int i = 0; i < vc; i++) { Vertex v; - if (lformat & VS::ARRAY_FORMAT_VERTEX) + if (lformat & RS::ARRAY_FORMAT_VERTEX) v.vertex = varr[i]; - if (lformat & VS::ARRAY_FORMAT_NORMAL) + if (lformat & RS::ARRAY_FORMAT_NORMAL) v.normal = narr[i]; - if (lformat & VS::ARRAY_FORMAT_TANGENT) { + if (lformat & RS::ARRAY_FORMAT_TANGENT) { Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]); v.tangent = p.normal; v.binormal = p.normal.cross(v.tangent).normalized() * p.d; } - if (lformat & VS::ARRAY_FORMAT_COLOR) + if (lformat & RS::ARRAY_FORMAT_COLOR) v.color = carr[i]; - if (lformat & VS::ARRAY_FORMAT_TEX_UV) + if (lformat & RS::ARRAY_FORMAT_TEX_UV) v.uv = uvarr[i]; - if (lformat & VS::ARRAY_FORMAT_TEX_UV2) + if (lformat & RS::ARRAY_FORMAT_TEX_UV2) v.uv2 = uv2arr[i]; - if (lformat & VS::ARRAY_FORMAT_BONES) { + if (lformat & RS::ARRAY_FORMAT_BONES) { Vector<int> b; b.resize(4); b.write[0] = barr[i * 4 + 0]; @@ -675,7 +675,7 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li b.write[3] = barr[i * 4 + 3]; v.bones = b; } - if (lformat & VS::ARRAY_FORMAT_WEIGHTS) { + if (lformat & RS::ARRAY_FORMAT_WEIGHTS) { Vector<float> w; w.resize(4); w.write[0] = warr[i * 4 + 0]; @@ -690,11 +690,11 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li //indices - Vector<int> idx = arr[VS::ARRAY_INDEX]; + Vector<int> idx = arr[RS::ARRAY_INDEX]; int is = idx.size(); if (is) { - lformat |= VS::ARRAY_FORMAT_INDEX; + lformat |= RS::ARRAY_FORMAT_INDEX; const int *iarr = idx.ptr(); for (int i = 0; i < is; i++) { r_index->push_back(iarr[i]); @@ -733,7 +733,7 @@ void SurfaceTool::create_from_blend_shape(const Ref<Mesh> &p_existing, int p_sur ERR_FAIL_COND(shape_idx == -1); ERR_FAIL_COND(shape_idx >= arr.size()); Array mesh = arr[shape_idx]; - ERR_FAIL_COND(mesh.size() != VS::ARRAY_MAX); + ERR_FAIL_COND(mesh.size() != RS::ARRAY_MAX); _create_list_from_arrays(arr[shape_idx], &vertex_array, &index_array, format); } @@ -755,10 +755,10 @@ void SurfaceTool::append_from(const Ref<Mesh> &p_existing, int p_surface, const Vertex v = E->get(); v.vertex = p_xform.xform(v.vertex); - if (nformat & VS::ARRAY_FORMAT_NORMAL) { + if (nformat & RS::ARRAY_FORMAT_NORMAL) { v.normal = p_xform.basis.xform(v.normal); } - if (nformat & VS::ARRAY_FORMAT_TANGENT) { + if (nformat & RS::ARRAY_FORMAT_TANGENT) { v.tangent = p_xform.basis.xform(v.tangent); v.binormal = p_xform.basis.xform(v.binormal); } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 1c5b2abad2..74b6a16d41 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -47,25 +47,25 @@ bool Texture2D::is_pixel_opaque(int p_x, int p_y) const { return true; } -void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, get_size()), get_rid(), false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, get_size()), get_rid(), false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void Texture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void Texture2D::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, get_rid(), p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, get_rid(), p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void Texture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void Texture2D::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, get_rid(), p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, get_rid(), p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); } bool Texture2D::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const { @@ -82,9 +82,9 @@ void Texture2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_height"), &Texture2D::get_height); ClassDB::bind_method(D_METHOD("get_size"), &Texture2D::get_size); ClassDB::bind_method(D_METHOD("has_alpha"), &Texture2D::has_alpha); - ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT)); - ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT)); - ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat", "clip_uv"), &Texture2D::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("draw", "canvas_item", "position", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT)); + ClassDB::bind_method(D_METHOD("draw_rect", "canvas_item", "rect", "tile", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat"), &Texture2D::draw_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT)); + ClassDB::bind_method(D_METHOD("draw_rect_region", "canvas_item", "rect", "src_rect", "modulate", "transpose", "normal_map", "specular_map", "specular_color_shininess", "texture_filter", "texture_repeat", "clip_uv"), &Texture2D::draw_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Color(1, 1, 1, 1)), DEFVAL(RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT), DEFVAL(RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT), DEFVAL(true)); ClassDB::bind_method(D_METHOD("get_data"), &Texture2D::get_data); ADD_GROUP("", ""); @@ -121,7 +121,7 @@ bool ImageTexture::_set(const StringName &p_name, const Variant &p_value) { Size2 s = p_value; w = s.width; h = s.height; - VisualServer::get_singleton()->texture_set_size_override(texture, w, h); + RenderingServer::get_singleton()->texture_set_size_override(texture, w, h); } else return false; @@ -158,8 +158,8 @@ void ImageTexture::_reload_hook(const RID &p_hook) { ERR_FAIL_COND_MSG(err != OK, "Cannot load image from path '" + path + "'."); - RID new_texture = VisualServer::get_singleton()->texture_2d_create(img); - VisualServer::get_singleton()->texture_replace(texture, new_texture); + RID new_texture = RenderingServer::get_singleton()->texture_2d_create(img); + RenderingServer::get_singleton()->texture_replace(texture, new_texture); _change_notify(); emit_changed(); @@ -174,10 +174,10 @@ void ImageTexture::create_from_image(const Ref<Image> &p_image) { mipmaps = p_image->has_mipmaps(); if (texture.is_null()) { - texture = VisualServer::get_singleton()->texture_2d_create(p_image); + texture = RenderingServer::get_singleton()->texture_2d_create(p_image); } else { - RID new_texture = VisualServer::get_singleton()->texture_2d_create(p_image); - VisualServer::get_singleton()->texture_replace(texture, new_texture); + RID new_texture = RenderingServer::get_singleton()->texture_2d_create(p_image); + RenderingServer::get_singleton()->texture_replace(texture, new_texture); } _change_notify(); emit_changed(); @@ -199,9 +199,9 @@ void ImageTexture::update(const Ref<Image> &p_image, bool p_immediate) { ERR_FAIL_COND(mipmaps != p_image->has_mipmaps()); if (p_immediate) { - VisualServer::get_singleton()->texture_2d_update_immediate(texture, p_image); + RenderingServer::get_singleton()->texture_2d_update_immediate(texture, p_image); } else { - VisualServer::get_singleton()->texture_2d_update(texture, p_image); + RenderingServer::get_singleton()->texture_2d_update(texture, p_image); } _change_notify(); @@ -219,7 +219,7 @@ void ImageTexture::_resource_path_changed() { Ref<Image> ImageTexture::get_data() const { if (image_stored) { - return VisualServer::get_singleton()->texture_2d_get(texture); + return RenderingServer::get_singleton()->texture_2d_get(texture); } else { return Ref<Image>(); } @@ -239,7 +239,7 @@ RID ImageTexture::get_rid() const { if (texture.is_null()) { //we are in trouble, create something temporary - texture = VisualServer::get_singleton()->texture_2d_placeholder_create(); + texture = RenderingServer::get_singleton()->texture_2d_placeholder_create(); } return texture; } @@ -249,29 +249,29 @@ bool ImageTexture::has_alpha() const { return (format == Image::FORMAT_LA8 || format == Image::FORMAT_RGBA8); } -void ImageTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void ImageTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void ImageTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void ImageTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void ImageTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void ImageTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); } bool ImageTexture::is_pixel_opaque(int p_x, int p_y) const { @@ -316,13 +316,13 @@ void ImageTexture::set_size_override(const Size2 &p_size) { w = s.x; if (s.y != 0) h = s.y; - VisualServer::get_singleton()->texture_set_size_override(texture, w, h); + RenderingServer::get_singleton()->texture_set_size_override(texture, w, h); } void ImageTexture::set_path(const String &p_path, bool p_take_over) { if (texture.is_valid()) { - VisualServer::get_singleton()->texture_set_path(texture, p_path); + RenderingServer::get_singleton()->texture_set_path(texture, p_path); } Resource::set_path(p_path, p_take_over); @@ -349,7 +349,7 @@ ImageTexture::ImageTexture() { ImageTexture::~ImageTexture() { if (texture.is_valid()) { - VisualServer::get_singleton()->free(texture); + RenderingServer::get_singleton()->free(texture); } } @@ -495,7 +495,7 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) void StreamTexture::set_path(const String &p_path, bool p_take_over) { if (texture.is_valid()) { - VisualServer::get_singleton()->texture_set_path(texture, p_path); + RenderingServer::get_singleton()->texture_set_path(texture, p_path); } Resource::set_path(p_path, p_take_over); @@ -509,7 +509,7 @@ void StreamTexture::_requested_3d(void *p_ud) { request_3d_callback(stex); } -void StreamTexture::_requested_roughness(void *p_ud, const String &p_normal_path, VS::TextureDetectRoughnessChannel p_roughness_channel) { +void StreamTexture::_requested_roughness(void *p_ud, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_roughness_channel) { StreamTexture *st = (StreamTexture *)p_ud; Ref<StreamTexture> stex(st); @@ -611,13 +611,13 @@ Error StreamTexture::load(const String &p_path) { return err; if (texture.is_valid()) { - RID new_texture = VS::get_singleton()->texture_2d_create(image); - VS::get_singleton()->texture_replace(texture, new_texture); + RID new_texture = RS::get_singleton()->texture_2d_create(image); + RS::get_singleton()->texture_replace(texture, new_texture); } else { - texture = VS::get_singleton()->texture_2d_create(image); + texture = RS::get_singleton()->texture_2d_create(image); } if (lwc || lhc) { - VS::get_singleton()->texture_set_size_override(texture, lwc, lhc); + RS::get_singleton()->texture_set_size_override(texture, lwc, lhc); } w = lwc ? lwc : lw; @@ -627,33 +627,33 @@ Error StreamTexture::load(const String &p_path) { if (get_path() == String()) { //temporarily set path if no path set for resource, helps find errors - VisualServer::get_singleton()->texture_set_path(texture, p_path); + RenderingServer::get_singleton()->texture_set_path(texture, p_path); } #ifdef TOOLS_ENABLED if (request_3d) { //print_line("request detect 3D at " + p_path); - VS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this); + RS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this); } else { //print_line("not requesting detect 3D at " + p_path); - VS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL); } if (request_roughness) { //print_line("request detect srgb at " + p_path); - VS::get_singleton()->texture_set_detect_roughness_callback(texture, _requested_roughness, this); + RS::get_singleton()->texture_set_detect_roughness_callback(texture, _requested_roughness, this); } else { //print_line("not requesting detect srgb at " + p_path); - VS::get_singleton()->texture_set_detect_roughness_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_roughness_callback(texture, NULL, NULL); } if (request_normal) { //print_line("request detect srgb at " + p_path); - VS::get_singleton()->texture_set_detect_normal_callback(texture, _requested_normal, this); + RS::get_singleton()->texture_set_detect_normal_callback(texture, _requested_normal, this); } else { //print_line("not requesting detect normal at " + p_path); - VS::get_singleton()->texture_set_detect_normal_callback(texture, NULL, NULL); + RS::get_singleton()->texture_set_detect_normal_callback(texture, NULL, NULL); } #endif @@ -677,34 +677,34 @@ int StreamTexture::get_height() const { RID StreamTexture::get_rid() const { if (!texture.is_valid()) { - texture = VS::get_singleton()->texture_2d_placeholder_create(); + texture = RS::get_singleton()->texture_2d_placeholder_create(); } return texture; } -void StreamTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void StreamTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, Rect2(p_pos, Size2(w, h)), texture, false, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void StreamTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void StreamTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item, p_rect, texture, p_tile, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void StreamTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void StreamTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { if ((w | h) == 0) return; RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, p_rect, texture, p_src_rect, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, p_clip_uv, p_texture_filter, p_texture_repeat); } bool StreamTexture::has_alpha() const { @@ -715,7 +715,7 @@ bool StreamTexture::has_alpha() const { Ref<Image> StreamTexture::get_data() const { if (texture.is_valid()) { - return VS::get_singleton()->texture_2d_get(texture); + return RS::get_singleton()->texture_2d_get(texture); } else { return Ref<Image>(); } @@ -792,7 +792,7 @@ StreamTexture::StreamTexture() { StreamTexture::~StreamTexture() { if (texture.is_valid()) { - VS::get_singleton()->free(texture); + RS::get_singleton()->free(texture); } } @@ -935,7 +935,7 @@ void AtlasTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_clip"), "set_filter_clip", "has_filter_clip"); } -void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if (!atlas.is_valid()) return; @@ -952,10 +952,10 @@ void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_m RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); + RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); } -void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if (!atlas.is_valid()) return; @@ -975,9 +975,9 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); + RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); } -void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { //this might not necessarily work well if using a rect, needs to be fixed properly if (!atlas.is_valid()) @@ -989,7 +989,7 @@ void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); + RS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose, normal_rid, specular_rid, p_specular_color_shininess, filter_clip, p_texture_filter, p_texture_repeat); } bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const { @@ -1087,7 +1087,7 @@ Ref<Texture2D> MeshTexture::get_base_texture() const { return base_texture; } -void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if (mesh.is_null() || base_texture.is_null()) { return; @@ -1100,9 +1100,9 @@ void MeshTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_mo } RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { if (mesh.is_null() || base_texture.is_null()) { return; } @@ -1123,9 +1123,9 @@ void MeshTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, } RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } -void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { if (mesh.is_null() || base_texture.is_null()) { return; @@ -1147,7 +1147,7 @@ void MeshTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const } RID normal_rid = p_normal_map.is_valid() ? p_normal_map->get_rid() : RID(); RID specular_rid = p_specular_map.is_valid() ? p_specular_map->get_rid() : RID(); - VisualServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); + RenderingServer::get_singleton()->canvas_item_add_mesh(p_canvas_item, mesh->get_rid(), xform, p_modulate, base_texture->get_rid(), normal_rid, specular_rid, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } bool MeshTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const { r_rect = p_rect; @@ -1300,7 +1300,7 @@ void LargeTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); } -void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { for (int i = 0; i < pieces.size(); i++) { @@ -1309,7 +1309,7 @@ void LargeTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_m } } -void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat) const { +void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat) const { //tiling not supported for this if (size.x == 0 || size.y == 0) @@ -1323,7 +1323,7 @@ void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.position, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose, p_normal_map, p_specular_map, p_specular_color_shininess, p_texture_filter, p_texture_repeat); } } -void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, VS::CanvasItemTextureFilter p_texture_filter, VS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { +void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, const Ref<Texture2D> &p_normal_map, const Ref<Texture2D> &p_specular_map, const Color &p_specular_color_shininess, RS::CanvasItemTextureFilter p_texture_filter, RS::CanvasItemTextureRepeat p_texture_repeat, bool p_clip_uv) const { //tiling not supported for this if (p_src_rect.size.x == 0 || p_src_rect.size.y == 0) @@ -1445,10 +1445,10 @@ void CurveTexture::_update() { Ref<Image> image = memnew(Image(_width, 1, false, Image::FORMAT_RF, data)); if (_texture.is_valid()) { - RID new_texture = VS::get_singleton()->texture_2d_create(image); - VS::get_singleton()->texture_replace(_texture, new_texture); + RID new_texture = RS::get_singleton()->texture_2d_create(image); + RS::get_singleton()->texture_replace(_texture, new_texture); } else { - _texture = VS::get_singleton()->texture_2d_create(image); + _texture = RS::get_singleton()->texture_2d_create(image); } emit_changed(); @@ -1462,7 +1462,7 @@ Ref<Curve> CurveTexture::get_curve() const { RID CurveTexture::get_rid() const { if (!_texture.is_valid()) { - _texture = VS::get_singleton()->texture_2d_placeholder_create(); + _texture = RS::get_singleton()->texture_2d_placeholder_create(); } return _texture; } @@ -1472,7 +1472,7 @@ CurveTexture::CurveTexture() { } CurveTexture::~CurveTexture() { if (_texture.is_valid()) { - VS::get_singleton()->free(_texture); + RS::get_singleton()->free(_texture); } } ////////////////// @@ -1492,7 +1492,7 @@ GradientTexture::GradientTexture() { GradientTexture::~GradientTexture() { if (texture.is_valid()) { - VS::get_singleton()->free(texture); + RS::get_singleton()->free(texture); } } @@ -1564,10 +1564,10 @@ void GradientTexture::_update() { Ref<Image> image = memnew(Image(width, 1, false, Image::FORMAT_RGBA8, data)); if (texture.is_valid()) { - RID new_texture = VS::get_singleton()->texture_2d_create(image); - VS::get_singleton()->texture_replace(texture, new_texture); + RID new_texture = RS::get_singleton()->texture_2d_create(image); + RS::get_singleton()->texture_replace(texture, new_texture); } else { - texture = VS::get_singleton()->texture_2d_create(image); + texture = RS::get_singleton()->texture_2d_create(image); } emit_changed(); @@ -1587,7 +1587,7 @@ Ref<Image> GradientTexture::get_data() const { if (!texture.is_valid()) { return Ref<Image>(); } - return VisualServer::get_singleton()->texture_2d_get(texture); + return RenderingServer::get_singleton()->texture_2d_get(texture); } ////////////////////////////////////// @@ -1607,13 +1607,13 @@ void ProxyTexture::set_base(const Ref<Texture2D> &p_texture) { base = p_texture; if (base.is_valid()) { if (proxy_ph.is_valid()) { - VS::get_singleton()->texture_proxy_update(proxy, base->get_rid()); - VS::get_singleton()->free(proxy_ph); + RS::get_singleton()->texture_proxy_update(proxy, base->get_rid()); + RS::get_singleton()->free(proxy_ph); proxy_ph = RID(); } else if (proxy.is_valid()) { - VS::get_singleton()->texture_proxy_update(proxy, base->get_rid()); + RS::get_singleton()->texture_proxy_update(proxy, base->get_rid()); } else { - proxy = VS::get_singleton()->texture_proxy_create(base->get_rid()); + proxy = RS::get_singleton()->texture_proxy_create(base->get_rid()); } } } @@ -1638,8 +1638,8 @@ int ProxyTexture::get_height() const { RID ProxyTexture::get_rid() const { if (proxy.is_null()) { - proxy_ph = VS::get_singleton()->texture_2d_placeholder_create(); - proxy = VS::get_singleton()->texture_proxy_create(proxy_ph); + proxy_ph = RS::get_singleton()->texture_2d_placeholder_create(); + proxy = RS::get_singleton()->texture_proxy_create(proxy_ph); } return proxy; } @@ -1653,16 +1653,16 @@ bool ProxyTexture::has_alpha() const { ProxyTexture::ProxyTexture() { - //proxy = VS::get_singleton()->texture_create(); + //proxy = RS::get_singleton()->texture_create(); } ProxyTexture::~ProxyTexture() { if (proxy_ph.is_valid()) { - VS::get_singleton()->free(proxy_ph); + RS::get_singleton()->free(proxy_ph); } if (proxy.is_valid()) { - VS::get_singleton()->free(proxy); + RS::get_singleton()->free(proxy); } } ////////////////////////////////////////////// @@ -1708,7 +1708,7 @@ void AnimatedTexture::_update_proxy() { } if (frames[current_frame].texture.is_valid()) { - VisualServer::get_singleton()->texture_proxy_update(proxy, frames[current_frame].texture->get_rid()); + RenderingServer::get_singleton()->texture_proxy_update(proxy, frames[current_frame].texture->get_rid()); } } @@ -1854,17 +1854,17 @@ void AnimatedTexture::_bind_methods() { } AnimatedTexture::AnimatedTexture() { - //proxy = VS::get_singleton()->texture_create(); - proxy_ph = VS::get_singleton()->texture_2d_placeholder_create(); - proxy = VS::get_singleton()->texture_proxy_create(proxy_ph); + //proxy = RS::get_singleton()->texture_create(); + proxy_ph = RS::get_singleton()->texture_2d_placeholder_create(); + proxy = RS::get_singleton()->texture_proxy_create(proxy_ph); - VisualServer::get_singleton()->texture_set_force_redraw_if_visible(proxy, true); + RenderingServer::get_singleton()->texture_set_force_redraw_if_visible(proxy, true); time = 0; frame_count = 1; fps = 4; prev_ticks = 0; current_frame = 0; - VisualServer::get_singleton()->connect("frame_pre_draw", callable_mp(this, &AnimatedTexture::_update_proxy)); + RenderingServer::get_singleton()->connect("frame_pre_draw", callable_mp(this, &AnimatedTexture::_update_proxy)); #ifndef NO_THREADS rw_lock = RWLock::create(); @@ -1874,8 +1874,8 @@ AnimatedTexture::AnimatedTexture() { } AnimatedTexture::~AnimatedTexture() { - VS::get_singleton()->free(proxy); - VS::get_singleton()->free(proxy_ph); + RS::get_singleton()->free(proxy); + RS::get_singleton()->free(proxy_ph); if (rw_lock) { memdelete(rw_lock); } @@ -1921,10 +1921,10 @@ Error TextureLayered::create_from_images(Vector<Ref<Image>> p_images) { int new_layers = p_images.size(); ERR_FAIL_COND_V(new_layers == 0, ERR_INVALID_PARAMETER); - if (layered_type == VS::TEXTURE_LAYERED_CUBEMAP) { + if (layered_type == RS::TEXTURE_LAYERED_CUBEMAP) { ERR_FAIL_COND_V_MSG(new_layers != 6, ERR_INVALID_PARAMETER, "Cubemaps require exactly 6 layers"); - } else if (layered_type == VS::TEXTURE_LAYERED_CUBEMAP_ARRAY) { + } else if (layered_type == RS::TEXTURE_LAYERED_CUBEMAP_ARRAY) { ERR_FAIL_COND_V_MSG((new_layers % 6) != 0, ERR_INVALID_PARAMETER, "Cubemap array layers must be a multiple of 6"); } @@ -1946,11 +1946,11 @@ Error TextureLayered::create_from_images(Vector<Ref<Image>> p_images) { } if (texture.is_valid()) { - RID new_texture = VS::get_singleton()->texture_2d_layered_create(p_images, layered_type); + RID new_texture = RS::get_singleton()->texture_2d_layered_create(p_images, layered_type); ERR_FAIL_COND_V(!new_texture.is_valid(), ERR_CANT_CREATE); - VS::get_singleton()->texture_replace(texture, new_texture); + RS::get_singleton()->texture_replace(texture, new_texture); } else { - texture = VS::get_singleton()->texture_2d_layered_create(p_images, layered_type); + texture = RS::get_singleton()->texture_2d_layered_create(p_images, layered_type); ERR_FAIL_COND_V(!texture.is_valid(), ERR_CANT_CREATE); } @@ -1969,24 +1969,24 @@ void TextureLayered::update_layer(const Ref<Image> &p_image, int p_layer) { ERR_FAIL_COND(p_image->get_width() != width || p_image->get_height() != height); ERR_FAIL_INDEX(p_layer, layers); ERR_FAIL_COND(p_image->has_mipmaps() != mipmaps); - VS::get_singleton()->texture_2d_update(texture, p_image, p_layer); + RS::get_singleton()->texture_2d_update(texture, p_image, p_layer); } Ref<Image> TextureLayered::get_layer_data(int p_layer) const { ERR_FAIL_INDEX_V(p_layer, layers, Ref<Image>()); - return VS::get_singleton()->texture_2d_layer_get(texture, p_layer); + return RS::get_singleton()->texture_2d_layer_get(texture, p_layer); } RID TextureLayered::get_rid() const { if (texture.is_null()) { - texture = VS::get_singleton()->texture_2d_layered_placeholder_create(); + texture = RS::get_singleton()->texture_2d_layered_placeholder_create(); } return texture; } void TextureLayered::set_path(const String &p_path, bool p_take_over) { if (texture.is_valid()) { - VS::get_singleton()->texture_set_path(texture, p_path); + RS::get_singleton()->texture_set_path(texture, p_path); } Resource::set_path(p_path, p_take_over); @@ -2009,7 +2009,7 @@ void TextureLayered::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_images", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_INTERNAL), "create_from_images", "_get_images"); } -TextureLayered::TextureLayered(VisualServer::TextureLayeredType p_layered_type) { +TextureLayered::TextureLayered(RenderingServer::TextureLayeredType p_layered_type) { layered_type = p_layered_type; format = Image::FORMAT_MAX; @@ -2020,7 +2020,7 @@ TextureLayered::TextureLayered(VisualServer::TextureLayeredType p_layered_type) TextureLayered::~TextureLayered() { if (texture.is_valid()) { - VS::get_singleton()->free(texture); + RS::get_singleton()->free(texture); } } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 1fb8742cec..c3bbbd5ee6 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -41,7 +41,7 @@ #include "scene/resources/curve.h" #include "scene/resources/gradient.h" #include "servers/camera_server.h" -#include "servers/visual_server.h" +#include "servers/rendering_server.h" class Texture : public Resource { GDCLASS(Texture, Resource); @@ -68,9 +68,9 @@ public: virtual bool has_alpha() const = 0; - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; virtual Ref<Image> get_data() const { return Ref<Image>(); } @@ -118,9 +118,9 @@ public: virtual RID get_rid() const; bool has_alpha() const; - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; bool is_pixel_opaque(int p_x, int p_y) const; @@ -171,7 +171,7 @@ private: virtual void reload_from_file(); static void _requested_3d(void *p_ud); - static void _requested_roughness(void *p_ud, const String &p_normal_path, VS::TextureDetectRoughnessChannel p_roughness_channel); + static void _requested_roughness(void *p_ud, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_roughness_channel); static void _requested_normal(void *p_ud); protected: @@ -182,7 +182,7 @@ public: static Ref<Image> load_image_from_file(FileAccess *p_file, int p_size_limit); typedef void (*TextureFormatRequestCallback)(const Ref<StreamTexture> &); - typedef void (*TextureFormatRoughnessRequestCallback)(const Ref<StreamTexture> &, const String &p_normal_path, VS::TextureDetectRoughnessChannel p_roughness_channel); + typedef void (*TextureFormatRoughnessRequestCallback)(const Ref<StreamTexture> &, const String &p_normal_path, RS::TextureDetectRoughnessChannel p_roughness_channel); static TextureFormatRequestCallback request_3d_callback; static TextureFormatRoughnessRequestCallback request_roughness_callback; @@ -198,9 +198,9 @@ public: virtual void set_path(const String &p_path, bool p_take_over); - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; virtual bool has_alpha() const; bool is_pixel_opaque(int p_x, int p_y) const; @@ -251,9 +251,9 @@ public: void set_filter_clip(const bool p_enable); bool has_filter_clip() const; - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; bool is_pixel_opaque(int p_x, int p_y) const; @@ -291,9 +291,9 @@ public: void set_base_texture(const Ref<Texture2D> &p_texture); Ref<Texture2D> get_base_texture() const; - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; virtual bool get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Rect2 &r_rect, Rect2 &r_src_rect) const; bool is_pixel_opaque(int p_x, int p_y) const; @@ -339,9 +339,9 @@ public: Ref<Texture2D> get_piece_texture(int p_idx) const; Ref<Image> to_image() const; - virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; - virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), VS::CanvasItemTextureFilter p_texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; + virtual void draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) const; + virtual void draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture2D> &p_normal_map = Ref<Texture2D>(), const Ref<Texture2D> &p_specular_map = Ref<Texture2D>(), const Color &p_specular_color_shininess = Color(1, 1, 1, 1), RS::CanvasItemTextureFilter p_texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, bool p_clip_uv = true) const; bool is_pixel_opaque(int p_x, int p_y) const; @@ -352,7 +352,7 @@ class TextureLayered : public Texture { GDCLASS(TextureLayered, Texture); - VS::TextureLayeredType layered_type; + RS::TextureLayeredType layered_type; mutable RID texture; Image::Format format; @@ -383,7 +383,7 @@ public: virtual RID get_rid() const; virtual void set_path(const String &p_path, bool p_take_over = false); - TextureLayered(VS::TextureLayeredType p_layered_type); + TextureLayered(RS::TextureLayeredType p_layered_type); ~TextureLayered(); }; @@ -392,7 +392,7 @@ class Texture2DArray : public TextureLayered { GDCLASS(Texture2DArray, TextureLayered) public: Texture2DArray() : - TextureLayered(VS::TEXTURE_LAYERED_2D_ARRAY) {} + TextureLayered(RS::TEXTURE_LAYERED_2D_ARRAY) {} }; class Cubemap : public TextureLayered { @@ -401,7 +401,7 @@ class Cubemap : public TextureLayered { public: Cubemap() : - TextureLayered(VS::TEXTURE_LAYERED_CUBEMAP) {} + TextureLayered(RS::TEXTURE_LAYERED_CUBEMAP) {} }; class CubemapArray : public TextureLayered { @@ -410,7 +410,7 @@ class CubemapArray : public TextureLayered { public: CubemapArray() : - TextureLayered(VS::TEXTURE_LAYERED_CUBEMAP_ARRAY) {} + TextureLayered(RS::TEXTURE_LAYERED_CUBEMAP_ARRAY) {} }; class ResourceFormatLoaderTextureLayered : public ResourceFormatLoader { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index b312aa054c..27305cfff1 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -362,7 +362,7 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::FLOAT, pre + "shape_one_way_margin", PROPERTY_HINT_RANGE, "0,128,0.01", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "shapes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::INT, pre + "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::INT, pre + "z_index", PROPERTY_HINT_RANGE, itos(RS::CANVAS_ITEM_Z_MIN) + "," + itos(RS::CANVAS_ITEM_Z_MAX) + ",1", PROPERTY_USAGE_NOEDITOR)); } } diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index c4a019c728..c47e80c807 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -31,7 +31,7 @@ #include "visual_shader.h" #include "core/vmap.h" -#include "servers/visual/shader_types.h" +#include "servers/rendering/shader_types.h" #include "visual_shader_nodes.h" bool VisualShaderNode::is_simple_decl() const { @@ -1040,8 +1040,8 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { Map<String, String> blend_mode_enums; Set<String> toggles; - for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode)).size(); i++) { - String mode = ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode))[i]; + for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) { + String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i]; int idx = 0; bool in_enum = false; while (render_mode_enums[idx].string) { @@ -1317,8 +1317,8 @@ void VisualShader::_update_shader() const { int which = modes[render_mode_enums[idx].string]; int count = 0; - for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode)).size(); i++) { - String mode = ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode))[i]; + for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) { + String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i]; if (mode.begins_with(render_mode_enums[idx].string)) { if (count == which) { if (render_mode != String()) { @@ -1336,9 +1336,9 @@ void VisualShader::_update_shader() const { } //fill render mode flags - for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode)).size(); i++) { + for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) { - String mode = ShaderTypes::get_singleton()->get_modes(VisualServer::ShaderMode(shader_mode))[i]; + String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i]; if (flags.has(mode)) { if (render_mode != String()) { render_mode += ", "; @@ -1358,7 +1358,7 @@ void VisualShader::_update_shader() const { String global_expressions; for (int i = 0, index = 0; i < TYPE_MAX; i++) { - if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) { + if (!ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader_mode)).has(func_name[i])) { continue; } @@ -1378,7 +1378,7 @@ void VisualShader::_update_shader() const { for (int i = 0; i < TYPE_MAX; i++) { - if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) { + if (!ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader_mode)).has(func_name[i])) { continue; } @@ -1417,7 +1417,7 @@ void VisualShader::_update_shader() const { final_code += global_expressions; String tcode = code; for (int i = 0; i < TYPE_MAX; i++) { - if (!ShaderTypes::get_singleton()->get_functions(VisualServer::ShaderMode(shader_mode)).has(func_name[i])) { + if (!ShaderTypes::get_singleton()->get_functions(RenderingServer::ShaderMode(shader_mode)).has(func_name[i])) { continue; } tcode = tcode.insert(insertion_pos[i], global_code_per_func[Type(i)]); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 75bdeeac07..ef8067497f 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -34,8 +34,8 @@ #include "scene/2d/camera_2d.h" #include "scene/2d/visibility_notifier_2d.h" #include "scene/main/window.h" -#include "servers/physics_2d_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_2d.h" +#include "servers/rendering_server.h" struct SpatialIndexer2D { @@ -379,30 +379,30 @@ void World2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "Physics2DDirectSpaceState", 0), "", "get_direct_space_state"); } -Physics2DDirectSpaceState *World2D::get_direct_space_state() { +PhysicsDirectSpaceState2D *World2D::get_direct_space_state() { - return Physics2DServer::get_singleton()->space_get_direct_state(space); + return PhysicsServer2D::get_singleton()->space_get_direct_state(space); } World2D::World2D() { - canvas = VisualServer::get_singleton()->canvas_create(); - space = Physics2DServer::get_singleton()->space_create(); + canvas = RenderingServer::get_singleton()->canvas_create(); + space = PhysicsServer2D::get_singleton()->space_create(); //set space2D to be more friendly with pixels than meters, by adjusting some constants - Physics2DServer::get_singleton()->space_set_active(space, true); - Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/2d/default_gravity", 98)); - Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/2d/default_gravity_vector", Vector2(0, 1))); - Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/2d/default_linear_damp", 0.1)); + PhysicsServer2D::get_singleton()->space_set_active(space, true); + PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/2d/default_gravity", 98)); + PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/2d/default_gravity_vector", Vector2(0, 1))); + PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/2d/default_linear_damp", 0.1)); ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_linear_damp", PropertyInfo(Variant::FLOAT, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); - Physics2DServer::get_singleton()->area_set_param(space, Physics2DServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/2d/default_angular_damp", 1.0)); + PhysicsServer2D::get_singleton()->area_set_param(space, PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/2d/default_angular_damp", 1.0)); ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); indexer = memnew(SpatialIndexer2D); } World2D::~World2D() { - VisualServer::get_singleton()->free(canvas); - Physics2DServer::get_singleton()->free(space); + RenderingServer::get_singleton()->free(canvas); + PhysicsServer2D::get_singleton()->free(space); memdelete(indexer); } diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index d837ef58c2..88b4c2594c 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -33,7 +33,7 @@ #include "core/project_settings.h" #include "core/resource.h" -#include "servers/physics_2d_server.h" +#include "servers/physics_server_2d.h" class VisibilityNotifier2D; class Viewport; @@ -67,7 +67,7 @@ public: RID get_canvas(); RID get_space(); - Physics2DDirectSpaceState *get_direct_space_state(); + PhysicsDirectSpaceState2D *get_direct_space_state(); void get_viewport_list(List<Viewport *> *r_viewports); diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp index 0a687af803..8e45b22cbf 100644 --- a/scene/resources/world_3d.cpp +++ b/scene/resources/world_3d.cpp @@ -275,9 +275,9 @@ void World3D::set_environment(const Ref<Environment> &p_environment) { environment = p_environment; if (environment.is_valid()) - VS::get_singleton()->scenario_set_environment(scenario, environment->get_rid()); + RS::get_singleton()->scenario_set_environment(scenario, environment->get_rid()); else - VS::get_singleton()->scenario_set_environment(scenario, RID()); + RS::get_singleton()->scenario_set_environment(scenario, RID()); emit_changed(); } @@ -294,9 +294,9 @@ void World3D::set_fallback_environment(const Ref<Environment> &p_environment) { fallback_environment = p_environment; if (fallback_environment.is_valid()) - VS::get_singleton()->scenario_set_fallback_environment(scenario, p_environment->get_rid()); + RS::get_singleton()->scenario_set_fallback_environment(scenario, p_environment->get_rid()); else - VS::get_singleton()->scenario_set_fallback_environment(scenario, RID()); + RS::get_singleton()->scenario_set_fallback_environment(scenario, RID()); emit_changed(); } @@ -310,9 +310,9 @@ void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { camera_effects = p_camera_effects; if (camera_effects.is_valid()) - VS::get_singleton()->scenario_set_camera_effects(scenario, camera_effects->get_rid()); + RS::get_singleton()->scenario_set_camera_effects(scenario, camera_effects->get_rid()); else - VS::get_singleton()->scenario_set_camera_effects(scenario, RID()); + RS::get_singleton()->scenario_set_camera_effects(scenario, RID()); } Ref<CameraEffects> World3D::get_camera_effects() const { @@ -320,9 +320,9 @@ Ref<CameraEffects> World3D::get_camera_effects() const { return camera_effects; } -PhysicsDirectSpaceState *World3D::get_direct_space_state() { +PhysicsDirectSpaceState3D *World3D::get_direct_space_state() { - return PhysicsServer::get_singleton()->space_get_direct_state(space); + return PhysicsServer3D::get_singleton()->space_get_direct_state(space); } void World3D::get_camera_list(List<Camera3D *> *r_cameras) { @@ -353,15 +353,15 @@ void World3D::_bind_methods() { World3D::World3D() { - space = PhysicsServer::get_singleton()->space_create(); - scenario = VisualServer::get_singleton()->scenario_create(); + space = PhysicsServer3D::get_singleton()->space_create(); + scenario = RenderingServer::get_singleton()->scenario_create(); - PhysicsServer::get_singleton()->space_set_active(space, true); - PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/3d/default_gravity", 9.8)); - PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/3d/default_gravity_vector", Vector3(0, -1, 0))); - PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/3d/default_linear_damp", 0.1)); + PhysicsServer3D::get_singleton()->space_set_active(space, true); + PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_GRAVITY, GLOBAL_DEF("physics/3d/default_gravity", 9.8)); + PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR, GLOBAL_DEF("physics/3d/default_gravity_vector", Vector3(0, -1, 0))); + PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_LINEAR_DAMP, GLOBAL_DEF("physics/3d/default_linear_damp", 0.1)); ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_linear_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); - PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/3d/default_angular_damp", 0.1)); + PhysicsServer3D::get_singleton()->area_set_param(space, PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/3d/default_angular_damp", 0.1)); ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater")); #ifdef _3D_DISABLED @@ -373,8 +373,8 @@ World3D::World3D() { World3D::~World3D() { - PhysicsServer::get_singleton()->free(space); - VisualServer::get_singleton()->free(scenario); + PhysicsServer3D::get_singleton()->free(space); + RenderingServer::get_singleton()->free(scenario); #ifndef _3D_DISABLED memdelete(indexer); diff --git a/scene/resources/world_3d.h b/scene/resources/world_3d.h index 4c18ba9cea..81a27a7349 100644 --- a/scene/resources/world_3d.h +++ b/scene/resources/world_3d.h @@ -33,8 +33,8 @@ #include "core/resource.h" #include "scene/resources/environment.h" -#include "servers/physics_server.h" -#include "servers/visual_server.h" +#include "servers/physics_server_3d.h" +#include "servers/rendering_server.h" class Camera3D; class VisibilityNotifier3D; @@ -82,7 +82,7 @@ public: void get_camera_list(List<Camera3D *> *r_cameras); - PhysicsDirectSpaceState *get_direct_space_state(); + PhysicsDirectSpaceState3D *get_direct_space_state(); World3D(); ~World3D(); diff --git a/scene/resources/world_margin_shape_3d.cpp b/scene/resources/world_margin_shape_3d.cpp index 3bea3111ef..aa96f8aa68 100644 --- a/scene/resources/world_margin_shape_3d.cpp +++ b/scene/resources/world_margin_shape_3d.cpp @@ -30,7 +30,7 @@ #include "world_margin_shape_3d.h" -#include "servers/physics_server.h" +#include "servers/physics_server_3d.h" Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() { @@ -63,7 +63,7 @@ Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() { void WorldMarginShape3D::_update_shape() { - PhysicsServer::get_singleton()->shape_set_data(get_shape(), plane); + PhysicsServer3D::get_singleton()->shape_set_data(get_shape(), plane); Shape3D::_update_shape(); } @@ -89,7 +89,7 @@ void WorldMarginShape3D::_bind_methods() { } WorldMarginShape3D::WorldMarginShape3D() : - Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_PLANE)) { + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_PLANE)) { set_plane(Plane(0, 1, 0, 0)); } |