summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-03-27 15:21:27 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-03-27 15:21:27 -0300
commita6f3bc7c696af03e3875f78e098d2476e409d15e (patch)
treefc1bb58e900436c48c03c52106eb57250442ae35 /servers
parent307b1b3a5835ecdb477859785c673a07e248f904 (diff)
Renaming of servers for coherency.
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
Diffstat (limited to 'servers')
-rw-r--r--servers/SCsub4
-rw-r--r--servers/arvr_server.cpp2
-rw-r--r--servers/camera/camera_feed.cpp28
-rw-r--r--servers/camera/camera_feed.h4
-rw-r--r--servers/camera_server.cpp2
-rw-r--r--servers/display_server.h2
-rw-r--r--servers/navigation_server_2d.cpp (renamed from servers/navigation_2d_server.cpp)164
-rw-r--r--servers/navigation_server_2d.h (renamed from servers/navigation_2d_server.h)14
-rw-r--r--servers/navigation_server_3d.cpp (renamed from servers/navigation_server.cpp)102
-rw-r--r--servers/navigation_server_3d.h (renamed from servers/navigation_server.h)24
-rw-r--r--servers/physics/physics_server_sw.cpp1589
-rw-r--r--servers/physics_2d/area_2d_sw.cpp48
-rw-r--r--servers/physics_2d/area_2d_sw.h14
-rw-r--r--servers/physics_2d/area_pair_2d_sw.cpp8
-rw-r--r--servers/physics_2d/body_2d_sw.cpp148
-rw-r--r--servers/physics_2d/body_2d_sw.h36
-rw-r--r--servers/physics_2d/body_pair_2d_sw.cpp12
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp14
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h2
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp12
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.cpp16
-rw-r--r--servers/physics_2d/joints_2d_sw.cpp24
-rw-r--r--servers/physics_2d/joints_2d_sw.h16
-rw-r--r--servers/physics_2d/physics_server_2d_sw.cpp (renamed from servers/physics_2d/physics_2d_server_sw.cpp)272
-rw-r--r--servers/physics_2d/physics_server_2d_sw.h (renamed from servers/physics_2d/physics_2d_server_sw.h)16
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.cpp (renamed from servers/physics_2d/physics_2d_server_wrap_mt.cpp)32
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.h (renamed from servers/physics_2d/physics_2d_server_wrap_mt.h)24
-rw-r--r--servers/physics_2d/shape_2d_sw.h20
-rw-r--r--servers/physics_2d/space_2d_sw.cpp98
-rw-r--r--servers/physics_2d/space_2d_sw.h12
-rw-r--r--servers/physics_2d/step_2d_sw.cpp6
-rw-r--r--servers/physics_3d/SCsub (renamed from servers/physics/SCsub)0
-rw-r--r--servers/physics_3d/area_3d_sw.cpp (renamed from servers/physics/area_sw.cpp)80
-rw-r--r--servers/physics_3d/area_3d_sw.h (renamed from servers/physics/area_sw.h)62
-rw-r--r--servers/physics_3d/area_pair_3d_sw.cpp (renamed from servers/physics/area_pair_sw.cpp)32
-rw-r--r--servers/physics_3d/area_pair_3d_sw.h (renamed from servers/physics/area_pair_sw.h)26
-rw-r--r--servers/physics_3d/body_3d_sw.cpp (renamed from servers/physics/body_sw.cpp)192
-rw-r--r--servers/physics_3d/body_3d_sw.h (renamed from servers/physics/body_sw.h)90
-rw-r--r--servers/physics_3d/body_pair_3d_sw.cpp (renamed from servers/physics/body_pair_sw.cpp)42
-rw-r--r--servers/physics_3d/body_pair_3d_sw.h (renamed from servers/physics/body_pair_sw.h)20
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.cpp (renamed from servers/physics/broad_phase_basic.cpp)34
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.h (renamed from servers/physics/broad_phase_basic.h)20
-rw-r--r--servers/physics_3d/broad_phase_3d_sw.cpp (renamed from servers/physics/broad_phase_sw.cpp)6
-rw-r--r--servers/physics_3d/broad_phase_3d_sw.h (renamed from servers/physics/broad_phase_sw.h)22
-rw-r--r--servers/physics_3d/broad_phase_octree.cpp (renamed from servers/physics/broad_phase_octree.cpp)22
-rw-r--r--servers/physics_3d/broad_phase_octree.h (renamed from servers/physics/broad_phase_octree.h)22
-rw-r--r--servers/physics_3d/collision_object_3d_sw.cpp (renamed from servers/physics/collision_object_sw.cpp)42
-rw-r--r--servers/physics_3d/collision_object_3d_sw.h (renamed from servers/physics/collision_object_sw.h)38
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.cpp (renamed from servers/physics/collision_solver_sat.cpp)148
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.h (renamed from servers/physics/collision_solver_sat.h)4
-rw-r--r--servers/physics_3d/collision_solver_3d_sw.cpp (renamed from servers/physics/collision_solver_sw.cpp)54
-rw-r--r--servers/physics_3d/collision_solver_3d_sw.h (renamed from servers/physics/collision_solver_sw.h)20
-rw-r--r--servers/physics_3d/constraint_3d_sw.h (renamed from servers/physics/constraint_sw.h)24
-rw-r--r--servers/physics_3d/gjk_epa.cpp (renamed from servers/physics/gjk_epa.cpp)18
-rw-r--r--servers/physics_3d/gjk_epa.h (renamed from servers/physics/gjk_epa.h)8
-rw-r--r--servers/physics_3d/joints/SCsub (renamed from servers/physics/joints/SCsub)0
-rw-r--r--servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp (renamed from servers/physics/joints/cone_twist_joint_sw.cpp)40
-rw-r--r--servers/physics_3d/joints/cone_twist_joint_3d_sw.h (renamed from servers/physics/joints/cone_twist_joint_sw.h)22
-rw-r--r--servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp (renamed from servers/physics/joints/generic_6dof_joint_sw.cpp)176
-rw-r--r--servers/physics_3d/joints/generic_6dof_joint_3d_sw.h (renamed from servers/physics/joints/generic_6dof_joint_sw.h)64
-rw-r--r--servers/physics_3d/joints/hinge_joint_3d_sw.cpp (renamed from servers/physics/joints/hinge_joint_sw.cpp)80
-rw-r--r--servers/physics_3d/joints/hinge_joint_3d_sw.h (renamed from servers/physics/joints/hinge_joint_sw.h)30
-rw-r--r--servers/physics_3d/joints/jacobian_entry_3d_sw.h (renamed from servers/physics/joints/jacobian_entry_sw.h)20
-rw-r--r--servers/physics_3d/joints/pin_joint_3d_sw.cpp (renamed from servers/physics/joints/pin_joint_sw.cpp)30
-rw-r--r--servers/physics_3d/joints/pin_joint_3d_sw.h (renamed from servers/physics/joints/pin_joint_sw.h)24
-rw-r--r--servers/physics_3d/joints/slider_joint_3d_sw.cpp (renamed from servers/physics/joints/slider_joint_sw.cpp)130
-rw-r--r--servers/physics_3d/joints/slider_joint_3d_sw.h (renamed from servers/physics/joints/slider_joint_sw.h)28
-rw-r--r--servers/physics_3d/joints_3d_sw.h (renamed from servers/physics/joints_sw.h)12
-rw-r--r--servers/physics_3d/physics_server_3d_sw.cpp1589
-rw-r--r--servers/physics_3d/physics_server_3d_sw.h (renamed from servers/physics/physics_server_sw.h)48
-rw-r--r--servers/physics_3d/shape_3d_sw.cpp (renamed from servers/physics/shape_sw.cpp)244
-rw-r--r--servers/physics_3d/shape_3d_sw.h (renamed from servers/physics/shape_sw.h)100
-rw-r--r--servers/physics_3d/space_3d_sw.cpp (renamed from servers/physics/space_sw.cpp)310
-rw-r--r--servers/physics_3d/space_3d_sw.h (renamed from servers/physics/space_sw.h)100
-rw-r--r--servers/physics_3d/step_3d_sw.cpp (renamed from servers/physics/step_sw.cpp)78
-rw-r--r--servers/physics_3d/step_3d_sw.h (renamed from servers/physics/step_sw.h)16
-rw-r--r--servers/physics_server_2d.cpp (renamed from servers/physics_2d_server.cpp)446
-rw-r--r--servers/physics_server_2d.h (renamed from servers/physics_2d_server.h)108
-rw-r--r--servers/physics_server_3d.cpp (renamed from servers/physics_server.cpp)452
-rw-r--r--servers/physics_server_3d.h (renamed from servers/physics_server.h)112
-rw-r--r--servers/register_server_types.cpp78
-rw-r--r--servers/rendering/SCsub (renamed from servers/visual/SCsub)0
-rw-r--r--servers/rendering/rasterizer.cpp (renamed from servers/visual/rasterizer.cpp)0
-rw-r--r--servers/rendering/rasterizer.h (renamed from servers/visual/rasterizer.h)132
-rw-r--r--servers/rendering/rasterizer_rd/SCsub (renamed from servers/visual/rasterizer_rd/SCsub)0
-rw-r--r--servers/rendering/rasterizer_rd/cubemap_coeffs.h (renamed from servers/visual/rasterizer_rd/cubemap_coeffs.h)0
-rw-r--r--servers/rendering/rasterizer_rd/light_cluster_builder.cpp (renamed from servers/visual/rasterizer_rd/light_cluster_builder.cpp)0
-rw-r--r--servers/rendering/rasterizer_rd/light_cluster_builder.h (renamed from servers/visual/rasterizer_rd/light_cluster_builder.h)2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp)90
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_canvas_rd.h)30
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp)16
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_effects_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_effects_rd.h)36
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_rd.cpp)0
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_rd.h)8
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp)172
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.h)14
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp)166
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_scene_rd.h)72
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp (renamed from servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp)248
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h (renamed from servers/visual/rasterizer_rd/rasterizer_storage_rd.h)112
-rw-r--r--servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp (renamed from servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp)0
-rw-r--r--servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h (renamed from servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h)2
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.cpp (renamed from servers/visual/rasterizer_rd/shader_compiler_rd.cpp)240
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.h (renamed from servers/visual/rasterizer_rd/shader_compiler_rd.h)8
-rw-r--r--servers/rendering/rasterizer_rd/shader_rd.cpp (renamed from servers/visual/rasterizer_rd/shader_rd.cpp)2
-rw-r--r--servers/rendering/rasterizer_rd/shader_rd.h (renamed from servers/visual/rasterizer_rd/shader_rd.h)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/SCsub (renamed from servers/visual/rasterizer_rd/shaders/SCsub)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/blur.glsl (renamed from servers/visual/rasterizer_rd/shaders/blur.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/blur_inc.glsl (renamed from servers/visual/rasterizer_rd/shaders/blur_inc.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl (renamed from servers/visual/rasterizer_rd/shaders/bokeh_dof.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas.glsl (renamed from servers/visual/rasterizer_rd/shaders/canvas.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl (renamed from servers/visual/rasterizer_rd/shaders/canvas_occlusion.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl (renamed from servers/visual/rasterizer_rd/shaders/canvas_uniforms_inc.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/copy.glsl (renamed from servers/visual/rasterizer_rd/shaders/copy.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl (renamed from servers/visual/rasterizer_rd/shaders/cubemap_downsampler.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl (renamed from servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl (renamed from servers/visual/rasterizer_rd/shaders/cubemap_roughness.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe.glsl (renamed from servers/visual/rasterizer_rd/shaders/giprobe.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl (renamed from servers/visual/rasterizer_rd/shaders/giprobe_debug.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl (renamed from servers/visual/rasterizer_rd/shaders/giprobe_sdf.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl (renamed from servers/visual/rasterizer_rd/shaders/giprobe_write.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl (renamed from servers/visual/rasterizer_rd/shaders/luminance_reduce.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl (renamed from servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl (renamed from servers/visual/rasterizer_rd/shaders/scene_high_end.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl (renamed from servers/visual/rasterizer_rd/shaders/scene_high_end_inc.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sky.glsl (renamed from servers/visual/rasterizer_rd/shaders/sky.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao.glsl (renamed from servers/visual/rasterizer_rd/shaders/ssao.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl (renamed from servers/visual/rasterizer_rd/shaders/ssao_blur.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl (renamed from servers/visual/rasterizer_rd/shaders/ssao_minify.glsl)0
-rw-r--r--servers/rendering/rasterizer_rd/shaders/tonemap.glsl (renamed from servers/visual/rasterizer_rd/shaders/tonemap.glsl)0
-rw-r--r--servers/rendering/rendering_device.cpp (renamed from servers/visual/rendering_device.cpp)0
-rw-r--r--servers/rendering/rendering_device.h (renamed from servers/visual/rendering_device.h)0
-rw-r--r--servers/rendering/rendering_server_canvas.cpp (renamed from servers/visual/visual_server_canvas.cpp)230
-rw-r--r--servers/rendering/rendering_server_canvas.h (renamed from servers/visual/visual_server_canvas.h)52
-rw-r--r--servers/rendering/rendering_server_globals.cpp (renamed from servers/visual/visual_server_globals.cpp)18
-rw-r--r--servers/rendering/rendering_server_globals.h (renamed from servers/visual/visual_server_globals.h)24
-rw-r--r--servers/rendering/rendering_server_raster.cpp (renamed from servers/visual/visual_server_raster.cpp)156
-rw-r--r--servers/rendering/rendering_server_raster.h (renamed from servers/visual/visual_server_raster.h)38
-rw-r--r--servers/rendering/rendering_server_scene.cpp (renamed from servers/visual/visual_server_scene.cpp)654
-rw-r--r--servers/rendering/rendering_server_scene.h (renamed from servers/visual/visual_server_scene.h)24
-rw-r--r--servers/rendering/rendering_server_viewport.cpp (renamed from servers/visual/visual_server_viewport.cpp)248
-rw-r--r--servers/rendering/rendering_server_viewport.h (renamed from servers/visual/visual_server_viewport.h)40
-rw-r--r--servers/rendering/rendering_server_wrap_mt.cpp (renamed from servers/visual/visual_server_wrap_mt.cpp)60
-rw-r--r--servers/rendering/rendering_server_wrap_mt.h (renamed from servers/visual/visual_server_wrap_mt.h)64
-rw-r--r--servers/rendering/shader_language.cpp (renamed from servers/visual/shader_language.cpp)18
-rw-r--r--servers/rendering/shader_language.h (renamed from servers/visual/shader_language.h)0
-rw-r--r--servers/rendering/shader_types.cpp328
-rw-r--r--servers/rendering/shader_types.h (renamed from servers/visual/shader_types.h)8
-rw-r--r--servers/rendering_server.cpp (renamed from servers/visual_server.cpp)924
-rw-r--r--servers/rendering_server.h (renamed from servers/visual_server.h)112
-rw-r--r--servers/visual/shader_types.cpp328
151 files changed, 6402 insertions, 6402 deletions
diff --git a/servers/SCsub b/servers/SCsub
index 34ba70b8cb..7706b99d87 100644
--- a/servers/SCsub
+++ b/servers/SCsub
@@ -7,9 +7,9 @@ env.add_source_files(env.servers_sources, "*.cpp")
SConscript('arvr/SCsub')
SConscript('camera/SCsub')
-SConscript('physics/SCsub')
+SConscript('physics_3d/SCsub')
SConscript('physics_2d/SCsub')
-SConscript('visual/SCsub')
+SConscript('rendering/SCsub')
SConscript('audio/SCsub')
lib = env.add_library("servers", env.servers_sources)
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 4b3417db6c..724414ae96 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -343,7 +343,7 @@ uint64_t ARVRServer::get_last_frame_usec() {
};
void ARVRServer::_process() {
- /* called from visual_server_viewport.draw_viewports right before we start drawing our viewports */
+ /* called from rendering_server_viewport.draw_viewports right before we start drawing our viewports */
/* mark for our frame timing */
last_process_usec = OS::get_singleton()->get_ticks_usec();
diff --git a/servers/camera/camera_feed.cpp b/servers/camera/camera_feed.cpp
index e8537950ec..41f44abae8 100644
--- a/servers/camera/camera_feed.cpp
+++ b/servers/camera/camera_feed.cpp
@@ -30,7 +30,7 @@
#include "camera_feed.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
void CameraFeed::_bind_methods() {
// FIXME: Disabled during Vulkan refactoring, should be ported.
@@ -148,7 +148,7 @@ CameraFeed::CameraFeed() {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
// create a texture object
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA
texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create();
#endif
@@ -168,7 +168,7 @@ CameraFeed::CameraFeed(String p_name, FeedPosition p_position) {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
// create a texture object
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA
texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create();
#endif
@@ -178,7 +178,7 @@ CameraFeed::~CameraFeed() {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
// Free our textures
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
vs->free(texture[CameraServer::FEED_Y_IMAGE]);
vs->free(texture[CameraServer::FEED_CBCR_IMAGE]);
#endif
@@ -188,7 +188,7 @@ void CameraFeed::set_RGB_img(Ref<Image> p_rgb_img) {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
if (active) {
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
int new_width = p_rgb_img->get_width();
int new_height = p_rgb_img->get_height();
@@ -198,7 +198,7 @@ void CameraFeed::set_RGB_img(Ref<Image> p_rgb_img) {
base_width = new_width;
base_height = new_height;
- vs->texture_allocate(texture[CameraServer::FEED_RGBA_IMAGE], new_width, new_height, 0, Image::FORMAT_RGB8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAGS_DEFAULT);
+ vs->texture_allocate(texture[CameraServer::FEED_RGBA_IMAGE], new_width, new_height, 0, Image::FORMAT_RGB8, RS::TEXTURE_TYPE_2D, RS::TEXTURE_FLAGS_DEFAULT);
}
vs->texture_set_data(texture[CameraServer::FEED_RGBA_IMAGE], p_rgb_img);
@@ -211,7 +211,7 @@ void CameraFeed::set_YCbCr_img(Ref<Image> p_ycbcr_img) {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
if (active) {
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
int new_width = p_ycbcr_img->get_width();
int new_height = p_ycbcr_img->get_height();
@@ -221,7 +221,7 @@ void CameraFeed::set_YCbCr_img(Ref<Image> p_ycbcr_img) {
base_width = new_width;
base_height = new_height;
- vs->texture_allocate(texture[CameraServer::FEED_RGBA_IMAGE], new_width, new_height, 0, Image::FORMAT_RGB8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAGS_DEFAULT);
+ vs->texture_allocate(texture[CameraServer::FEED_RGBA_IMAGE], new_width, new_height, 0, Image::FORMAT_RGB8, RS::TEXTURE_TYPE_2D, RS::TEXTURE_FLAGS_DEFAULT);
}
vs->texture_set_data(texture[CameraServer::FEED_RGBA_IMAGE], p_ycbcr_img);
@@ -234,7 +234,7 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
if (active) {
- VisualServer *vs = VisualServer::get_singleton();
+ RenderingServer *vs = RenderingServer::get_singleton();
///@TODO investigate whether we can use thirdparty/misc/yuv2rgb.h here to convert our YUV data to RGB, our shader approach is potentially faster though..
// Wondering about including that into multiple projects, may cause issues.
@@ -250,10 +250,10 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) {
base_width = new_y_width;
base_height = new_y_height;
- vs->texture_allocate(texture[CameraServer::FEED_Y_IMAGE], new_y_width, new_y_height, 0, Image::FORMAT_R8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING);
+ vs->texture_allocate(texture[CameraServer::FEED_Y_IMAGE], new_y_width, new_y_height, 0, Image::FORMAT_R8, RS::TEXTURE_TYPE_2D, RS::TEXTURE_FLAG_USED_FOR_STREAMING);
///@TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
- vs->texture_allocate(texture[CameraServer::FEED_CBCR_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING);
+ vs->texture_allocate(texture[CameraServer::FEED_CBCR_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, RS::TEXTURE_TYPE_2D, RS::TEXTURE_FLAG_USED_FOR_STREAMING);
}
vs->texture_set_data(texture[CameraServer::FEED_Y_IMAGE], p_y_img);
@@ -265,15 +265,15 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) {
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
-void CameraFeed::allocate_texture(int p_width, int p_height, Image::Format p_format, VisualServer::TextureType p_texture_type, FeedDataType p_data_type) {
- VisualServer *vs = VisualServer::get_singleton();
+void CameraFeed::allocate_texture(int p_width, int p_height, Image::Format p_format, RenderingServer::TextureType p_texture_type, FeedDataType p_data_type) {
+ RenderingServer *vs = RenderingServer::get_singleton();
if ((base_width != p_width) || (base_height != p_height)) {
// We're assuming here that our camera image doesn't change around formats etc, allocate the whole lot...
base_width = p_width;
base_height = p_height;
- vs->texture_allocate(texture[0], p_width, p_height, 0, p_format, p_texture_type, VS::TEXTURE_FLAGS_DEFAULT);
+ vs->texture_allocate(texture[0], p_width, p_height, 0, p_format, p_texture_type, RS::TEXTURE_FLAGS_DEFAULT);
}
datatype = p_data_type;
diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h
index b99ded68e4..52a737cd8d 100644
--- a/servers/camera/camera_feed.h
+++ b/servers/camera/camera_feed.h
@@ -34,7 +34,7 @@
#include "core/image.h"
#include "core/math/transform_2d.h"
#include "servers/camera_server.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
/**
@author Bastiaan Olij <mux213@gmail.com>
@@ -105,7 +105,7 @@ public:
void set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img);
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
- void allocate_texture(int p_width, int p_height, Image::Format p_format, VisualServer::TextureType p_texture_type, FeedDataType p_data_type);
+ void allocate_texture(int p_width, int p_height, Image::Format p_format, RenderingServer::TextureType p_texture_type, FeedDataType p_data_type);
#endif
virtual bool activate_feed();
diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp
index fd88d15e58..1a86ff1af4 100644
--- a/servers/camera_server.cpp
+++ b/servers/camera_server.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "camera_server.h"
+#include "rendering_server.h"
#include "servers/camera/camera_feed.h"
-#include "visual_server.h"
////////////////////////////////////////////////////////
// CameraServer
diff --git a/servers/display_server.h b/servers/display_server.h
index 4803eeb084..c0e92891a3 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -83,7 +83,7 @@ protected:
static DisplayServerCreate server_create_functions[MAX_SERVERS];
static int server_create_count;
- friend class VisualServerRaster;
+ friend class RenderingServerRaster;
virtual void _set_use_vsync(bool p_enable);
public:
diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_server_2d.cpp
index d9b53122e2..b64ad0e5ab 100644
--- a/servers/navigation_2d_server.cpp
+++ b/servers/navigation_server_2d.cpp
@@ -28,77 +28,77 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/navigation_2d_server.h"
+#include "servers/navigation_server_2d.h"
#include "core/math/transform.h"
#include "core/math/transform_2d.h"
-#include "servers/navigation_server.h"
+#include "servers/navigation_server_3d.h"
/**
@author AndreaCatania
*/
-Navigation2DServer *Navigation2DServer::singleton = NULL;
+NavigationServer2D *NavigationServer2D::singleton = NULL;
-#define FORWARD_0_C(FUNC_NAME) \
- Navigation2DServer::FUNC_NAME() \
- const { \
- return NavigationServer::get_singleton()->FUNC_NAME(); \
+#define FORWARD_0_C(FUNC_NAME) \
+ NavigationServer2D::FUNC_NAME() \
+ const { \
+ return NavigationServer3D::get_singleton()->FUNC_NAME(); \
}
-#define FORWARD_1(FUNC_NAME, T_0, D_0, CONV_0) \
- Navigation2DServer::FUNC_NAME(T_0 D_0) { \
- return NavigationServer::get_singleton_mut()->FUNC_NAME(CONV_0(D_0)); \
+#define FORWARD_1(FUNC_NAME, T_0, D_0, CONV_0) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0) { \
+ return NavigationServer3D::get_singleton_mut()->FUNC_NAME(CONV_0(D_0)); \
}
-#define FORWARD_1_C(FUNC_NAME, T_0, D_0, CONV_0) \
- Navigation2DServer::FUNC_NAME(T_0 D_0) \
- const { \
- return NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0)); \
+#define FORWARD_1_C(FUNC_NAME, T_0, D_0, CONV_0) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0) \
+ const { \
+ return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0)); \
}
-#define FORWARD_2_C(FUNC_NAME, T_0, D_0, T_1, D_1, CONV_0, CONV_1) \
- Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1) \
- const { \
- return NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1)); \
+#define FORWARD_2_C(FUNC_NAME, T_0, D_0, T_1, D_1, CONV_0, CONV_1) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1) \
+ const { \
+ return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1)); \
}
-#define FORWARD_2_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, CONV_0, CONV_1) \
- Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1) \
- const { \
- return CONV_R(NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1))); \
+#define FORWARD_2_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, CONV_0, CONV_1) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1) \
+ const { \
+ return CONV_R(NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1))); \
}
-#define FORWARD_4_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
- Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
- const { \
- return CONV_R(NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3))); \
+#define FORWARD_4_R_C(CONV_R, FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
+ const { \
+ return CONV_R(NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3))); \
}
-#define FORWARD_4_C(FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
- Navigation2DServer::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
- const { \
- return NavigationServer::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3)); \
+#define FORWARD_4_C(FUNC_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3, CONV_0, CONV_1, CONV_2, CONV_3) \
+ NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) \
+ const { \
+ return NavigationServer3D::get_singleton()->FUNC_NAME(CONV_0(D_0), CONV_1(D_1), CONV_2(D_2), CONV_3(D_3)); \
}
-RID rid_to_rid(const RID d) {
+static RID rid_to_rid(const RID d) {
return d;
}
-bool bool_to_bool(const bool d) {
+static bool bool_to_bool(const bool d) {
return d;
}
-int int_to_int(const int d) {
+static int int_to_int(const int d) {
return d;
}
-real_t real_to_real(const real_t d) {
+static real_t real_to_real(const real_t d) {
return d;
}
-Vector3 v2_to_v3(const Vector2 d) {
+static Vector3 v2_to_v3(const Vector2 d) {
return Vector3(d.x, 0.0, d.y);
}
-Vector2 v3_to_v2(const Vector3 &d) {
+static Vector2 v3_to_v2(const Vector3 &d) {
return Vector2(d.x, d.z);
}
-Vector<Vector2> vector_v3_to_v2(const Vector<Vector3> &d) {
+static Vector<Vector2> vector_v3_to_v2(const Vector<Vector3> &d) {
Vector<Vector2> nd;
nd.resize(d.size());
for (int i(0); i < nd.size(); i++) {
@@ -106,22 +106,22 @@ Vector<Vector2> vector_v3_to_v2(const Vector<Vector3> &d) {
}
return nd;
}
-Transform trf2_to_trf3(const Transform2D &d) {
+static Transform trf2_to_trf3(const Transform2D &d) {
Vector3 o(v2_to_v3(d.get_origin()));
Basis b;
b.rotate(Vector3(0, 1, 0), d.get_rotation());
return Transform(b, o);
}
-Object *obj_to_obj(Object *d) {
+static Object *obj_to_obj(Object *d) {
return d;
}
-StringName sn_to_sn(StringName &d) {
+static StringName sn_to_sn(StringName &d) {
return d;
}
-Variant var_to_var(Variant &d) {
+static Variant var_to_var(Variant &d) {
return d;
}
-Ref<NavigationMesh> poly_to_mesh(Ref<NavigationPolygon> d) {
+static Ref<NavigationMesh> poly_to_mesh(Ref<NavigationPolygon> d) {
if (d.is_valid()) {
return d->get_mesh();
} else {
@@ -129,44 +129,44 @@ Ref<NavigationMesh> poly_to_mesh(Ref<NavigationPolygon> d) {
}
}
-void Navigation2DServer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("map_create"), &Navigation2DServer::map_create);
- ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &Navigation2DServer::map_set_active);
- ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &Navigation2DServer::map_is_active);
- ClassDB::bind_method(D_METHOD("map_set_cell_size", "map", "cell_size"), &Navigation2DServer::map_set_cell_size);
- ClassDB::bind_method(D_METHOD("map_get_cell_size", "map"), &Navigation2DServer::map_get_cell_size);
- ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &Navigation2DServer::map_set_edge_connection_margin);
- ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &Navigation2DServer::map_get_edge_connection_margin);
- ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &Navigation2DServer::map_get_path);
- ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &Navigation2DServer::map_get_closest_point);
- ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &Navigation2DServer::map_get_closest_point_owner);
-
- ClassDB::bind_method(D_METHOD("region_create"), &Navigation2DServer::region_create);
- ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &Navigation2DServer::region_set_map);
- ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &Navigation2DServer::region_set_transform);
- ClassDB::bind_method(D_METHOD("region_set_navpoly", "region", "nav_poly"), &Navigation2DServer::region_set_navpoly);
-
- ClassDB::bind_method(D_METHOD("agent_create"), &Navigation2DServer::agent_create);
- ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &Navigation2DServer::agent_set_map);
- ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &Navigation2DServer::agent_set_neighbor_dist);
- ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &Navigation2DServer::agent_set_max_neighbors);
- ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &Navigation2DServer::agent_set_time_horizon);
- ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &Navigation2DServer::agent_set_radius);
- ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &Navigation2DServer::agent_set_max_speed);
- ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &Navigation2DServer::agent_set_velocity);
- ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &Navigation2DServer::agent_set_target_velocity);
- ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &Navigation2DServer::agent_set_position);
- ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &Navigation2DServer::agent_is_map_changed);
- ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &Navigation2DServer::agent_set_callback, DEFVAL(Variant()));
-
- ClassDB::bind_method(D_METHOD("free", "object"), &Navigation2DServer::free);
-}
-
-Navigation2DServer::Navigation2DServer() {
+void NavigationServer2D::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer2D::map_create);
+ ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer2D::map_set_active);
+ ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer2D::map_is_active);
+ ClassDB::bind_method(D_METHOD("map_set_cell_size", "map", "cell_size"), &NavigationServer2D::map_set_cell_size);
+ ClassDB::bind_method(D_METHOD("map_get_cell_size", "map"), &NavigationServer2D::map_get_cell_size);
+ ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &NavigationServer2D::map_set_edge_connection_margin);
+ ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &NavigationServer2D::map_get_edge_connection_margin);
+ ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &NavigationServer2D::map_get_path);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &NavigationServer2D::map_get_closest_point);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &NavigationServer2D::map_get_closest_point_owner);
+
+ ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create);
+ ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer2D::region_set_map);
+ ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &NavigationServer2D::region_set_transform);
+ ClassDB::bind_method(D_METHOD("region_set_navpoly", "region", "nav_poly"), &NavigationServer2D::region_set_navpoly);
+
+ ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer2D::agent_create);
+ ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer2D::agent_set_map);
+ ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &NavigationServer2D::agent_set_neighbor_dist);
+ ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer2D::agent_set_max_neighbors);
+ ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &NavigationServer2D::agent_set_time_horizon);
+ ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer2D::agent_set_radius);
+ ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &NavigationServer2D::agent_set_max_speed);
+ ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &NavigationServer2D::agent_set_velocity);
+ ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer2D::agent_set_target_velocity);
+ ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer2D::agent_set_position);
+ ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer2D::agent_is_map_changed);
+ ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &NavigationServer2D::agent_set_callback, DEFVAL(Variant()));
+
+ ClassDB::bind_method(D_METHOD("free", "object"), &NavigationServer2D::free);
+}
+
+NavigationServer2D::NavigationServer2D() {
singleton = this;
}
-Navigation2DServer::~Navigation2DServer() {
+NavigationServer2D::~NavigationServer2D() {
singleton = NULL;
}
@@ -192,13 +192,13 @@ void FORWARD_2_C(region_set_map, RID, p_region, RID, p_map, rid_to_rid, rid_to_r
void FORWARD_2_C(region_set_transform, RID, p_region, Transform2D, p_transform, rid_to_rid, trf2_to_trf3);
-void Navigation2DServer::region_set_navpoly(RID p_region, Ref<NavigationPolygon> p_nav_mesh) const {
- NavigationServer::get_singleton()->region_set_navmesh(p_region, poly_to_mesh(p_nav_mesh));
+void NavigationServer2D::region_set_navpoly(RID p_region, Ref<NavigationPolygon> p_nav_mesh) const {
+ NavigationServer3D::get_singleton()->region_set_navmesh(p_region, poly_to_mesh(p_nav_mesh));
}
-RID Navigation2DServer::agent_create() const {
- RID agent = NavigationServer::get_singleton()->agent_create();
- NavigationServer::get_singleton()->agent_set_ignore_y(agent, true);
+RID NavigationServer2D::agent_create() const {
+ RID agent = NavigationServer3D::get_singleton()->agent_create();
+ NavigationServer3D::get_singleton()->agent_set_ignore_y(agent, true);
return agent;
}
diff --git a/servers/navigation_2d_server.h b/servers/navigation_server_2d.h
index 35902f83d4..272d07667d 100644
--- a/servers/navigation_2d_server.h
+++ b/servers/navigation_server_2d.h
@@ -40,20 +40,20 @@
#include "scene/2d/navigation_region_2d.h"
// This server exposes the 3D `NavigationServer` features in the 2D world.
-class Navigation2DServer : public Object {
- GDCLASS(Navigation2DServer, Object);
+class NavigationServer2D : public Object {
+ GDCLASS(NavigationServer2D, Object);
- static Navigation2DServer *singleton;
+ static NavigationServer2D *singleton;
protected:
static void _bind_methods();
public:
/// Thread safe, can be used across many threads.
- static const Navigation2DServer *get_singleton() { return singleton; }
+ static const NavigationServer2D *get_singleton() { return singleton; }
/// MUST be used in single thread!
- static Navigation2DServer *get_singleton_mut() { return singleton; }
+ static NavigationServer2D *get_singleton_mut() { return singleton; }
/// Create a new map.
virtual RID map_create() const;
@@ -156,8 +156,8 @@ public:
/// Destroy the `RID`
virtual void free(RID p_object) const;
- Navigation2DServer();
- virtual ~Navigation2DServer();
+ NavigationServer2D();
+ virtual ~NavigationServer2D();
};
#endif
diff --git a/servers/navigation_server.cpp b/servers/navigation_server_3d.cpp
index f2b727ac47..3cfc47b1e5 100644
--- a/servers/navigation_server.cpp
+++ b/servers/navigation_server_3d.cpp
@@ -32,76 +32,76 @@
@author AndreaCatania
*/
-#include "navigation_server.h"
-
-NavigationServer *NavigationServer::singleton = NULL;
-
-void NavigationServer::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer::map_create);
- ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer::map_set_active);
- ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer::map_is_active);
- ClassDB::bind_method(D_METHOD("map_set_up", "map", "up"), &NavigationServer::map_set_up);
- ClassDB::bind_method(D_METHOD("map_get_up", "map"), &NavigationServer::map_get_up);
- ClassDB::bind_method(D_METHOD("map_set_cell_size", "map", "cell_size"), &NavigationServer::map_set_cell_size);
- ClassDB::bind_method(D_METHOD("map_get_cell_size", "map"), &NavigationServer::map_get_cell_size);
- ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &NavigationServer::map_set_edge_connection_margin);
- ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &NavigationServer::map_get_edge_connection_margin);
- ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &NavigationServer::map_get_path);
- ClassDB::bind_method(D_METHOD("map_get_closest_point_to_segment", "map", "start", "end", "use_collision"), &NavigationServer::map_get_closest_point_to_segment, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &NavigationServer::map_get_closest_point);
- ClassDB::bind_method(D_METHOD("map_get_closest_point_normal", "map", "to_point"), &NavigationServer::map_get_closest_point_normal);
- ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &NavigationServer::map_get_closest_point_owner);
-
- ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer::region_create);
- ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer::region_set_map);
- ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &NavigationServer::region_set_transform);
- ClassDB::bind_method(D_METHOD("region_set_navmesh", "region", "nav_mesh"), &NavigationServer::region_set_navmesh);
- ClassDB::bind_method(D_METHOD("region_bake_navmesh", "mesh", "node"), &NavigationServer::region_bake_navmesh);
-
- ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer::agent_create);
- ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer::agent_set_map);
- ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &NavigationServer::agent_set_neighbor_dist);
- ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer::agent_set_max_neighbors);
- ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &NavigationServer::agent_set_time_horizon);
- ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer::agent_set_radius);
- ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &NavigationServer::agent_set_max_speed);
- ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &NavigationServer::agent_set_velocity);
- ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer::agent_set_target_velocity);
- ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer::agent_set_position);
- ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer::agent_is_map_changed);
- ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &NavigationServer::agent_set_callback, DEFVAL(Variant()));
-
- ClassDB::bind_method(D_METHOD("free", "object"), &NavigationServer::free);
-
- ClassDB::bind_method(D_METHOD("set_active", "active"), &NavigationServer::set_active);
- ClassDB::bind_method(D_METHOD("process", "delta_time"), &NavigationServer::process);
+#include "navigation_server_3d.h"
+
+NavigationServer3D *NavigationServer3D::singleton = NULL;
+
+void NavigationServer3D::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer3D::map_create);
+ ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer3D::map_set_active);
+ ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer3D::map_is_active);
+ ClassDB::bind_method(D_METHOD("map_set_up", "map", "up"), &NavigationServer3D::map_set_up);
+ ClassDB::bind_method(D_METHOD("map_get_up", "map"), &NavigationServer3D::map_get_up);
+ ClassDB::bind_method(D_METHOD("map_set_cell_size", "map", "cell_size"), &NavigationServer3D::map_set_cell_size);
+ ClassDB::bind_method(D_METHOD("map_get_cell_size", "map"), &NavigationServer3D::map_get_cell_size);
+ ClassDB::bind_method(D_METHOD("map_set_edge_connection_margin", "map", "margin"), &NavigationServer3D::map_set_edge_connection_margin);
+ ClassDB::bind_method(D_METHOD("map_get_edge_connection_margin", "map"), &NavigationServer3D::map_get_edge_connection_margin);
+ ClassDB::bind_method(D_METHOD("map_get_path", "map", "origin", "destination", "optimize"), &NavigationServer3D::map_get_path);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_to_segment", "map", "start", "end", "use_collision"), &NavigationServer3D::map_get_closest_point_to_segment, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("map_get_closest_point", "map", "to_point"), &NavigationServer3D::map_get_closest_point);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_normal", "map", "to_point"), &NavigationServer3D::map_get_closest_point_normal);
+ ClassDB::bind_method(D_METHOD("map_get_closest_point_owner", "map", "to_point"), &NavigationServer3D::map_get_closest_point_owner);
+
+ ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer3D::region_create);
+ ClassDB::bind_method(D_METHOD("region_set_map", "region", "map"), &NavigationServer3D::region_set_map);
+ ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &NavigationServer3D::region_set_transform);
+ ClassDB::bind_method(D_METHOD("region_set_navmesh", "region", "nav_mesh"), &NavigationServer3D::region_set_navmesh);
+ ClassDB::bind_method(D_METHOD("region_bake_navmesh", "mesh", "node"), &NavigationServer3D::region_bake_navmesh);
+
+ ClassDB::bind_method(D_METHOD("agent_create"), &NavigationServer3D::agent_create);
+ ClassDB::bind_method(D_METHOD("agent_set_map", "agent", "map"), &NavigationServer3D::agent_set_map);
+ ClassDB::bind_method(D_METHOD("agent_set_neighbor_dist", "agent", "dist"), &NavigationServer3D::agent_set_neighbor_dist);
+ ClassDB::bind_method(D_METHOD("agent_set_max_neighbors", "agent", "count"), &NavigationServer3D::agent_set_max_neighbors);
+ ClassDB::bind_method(D_METHOD("agent_set_time_horizon", "agent", "time"), &NavigationServer3D::agent_set_time_horizon);
+ ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer3D::agent_set_radius);
+ ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &NavigationServer3D::agent_set_max_speed);
+ ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &NavigationServer3D::agent_set_velocity);
+ ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer3D::agent_set_target_velocity);
+ ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer3D::agent_set_position);
+ ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer3D::agent_is_map_changed);
+ ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &NavigationServer3D::agent_set_callback, DEFVAL(Variant()));
+
+ ClassDB::bind_method(D_METHOD("free", "object"), &NavigationServer3D::free);
+
+ ClassDB::bind_method(D_METHOD("set_active", "active"), &NavigationServer3D::set_active);
+ ClassDB::bind_method(D_METHOD("process", "delta_time"), &NavigationServer3D::process);
}
-const NavigationServer *NavigationServer::get_singleton() {
+const NavigationServer3D *NavigationServer3D::get_singleton() {
return singleton;
}
-NavigationServer *NavigationServer::get_singleton_mut() {
+NavigationServer3D *NavigationServer3D::get_singleton_mut() {
return singleton;
}
-NavigationServer::NavigationServer() {
+NavigationServer3D::NavigationServer3D() {
ERR_FAIL_COND(singleton != NULL);
singleton = this;
}
-NavigationServer::~NavigationServer() {
+NavigationServer3D::~NavigationServer3D() {
singleton = NULL;
}
-NavigationServerCallback NavigationServerManager::create_callback = NULL;
+NavigationServer3DCallback NavigationServer3DManager::create_callback = NULL;
-void NavigationServerManager::set_default_server(NavigationServerCallback p_callback) {
+void NavigationServer3DManager::set_default_server(NavigationServer3DCallback p_callback) {
create_callback = p_callback;
}
-NavigationServer *NavigationServerManager::new_default_server() {
+NavigationServer3D *NavigationServer3DManager::new_default_server() {
ERR_FAIL_COND_V(create_callback == NULL, NULL);
return create_callback();
}
diff --git a/servers/navigation_server.h b/servers/navigation_server_3d.h
index 2ea8e787cf..2e9d078f73 100644
--- a/servers/navigation_server.h
+++ b/servers/navigation_server_3d.h
@@ -45,20 +45,20 @@
///
/// Note: All the `set` functions are commands executed during the `sync` phase,
/// don't expect that a change is immediately propagated.
-class NavigationServer : public Object {
- GDCLASS(NavigationServer, Object);
+class NavigationServer3D : public Object {
+ GDCLASS(NavigationServer3D, Object);
- static NavigationServer *singleton;
+ static NavigationServer3D *singleton;
protected:
static void _bind_methods();
public:
/// Thread safe, can be used across many threads.
- static const NavigationServer *get_singleton();
+ static const NavigationServer3D *get_singleton();
/// MUST be used in single thread!
- static NavigationServer *get_singleton_mut();
+ static NavigationServer3D *get_singleton_mut();
/// Create a new map.
virtual RID map_create() const = 0;
@@ -181,19 +181,19 @@ public:
/// Note: This function is not thread safe.
virtual void process(real_t delta_time) = 0;
- NavigationServer();
- virtual ~NavigationServer();
+ NavigationServer3D();
+ virtual ~NavigationServer3D();
};
-typedef NavigationServer *(*NavigationServerCallback)();
+typedef NavigationServer3D *(*NavigationServer3DCallback)();
/// Manager used for the server singleton registration
-class NavigationServerManager {
- static NavigationServerCallback create_callback;
+class NavigationServer3DManager {
+ static NavigationServer3DCallback create_callback;
public:
- static void set_default_server(NavigationServerCallback p_callback);
- static NavigationServer *new_default_server();
+ static void set_default_server(NavigationServer3DCallback p_callback);
+ static NavigationServer3D *new_default_server();
};
#endif
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
deleted file mode 100644
index 25b21a5394..0000000000
--- a/servers/physics/physics_server_sw.cpp
+++ /dev/null
@@ -1,1589 +0,0 @@
-/*************************************************************************/
-/* physics_server_sw.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "physics_server_sw.h"
-
-#include "broad_phase_basic.h"
-#include "broad_phase_octree.h"
-#include "core/debugger/engine_debugger.h"
-#include "core/os/os.h"
-#include "joints/cone_twist_joint_sw.h"
-#include "joints/generic_6dof_joint_sw.h"
-#include "joints/hinge_joint_sw.h"
-#include "joints/pin_joint_sw.h"
-#include "joints/slider_joint_sw.h"
-
-#define FLUSH_QUERY_CHECK(m_object) \
- ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
-
-RID PhysicsServerSW::shape_create(ShapeType p_shape) {
-
- ShapeSW *shape = NULL;
- switch (p_shape) {
-
- case SHAPE_PLANE: {
-
- shape = memnew(PlaneShapeSW);
- } break;
- case SHAPE_RAY: {
-
- shape = memnew(RayShapeSW);
- } break;
- case SHAPE_SPHERE: {
-
- shape = memnew(SphereShapeSW);
- } break;
- case SHAPE_BOX: {
-
- shape = memnew(BoxShapeSW);
- } break;
- case SHAPE_CAPSULE: {
-
- shape = memnew(CapsuleShapeSW);
- } break;
- case SHAPE_CYLINDER: {
-
- ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
- } break;
- case SHAPE_CONVEX_POLYGON: {
-
- shape = memnew(ConvexPolygonShapeSW);
- } break;
- case SHAPE_CONCAVE_POLYGON: {
-
- shape = memnew(ConcavePolygonShapeSW);
- } break;
- case SHAPE_HEIGHTMAP: {
-
- shape = memnew(HeightMapShapeSW);
- } break;
- case SHAPE_CUSTOM: {
-
- ERR_FAIL_V(RID());
-
- } break;
- }
-
- RID id = shape_owner.make_rid(shape);
- shape->set_self(id);
-
- return id;
-};
-
-void PhysicsServerSW::shape_set_data(RID p_shape, const Variant &p_data) {
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
- shape->set_data(p_data);
-};
-
-void PhysicsServerSW::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
- shape->set_custom_bias(p_bias);
-}
-
-PhysicsServer::ShapeType PhysicsServerSW::shape_get_type(RID p_shape) const {
-
- const ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND_V(!shape, SHAPE_CUSTOM);
- return shape->get_type();
-};
-
-Variant PhysicsServerSW::shape_get_data(RID p_shape) const {
-
- const ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND_V(!shape, Variant());
- ERR_FAIL_COND_V(!shape->is_configured(), Variant());
- return shape->get_data();
-};
-
-void PhysicsServerSW::shape_set_margin(RID p_shape, real_t p_margin) {
-}
-
-real_t PhysicsServerSW::shape_get_margin(RID p_shape) const {
- return 0.0;
-}
-
-real_t PhysicsServerSW::shape_get_custom_solver_bias(RID p_shape) const {
-
- const ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND_V(!shape, 0);
- return shape->get_custom_bias();
-}
-
-RID PhysicsServerSW::space_create() {
-
- SpaceSW *space = memnew(SpaceSW);
- RID id = space_owner.make_rid(space);
- space->set_self(id);
- RID area_id = area_create();
- AreaSW *area = area_owner.getornull(area_id);
- ERR_FAIL_COND_V(!area, RID());
- space->set_default_area(area);
- area->set_space(space);
- area->set_priority(-1);
- RID sgb = body_create();
- body_set_space(sgb, id);
- body_set_mode(sgb, BODY_MODE_STATIC);
- space->set_static_global_body(sgb);
-
- return id;
-};
-
-void PhysicsServerSW::space_set_active(RID p_space, bool p_active) {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND(!space);
- if (p_active)
- active_spaces.insert(space);
- else
- active_spaces.erase(space);
-}
-
-bool PhysicsServerSW::space_is_active(RID p_space) const {
-
- const SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, false);
-
- return active_spaces.has(space);
-}
-
-void PhysicsServerSW::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND(!space);
-
- space->set_param(p_param, p_value);
-}
-
-real_t PhysicsServerSW::space_get_param(RID p_space, SpaceParameter p_param) const {
-
- const SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, 0);
- return space->get_param(p_param);
-}
-
-PhysicsDirectSpaceState *PhysicsServerSW::space_get_direct_state(RID p_space) {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, NULL);
- ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
-
- return space->get_direct_state();
-}
-
-void PhysicsServerSW::space_set_debug_contacts(RID p_space, int p_max_contacts) {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND(!space);
- space->set_debug_contacts(p_max_contacts);
-}
-
-Vector<Vector3> PhysicsServerSW::space_get_contacts(RID p_space) const {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, Vector<Vector3>());
- return space->get_debug_contacts();
-}
-
-int PhysicsServerSW::space_get_contact_count(RID p_space) const {
-
- SpaceSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, 0);
- return space->get_debug_contact_count();
-}
-
-RID PhysicsServerSW::area_create() {
-
- AreaSW *area = memnew(AreaSW);
- RID rid = area_owner.make_rid(area);
- area->set_self(rid);
- return rid;
-};
-
-void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- SpaceSW *space = NULL;
- if (p_space.is_valid()) {
- space = space_owner.getornull(p_space);
- ERR_FAIL_COND(!space);
- }
-
- if (area->get_space() == space)
- return; //pointless
-
- area->clear_constraints();
- area->set_space(space);
-};
-
-RID PhysicsServerSW::area_get_space(RID p_area) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, RID());
-
- SpaceSW *space = area->get_space();
- if (!space)
- return RID();
- return space->get_self();
-};
-
-void PhysicsServerSW::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_space_override_mode(p_mode);
-}
-
-PhysicsServer::AreaSpaceOverrideMode PhysicsServerSW::area_get_space_override_mode(RID p_area) const {
-
- const AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, AREA_SPACE_OVERRIDE_DISABLED);
-
- return area->get_space_override_mode();
-}
-
-void PhysicsServerSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
-
- area->add_shape(shape, p_transform, p_disabled);
-}
-
-void PhysicsServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
- ERR_FAIL_COND(!shape->is_configured());
-
- area->set_shape(p_shape_idx, shape);
-}
-
-void PhysicsServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_shape_transform(p_shape_idx, p_transform);
-}
-
-int PhysicsServerSW::area_get_shape_count(RID p_area) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, -1);
-
- return area->get_shape_count();
-}
-RID PhysicsServerSW::area_get_shape(RID p_area, int p_shape_idx) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, RID());
-
- ShapeSW *shape = area->get_shape(p_shape_idx);
- ERR_FAIL_COND_V(!shape, RID());
-
- return shape->get_self();
-}
-Transform PhysicsServerSW::area_get_shape_transform(RID p_area, int p_shape_idx) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, Transform());
-
- return area->get_shape_transform(p_shape_idx);
-}
-
-void PhysicsServerSW::area_remove_shape(RID p_area, int p_shape_idx) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->remove_shape(p_shape_idx);
-}
-
-void PhysicsServerSW::area_clear_shapes(RID p_area) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- while (area->get_shape_count())
- area->remove_shape(0);
-}
-
-void PhysicsServerSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
- ERR_FAIL_INDEX(p_shape_idx, area->get_shape_count());
- FLUSH_QUERY_CHECK(area);
- area->set_shape_as_disabled(p_shape_idx, p_disabled);
-}
-
-void PhysicsServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
-
- if (space_owner.owns(p_area)) {
- SpaceSW *space = space_owner.getornull(p_area);
- p_area = space->get_default_area()->get_self();
- }
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
- area->set_instance_id(p_id);
-}
-ObjectID PhysicsServerSW::area_get_object_instance_id(RID p_area) const {
-
- if (space_owner.owns(p_area)) {
- SpaceSW *space = space_owner.getornull(p_area);
- p_area = space->get_default_area()->get_self();
- }
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, ObjectID());
- return area->get_instance_id();
-}
-
-void PhysicsServerSW::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) {
-
- if (space_owner.owns(p_area)) {
- SpaceSW *space = space_owner.getornull(p_area);
- p_area = space->get_default_area()->get_self();
- }
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
- area->set_param(p_param, p_value);
-};
-
-void PhysicsServerSW::area_set_transform(RID p_area, const Transform &p_transform) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
- area->set_transform(p_transform);
-};
-
-Variant PhysicsServerSW::area_get_param(RID p_area, AreaParameter p_param) const {
-
- if (space_owner.owns(p_area)) {
- SpaceSW *space = space_owner.getornull(p_area);
- p_area = space->get_default_area()->get_self();
- }
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, Variant());
-
- return area->get_param(p_param);
-};
-
-Transform PhysicsServerSW::area_get_transform(RID p_area) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, Transform());
-
- return area->get_transform();
-};
-
-void PhysicsServerSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_collision_layer(p_layer);
-}
-
-void PhysicsServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_collision_mask(p_mask);
-}
-
-void PhysicsServerSW::area_set_monitorable(RID p_area, bool p_monitorable) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
- FLUSH_QUERY_CHECK(area);
-
- area->set_monitorable(p_monitorable);
-}
-
-void PhysicsServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
-}
-
-void PhysicsServerSW::area_set_ray_pickable(RID p_area, bool p_enable) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_ray_pickable(p_enable);
-}
-
-bool PhysicsServerSW::area_is_ray_pickable(RID p_area) const {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND_V(!area, false);
-
- return area->is_ray_pickable();
-}
-
-void PhysicsServerSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
-
- AreaSW *area = area_owner.getornull(p_area);
- ERR_FAIL_COND(!area);
-
- area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
-}
-
-/* BODY API */
-
-RID PhysicsServerSW::body_create(BodyMode p_mode, bool p_init_sleeping) {
-
- BodySW *body = memnew(BodySW);
- if (p_mode != BODY_MODE_RIGID)
- body->set_mode(p_mode);
- if (p_init_sleeping)
- body->set_state(BODY_STATE_SLEEPING, p_init_sleeping);
- RID rid = body_owner.make_rid(body);
- body->set_self(rid);
- return rid;
-};
-
-void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- SpaceSW *space = NULL;
- if (p_space.is_valid()) {
- space = space_owner.getornull(p_space);
- ERR_FAIL_COND(!space);
- }
-
- if (body->get_space() == space)
- return; //pointless
-
- body->clear_constraint_map();
- body->set_space(space);
-};
-
-RID PhysicsServerSW::body_get_space(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, RID());
-
- SpaceSW *space = body->get_space();
- if (!space)
- return RID();
- return space->get_self();
-};
-
-void PhysicsServerSW::body_set_mode(RID p_body, BodyMode p_mode) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_mode(p_mode);
-};
-
-PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, BODY_MODE_STATIC);
-
- return body->get_mode();
-};
-
-void PhysicsServerSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
-
- body->add_shape(shape, p_transform, p_disabled);
-}
-
-void PhysicsServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- ShapeSW *shape = shape_owner.getornull(p_shape);
- ERR_FAIL_COND(!shape);
- ERR_FAIL_COND(!shape->is_configured());
-
- body->set_shape(p_shape_idx, shape);
-}
-void PhysicsServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_shape_transform(p_shape_idx, p_transform);
-}
-
-int PhysicsServerSW::body_get_shape_count(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, -1);
-
- return body->get_shape_count();
-}
-RID PhysicsServerSW::body_get_shape(RID p_body, int p_shape_idx) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, RID());
-
- ShapeSW *shape = body->get_shape(p_shape_idx);
- ERR_FAIL_COND_V(!shape, RID());
-
- return shape->get_self();
-}
-
-void PhysicsServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
- ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count());
- FLUSH_QUERY_CHECK(body);
-
- body->set_shape_as_disabled(p_shape_idx, p_disabled);
-}
-
-Transform PhysicsServerSW::body_get_shape_transform(RID p_body, int p_shape_idx) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, Transform());
-
- return body->get_shape_transform(p_shape_idx);
-}
-
-void PhysicsServerSW::body_remove_shape(RID p_body, int p_shape_idx) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->remove_shape(p_shape_idx);
-}
-
-void PhysicsServerSW::body_clear_shapes(RID p_body) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- while (body->get_shape_count())
- body->remove_shape(0);
-}
-
-void PhysicsServerSW::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_continuous_collision_detection(p_enable);
-}
-
-bool PhysicsServerSW::body_is_continuous_collision_detection_enabled(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, false);
-
- return body->is_continuous_collision_detection_enabled();
-}
-
-void PhysicsServerSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_collision_layer(p_layer);
- body->wakeup();
-}
-
-uint32_t PhysicsServerSW::body_get_collision_layer(RID p_body) const {
-
- const BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
-
- return body->get_collision_layer();
-}
-
-void PhysicsServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_collision_mask(p_mask);
- body->wakeup();
-}
-
-uint32_t PhysicsServerSW::body_get_collision_mask(RID p_body) const {
-
- const BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
-
- return body->get_collision_mask();
-}
-
-void PhysicsServerSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_instance_id(p_id);
-};
-
-ObjectID PhysicsServerSW::body_get_object_instance_id(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, ObjectID());
-
- return body->get_instance_id();
-};
-
-void PhysicsServerSW::body_set_user_flags(RID p_body, uint32_t p_flags) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-};
-
-uint32_t PhysicsServerSW::body_get_user_flags(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
-
- return 0;
-};
-
-void PhysicsServerSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_param(p_param, p_value);
-};
-
-real_t PhysicsServerSW::body_get_param(RID p_body, BodyParameter p_param) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
-
- return body->get_param(p_param);
-};
-
-void PhysicsServerSW::body_set_kinematic_safe_margin(RID p_body, real_t p_margin) {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
- body->set_kinematic_margin(p_margin);
-}
-
-real_t PhysicsServerSW::body_get_kinematic_safe_margin(RID p_body) const {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
-
- return body->get_kinematic_margin();
-}
-
-void PhysicsServerSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_state(p_state, p_variant);
-};
-
-Variant PhysicsServerSW::body_get_state(RID p_body, BodyState p_state) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, Variant());
-
- return body->get_state(p_state);
-};
-
-void PhysicsServerSW::body_set_applied_force(RID p_body, const Vector3 &p_force) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_applied_force(p_force);
- body->wakeup();
-};
-
-Vector3 PhysicsServerSW::body_get_applied_force(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, Vector3());
- return body->get_applied_force();
-};
-
-void PhysicsServerSW::body_set_applied_torque(RID p_body, const Vector3 &p_torque) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_applied_torque(p_torque);
- body->wakeup();
-};
-
-Vector3 PhysicsServerSW::body_get_applied_torque(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, Vector3());
-
- return body->get_applied_torque();
-};
-
-void PhysicsServerSW::body_add_central_force(RID p_body, const Vector3 &p_force) {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->add_central_force(p_force);
- body->wakeup();
-}
-
-void PhysicsServerSW::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->add_force(p_force, p_pos);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_add_torque(RID p_body, const Vector3 &p_torque) {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->add_torque(p_torque);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- _update_shapes();
-
- body->apply_central_impulse(p_impulse);
- body->wakeup();
-}
-
-void PhysicsServerSW::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- _update_shapes();
-
- body->apply_impulse(p_pos, p_impulse);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- _update_shapes();
-
- body->apply_torque_impulse(p_impulse);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- _update_shapes();
-
- Vector3 v = body->get_linear_velocity();
- Vector3 axis = p_axis_velocity.normalized();
- v -= axis * axis.dot(v);
- v += p_axis_velocity;
- body->set_linear_velocity(v);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_axis_lock(p_axis, p_lock);
- body->wakeup();
-}
-
-bool PhysicsServerSW::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
-
- const BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
- return body->is_axis_locked(p_axis);
-}
-
-void PhysicsServerSW::body_add_collision_exception(RID p_body, RID p_body_b) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->add_exception(p_body_b);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_remove_collision_exception(RID p_body, RID p_body_b) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->remove_exception(p_body_b);
- body->wakeup();
-};
-
-void PhysicsServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- for (int i = 0; i < body->get_exceptions().size(); i++) {
- p_exceptions->push_back(body->get_exceptions()[i]);
- }
-};
-
-void PhysicsServerSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-};
-
-real_t PhysicsServerSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, 0);
- return 0;
-};
-
-void PhysicsServerSW::body_set_omit_force_integration(RID p_body, bool p_omit) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
-
- body->set_omit_force_integration(p_omit);
-};
-
-bool PhysicsServerSW::body_is_omitting_force_integration(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, false);
- return body->get_omit_force_integration();
-};
-
-void PhysicsServerSW::body_set_max_contacts_reported(RID p_body, int p_contacts) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
- body->set_max_contacts_reported(p_contacts);
-}
-
-int PhysicsServerSW::body_get_max_contacts_reported(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, -1);
- return body->get_max_contacts_reported();
-}
-
-void PhysicsServerSW::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
- body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
-}
-
-void PhysicsServerSW::body_set_ray_pickable(RID p_body, bool p_enable) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND(!body);
- body->set_ray_pickable(p_enable);
-}
-
-bool PhysicsServerSW::body_is_ray_pickable(RID p_body) const {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, false);
- return body->is_ray_pickable();
-}
-
-bool PhysicsServerSW::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, false);
- ERR_FAIL_COND_V(!body->get_space(), false);
- ERR_FAIL_COND_V(body->get_space()->is_locked(), false);
-
- _update_shapes();
-
- return body->get_space()->test_body_motion(body, p_from, p_motion, p_infinite_inertia, body->get_kinematic_margin(), r_result, p_exclude_raycast_shapes);
-}
-
-int PhysicsServerSW::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, false);
- ERR_FAIL_COND_V(!body->get_space(), false);
- ERR_FAIL_COND_V(body->get_space()->is_locked(), false);
-
- _update_shapes();
-
- return body->get_space()->test_body_ray_separation(body, p_transform, p_infinite_inertia, r_recover_motion, r_results, p_result_max, p_margin);
-}
-
-PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {
-
- BodySW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, NULL);
- ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
-
- direct_state->body = body;
- return direct_state;
-}
-
-/* JOINT API */
-
-RID PhysicsServerSW::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(PinJointSW(body_A, p_local_A, body_B, p_local_B));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-void PhysicsServerSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- pin_joint->set_param(p_param, p_value);
-}
-real_t PhysicsServerSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, 0);
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- return pin_joint->get_param(p_param);
-}
-
-void PhysicsServerSW::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- pin_joint->set_pos_a(p_A);
-}
-Vector3 PhysicsServerSW::pin_joint_get_local_a(RID p_joint) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, Vector3());
- ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- return pin_joint->get_position_a();
-}
-
-void PhysicsServerSW::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- pin_joint->set_pos_b(p_B);
-}
-Vector3 PhysicsServerSW::pin_joint_get_local_b(RID p_joint) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, Vector3());
- ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
- PinJointSW *pin_joint = static_cast<PinJointSW *>(joint);
- return pin_joint->get_position_b();
-}
-
-RID PhysicsServerSW::joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(HingeJointSW(body_A, body_B, p_frame_A, p_frame_B));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-RID PhysicsServerSW::joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(HingeJointSW(body_A, body_B, p_pivot_A, p_pivot_B, p_axis_A, p_axis_B));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-void PhysicsServerSW::hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_HINGE);
- HingeJointSW *hinge_joint = static_cast<HingeJointSW *>(joint);
- hinge_joint->set_param(p_param, p_value);
-}
-real_t PhysicsServerSW::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, 0);
- HingeJointSW *hinge_joint = static_cast<HingeJointSW *>(joint);
- return hinge_joint->get_param(p_param);
-}
-
-void PhysicsServerSW::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_HINGE);
- HingeJointSW *hinge_joint = static_cast<HingeJointSW *>(joint);
- hinge_joint->set_flag(p_flag, p_value);
-}
-bool PhysicsServerSW::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, false);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, false);
- HingeJointSW *hinge_joint = static_cast<HingeJointSW *>(joint);
- return hinge_joint->get_flag(p_flag);
-}
-
-void PhysicsServerSW::joint_set_solver_priority(RID p_joint, int p_priority) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- joint->set_priority(p_priority);
-}
-
-int PhysicsServerSW::joint_get_solver_priority(RID p_joint) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- return joint->get_priority();
-}
-
-void PhysicsServerSW::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) {
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
-
- joint->disable_collisions_between_bodies(p_disable);
-
- if (2 == joint->get_body_count()) {
- BodySW *body_a = *joint->get_body_ptr();
- BodySW *body_b = *(joint->get_body_ptr() + 1);
-
- if (p_disable) {
- body_add_collision_exception(body_a->get_self(), body_b->get_self());
- body_add_collision_exception(body_b->get_self(), body_a->get_self());
- } else {
- body_remove_collision_exception(body_a->get_self(), body_b->get_self());
- body_remove_collision_exception(body_b->get_self(), body_a->get_self());
- }
- }
-}
-
-bool PhysicsServerSW::joint_is_disabled_collisions_between_bodies(RID p_joint) const {
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, true);
-
- return joint->is_disabled_collisions_between_bodies();
-}
-
-PhysicsServerSW::JointType PhysicsServerSW::joint_get_type(RID p_joint) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, JOINT_PIN);
- return joint->get_type();
-}
-
-RID PhysicsServerSW::joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(SliderJointSW(body_A, body_B, p_local_frame_A, p_local_frame_B));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-void PhysicsServerSW::slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_SLIDER);
- SliderJointSW *slider_joint = static_cast<SliderJointSW *>(joint);
- slider_joint->set_param(p_param, p_value);
-}
-real_t PhysicsServerSW::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_CONE_TWIST, 0);
- SliderJointSW *slider_joint = static_cast<SliderJointSW *>(joint);
- return slider_joint->get_param(p_param);
-}
-
-RID PhysicsServerSW::joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(ConeTwistJointSW(body_A, body_B, p_local_frame_A, p_local_frame_B));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-void PhysicsServerSW::cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_CONE_TWIST);
- ConeTwistJointSW *cone_twist_joint = static_cast<ConeTwistJointSW *>(joint);
- cone_twist_joint->set_param(p_param, p_value);
-}
-real_t PhysicsServerSW::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_CONE_TWIST, 0);
- ConeTwistJointSW *cone_twist_joint = static_cast<ConeTwistJointSW *>(joint);
- return cone_twist_joint->get_param(p_param);
-}
-
-RID PhysicsServerSW::joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
-
- BodySW *body_A = body_owner.getornull(p_body_A);
- ERR_FAIL_COND_V(!body_A, RID());
-
- if (!p_body_B.is_valid()) {
- ERR_FAIL_COND_V(!body_A->get_space(), RID());
- p_body_B = body_A->get_space()->get_static_global_body();
- }
-
- BodySW *body_B = body_owner.getornull(p_body_B);
- ERR_FAIL_COND_V(!body_B, RID());
-
- ERR_FAIL_COND_V(body_A == body_B, RID());
-
- JointSW *joint = memnew(Generic6DOFJointSW(body_A, body_B, p_local_frame_A, p_local_frame_B, true));
- RID rid = joint_owner.make_rid(joint);
- joint->set_self(rid);
- return rid;
-}
-
-void PhysicsServerSW::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
- Generic6DOFJointSW *generic_6dof_joint = static_cast<Generic6DOFJointSW *>(joint);
- generic_6dof_joint->set_param(p_axis, p_param, p_value);
-}
-real_t PhysicsServerSW::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, 0);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0);
- Generic6DOFJointSW *generic_6dof_joint = static_cast<Generic6DOFJointSW *>(joint);
- return generic_6dof_joint->get_param(p_axis, p_param);
-}
-
-void PhysicsServerSW::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND(!joint);
- ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
- Generic6DOFJointSW *generic_6dof_joint = static_cast<Generic6DOFJointSW *>(joint);
- generic_6dof_joint->set_flag(p_axis, p_flag, p_enable);
-}
-bool PhysicsServerSW::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) {
-
- JointSW *joint = joint_owner.getornull(p_joint);
- ERR_FAIL_COND_V(!joint, false);
- ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, false);
- Generic6DOFJointSW *generic_6dof_joint = static_cast<Generic6DOFJointSW *>(joint);
- return generic_6dof_joint->get_flag(p_axis, p_flag);
-}
-
-void PhysicsServerSW::free(RID p_rid) {
-
- _update_shapes(); //just in case
-
- if (shape_owner.owns(p_rid)) {
-
- ShapeSW *shape = shape_owner.getornull(p_rid);
-
- while (shape->get_owners().size()) {
- ShapeOwnerSW *so = shape->get_owners().front()->key();
- so->remove_shape(shape);
- }
-
- shape_owner.free(p_rid);
- memdelete(shape);
- } else if (body_owner.owns(p_rid)) {
-
- BodySW *body = body_owner.getornull(p_rid);
-
- /*
- if (body->get_state_query())
- _clear_query(body->get_state_query());
-
- if (body->get_direct_state_query())
- _clear_query(body->get_direct_state_query());
- */
-
- body->set_space(NULL);
-
- while (body->get_shape_count()) {
-
- body->remove_shape(0);
- }
-
- body_owner.free(p_rid);
- memdelete(body);
-
- } else if (area_owner.owns(p_rid)) {
-
- AreaSW *area = area_owner.getornull(p_rid);
-
- /*
- if (area->get_monitor_query())
- _clear_query(area->get_monitor_query());
- */
-
- area->set_space(NULL);
-
- while (area->get_shape_count()) {
-
- area->remove_shape(0);
- }
-
- area_owner.free(p_rid);
- memdelete(area);
- } else if (space_owner.owns(p_rid)) {
-
- SpaceSW *space = space_owner.getornull(p_rid);
-
- while (space->get_objects().size()) {
- CollisionObjectSW *co = (CollisionObjectSW *)space->get_objects().front()->get();
- co->set_space(NULL);
- }
-
- active_spaces.erase(space);
- free(space->get_default_area()->get_self());
- free(space->get_static_global_body());
-
- space_owner.free(p_rid);
- memdelete(space);
- } else if (joint_owner.owns(p_rid)) {
-
- JointSW *joint = joint_owner.getornull(p_rid);
-
- for (int i = 0; i < joint->get_body_count(); i++) {
-
- joint->get_body_ptr()[i]->remove_constraint(joint);
- }
- joint_owner.free(p_rid);
- memdelete(joint);
-
- } else {
-
- ERR_FAIL_MSG("Invalid ID.");
- }
-};
-
-void PhysicsServerSW::set_active(bool p_active) {
-
- active = p_active;
-};
-
-void PhysicsServerSW::init() {
-
- doing_sync = true;
- last_step = 0.001;
- iterations = 8; // 8?
- stepper = memnew(StepSW);
- direct_state = memnew(PhysicsDirectBodyStateSW);
-};
-
-void PhysicsServerSW::step(real_t p_step) {
-
-#ifndef _3D_DISABLED
-
- if (!active)
- return;
-
- _update_shapes();
-
- doing_sync = false;
-
- last_step = p_step;
- PhysicsDirectBodyStateSW::singleton->step = p_step;
-
- island_count = 0;
- active_objects = 0;
- collision_pairs = 0;
- for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
-
- stepper->step((SpaceSW *)E->get(), p_step, iterations);
- island_count += E->get()->get_island_count();
- active_objects += E->get()->get_active_objects();
- collision_pairs += E->get()->get_collision_pairs();
- }
-#endif
-}
-
-void PhysicsServerSW::sync(){
-
-};
-
-void PhysicsServerSW::flush_queries() {
-
-#ifndef _3D_DISABLED
-
- if (!active)
- return;
-
- doing_sync = true;
-
- flushing_queries = true;
-
- uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
-
- for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
-
- SpaceSW *space = (SpaceSW *)E->get();
- space->call_queries();
- }
-
- flushing_queries = false;
-
- if (EngineDebugger::is_profiling("servers")) {
-
- uint64_t total_time[SpaceSW::ELAPSED_TIME_MAX];
- static const char *time_name[SpaceSW::ELAPSED_TIME_MAX] = {
- "integrate_forces",
- "generate_islands",
- "setup_constraints",
- "solve_constraints",
- "integrate_velocities"
- };
-
- for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
- total_time[i] = 0;
- }
-
- for (Set<const SpaceSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
-
- for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
- total_time[i] += E->get()->get_elapsed_time(SpaceSW::ElapsedTime(i));
- }
- }
-
- Array values;
- values.resize(SpaceSW::ELAPSED_TIME_MAX * 2);
- for (int i = 0; i < SpaceSW::ELAPSED_TIME_MAX; i++) {
- values[i * 2 + 0] = time_name[i];
- values[i * 2 + 1] = USEC_TO_SEC(total_time[i]);
- }
- values.push_back("flush_queries");
- values.push_back(USEC_TO_SEC(OS::get_singleton()->get_ticks_usec() - time_beg));
-
- values.push_front("physics");
- EngineDebugger::profiler_add_frame_data("server", values);
- }
-#endif
-};
-
-void PhysicsServerSW::finish() {
-
- memdelete(stepper);
- memdelete(direct_state);
-};
-
-int PhysicsServerSW::get_process_info(ProcessInfo p_info) {
-
- switch (p_info) {
-
- case INFO_ACTIVE_OBJECTS: {
-
- return active_objects;
- } break;
- case INFO_COLLISION_PAIRS: {
- return collision_pairs;
- } break;
- case INFO_ISLAND_COUNT: {
-
- return island_count;
- } break;
- }
-
- return 0;
-}
-
-void PhysicsServerSW::_update_shapes() {
-
- while (pending_shape_update_list.first()) {
- pending_shape_update_list.first()->self()->_shape_changed();
- pending_shape_update_list.remove(pending_shape_update_list.first());
- }
-}
-
-void PhysicsServerSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata) {
-
- CollCbkData *cbk = (CollCbkData *)p_userdata;
-
- if (cbk->max == 0)
- return;
-
- if (cbk->amount == cbk->max) {
- //find least deep
- real_t min_depth = 1e20;
- int min_depth_idx = 0;
- for (int i = 0; i < cbk->amount; i++) {
-
- real_t d = cbk->ptr[i * 2 + 0].distance_squared_to(cbk->ptr[i * 2 + 1]);
- if (d < min_depth) {
- min_depth = d;
- min_depth_idx = i;
- }
- }
-
- real_t d = p_point_A.distance_squared_to(p_point_B);
- if (d < min_depth)
- return;
- cbk->ptr[min_depth_idx * 2 + 0] = p_point_A;
- cbk->ptr[min_depth_idx * 2 + 1] = p_point_B;
-
- } else {
-
- cbk->ptr[cbk->amount * 2 + 0] = p_point_A;
- cbk->ptr[cbk->amount * 2 + 1] = p_point_B;
- cbk->amount++;
- }
-}
-
-PhysicsServerSW *PhysicsServerSW::singleton = NULL;
-PhysicsServerSW::PhysicsServerSW() {
- singleton = this;
- BroadPhaseSW::create_func = BroadPhaseOctree::_create;
- island_count = 0;
- active_objects = 0;
- collision_pairs = 0;
-
- active = true;
- flushing_queries = false;
-};
-
-PhysicsServerSW::~PhysicsServerSW(){
-
-};
diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp
index 45666d9d09..85ec2aae47 100644
--- a/servers/physics_2d/area_2d_sw.cpp
+++ b/servers/physics_2d/area_2d_sw.cpp
@@ -117,40 +117,40 @@ void Area2DSW::set_area_monitor_callback(ObjectID p_id, const StringName &p_meth
get_space()->area_add_to_moved_list(&moved_list);
}
-void Area2DSW::set_space_override_mode(Physics2DServer::AreaSpaceOverrideMode p_mode) {
- bool do_override = p_mode != Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED;
- if (do_override == (space_override_mode != Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED))
+void Area2DSW::set_space_override_mode(PhysicsServer2D::AreaSpaceOverrideMode p_mode) {
+ bool do_override = p_mode != PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED;
+ if (do_override == (space_override_mode != PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED))
return;
_unregister_shapes();
space_override_mode = p_mode;
_shape_changed();
}
-void Area2DSW::set_param(Physics2DServer::AreaParameter p_param, const Variant &p_value) {
+void Area2DSW::set_param(PhysicsServer2D::AreaParameter p_param, const Variant &p_value) {
switch (p_param) {
- case Physics2DServer::AREA_PARAM_GRAVITY: gravity = p_value; break;
- case Physics2DServer::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
- case Physics2DServer::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
- case Physics2DServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
- case Physics2DServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
- case Physics2DServer::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
- case Physics2DServer::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
- case Physics2DServer::AREA_PARAM_PRIORITY: priority = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY: gravity = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
+ case PhysicsServer2D::AREA_PARAM_PRIORITY: priority = p_value; break;
}
}
-Variant Area2DSW::get_param(Physics2DServer::AreaParameter p_param) const {
+Variant Area2DSW::get_param(PhysicsServer2D::AreaParameter p_param) const {
switch (p_param) {
- case Physics2DServer::AREA_PARAM_GRAVITY: return gravity;
- case Physics2DServer::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
- case Physics2DServer::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
- case Physics2DServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
- case Physics2DServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
- case Physics2DServer::AREA_PARAM_LINEAR_DAMP: return linear_damp;
- case Physics2DServer::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
- case Physics2DServer::AREA_PARAM_PRIORITY: return priority;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY: return gravity;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
+ case PhysicsServer2D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
+ case PhysicsServer2D::AREA_PARAM_LINEAR_DAMP: return linear_damp;
+ case PhysicsServer2D::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
+ case PhysicsServer2D::AREA_PARAM_PRIORITY: return priority;
}
return Variant();
@@ -194,7 +194,7 @@ void Area2DSW::call_queries() {
if (E->get().state == 0)
continue; //nothing happened
- res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
+ res[0] = E->get().state > 0 ? PhysicsServer2D::AREA_BODY_ADDED : PhysicsServer2D::AREA_BODY_REMOVED;
res[1] = E->key().rid;
res[2] = E->key().instance_id;
res[3] = E->key().body_shape;
@@ -226,7 +226,7 @@ void Area2DSW::call_queries() {
if (E->get().state == 0)
continue; //nothing happened
- res[0] = E->get().state > 0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
+ res[0] = E->get().state > 0 ? PhysicsServer2D::AREA_BODY_ADDED : PhysicsServer2D::AREA_BODY_REMOVED;
res[1] = E->key().rid;
res[2] = E->key().instance_id;
res[3] = E->key().body_shape;
@@ -248,7 +248,7 @@ Area2DSW::Area2DSW() :
moved_list(this) {
_set_static(true); //areas are not active by default
- space_override_mode = Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED;
+ space_override_mode = PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED;
gravity = 9.80665;
gravity_vector = Vector2(0, -1);
gravity_is_point = false;
diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h
index 54ffd9763d..ae2a8ff995 100644
--- a/servers/physics_2d/area_2d_sw.h
+++ b/servers/physics_2d/area_2d_sw.h
@@ -33,8 +33,8 @@
#include "collision_object_2d_sw.h"
#include "core/self_list.h"
-#include "servers/physics_2d_server.h"
-//#include "servers/physics/query_sw.h"
+#include "servers/physics_server_2d.h"
+//#include "servers/physics_3d/query_sw.h"
class Space2DSW;
class Body2DSW;
@@ -42,7 +42,7 @@ class Constraint2DSW;
class Area2DSW : public CollisionObject2DSW {
- Physics2DServer::AreaSpaceOverrideMode space_override_mode;
+ PhysicsServer2D::AreaSpaceOverrideMode space_override_mode;
real_t gravity;
Vector2 gravity_vector;
bool gravity_is_point;
@@ -121,11 +121,11 @@ public:
_FORCE_INLINE_ void add_area_to_query(Area2DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
_FORCE_INLINE_ void remove_area_from_query(Area2DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
- void set_param(Physics2DServer::AreaParameter p_param, const Variant &p_value);
- Variant get_param(Physics2DServer::AreaParameter p_param) const;
+ void set_param(PhysicsServer2D::AreaParameter p_param, const Variant &p_value);
+ Variant get_param(PhysicsServer2D::AreaParameter p_param) const;
- void set_space_override_mode(Physics2DServer::AreaSpaceOverrideMode p_mode);
- Physics2DServer::AreaSpaceOverrideMode get_space_override_mode() const { return space_override_mode; }
+ void set_space_override_mode(PhysicsServer2D::AreaSpaceOverrideMode p_mode);
+ PhysicsServer2D::AreaSpaceOverrideMode get_space_override_mode() const { return space_override_mode; }
_FORCE_INLINE_ void set_gravity(real_t p_gravity) { gravity = p_gravity; }
_FORCE_INLINE_ real_t get_gravity() const { return gravity; }
diff --git a/servers/physics_2d/area_pair_2d_sw.cpp b/servers/physics_2d/area_pair_2d_sw.cpp
index 05d71cfabe..669f27bcc8 100644
--- a/servers/physics_2d/area_pair_2d_sw.cpp
+++ b/servers/physics_2d/area_pair_2d_sw.cpp
@@ -45,14 +45,14 @@ bool AreaPair2DSW::setup(real_t p_step) {
if (result) {
- if (area->get_space_override_mode() != Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED)
body->add_area(area);
if (area->has_monitor_callback())
area->add_body_to_query(body, body_shape, area_shape);
} else {
- if (area->get_space_override_mode() != Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED)
body->remove_area(area);
if (area->has_monitor_callback())
area->remove_body_from_query(body, body_shape, area_shape);
@@ -76,7 +76,7 @@ AreaPair2DSW::AreaPair2DSW(Body2DSW *p_body, int p_body_shape, Area2DSW *p_area,
colliding = false;
body->add_constraint(this, 0);
area->add_constraint(this);
- if (p_body->get_mode() == Physics2DServer::BODY_MODE_KINEMATIC) //need to be active to process pair
+ if (p_body->get_mode() == PhysicsServer2D::BODY_MODE_KINEMATIC) //need to be active to process pair
p_body->set_active(true);
}
@@ -84,7 +84,7 @@ AreaPair2DSW::~AreaPair2DSW() {
if (colliding) {
- if (area->get_space_override_mode() != Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer2D::AREA_SPACE_OVERRIDE_DISABLED)
body->remove_area(area);
if (area->has_monitor_callback())
area->remove_body_from_query(body, body_shape, area_shape);
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 863b422996..79388ffe93 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -30,7 +30,7 @@
#include "body_2d_sw.h"
#include "area_2d_sw.h"
-#include "physics_2d_server_sw.h"
+#include "physics_server_2d_sw.h"
#include "space_2d_sw.h"
void Body2DSW::_update_inertia() {
@@ -45,7 +45,7 @@ void Body2DSW::update_inertias() {
switch (mode) {
- case Physics2DServer::BODY_MODE_RIGID: {
+ case PhysicsServer2D::BODY_MODE_RIGID: {
if (user_inertia) {
_inv_inertia = inertia > 0 ? (1.0 / inertia) : 0;
@@ -86,13 +86,13 @@ void Body2DSW::update_inertias() {
_inv_mass = 0;
} break;
- case Physics2DServer::BODY_MODE_KINEMATIC:
- case Physics2DServer::BODY_MODE_STATIC: {
+ case PhysicsServer2D::BODY_MODE_KINEMATIC:
+ case PhysicsServer2D::BODY_MODE_STATIC: {
_inv_inertia = 0;
_inv_mass = 0;
} break;
- case Physics2DServer::BODY_MODE_CHARACTER: {
+ case PhysicsServer2D::BODY_MODE_CHARACTER: {
_inv_inertia = 0;
_inv_mass = 1.0 / mass;
@@ -114,7 +114,7 @@ void Body2DSW::set_active(bool p_active) {
if (get_space())
get_space()->body_remove_from_active_list(&active_list);
} else {
- if (mode == Physics2DServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer2D::BODY_MODE_STATIC)
return; //static bodies can't become active
if (get_space())
get_space()->body_add_to_active_list(&active_list);
@@ -134,24 +134,24 @@ void Body2DSW::set_active(bool p_active) {
*/
}
-void Body2DSW::set_param(Physics2DServer::BodyParameter p_param, real_t p_value) {
+void Body2DSW::set_param(PhysicsServer2D::BodyParameter p_param, real_t p_value) {
switch (p_param) {
- case Physics2DServer::BODY_PARAM_BOUNCE: {
+ case PhysicsServer2D::BODY_PARAM_BOUNCE: {
bounce = p_value;
} break;
- case Physics2DServer::BODY_PARAM_FRICTION: {
+ case PhysicsServer2D::BODY_PARAM_FRICTION: {
friction = p_value;
} break;
- case Physics2DServer::BODY_PARAM_MASS: {
+ case PhysicsServer2D::BODY_PARAM_MASS: {
ERR_FAIL_COND(p_value <= 0);
mass = p_value;
_update_inertia();
} break;
- case Physics2DServer::BODY_PARAM_INERTIA: {
+ case PhysicsServer2D::BODY_PARAM_INERTIA: {
if (p_value <= 0) {
user_inertia = false;
_update_inertia();
@@ -161,14 +161,14 @@ void Body2DSW::set_param(Physics2DServer::BodyParameter p_param, real_t p_value)
_inv_inertia = 1.0 / p_value;
}
} break;
- case Physics2DServer::BODY_PARAM_GRAVITY_SCALE: {
+ case PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE: {
gravity_scale = p_value;
} break;
- case Physics2DServer::BODY_PARAM_LINEAR_DAMP: {
+ case PhysicsServer2D::BODY_PARAM_LINEAR_DAMP: {
linear_damp = p_value;
} break;
- case Physics2DServer::BODY_PARAM_ANGULAR_DAMP: {
+ case PhysicsServer2D::BODY_PARAM_ANGULAR_DAMP: {
angular_damp = p_value;
} break;
@@ -177,31 +177,31 @@ void Body2DSW::set_param(Physics2DServer::BodyParameter p_param, real_t p_value)
}
}
-real_t Body2DSW::get_param(Physics2DServer::BodyParameter p_param) const {
+real_t Body2DSW::get_param(PhysicsServer2D::BodyParameter p_param) const {
switch (p_param) {
- case Physics2DServer::BODY_PARAM_BOUNCE: {
+ case PhysicsServer2D::BODY_PARAM_BOUNCE: {
return bounce;
}
- case Physics2DServer::BODY_PARAM_FRICTION: {
+ case PhysicsServer2D::BODY_PARAM_FRICTION: {
return friction;
}
- case Physics2DServer::BODY_PARAM_MASS: {
+ case PhysicsServer2D::BODY_PARAM_MASS: {
return mass;
}
- case Physics2DServer::BODY_PARAM_INERTIA: {
+ case PhysicsServer2D::BODY_PARAM_INERTIA: {
return inertia;
}
- case Physics2DServer::BODY_PARAM_GRAVITY_SCALE: {
+ case PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE: {
return gravity_scale;
}
- case Physics2DServer::BODY_PARAM_LINEAR_DAMP: {
+ case PhysicsServer2D::BODY_PARAM_LINEAR_DAMP: {
return linear_damp;
}
- case Physics2DServer::BODY_PARAM_ANGULAR_DAMP: {
+ case PhysicsServer2D::BODY_PARAM_ANGULAR_DAMP: {
return angular_damp;
}
@@ -212,28 +212,28 @@ real_t Body2DSW::get_param(Physics2DServer::BodyParameter p_param) const {
return 0;
}
-void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
+void Body2DSW::set_mode(PhysicsServer2D::BodyMode p_mode) {
- Physics2DServer::BodyMode prev = mode;
+ PhysicsServer2D::BodyMode prev = mode;
mode = p_mode;
switch (p_mode) {
//CLEAR UP EVERYTHING IN CASE IT NOT WORKS!
- case Physics2DServer::BODY_MODE_STATIC:
- case Physics2DServer::BODY_MODE_KINEMATIC: {
+ case PhysicsServer2D::BODY_MODE_STATIC:
+ case PhysicsServer2D::BODY_MODE_KINEMATIC: {
_set_inv_transform(get_transform().affine_inverse());
_inv_mass = 0;
_inv_inertia = 0;
- _set_static(p_mode == Physics2DServer::BODY_MODE_STATIC);
- set_active(p_mode == Physics2DServer::BODY_MODE_KINEMATIC && contacts.size());
+ _set_static(p_mode == PhysicsServer2D::BODY_MODE_STATIC);
+ set_active(p_mode == PhysicsServer2D::BODY_MODE_KINEMATIC && contacts.size());
linear_velocity = Vector2();
angular_velocity = 0;
- if (mode == Physics2DServer::BODY_MODE_KINEMATIC && prev != mode) {
+ if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC && prev != mode) {
first_time_kinematic = true;
}
} break;
- case Physics2DServer::BODY_MODE_RIGID: {
+ case PhysicsServer2D::BODY_MODE_RIGID: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_inv_inertia = inertia > 0 ? (1.0 / inertia) : 0;
@@ -241,7 +241,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
set_active(true);
} break;
- case Physics2DServer::BODY_MODE_CHARACTER: {
+ case PhysicsServer2D::BODY_MODE_CHARACTER: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_inv_inertia = 0;
@@ -250,7 +250,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
angular_velocity = 0;
} break;
}
- if (p_mode == Physics2DServer::BODY_MODE_RIGID && _inv_inertia == 0) {
+ if (p_mode == PhysicsServer2D::BODY_MODE_RIGID && _inv_inertia == 0) {
_update_inertia();
}
/*
@@ -258,7 +258,7 @@ void Body2DSW::set_mode(Physics2DServer::BodyMode p_mode) {
_update_queries();
*/
}
-Physics2DServer::BodyMode Body2DSW::get_mode() const {
+PhysicsServer2D::BodyMode Body2DSW::get_mode() const {
return mode;
}
@@ -269,12 +269,12 @@ void Body2DSW::_shapes_changed() {
wakeup_neighbours();
}
-void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant &p_variant) {
+void Body2DSW::set_state(PhysicsServer2D::BodyState p_state, const Variant &p_variant) {
switch (p_state) {
- case Physics2DServer::BODY_STATE_TRANSFORM: {
+ case PhysicsServer2D::BODY_STATE_TRANSFORM: {
- if (mode == Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC) {
new_transform = p_variant;
//wakeup_neighbours();
@@ -284,7 +284,7 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant &p_va
_set_inv_transform(get_transform().affine_inverse());
first_time_kinematic = false;
}
- } else if (mode == Physics2DServer::BODY_MODE_STATIC) {
+ } else if (mode == PhysicsServer2D::BODY_MODE_STATIC) {
_set_transform(p_variant);
_set_inv_transform(get_transform().affine_inverse());
wakeup_neighbours();
@@ -300,28 +300,28 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant &p_va
wakeup();
} break;
- case Physics2DServer::BODY_STATE_LINEAR_VELOCITY: {
+ case PhysicsServer2D::BODY_STATE_LINEAR_VELOCITY: {
/*
- if (mode==Physics2DServer::BODY_MODE_STATIC)
+ if (mode==PhysicsServer2D::BODY_MODE_STATIC)
break;
*/
linear_velocity = p_variant;
wakeup();
} break;
- case Physics2DServer::BODY_STATE_ANGULAR_VELOCITY: {
+ case PhysicsServer2D::BODY_STATE_ANGULAR_VELOCITY: {
/*
- if (mode!=Physics2DServer::BODY_MODE_RIGID)
+ if (mode!=PhysicsServer2D::BODY_MODE_RIGID)
break;
*/
angular_velocity = p_variant;
wakeup();
} break;
- case Physics2DServer::BODY_STATE_SLEEPING: {
+ case PhysicsServer2D::BODY_STATE_SLEEPING: {
//?
- if (mode == Physics2DServer::BODY_MODE_STATIC || mode == Physics2DServer::BODY_MODE_KINEMATIC)
+ if (mode == PhysicsServer2D::BODY_MODE_STATIC || mode == PhysicsServer2D::BODY_MODE_KINEMATIC)
break;
bool do_sleep = p_variant;
if (do_sleep) {
@@ -331,34 +331,34 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant &p_va
//biased_angular_velocity=Vector3();
set_active(false);
} else {
- if (mode != Physics2DServer::BODY_MODE_STATIC)
+ if (mode != PhysicsServer2D::BODY_MODE_STATIC)
set_active(true);
}
} break;
- case Physics2DServer::BODY_STATE_CAN_SLEEP: {
+ case PhysicsServer2D::BODY_STATE_CAN_SLEEP: {
can_sleep = p_variant;
- if (mode == Physics2DServer::BODY_MODE_RIGID && !active && !can_sleep)
+ if (mode == PhysicsServer2D::BODY_MODE_RIGID && !active && !can_sleep)
set_active(true);
} break;
}
}
-Variant Body2DSW::get_state(Physics2DServer::BodyState p_state) const {
+Variant Body2DSW::get_state(PhysicsServer2D::BodyState p_state) const {
switch (p_state) {
- case Physics2DServer::BODY_STATE_TRANSFORM: {
+ case PhysicsServer2D::BODY_STATE_TRANSFORM: {
return get_transform();
}
- case Physics2DServer::BODY_STATE_LINEAR_VELOCITY: {
+ case PhysicsServer2D::BODY_STATE_LINEAR_VELOCITY: {
return linear_velocity;
}
- case Physics2DServer::BODY_STATE_ANGULAR_VELOCITY: {
+ case PhysicsServer2D::BODY_STATE_ANGULAR_VELOCITY: {
return angular_velocity;
}
- case Physics2DServer::BODY_STATE_SLEEPING: {
+ case PhysicsServer2D::BODY_STATE_SLEEPING: {
return !is_active();
}
- case Physics2DServer::BODY_STATE_CAN_SLEEP: {
+ case PhysicsServer2D::BODY_STATE_CAN_SLEEP: {
return can_sleep;
}
}
@@ -418,7 +418,7 @@ void Body2DSW::_compute_area_gravity_and_dampenings(const Area2DSW *p_area) {
void Body2DSW::integrate_forces(real_t p_step) {
- if (mode == Physics2DServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer2D::BODY_MODE_STATIC)
return;
Area2DSW *def_area = get_space()->get_default_area();
@@ -435,20 +435,20 @@ void Body2DSW::integrate_forces(real_t p_step) {
const AreaCMP *aa = &areas[0];
// damp_area = aa[ac-1].area;
for (int i = ac - 1; i >= 0 && !stopped; i--) {
- Physics2DServer::AreaSpaceOverrideMode mode = aa[i].area->get_space_override_mode();
+ PhysicsServer2D::AreaSpaceOverrideMode mode = aa[i].area->get_space_override_mode();
switch (mode) {
- case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE:
- case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: {
+ case PhysicsServer2D::AREA_SPACE_OVERRIDE_COMBINE:
+ case PhysicsServer2D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: {
_compute_area_gravity_and_dampenings(aa[i].area);
- stopped = mode == Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE;
+ stopped = mode == PhysicsServer2D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE;
} break;
- case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE:
- case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: {
+ case PhysicsServer2D::AREA_SPACE_OVERRIDE_REPLACE:
+ case PhysicsServer2D::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: {
gravity = Vector2(0, 0);
area_angular_damp = 0;
area_linear_damp = 0;
_compute_area_gravity_and_dampenings(aa[i].area);
- stopped = mode == Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE;
+ stopped = mode == PhysicsServer2D::AREA_SPACE_OVERRIDE_REPLACE;
} break;
default: {
}
@@ -478,7 +478,7 @@ void Body2DSW::integrate_forces(real_t p_step) {
Vector2 motion;
bool do_motion = false;
- if (mode == Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC) {
//compute motion, angular and etc. velocities from prev transform
motion = new_transform.get_origin() - get_transform().get_origin();
@@ -521,7 +521,7 @@ void Body2DSW::integrate_forces(real_t p_step) {
angular_velocity += _inv_inertia * torque * p_step;
}
- if (continuous_cd_mode != Physics2DServer::CCD_MODE_DISABLED) {
+ if (continuous_cd_mode != PhysicsServer2D::CCD_MODE_DISABLED) {
motion = linear_velocity * p_step;
do_motion = true;
@@ -545,13 +545,13 @@ void Body2DSW::integrate_forces(real_t p_step) {
void Body2DSW::integrate_velocities(real_t p_step) {
- if (mode == Physics2DServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer2D::BODY_MODE_STATIC)
return;
if (fi_callback)
get_space()->body_add_to_state_query_list(&direct_state_query_list);
- if (mode == Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC) {
_set_transform(new_transform, false);
_set_inv_transform(new_transform.affine_inverse());
@@ -566,10 +566,10 @@ void Body2DSW::integrate_velocities(real_t p_step) {
real_t angle = get_transform().get_rotation() + total_angular_velocity * p_step;
Vector2 pos = get_transform().get_origin() + total_linear_velocity * p_step;
- _set_transform(Transform2D(angle, pos), continuous_cd_mode == Physics2DServer::CCD_MODE_DISABLED);
+ _set_transform(Transform2D(angle, pos), continuous_cd_mode == PhysicsServer2D::CCD_MODE_DISABLED);
_set_inv_transform(get_transform().inverse());
- if (continuous_cd_mode != Physics2DServer::CCD_MODE_DISABLED)
+ if (continuous_cd_mode != PhysicsServer2D::CCD_MODE_DISABLED)
new_transform = get_transform();
//_update_inertia_tensor();
@@ -588,7 +588,7 @@ void Body2DSW::wakeup_neighbours() {
if (i == E->get())
continue;
Body2DSW *b = n[i];
- if (b->mode != Physics2DServer::BODY_MODE_RIGID)
+ if (b->mode != PhysicsServer2D::BODY_MODE_RIGID)
continue;
if (!b->is_active())
@@ -626,9 +626,9 @@ void Body2DSW::call_queries() {
bool Body2DSW::sleep_test(real_t p_step) {
- if (mode == Physics2DServer::BODY_MODE_STATIC || mode == Physics2DServer::BODY_MODE_KINEMATIC)
+ if (mode == PhysicsServer2D::BODY_MODE_STATIC || mode == PhysicsServer2D::BODY_MODE_KINEMATIC)
return true; //
- else if (mode == Physics2DServer::BODY_MODE_CHARACTER)
+ else if (mode == PhysicsServer2D::BODY_MODE_CHARACTER)
return !active; // characters and kinematic bodies don't sleep unless asked to sleep
else if (!can_sleep)
return false;
@@ -668,7 +668,7 @@ Body2DSW::Body2DSW() :
inertia_update_list(this),
direct_state_query_list(this) {
- mode = Physics2DServer::BODY_MODE_RIGID;
+ mode = PhysicsServer2D::BODY_MODE_RIGID;
active = true;
angular_velocity = 0;
biased_angular_velocity = 0;
@@ -695,7 +695,7 @@ Body2DSW::Body2DSW() :
first_integration = false;
still_time = 0;
- continuous_cd_mode = Physics2DServer::CCD_MODE_DISABLED;
+ continuous_cd_mode = PhysicsServer2D::CCD_MODE_DISABLED;
can_sleep = true;
fi_callback = NULL;
}
@@ -708,7 +708,7 @@ Body2DSW::~Body2DSW() {
Physics2DDirectBodyStateSW *Physics2DDirectBodyStateSW::singleton = NULL;
-Physics2DDirectSpaceState *Physics2DDirectBodyStateSW::get_space_state() {
+PhysicsDirectSpaceState2D *Physics2DDirectBodyStateSW::get_space_state() {
return body->get_space()->get_direct_state();
}
@@ -717,11 +717,11 @@ Variant Physics2DDirectBodyStateSW::get_contact_collider_shape_metadata(int p_co
ERR_FAIL_INDEX_V(p_contact_idx, body->contact_count, Variant());
- if (!Physics2DServerSW::singletonsw->body_owner.owns(body->contacts[p_contact_idx].collider)) {
+ if (!PhysicsServer2DSW::singletonsw->body_owner.owns(body->contacts[p_contact_idx].collider)) {
return Variant();
}
- Body2DSW *other = Physics2DServerSW::singletonsw->body_owner.getornull(body->contacts[p_contact_idx].collider);
+ Body2DSW *other = PhysicsServer2DSW::singletonsw->body_owner.getornull(body->contacts[p_contact_idx].collider);
int sidx = body->contacts[p_contact_idx].collider_shape;
if (sidx < 0 || sidx >= other->get_shape_count()) {
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index ea07b8260c..4a83cf9500 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -39,7 +39,7 @@ class Constraint2DSW;
class Body2DSW : public CollisionObject2DSW {
- Physics2DServer::BodyMode mode;
+ PhysicsServer2D::BodyMode mode;
Vector2 biased_linear_velocity;
real_t biased_angular_velocity;
@@ -74,7 +74,7 @@ class Body2DSW : public CollisionObject2DSW {
SelfList<Body2DSW> direct_state_query_list;
VSet<RID> exceptions;
- Physics2DServer::CCDMode continuous_cd_mode;
+ PhysicsServer2D::CCDMode continuous_cd_mode;
bool omit_force_integration;
bool active;
bool can_sleep;
@@ -158,7 +158,7 @@ public:
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) {
contacts.resize(p_size);
contact_count = 0;
- if (mode == Physics2DServer::BODY_MODE_KINEMATIC && p_size) set_active(true);
+ if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC && p_size) set_active(true);
}
_FORCE_INLINE_ int get_max_contacts_reported() const { return contacts.size(); }
@@ -224,19 +224,19 @@ public:
_FORCE_INLINE_ bool is_active() const { return active; }
_FORCE_INLINE_ void wakeup() {
- if ((!get_space()) || mode == Physics2DServer::BODY_MODE_STATIC || mode == Physics2DServer::BODY_MODE_KINEMATIC)
+ if ((!get_space()) || mode == PhysicsServer2D::BODY_MODE_STATIC || mode == PhysicsServer2D::BODY_MODE_KINEMATIC)
return;
set_active(true);
}
- void set_param(Physics2DServer::BodyParameter p_param, real_t);
- real_t get_param(Physics2DServer::BodyParameter p_param) const;
+ void set_param(PhysicsServer2D::BodyParameter p_param, real_t);
+ real_t get_param(PhysicsServer2D::BodyParameter p_param) const;
- void set_mode(Physics2DServer::BodyMode p_mode);
- Physics2DServer::BodyMode get_mode() const;
+ void set_mode(PhysicsServer2D::BodyMode p_mode);
+ PhysicsServer2D::BodyMode get_mode() const;
- void set_state(Physics2DServer::BodyState p_state, const Variant &p_variant);
- Variant get_state(Physics2DServer::BodyState p_state) const;
+ void set_state(PhysicsServer2D::BodyState p_state, const Variant &p_variant);
+ Variant get_state(PhysicsServer2D::BodyState p_state) const;
void set_applied_force(const Vector2 &p_force) { applied_force = p_force; }
Vector2 get_applied_force() const { return applied_force; }
@@ -258,8 +258,8 @@ public:
applied_torque += p_torque;
}
- _FORCE_INLINE_ void set_continuous_collision_detection_mode(Physics2DServer::CCDMode p_mode) { continuous_cd_mode = p_mode; }
- _FORCE_INLINE_ Physics2DServer::CCDMode get_continuous_collision_detection_mode() const { return continuous_cd_mode; }
+ _FORCE_INLINE_ void set_continuous_collision_detection_mode(PhysicsServer2D::CCDMode p_mode) { continuous_cd_mode = p_mode; }
+ _FORCE_INLINE_ PhysicsServer2D::CCDMode get_continuous_collision_detection_mode() const { return continuous_cd_mode; }
void set_space(Space2DSW *p_space);
@@ -278,9 +278,9 @@ public:
_FORCE_INLINE_ Vector2 get_motion() const {
- if (mode > Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (mode > PhysicsServer2D::BODY_MODE_KINEMATIC) {
return new_transform.get_origin() - get_transform().get_origin();
- } else if (mode == Physics2DServer::BODY_MODE_KINEMATIC) {
+ } else if (mode == PhysicsServer2D::BODY_MODE_KINEMATIC) {
return get_transform().get_origin() - new_transform.get_origin(); //kinematic simulates forward
}
return Vector2();
@@ -341,9 +341,9 @@ void Body2DSW::add_contact(const Vector2 &p_local_pos, const Vector2 &p_local_no
c[idx].collider_velocity_at_pos = p_collider_velocity_at_pos;
}
-class Physics2DDirectBodyStateSW : public Physics2DDirectBodyState {
+class Physics2DDirectBodyStateSW : public PhysicsDirectBodyState2D {
- GDCLASS(Physics2DDirectBodyStateSW, Physics2DDirectBodyState);
+ GDCLASS(Physics2DDirectBodyStateSW, PhysicsDirectBodyState2D);
public:
static Physics2DDirectBodyStateSW *singleton;
@@ -363,7 +363,7 @@ public:
virtual void set_angular_velocity(real_t p_velocity) { body->set_angular_velocity(p_velocity); }
virtual real_t get_angular_velocity() const { return body->get_angular_velocity(); }
- virtual void set_transform(const Transform2D &p_transform) { body->set_state(Physics2DServer::BODY_STATE_TRANSFORM, p_transform); }
+ virtual void set_transform(const Transform2D &p_transform) { body->set_state(PhysicsServer2D::BODY_STATE_TRANSFORM, p_transform); }
virtual Transform2D get_transform() const { return body->get_transform(); }
virtual void add_central_force(const Vector2 &p_force) { body->add_central_force(p_force); }
@@ -414,7 +414,7 @@ public:
return body->contacts[p_contact_idx].collider_velocity_at_pos;
}
- virtual Physics2DDirectSpaceState *get_space_state();
+ virtual PhysicsDirectSpaceState2D *get_space_state();
virtual real_t get_step() const { return step; }
Physics2DDirectBodyStateSW() {
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp
index 38f33134a5..f38a76cff6 100644
--- a/servers/physics_2d/body_pair_2d_sw.cpp
+++ b/servers/physics_2d/body_pair_2d_sw.cpp
@@ -230,7 +230,7 @@ real_t combine_friction(Body2DSW *A, Body2DSW *B) {
bool BodyPair2DSW::setup(real_t p_step) {
//cannot collide
- if (!A->test_collision_mask(B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC && B->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC && A->get_max_contacts_reported() == 0 && B->get_max_contacts_reported() == 0)) {
+ if (!A->test_collision_mask(B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC && A->get_max_contacts_reported() == 0 && B->get_max_contacts_reported() == 0)) {
collided = false;
return false;
}
@@ -258,10 +258,10 @@ bool BodyPair2DSW::setup(real_t p_step) {
Vector2 motion_A, motion_B;
- if (A->get_continuous_collision_detection_mode() == Physics2DServer::CCD_MODE_CAST_SHAPE) {
+ if (A->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_SHAPE) {
motion_A = A->get_motion();
}
- if (B->get_continuous_collision_detection_mode() == Physics2DServer::CCD_MODE_CAST_SHAPE) {
+ if (B->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_SHAPE) {
motion_B = B->get_motion();
}
//faster to set than to check..
@@ -273,12 +273,12 @@ bool BodyPair2DSW::setup(real_t p_step) {
//test ccd (currently just a raycast)
- if (A->get_continuous_collision_detection_mode() == Physics2DServer::CCD_MODE_CAST_RAY && A->get_mode() > Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (A->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_RAY && A->get_mode() > PhysicsServer2D::BODY_MODE_KINEMATIC) {
if (_test_ccd(p_step, A, shape_A, xform_A, B, shape_B, xform_B))
collided = true;
}
- if (B->get_continuous_collision_detection_mode() == Physics2DServer::CCD_MODE_CAST_RAY && B->get_mode() > Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (B->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_RAY && B->get_mode() > PhysicsServer2D::BODY_MODE_KINEMATIC) {
if (_test_ccd(p_step, B, shape_B, xform_B, A, shape_A, xform_A, true))
collided = true;
}
@@ -405,7 +405,7 @@ bool BodyPair2DSW::setup(real_t p_step) {
}
}
- if ((A->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC && B->get_mode() <= Physics2DServer::BODY_MODE_KINEMATIC)) {
+ if ((A->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer2D::BODY_MODE_KINEMATIC)) {
c.active = false;
collided = false;
continue;
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index 8fb3296be6..a6891372c2 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "collision_object_2d_sw.h"
-#include "servers/physics_2d/physics_2d_server_sw.h"
+#include "servers/physics_2d/physics_server_2d_sw.h"
#include "space_2d_sw.h"
void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Transform2D &p_transform, bool p_disabled) {
@@ -46,7 +46,7 @@ void CollisionObject2DSW::add_shape(Shape2DSW *p_shape, const Transform2D &p_tra
p_shape->add_owner(this);
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
// _update_shapes();
// _shapes_changed();
@@ -61,7 +61,7 @@ void CollisionObject2DSW::set_shape(int p_index, Shape2DSW *p_shape) {
p_shape->add_owner(this);
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
// _update_shapes();
// _shapes_changed();
@@ -81,7 +81,7 @@ void CollisionObject2DSW::set_shape_transform(int p_index, const Transform2D &p_
shapes.write[p_index].xform_inv = p_transform.affine_inverse();
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
// _update_shapes();
// _shapes_changed();
@@ -103,12 +103,12 @@ void CollisionObject2DSW::set_shape_as_disabled(int p_idx, bool p_disabled) {
space->get_broadphase()->remove(shape.bpid);
shape.bpid = 0;
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes();
} else if (!p_disabled && shape.bpid == 0) {
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes(); // automatically adds shape with bpid == 0
}
@@ -142,7 +142,7 @@ void CollisionObject2DSW::remove_shape(int p_index) {
shapes.remove(p_index);
if (!pending_shape_update_list.in_list()) {
- Physics2DServerSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer2DSW::singletonsw->pending_shape_update_list.add(&pending_shape_update_list);
}
// _update_shapes();
// _shapes_changed();
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 3f9d19bbab..98105a7c0e 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -33,7 +33,7 @@
#include "broad_phase_2d_sw.h"
#include "core/self_list.h"
-#include "servers/physics_2d_server.h"
+#include "servers/physics_server_2d.h"
#include "shape_2d_sw.h"
class Space2DSW;
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index da67fcc770..217c93c6da 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -1042,16 +1042,16 @@ static void _collision_convex_polygon_convex_polygon(const Shape2DSW *p_a, const
bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap, Vector2 *sep_axis, real_t p_margin_A, real_t p_margin_B) {
- Physics2DServer::ShapeType type_A = p_shape_A->get_type();
+ PhysicsServer2D::ShapeType type_A = p_shape_A->get_type();
- ERR_FAIL_COND_V(type_A == Physics2DServer::SHAPE_LINE, false);
- //ERR_FAIL_COND_V(type_A==Physics2DServer::SHAPE_RAY,false);
+ ERR_FAIL_COND_V(type_A == PhysicsServer2D::SHAPE_LINE, false);
+ //ERR_FAIL_COND_V(type_A==PhysicsServer2D::SHAPE_RAY,false);
ERR_FAIL_COND_V(p_shape_A->is_concave(), false);
- Physics2DServer::ShapeType type_B = p_shape_B->get_type();
+ PhysicsServer2D::ShapeType type_B = p_shape_B->get_type();
- ERR_FAIL_COND_V(type_B == Physics2DServer::SHAPE_LINE, false);
- //ERR_FAIL_COND_V(type_B==Physics2DServer::SHAPE_RAY,false);
+ ERR_FAIL_COND_V(type_B == PhysicsServer2D::SHAPE_LINE, false);
+ //ERR_FAIL_COND_V(type_B==PhysicsServer2D::SHAPE_RAY,false);
ERR_FAIL_COND_V(p_shape_B->is_concave(), false);
static const CollisionFunc collision_table[5][5] = {
diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp
index 60cca6f825..f117dcbfe5 100644
--- a/servers/physics_2d/collision_solver_2d_sw.cpp
+++ b/servers/physics_2d/collision_solver_2d_sw.cpp
@@ -37,7 +37,7 @@
bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
const LineShape2DSW *line = static_cast<const LineShape2DSW *>(p_shape_A);
- if (p_shape_B->get_type() == Physics2DServer::SHAPE_LINE)
+ if (p_shape_B->get_type() == PhysicsServer2D::SHAPE_LINE)
return false;
Vector2 n = p_transform_A.basis_xform(line->get_normal()).normalized();
@@ -75,7 +75,7 @@ bool CollisionSolver2DSW::solve_static_line(const Shape2DSW *p_shape_A, const Tr
bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis) {
const RayShape2DSW *ray = static_cast<const RayShape2DSW *>(p_shape_A);
- if (p_shape_B->get_type() == Physics2DServer::SHAPE_RAY)
+ if (p_shape_B->get_type() == PhysicsServer2D::SHAPE_RAY)
return false;
Vector2 from = p_transform_A.get_origin();
@@ -195,8 +195,8 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A, const Transf
bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *sep_axis, real_t p_margin_A, real_t p_margin_B) {
- Physics2DServer::ShapeType type_A = p_shape_A->get_type();
- Physics2DServer::ShapeType type_B = p_shape_B->get_type();
+ PhysicsServer2D::ShapeType type_A = p_shape_A->get_type();
+ PhysicsServer2D::ShapeType type_B = p_shape_B->get_type();
bool concave_A = p_shape_A->is_concave();
bool concave_B = p_shape_B->is_concave();
real_t margin_A = p_margin_A, margin_B = p_margin_B;
@@ -210,9 +210,9 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
swap = true;
}
- if (type_A == Physics2DServer::SHAPE_LINE) {
+ if (type_A == PhysicsServer2D::SHAPE_LINE) {
- if (type_B == Physics2DServer::SHAPE_LINE || type_B == Physics2DServer::SHAPE_RAY) {
+ if (type_B == PhysicsServer2D::SHAPE_LINE || type_B == PhysicsServer2D::SHAPE_RAY) {
return false;
}
@@ -222,9 +222,9 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
return solve_static_line(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
}
- } else if (type_A == Physics2DServer::SHAPE_RAY) {
+ } else if (type_A == PhysicsServer2D::SHAPE_RAY) {
- if (type_B == Physics2DServer::SHAPE_RAY) {
+ if (type_B == PhysicsServer2D::SHAPE_RAY) {
return false; //no ray-ray
}
diff --git a/servers/physics_2d/joints_2d_sw.cpp b/servers/physics_2d/joints_2d_sw.cpp
index 02b3502242..4524629d50 100644
--- a/servers/physics_2d/joints_2d_sw.cpp
+++ b/servers/physics_2d/joints_2d_sw.cpp
@@ -171,15 +171,15 @@ void PinJoint2DSW::solve(real_t p_step) {
P += impulse;
}
-void PinJoint2DSW::set_param(Physics2DServer::PinJointParam p_param, real_t p_value) {
+void PinJoint2DSW::set_param(PhysicsServer2D::PinJointParam p_param, real_t p_value) {
- if (p_param == Physics2DServer::PIN_JOINT_SOFTNESS)
+ if (p_param == PhysicsServer2D::PIN_JOINT_SOFTNESS)
softness = p_value;
}
-real_t PinJoint2DSW::get_param(Physics2DServer::PinJointParam p_param) const {
+real_t PinJoint2DSW::get_param(PhysicsServer2D::PinJointParam p_param) const {
- if (p_param == Physics2DServer::PIN_JOINT_SOFTNESS)
+ if (p_param == PhysicsServer2D::PIN_JOINT_SOFTNESS)
return softness;
ERR_FAIL_V(0);
}
@@ -396,38 +396,38 @@ void DampedSpringJoint2DSW::solve(real_t p_step) {
B->apply_impulse(rB, j);
}
-void DampedSpringJoint2DSW::set_param(Physics2DServer::DampedStringParam p_param, real_t p_value) {
+void DampedSpringJoint2DSW::set_param(PhysicsServer2D::DampedStringParam p_param, real_t p_value) {
switch (p_param) {
- case Physics2DServer::DAMPED_STRING_REST_LENGTH: {
+ case PhysicsServer2D::DAMPED_STRING_REST_LENGTH: {
rest_length = p_value;
} break;
- case Physics2DServer::DAMPED_STRING_DAMPING: {
+ case PhysicsServer2D::DAMPED_STRING_DAMPING: {
damping = p_value;
} break;
- case Physics2DServer::DAMPED_STRING_STIFFNESS: {
+ case PhysicsServer2D::DAMPED_STRING_STIFFNESS: {
stiffness = p_value;
} break;
}
}
-real_t DampedSpringJoint2DSW::get_param(Physics2DServer::DampedStringParam p_param) const {
+real_t DampedSpringJoint2DSW::get_param(PhysicsServer2D::DampedStringParam p_param) const {
switch (p_param) {
- case Physics2DServer::DAMPED_STRING_REST_LENGTH: {
+ case PhysicsServer2D::DAMPED_STRING_REST_LENGTH: {
return rest_length;
} break;
- case Physics2DServer::DAMPED_STRING_DAMPING: {
+ case PhysicsServer2D::DAMPED_STRING_DAMPING: {
return damping;
} break;
- case Physics2DServer::DAMPED_STRING_STIFFNESS: {
+ case PhysicsServer2D::DAMPED_STRING_STIFFNESS: {
return stiffness;
} break;
diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h
index 3e8fc1a29f..f4aeb6e3c8 100644
--- a/servers/physics_2d/joints_2d_sw.h
+++ b/servers/physics_2d/joints_2d_sw.h
@@ -50,7 +50,7 @@ public:
_FORCE_INLINE_ void set_max_bias(real_t p_bias) { max_bias = p_bias; }
_FORCE_INLINE_ real_t get_max_bias() const { return max_bias; }
- virtual Physics2DServer::JointType get_type() const = 0;
+ virtual PhysicsServer2D::JointType get_type() const = 0;
Joint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0) :
Constraint2DSW(p_body_ptr, p_body_count) {
bias = 0;
@@ -78,13 +78,13 @@ class PinJoint2DSW : public Joint2DSW {
real_t softness;
public:
- virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_PIN; }
+ virtual PhysicsServer2D::JointType get_type() const { return PhysicsServer2D::JOINT_PIN; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
- void set_param(Physics2DServer::PinJointParam p_param, real_t p_value);
- real_t get_param(Physics2DServer::PinJointParam p_param) const;
+ void set_param(PhysicsServer2D::PinJointParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer2D::PinJointParam p_param) const;
PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = NULL);
~PinJoint2DSW();
@@ -116,7 +116,7 @@ class GrooveJoint2DSW : public Joint2DSW {
bool correct;
public:
- virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_GROOVE; }
+ virtual PhysicsServer2D::JointType get_type() const { return PhysicsServer2D::JOINT_GROOVE; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
@@ -150,13 +150,13 @@ class DampedSpringJoint2DSW : public Joint2DSW {
real_t v_coef;
public:
- virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_DAMPED_SPRING; }
+ virtual PhysicsServer2D::JointType get_type() const { return PhysicsServer2D::JOINT_DAMPED_SPRING; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
- void set_param(Physics2DServer::DampedStringParam p_param, real_t p_value);
- real_t get_param(Physics2DServer::DampedStringParam p_param) const;
+ void set_param(PhysicsServer2D::DampedStringParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer2D::DampedStringParam p_param) const;
DampedSpringJoint2DSW(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, Body2DSW *p_body_a, Body2DSW *p_body_b);
~DampedSpringJoint2DSW();
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp
index baeb3f76b0..cd1f14b69d 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_server_2d_sw.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "physics_2d_server_sw.h"
+#include "physics_server_2d_sw.h"
#include "broad_phase_2d_basic.h"
#include "broad_phase_2d_hash_grid.h"
#include "collision_solver_2d_sw.h"
@@ -39,7 +39,7 @@
#define FLUSH_QUERY_CHECK(m_object) \
ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
-RID Physics2DServerSW::_shape_create(ShapeType p_shape) {
+RID PhysicsServer2DSW::_shape_create(ShapeType p_shape) {
Shape2DSW *shape = NULL;
switch (p_shape) {
@@ -89,63 +89,63 @@ RID Physics2DServerSW::_shape_create(ShapeType p_shape) {
return id;
}
-RID Physics2DServerSW::line_shape_create() {
+RID PhysicsServer2DSW::line_shape_create() {
return _shape_create(SHAPE_LINE);
}
-RID Physics2DServerSW::ray_shape_create() {
+RID PhysicsServer2DSW::ray_shape_create() {
return _shape_create(SHAPE_RAY);
}
-RID Physics2DServerSW::segment_shape_create() {
+RID PhysicsServer2DSW::segment_shape_create() {
return _shape_create(SHAPE_SEGMENT);
}
-RID Physics2DServerSW::circle_shape_create() {
+RID PhysicsServer2DSW::circle_shape_create() {
return _shape_create(SHAPE_CIRCLE);
}
-RID Physics2DServerSW::rectangle_shape_create() {
+RID PhysicsServer2DSW::rectangle_shape_create() {
return _shape_create(SHAPE_RECTANGLE);
}
-RID Physics2DServerSW::capsule_shape_create() {
+RID PhysicsServer2DSW::capsule_shape_create() {
return _shape_create(SHAPE_CAPSULE);
}
-RID Physics2DServerSW::convex_polygon_shape_create() {
+RID PhysicsServer2DSW::convex_polygon_shape_create() {
return _shape_create(SHAPE_CONVEX_POLYGON);
}
-RID Physics2DServerSW::concave_polygon_shape_create() {
+RID PhysicsServer2DSW::concave_polygon_shape_create() {
return _shape_create(SHAPE_CONCAVE_POLYGON);
}
-void Physics2DServerSW::shape_set_data(RID p_shape, const Variant &p_data) {
+void PhysicsServer2DSW::shape_set_data(RID p_shape, const Variant &p_data) {
Shape2DSW *shape = shape_owner.getornull(p_shape);
ERR_FAIL_COND(!shape);
shape->set_data(p_data);
};
-void Physics2DServerSW::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {
+void PhysicsServer2DSW::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {
Shape2DSW *shape = shape_owner.getornull(p_shape);
ERR_FAIL_COND(!shape);
shape->set_custom_bias(p_bias);
}
-Physics2DServer::ShapeType Physics2DServerSW::shape_get_type(RID p_shape) const {
+PhysicsServer2D::ShapeType PhysicsServer2DSW::shape_get_type(RID p_shape) const {
const Shape2DSW *shape = shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, SHAPE_CUSTOM);
return shape->get_type();
};
-Variant Physics2DServerSW::shape_get_data(RID p_shape) const {
+Variant PhysicsServer2DSW::shape_get_data(RID p_shape) const {
const Shape2DSW *shape = shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, Variant());
@@ -153,14 +153,14 @@ Variant Physics2DServerSW::shape_get_data(RID p_shape) const {
return shape->get_data();
};
-real_t Physics2DServerSW::shape_get_custom_solver_bias(RID p_shape) const {
+real_t PhysicsServer2DSW::shape_get_custom_solver_bias(RID p_shape) const {
const Shape2DSW *shape = shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
return shape->get_custom_bias();
}
-void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &p_point_B, void *p_userdata) {
+void PhysicsServer2DSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &p_point_B, void *p_userdata) {
CollCbkData *cbk = (CollCbkData *)p_userdata;
@@ -217,7 +217,7 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
}
}
-bool Physics2DServerSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_A, const Vector2 &p_motion_A, RID p_shape_B, const Transform2D &p_xform_B, const Vector2 &p_motion_B, Vector2 *r_results, int p_result_max, int &r_result_count) {
+bool PhysicsServer2DSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_A, const Vector2 &p_motion_A, RID p_shape_B, const Transform2D &p_xform_B, const Vector2 &p_motion_B, Vector2 *r_results, int p_result_max, int &r_result_count) {
Shape2DSW *shape_A = shape_owner.getornull(p_shape_A);
ERR_FAIL_COND_V(!shape_A, false);
@@ -240,7 +240,7 @@ bool Physics2DServerSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_
return res;
}
-RID Physics2DServerSW::space_create() {
+RID PhysicsServer2DSW::space_create() {
Space2DSW *space = memnew(Space2DSW);
RID id = space_owner.make_rid(space);
@@ -255,7 +255,7 @@ RID Physics2DServerSW::space_create() {
return id;
};
-void Physics2DServerSW::space_set_active(RID p_space, bool p_active) {
+void PhysicsServer2DSW::space_set_active(RID p_space, bool p_active) {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -265,7 +265,7 @@ void Physics2DServerSW::space_set_active(RID p_space, bool p_active) {
active_spaces.erase(space);
}
-bool Physics2DServerSW::space_is_active(RID p_space) const {
+bool PhysicsServer2DSW::space_is_active(RID p_space) const {
const Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND_V(!space, false);
@@ -273,7 +273,7 @@ bool Physics2DServerSW::space_is_active(RID p_space) const {
return active_spaces.has(space);
}
-void Physics2DServerSW::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
+void PhysicsServer2DSW::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -281,35 +281,35 @@ void Physics2DServerSW::space_set_param(RID p_space, SpaceParameter p_param, rea
space->set_param(p_param, p_value);
}
-real_t Physics2DServerSW::space_get_param(RID p_space, SpaceParameter p_param) const {
+real_t PhysicsServer2DSW::space_get_param(RID p_space, SpaceParameter p_param) const {
const Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND_V(!space, 0);
return space->get_param(p_param);
}
-void Physics2DServerSW::space_set_debug_contacts(RID p_space, int p_max_contacts) {
+void PhysicsServer2DSW::space_set_debug_contacts(RID p_space, int p_max_contacts) {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
space->set_debug_contacts(p_max_contacts);
}
-Vector<Vector2> Physics2DServerSW::space_get_contacts(RID p_space) const {
+Vector<Vector2> PhysicsServer2DSW::space_get_contacts(RID p_space) const {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND_V(!space, Vector<Vector2>());
return space->get_debug_contacts();
}
-int Physics2DServerSW::space_get_contact_count(RID p_space) const {
+int PhysicsServer2DSW::space_get_contact_count(RID p_space) const {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND_V(!space, 0);
return space->get_debug_contact_count();
}
-Physics2DDirectSpaceState *Physics2DServerSW::space_get_direct_state(RID p_space) {
+PhysicsDirectSpaceState2D *PhysicsServer2DSW::space_get_direct_state(RID p_space) {
Space2DSW *space = space_owner.getornull(p_space);
ERR_FAIL_COND_V(!space, NULL);
@@ -318,7 +318,7 @@ Physics2DDirectSpaceState *Physics2DServerSW::space_get_direct_state(RID p_space
return space->get_direct_state();
}
-RID Physics2DServerSW::area_create() {
+RID PhysicsServer2DSW::area_create() {
Area2DSW *area = memnew(Area2DSW);
RID rid = area_owner.make_rid(area);
@@ -326,7 +326,7 @@ RID Physics2DServerSW::area_create() {
return rid;
};
-void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
+void PhysicsServer2DSW::area_set_space(RID p_area, RID p_space) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -344,7 +344,7 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
area->set_space(space);
};
-RID Physics2DServerSW::area_get_space(RID p_area) const {
+RID PhysicsServer2DSW::area_get_space(RID p_area) const {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, RID());
@@ -355,7 +355,7 @@ RID Physics2DServerSW::area_get_space(RID p_area) const {
return space->get_self();
};
-void Physics2DServerSW::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {
+void PhysicsServer2DSW::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -363,7 +363,7 @@ void Physics2DServerSW::area_set_space_override_mode(RID p_area, AreaSpaceOverri
area->set_space_override_mode(p_mode);
}
-Physics2DServer::AreaSpaceOverrideMode Physics2DServerSW::area_get_space_override_mode(RID p_area) const {
+PhysicsServer2D::AreaSpaceOverrideMode PhysicsServer2DSW::area_get_space_override_mode(RID p_area) const {
const Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, AREA_SPACE_OVERRIDE_DISABLED);
@@ -371,7 +371,7 @@ Physics2DServer::AreaSpaceOverrideMode Physics2DServerSW::area_get_space_overrid
return area->get_space_override_mode();
}
-void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
+void PhysicsServer2DSW::area_add_shape(RID p_area, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -382,7 +382,7 @@ void Physics2DServerSW::area_add_shape(RID p_area, RID p_shape, const Transform2
area->add_shape(shape, p_transform, p_disabled);
}
-void Physics2DServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
+void PhysicsServer2DSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -393,7 +393,7 @@ void Physics2DServerSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape)
area->set_shape(p_shape_idx, shape);
}
-void Physics2DServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D &p_transform) {
+void PhysicsServer2DSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform2D &p_transform) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -401,7 +401,7 @@ void Physics2DServerSW::area_set_shape_transform(RID p_area, int p_shape_idx, co
area->set_shape_transform(p_shape_idx, p_transform);
}
-void Physics2DServerSW::area_set_shape_disabled(RID p_area, int p_shape, bool p_disabled) {
+void PhysicsServer2DSW::area_set_shape_disabled(RID p_area, int p_shape, bool p_disabled) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -411,14 +411,14 @@ void Physics2DServerSW::area_set_shape_disabled(RID p_area, int p_shape, bool p_
area->set_shape_as_disabled(p_shape, p_disabled);
}
-int Physics2DServerSW::area_get_shape_count(RID p_area) const {
+int PhysicsServer2DSW::area_get_shape_count(RID p_area) const {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, -1);
return area->get_shape_count();
}
-RID Physics2DServerSW::area_get_shape(RID p_area, int p_shape_idx) const {
+RID PhysicsServer2DSW::area_get_shape(RID p_area, int p_shape_idx) const {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, RID());
@@ -428,7 +428,7 @@ RID Physics2DServerSW::area_get_shape(RID p_area, int p_shape_idx) const {
return shape->get_self();
}
-Transform2D Physics2DServerSW::area_get_shape_transform(RID p_area, int p_shape_idx) const {
+Transform2D PhysicsServer2DSW::area_get_shape_transform(RID p_area, int p_shape_idx) const {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, Transform2D());
@@ -436,7 +436,7 @@ Transform2D Physics2DServerSW::area_get_shape_transform(RID p_area, int p_shape_
return area->get_shape_transform(p_shape_idx);
}
-void Physics2DServerSW::area_remove_shape(RID p_area, int p_shape_idx) {
+void PhysicsServer2DSW::area_remove_shape(RID p_area, int p_shape_idx) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -444,7 +444,7 @@ void Physics2DServerSW::area_remove_shape(RID p_area, int p_shape_idx) {
area->remove_shape(p_shape_idx);
}
-void Physics2DServerSW::area_clear_shapes(RID p_area) {
+void PhysicsServer2DSW::area_clear_shapes(RID p_area) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -453,7 +453,7 @@ void Physics2DServerSW::area_clear_shapes(RID p_area) {
area->remove_shape(0);
}
-void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
+void PhysicsServer2DSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -463,7 +463,7 @@ void Physics2DServerSW::area_attach_object_instance_id(RID p_area, ObjectID p_id
ERR_FAIL_COND(!area);
area->set_instance_id(p_id);
}
-ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const {
+ObjectID PhysicsServer2DSW::area_get_object_instance_id(RID p_area) const {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -474,7 +474,7 @@ ObjectID Physics2DServerSW::area_get_object_instance_id(RID p_area) const {
return area->get_instance_id();
}
-void Physics2DServerSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_id) {
+void PhysicsServer2DSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_id) {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -484,7 +484,7 @@ void Physics2DServerSW::area_attach_canvas_instance_id(RID p_area, ObjectID p_id
ERR_FAIL_COND(!area);
area->set_canvas_instance_id(p_id);
}
-ObjectID Physics2DServerSW::area_get_canvas_instance_id(RID p_area) const {
+ObjectID PhysicsServer2DSW::area_get_canvas_instance_id(RID p_area) const {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -495,7 +495,7 @@ ObjectID Physics2DServerSW::area_get_canvas_instance_id(RID p_area) const {
return area->get_canvas_instance_id();
}
-void Physics2DServerSW::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) {
+void PhysicsServer2DSW::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -506,14 +506,14 @@ void Physics2DServerSW::area_set_param(RID p_area, AreaParameter p_param, const
area->set_param(p_param, p_value);
};
-void Physics2DServerSW::area_set_transform(RID p_area, const Transform2D &p_transform) {
+void PhysicsServer2DSW::area_set_transform(RID p_area, const Transform2D &p_transform) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
area->set_transform(p_transform);
};
-Variant Physics2DServerSW::area_get_param(RID p_area, AreaParameter p_param) const {
+Variant PhysicsServer2DSW::area_get_param(RID p_area, AreaParameter p_param) const {
if (space_owner.owns(p_area)) {
Space2DSW *space = space_owner.getornull(p_area);
@@ -525,7 +525,7 @@ Variant Physics2DServerSW::area_get_param(RID p_area, AreaParameter p_param) con
return area->get_param(p_param);
};
-Transform2D Physics2DServerSW::area_get_transform(RID p_area) const {
+Transform2D PhysicsServer2DSW::area_get_transform(RID p_area) const {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND_V(!area, Transform2D());
@@ -533,14 +533,14 @@ Transform2D Physics2DServerSW::area_get_transform(RID p_area) const {
return area->get_transform();
};
-void Physics2DServerSW::area_set_pickable(RID p_area, bool p_pickable) {
+void PhysicsServer2DSW::area_set_pickable(RID p_area, bool p_pickable) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
area->set_pickable(p_pickable);
}
-void Physics2DServerSW::area_set_monitorable(RID p_area, bool p_monitorable) {
+void PhysicsServer2DSW::area_set_monitorable(RID p_area, bool p_monitorable) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -549,7 +549,7 @@ void Physics2DServerSW::area_set_monitorable(RID p_area, bool p_monitorable) {
area->set_monitorable(p_monitorable);
}
-void Physics2DServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
+void PhysicsServer2DSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -557,7 +557,7 @@ void Physics2DServerSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
area->set_collision_mask(p_mask);
}
-void Physics2DServerSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
+void PhysicsServer2DSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -565,7 +565,7 @@ void Physics2DServerSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
area->set_collision_layer(p_layer);
}
-void Physics2DServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
+void PhysicsServer2DSW::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -573,7 +573,7 @@ void Physics2DServerSW::area_set_monitor_callback(RID p_area, Object *p_receiver
area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
}
-void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
+void PhysicsServer2DSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
@@ -583,7 +583,7 @@ void Physics2DServerSW::area_set_area_monitor_callback(RID p_area, Object *p_rec
/* BODY API */
-RID Physics2DServerSW::body_create() {
+RID PhysicsServer2DSW::body_create() {
Body2DSW *body = memnew(Body2DSW);
RID rid = body_owner.make_rid(body);
@@ -591,7 +591,7 @@ RID Physics2DServerSW::body_create() {
return rid;
}
-void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
+void PhysicsServer2DSW::body_set_space(RID p_body, RID p_space) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -608,7 +608,7 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
body->set_space(space);
};
-RID Physics2DServerSW::body_get_space(RID p_body) const {
+RID PhysicsServer2DSW::body_get_space(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, RID());
@@ -619,7 +619,7 @@ RID Physics2DServerSW::body_get_space(RID p_body) const {
return space->get_self();
};
-void Physics2DServerSW::body_set_mode(RID p_body, BodyMode p_mode) {
+void PhysicsServer2DSW::body_set_mode(RID p_body, BodyMode p_mode) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -628,7 +628,7 @@ void Physics2DServerSW::body_set_mode(RID p_body, BodyMode p_mode) {
body->set_mode(p_mode);
};
-Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body) const {
+PhysicsServer2D::BodyMode PhysicsServer2DSW::body_get_mode(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, BODY_MODE_STATIC);
@@ -636,7 +636,7 @@ Physics2DServer::BodyMode Physics2DServerSW::body_get_mode(RID p_body) const {
return body->get_mode();
};
-void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
+void PhysicsServer2DSW::body_add_shape(RID p_body, RID p_shape, const Transform2D &p_transform, bool p_disabled) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -647,7 +647,7 @@ void Physics2DServerSW::body_add_shape(RID p_body, RID p_shape, const Transform2
body->add_shape(shape, p_transform, p_disabled);
}
-void Physics2DServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
+void PhysicsServer2DSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -658,7 +658,7 @@ void Physics2DServerSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape)
body->set_shape(p_shape_idx, shape);
}
-void Physics2DServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform) {
+void PhysicsServer2DSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform2D &p_transform) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -666,28 +666,28 @@ void Physics2DServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, co
body->set_shape_transform(p_shape_idx, p_transform);
}
-void Physics2DServerSW::body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) {
+void PhysicsServer2DSW::body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant &p_metadata) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_shape_metadata(p_shape_idx, p_metadata);
}
-Variant Physics2DServerSW::body_get_shape_metadata(RID p_body, int p_shape_idx) const {
+Variant PhysicsServer2DSW::body_get_shape_metadata(RID p_body, int p_shape_idx) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, Variant());
return body->get_shape_metadata(p_shape_idx);
}
-int Physics2DServerSW::body_get_shape_count(RID p_body) const {
+int PhysicsServer2DSW::body_get_shape_count(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, -1);
return body->get_shape_count();
}
-RID Physics2DServerSW::body_get_shape(RID p_body, int p_shape_idx) const {
+RID PhysicsServer2DSW::body_get_shape(RID p_body, int p_shape_idx) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, RID());
@@ -697,7 +697,7 @@ RID Physics2DServerSW::body_get_shape(RID p_body, int p_shape_idx) const {
return shape->get_self();
}
-Transform2D Physics2DServerSW::body_get_shape_transform(RID p_body, int p_shape_idx) const {
+Transform2D PhysicsServer2DSW::body_get_shape_transform(RID p_body, int p_shape_idx) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, Transform2D());
@@ -705,7 +705,7 @@ Transform2D Physics2DServerSW::body_get_shape_transform(RID p_body, int p_shape_
return body->get_shape_transform(p_shape_idx);
}
-void Physics2DServerSW::body_remove_shape(RID p_body, int p_shape_idx) {
+void PhysicsServer2DSW::body_remove_shape(RID p_body, int p_shape_idx) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -713,7 +713,7 @@ void Physics2DServerSW::body_remove_shape(RID p_body, int p_shape_idx) {
body->remove_shape(p_shape_idx);
}
-void Physics2DServerSW::body_clear_shapes(RID p_body) {
+void PhysicsServer2DSW::body_clear_shapes(RID p_body) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -722,7 +722,7 @@ void Physics2DServerSW::body_clear_shapes(RID p_body) {
body->remove_shape(0);
}
-void Physics2DServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
+void PhysicsServer2DSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -731,7 +731,7 @@ void Physics2DServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, boo
body->set_shape_as_disabled(p_shape_idx, p_disabled);
}
-void Physics2DServerSW::body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin) {
+void PhysicsServer2DSW::body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -741,14 +741,14 @@ void Physics2DServerSW::body_set_shape_as_one_way_collision(RID p_body, int p_sh
body->set_shape_as_one_way_collision(p_shape_idx, p_enable, p_margin);
}
-void Physics2DServerSW::body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode) {
+void PhysicsServer2DSW::body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_continuous_collision_detection_mode(p_mode);
}
-Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_detection_mode(RID p_body) const {
+PhysicsServer2DSW::CCDMode PhysicsServer2DSW::body_get_continuous_collision_detection_mode(RID p_body) const {
const Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, CCD_MODE_DISABLED);
@@ -756,7 +756,7 @@ Physics2DServerSW::CCDMode Physics2DServerSW::body_get_continuous_collision_dete
return body->get_continuous_collision_detection_mode();
}
-void Physics2DServerSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
+void PhysicsServer2DSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -764,7 +764,7 @@ void Physics2DServerSW::body_attach_object_instance_id(RID p_body, ObjectID p_id
body->set_instance_id(p_id);
};
-ObjectID Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
+ObjectID PhysicsServer2DSW::body_get_object_instance_id(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, ObjectID());
@@ -772,7 +772,7 @@ ObjectID Physics2DServerSW::body_get_object_instance_id(RID p_body) const {
return body->get_instance_id();
};
-void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, ObjectID p_id) {
+void PhysicsServer2DSW::body_attach_canvas_instance_id(RID p_body, ObjectID p_id) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -780,7 +780,7 @@ void Physics2DServerSW::body_attach_canvas_instance_id(RID p_body, ObjectID p_id
body->set_canvas_instance_id(p_id);
};
-ObjectID Physics2DServerSW::body_get_canvas_instance_id(RID p_body) const {
+ObjectID PhysicsServer2DSW::body_get_canvas_instance_id(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, ObjectID());
@@ -788,14 +788,14 @@ ObjectID Physics2DServerSW::body_get_canvas_instance_id(RID p_body) const {
return body->get_canvas_instance_id();
};
-void Physics2DServerSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
+void PhysicsServer2DSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_collision_layer(p_layer);
};
-uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const {
+uint32_t PhysicsServer2DSW::body_get_collision_layer(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, 0);
@@ -803,14 +803,14 @@ uint32_t Physics2DServerSW::body_get_collision_layer(RID p_body) const {
return body->get_collision_layer();
};
-void Physics2DServerSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
+void PhysicsServer2DSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_collision_mask(p_mask);
};
-uint32_t Physics2DServerSW::body_get_collision_mask(RID p_body) const {
+uint32_t PhysicsServer2DSW::body_get_collision_mask(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, 0);
@@ -818,7 +818,7 @@ uint32_t Physics2DServerSW::body_get_collision_mask(RID p_body) const {
return body->get_collision_mask();
};
-void Physics2DServerSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) {
+void PhysicsServer2DSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -826,7 +826,7 @@ void Physics2DServerSW::body_set_param(RID p_body, BodyParameter p_param, real_t
body->set_param(p_param, p_value);
};
-real_t Physics2DServerSW::body_get_param(RID p_body, BodyParameter p_param) const {
+real_t PhysicsServer2DSW::body_get_param(RID p_body, BodyParameter p_param) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, 0);
@@ -834,7 +834,7 @@ real_t Physics2DServerSW::body_get_param(RID p_body, BodyParameter p_param) cons
return body->get_param(p_param);
};
-void Physics2DServerSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
+void PhysicsServer2DSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -842,7 +842,7 @@ void Physics2DServerSW::body_set_state(RID p_body, BodyState p_state, const Vari
body->set_state(p_state, p_variant);
};
-Variant Physics2DServerSW::body_get_state(RID p_body, BodyState p_state) const {
+Variant PhysicsServer2DSW::body_get_state(RID p_body, BodyState p_state) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, Variant());
@@ -850,7 +850,7 @@ Variant Physics2DServerSW::body_get_state(RID p_body, BodyState p_state) const {
return body->get_state(p_state);
};
-void Physics2DServerSW::body_set_applied_force(RID p_body, const Vector2 &p_force) {
+void PhysicsServer2DSW::body_set_applied_force(RID p_body, const Vector2 &p_force) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -859,14 +859,14 @@ void Physics2DServerSW::body_set_applied_force(RID p_body, const Vector2 &p_forc
body->wakeup();
};
-Vector2 Physics2DServerSW::body_get_applied_force(RID p_body) const {
+Vector2 PhysicsServer2DSW::body_get_applied_force(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, Vector2());
return body->get_applied_force();
};
-void Physics2DServerSW::body_set_applied_torque(RID p_body, real_t p_torque) {
+void PhysicsServer2DSW::body_set_applied_torque(RID p_body, real_t p_torque) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -875,7 +875,7 @@ void Physics2DServerSW::body_set_applied_torque(RID p_body, real_t p_torque) {
body->wakeup();
};
-real_t Physics2DServerSW::body_get_applied_torque(RID p_body) const {
+real_t PhysicsServer2DSW::body_get_applied_torque(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, 0);
@@ -883,7 +883,7 @@ real_t Physics2DServerSW::body_get_applied_torque(RID p_body) const {
return body->get_applied_torque();
};
-void Physics2DServerSW::body_apply_central_impulse(RID p_body, const Vector2 &p_impulse) {
+void PhysicsServer2DSW::body_apply_central_impulse(RID p_body, const Vector2 &p_impulse) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -891,7 +891,7 @@ void Physics2DServerSW::body_apply_central_impulse(RID p_body, const Vector2 &p_
body->wakeup();
}
-void Physics2DServerSW::body_apply_torque_impulse(RID p_body, real_t p_torque) {
+void PhysicsServer2DSW::body_apply_torque_impulse(RID p_body, real_t p_torque) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -900,7 +900,7 @@ void Physics2DServerSW::body_apply_torque_impulse(RID p_body, real_t p_torque) {
body->apply_torque_impulse(p_torque);
}
-void Physics2DServerSW::body_apply_impulse(RID p_body, const Vector2 &p_pos, const Vector2 &p_impulse) {
+void PhysicsServer2DSW::body_apply_impulse(RID p_body, const Vector2 &p_pos, const Vector2 &p_impulse) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -911,7 +911,7 @@ void Physics2DServerSW::body_apply_impulse(RID p_body, const Vector2 &p_pos, con
body->wakeup();
};
-void Physics2DServerSW::body_add_central_force(RID p_body, const Vector2 &p_force) {
+void PhysicsServer2DSW::body_add_central_force(RID p_body, const Vector2 &p_force) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -919,7 +919,7 @@ void Physics2DServerSW::body_add_central_force(RID p_body, const Vector2 &p_forc
body->wakeup();
};
-void Physics2DServerSW::body_add_force(RID p_body, const Vector2 &p_offset, const Vector2 &p_force) {
+void PhysicsServer2DSW::body_add_force(RID p_body, const Vector2 &p_offset, const Vector2 &p_force) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -928,7 +928,7 @@ void Physics2DServerSW::body_add_force(RID p_body, const Vector2 &p_offset, cons
body->wakeup();
};
-void Physics2DServerSW::body_add_torque(RID p_body, real_t p_torque) {
+void PhysicsServer2DSW::body_add_torque(RID p_body, real_t p_torque) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -936,7 +936,7 @@ void Physics2DServerSW::body_add_torque(RID p_body, real_t p_torque) {
body->wakeup();
};
-void Physics2DServerSW::body_set_axis_velocity(RID p_body, const Vector2 &p_axis_velocity) {
+void PhysicsServer2DSW::body_set_axis_velocity(RID p_body, const Vector2 &p_axis_velocity) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -951,7 +951,7 @@ void Physics2DServerSW::body_set_axis_velocity(RID p_body, const Vector2 &p_axis
body->wakeup();
};
-void Physics2DServerSW::body_add_collision_exception(RID p_body, RID p_body_b) {
+void PhysicsServer2DSW::body_add_collision_exception(RID p_body, RID p_body_b) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -960,7 +960,7 @@ void Physics2DServerSW::body_add_collision_exception(RID p_body, RID p_body_b) {
body->wakeup();
};
-void Physics2DServerSW::body_remove_collision_exception(RID p_body, RID p_body_b) {
+void PhysicsServer2DSW::body_remove_collision_exception(RID p_body, RID p_body_b) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -969,7 +969,7 @@ void Physics2DServerSW::body_remove_collision_exception(RID p_body, RID p_body_b
body->wakeup();
};
-void Physics2DServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
+void PhysicsServer2DSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -979,20 +979,20 @@ void Physics2DServerSW::body_get_collision_exceptions(RID p_body, List<RID> *p_e
}
};
-void Physics2DServerSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
+void PhysicsServer2DSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
};
-real_t Physics2DServerSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
+real_t PhysicsServer2DSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, 0);
return 0;
};
-void Physics2DServerSW::body_set_omit_force_integration(RID p_body, bool p_omit) {
+void PhysicsServer2DSW::body_set_omit_force_integration(RID p_body, bool p_omit) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
@@ -1000,35 +1000,35 @@ void Physics2DServerSW::body_set_omit_force_integration(RID p_body, bool p_omit)
body->set_omit_force_integration(p_omit);
};
-bool Physics2DServerSW::body_is_omitting_force_integration(RID p_body) const {
+bool PhysicsServer2DSW::body_is_omitting_force_integration(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, false);
return body->get_omit_force_integration();
};
-void Physics2DServerSW::body_set_max_contacts_reported(RID p_body, int p_contacts) {
+void PhysicsServer2DSW::body_set_max_contacts_reported(RID p_body, int p_contacts) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_max_contacts_reported(p_contacts);
}
-int Physics2DServerSW::body_get_max_contacts_reported(RID p_body) const {
+int PhysicsServer2DSW::body_get_max_contacts_reported(RID p_body) const {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, -1);
return body->get_max_contacts_reported();
}
-void Physics2DServerSW::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
+void PhysicsServer2DSW::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
}
-bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, Vector2 *r_results, int p_result_max, int &r_result_count) {
+bool PhysicsServer2DSW::body_collide_shape(RID p_body, int p_body_shape, RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, Vector2 *r_results, int p_result_max, int &r_result_count) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, false);
@@ -1037,14 +1037,14 @@ bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_s
return shape_collide(body->get_shape(p_body_shape)->get_self(), body->get_transform() * body->get_shape_transform(p_body_shape), Vector2(), p_shape, p_shape_xform, p_motion, r_results, p_result_max, r_result_count);
}
-void Physics2DServerSW::body_set_pickable(RID p_body, bool p_pickable) {
+void PhysicsServer2DSW::body_set_pickable(RID p_body, bool p_pickable) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
body->set_pickable(p_pickable);
}
-bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, MotionResult *r_result, bool p_exclude_raycast_shapes) {
+bool PhysicsServer2DSW::body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, MotionResult *r_result, bool p_exclude_raycast_shapes) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, false);
@@ -1056,7 +1056,7 @@ bool Physics2DServerSW::body_test_motion(RID p_body, const Transform2D &p_from,
return body->get_space()->test_body_motion(body, p_from, p_motion, p_infinite_inertia, p_margin, r_result, p_exclude_raycast_shapes);
}
-int Physics2DServerSW::body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) {
+int PhysicsServer2DSW::body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND_V(!body, false);
@@ -1066,7 +1066,7 @@ int Physics2DServerSW::body_test_ray_separation(RID p_body, const Transform2D &p
return body->get_space()->test_body_ray_separation(body, p_transform, p_infinite_inertia, r_recover_motion, r_results, p_result_max, p_margin);
}
-Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
+PhysicsDirectBodyState2D *PhysicsServer2DSW::body_get_direct_state(RID p_body) {
ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
@@ -1084,7 +1084,7 @@ Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
/* JOINT API */
-void Physics2DServerSW::joint_set_param(RID p_joint, JointParam p_param, real_t p_value) {
+void PhysicsServer2DSW::joint_set_param(RID p_joint, JointParam p_param, real_t p_value) {
Joint2DSW *joint = joint_owner.getornull(p_joint);
ERR_FAIL_COND(!joint);
@@ -1096,7 +1096,7 @@ void Physics2DServerSW::joint_set_param(RID p_joint, JointParam p_param, real_t
}
}
-real_t Physics2DServerSW::joint_get_param(RID p_joint, JointParam p_param) const {
+real_t PhysicsServer2DSW::joint_get_param(RID p_joint, JointParam p_param) const {
const Joint2DSW *joint = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!joint, -1);
@@ -1110,7 +1110,7 @@ real_t Physics2DServerSW::joint_get_param(RID p_joint, JointParam p_param) const
return 0;
}
-void Physics2DServerSW::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) {
+void PhysicsServer2DSW::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) {
Joint2DSW *joint = joint_owner.getornull(p_joint);
ERR_FAIL_COND(!joint);
@@ -1130,14 +1130,14 @@ void Physics2DServerSW::joint_disable_collisions_between_bodies(RID p_joint, con
}
}
-bool Physics2DServerSW::joint_is_disabled_collisions_between_bodies(RID p_joint) const {
+bool PhysicsServer2DSW::joint_is_disabled_collisions_between_bodies(RID p_joint) const {
const Joint2DSW *joint = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!joint, true);
return joint->is_disabled_collisions_between_bodies();
}
-RID Physics2DServerSW::pin_joint_create(const Vector2 &p_pos, RID p_body_a, RID p_body_b) {
+RID PhysicsServer2DSW::pin_joint_create(const Vector2 &p_pos, RID p_body_a, RID p_body_b) {
Body2DSW *A = body_owner.getornull(p_body_a);
ERR_FAIL_COND_V(!A, RID());
@@ -1154,7 +1154,7 @@ RID Physics2DServerSW::pin_joint_create(const Vector2 &p_pos, RID p_body_a, RID
return self;
}
-RID Physics2DServerSW::groove_joint_create(const Vector2 &p_a_groove1, const Vector2 &p_a_groove2, const Vector2 &p_b_anchor, RID p_body_a, RID p_body_b) {
+RID PhysicsServer2DSW::groove_joint_create(const Vector2 &p_a_groove1, const Vector2 &p_a_groove2, const Vector2 &p_b_anchor, RID p_body_a, RID p_body_b) {
Body2DSW *A = body_owner.getornull(p_body_a);
ERR_FAIL_COND_V(!A, RID());
@@ -1168,7 +1168,7 @@ RID Physics2DServerSW::groove_joint_create(const Vector2 &p_a_groove1, const Vec
return self;
}
-RID Physics2DServerSW::damped_spring_joint_create(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, RID p_body_a, RID p_body_b) {
+RID PhysicsServer2DSW::damped_spring_joint_create(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, RID p_body_a, RID p_body_b) {
Body2DSW *A = body_owner.getornull(p_body_a);
ERR_FAIL_COND_V(!A, RID());
@@ -1182,7 +1182,7 @@ RID Physics2DServerSW::damped_spring_joint_create(const Vector2 &p_anchor_a, con
return self;
}
-void Physics2DServerSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
+void PhysicsServer2DSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND(!j);
@@ -1192,7 +1192,7 @@ void Physics2DServerSW::pin_joint_set_param(RID p_joint, PinJointParam p_param,
pin_joint->set_param(p_param, p_value);
}
-real_t Physics2DServerSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
+real_t PhysicsServer2DSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!j, 0);
ERR_FAIL_COND_V(j->get_type() != JOINT_PIN, 0);
@@ -1201,7 +1201,7 @@ real_t Physics2DServerSW::pin_joint_get_param(RID p_joint, PinJointParam p_param
return pin_joint->get_param(p_param);
}
-void Physics2DServerSW::damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value) {
+void PhysicsServer2DSW::damped_string_joint_set_param(RID p_joint, DampedStringParam p_param, real_t p_value) {
Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND(!j);
@@ -1211,7 +1211,7 @@ void Physics2DServerSW::damped_string_joint_set_param(RID p_joint, DampedStringP
dsj->set_param(p_param, p_value);
}
-real_t Physics2DServerSW::damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const {
+real_t PhysicsServer2DSW::damped_string_joint_get_param(RID p_joint, DampedStringParam p_param) const {
Joint2DSW *j = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!j, 0);
@@ -1221,7 +1221,7 @@ real_t Physics2DServerSW::damped_string_joint_get_param(RID p_joint, DampedStrin
return dsj->get_param(p_param);
}
-Physics2DServer::JointType Physics2DServerSW::joint_get_type(RID p_joint) const {
+PhysicsServer2D::JointType PhysicsServer2DSW::joint_get_type(RID p_joint) const {
Joint2DSW *joint = joint_owner.getornull(p_joint);
ERR_FAIL_COND_V(!joint, JOINT_PIN);
@@ -1229,7 +1229,7 @@ Physics2DServer::JointType Physics2DServerSW::joint_get_type(RID p_joint) const
return joint->get_type();
}
-void Physics2DServerSW::free(RID p_rid) {
+void PhysicsServer2DSW::free(RID p_rid) {
_update_shapes(); // just in case
@@ -1310,12 +1310,12 @@ void Physics2DServerSW::free(RID p_rid) {
}
};
-void Physics2DServerSW::set_active(bool p_active) {
+void PhysicsServer2DSW::set_active(bool p_active) {
active = p_active;
};
-void Physics2DServerSW::init() {
+void PhysicsServer2DSW::init() {
doing_sync = false;
last_step = 0.001;
@@ -1324,7 +1324,7 @@ void Physics2DServerSW::init() {
direct_state = memnew(Physics2DDirectBodyStateSW);
};
-void Physics2DServerSW::step(real_t p_step) {
+void PhysicsServer2DSW::step(real_t p_step) {
if (!active)
return;
@@ -1347,12 +1347,12 @@ void Physics2DServerSW::step(real_t p_step) {
}
};
-void Physics2DServerSW::sync() {
+void PhysicsServer2DSW::sync() {
doing_sync = true;
};
-void Physics2DServerSW::flush_queries() {
+void PhysicsServer2DSW::flush_queries() {
if (!active)
return;
@@ -1405,17 +1405,17 @@ void Physics2DServerSW::flush_queries() {
}
}
-void Physics2DServerSW::end_sync() {
+void PhysicsServer2DSW::end_sync() {
doing_sync = false;
}
-void Physics2DServerSW::finish() {
+void PhysicsServer2DSW::finish() {
memdelete(stepper);
memdelete(direct_state);
};
-void Physics2DServerSW::_update_shapes() {
+void PhysicsServer2DSW::_update_shapes() {
while (pending_shape_update_list.first()) {
pending_shape_update_list.first()->self()->_shape_changed();
@@ -1423,7 +1423,7 @@ void Physics2DServerSW::_update_shapes() {
}
}
-int Physics2DServerSW::get_process_info(ProcessInfo p_info) {
+int PhysicsServer2DSW::get_process_info(ProcessInfo p_info) {
switch (p_info) {
@@ -1443,9 +1443,9 @@ int Physics2DServerSW::get_process_info(ProcessInfo p_info) {
return 0;
}
-Physics2DServerSW *Physics2DServerSW::singletonsw = NULL;
+PhysicsServer2DSW *PhysicsServer2DSW::singletonsw = NULL;
-Physics2DServerSW::Physics2DServerSW() {
+PhysicsServer2DSW::PhysicsServer2DSW() {
singletonsw = this;
BroadPhase2DSW::create_func = BroadPhase2DHashGrid::_create;
@@ -1459,6 +1459,6 @@ Physics2DServerSW::Physics2DServerSW() {
flushing_queries = false;
};
-Physics2DServerSW::~Physics2DServerSW(){
+PhysicsServer2DSW::~PhysicsServer2DSW(){
};
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_server_2d_sw.h
index a95a2ea0dd..196b9a50b9 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_server_2d_sw.h
@@ -33,14 +33,14 @@
#include "core/rid_owner.h"
#include "joints_2d_sw.h"
-#include "servers/physics_2d_server.h"
+#include "servers/physics_server_2d.h"
#include "shape_2d_sw.h"
#include "space_2d_sw.h"
#include "step_2d_sw.h"
-class Physics2DServerSW : public Physics2DServer {
+class PhysicsServer2DSW : public PhysicsServer2D {
- GDCLASS(Physics2DServerSW, Physics2DServer);
+ GDCLASS(PhysicsServer2DSW, PhysicsServer2D);
friend class Physics2DDirectSpaceStateSW;
friend class Physics2DDirectBodyStateSW;
@@ -68,7 +68,7 @@ class Physics2DServerSW : public Physics2DServer {
mutable RID_PtrOwner<Body2DSW> body_owner;
mutable RID_PtrOwner<Joint2DSW> joint_owner;
- static Physics2DServerSW *singletonsw;
+ static PhysicsServer2DSW *singletonsw;
//void _clear_query(Query2DSW *p_query);
friend class CollisionObject2DSW;
@@ -123,7 +123,7 @@ public:
virtual int space_get_contact_count(RID p_space) const;
// this function only works on physics process, errors and returns null otherwise
- virtual Physics2DDirectSpaceState *space_get_direct_state(RID p_space);
+ virtual PhysicsDirectSpaceState2D *space_get_direct_state(RID p_space);
/* AREA API */
@@ -253,7 +253,7 @@ public:
virtual int body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
// this function only works on physics process, errors and returns null otherwise
- virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body);
+ virtual PhysicsDirectBodyState2D *body_get_direct_state(RID p_body);
/* JOINT API */
@@ -289,8 +289,8 @@ public:
int get_process_info(ProcessInfo p_info);
- Physics2DServerSW();
- ~Physics2DServerSW();
+ PhysicsServer2DSW();
+ ~PhysicsServer2DSW();
};
#endif
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
index 76036930c6..c0f49aa4d1 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
@@ -28,29 +28,29 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "physics_2d_server_wrap_mt.h"
+#include "physics_server_2d_wrap_mt.h"
#include "core/os/os.h"
-void Physics2DServerWrapMT::thread_exit() {
+void PhysicsServer2DWrapMT::thread_exit() {
exit = true;
}
-void Physics2DServerWrapMT::thread_step(real_t p_delta) {
+void PhysicsServer2DWrapMT::thread_step(real_t p_delta) {
physics_2d_server->step(p_delta);
step_sem.post();
}
-void Physics2DServerWrapMT::_thread_callback(void *_instance) {
+void PhysicsServer2DWrapMT::_thread_callback(void *_instance) {
- Physics2DServerWrapMT *vsmt = reinterpret_cast<Physics2DServerWrapMT *>(_instance);
+ PhysicsServer2DWrapMT *vsmt = reinterpret_cast<PhysicsServer2DWrapMT *>(_instance);
vsmt->thread_loop();
}
-void Physics2DServerWrapMT::thread_loop() {
+void PhysicsServer2DWrapMT::thread_loop() {
server_thread = Thread::get_caller_id();
@@ -70,11 +70,11 @@ void Physics2DServerWrapMT::thread_loop() {
/* EVENT QUEUING */
-void Physics2DServerWrapMT::step(real_t p_step) {
+void PhysicsServer2DWrapMT::step(real_t p_step) {
if (create_thread) {
- command_queue.push(this, &Physics2DServerWrapMT::thread_step, p_step);
+ command_queue.push(this, &PhysicsServer2DWrapMT::thread_step, p_step);
} else {
command_queue.flush_all(); //flush all pending from other threads
@@ -82,7 +82,7 @@ void Physics2DServerWrapMT::step(real_t p_step) {
}
}
-void Physics2DServerWrapMT::sync() {
+void PhysicsServer2DWrapMT::sync() {
if (thread) {
if (first_frame)
@@ -93,17 +93,17 @@ void Physics2DServerWrapMT::sync() {
physics_2d_server->sync();
}
-void Physics2DServerWrapMT::flush_queries() {
+void PhysicsServer2DWrapMT::flush_queries() {
physics_2d_server->flush_queries();
}
-void Physics2DServerWrapMT::end_sync() {
+void PhysicsServer2DWrapMT::end_sync() {
physics_2d_server->end_sync();
}
-void Physics2DServerWrapMT::init() {
+void PhysicsServer2DWrapMT::init() {
if (create_thread) {
@@ -118,11 +118,11 @@ void Physics2DServerWrapMT::init() {
}
}
-void Physics2DServerWrapMT::finish() {
+void PhysicsServer2DWrapMT::finish() {
if (thread) {
- command_queue.push(this, &Physics2DServerWrapMT::thread_exit);
+ command_queue.push(this, &PhysicsServer2DWrapMT::thread_exit);
Thread::wait_to_finish(thread);
memdelete(thread);
@@ -145,7 +145,7 @@ void Physics2DServerWrapMT::finish() {
body_free_cached_ids();
}
-Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool p_create_thread) :
+PhysicsServer2DWrapMT::PhysicsServer2DWrapMT(PhysicsServer2D *p_contained, bool p_create_thread) :
command_queue(p_create_thread) {
physics_2d_server = p_contained;
@@ -166,7 +166,7 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer *p_contained, bool
first_frame = true;
}
-Physics2DServerWrapMT::~Physics2DServerWrapMT() {
+PhysicsServer2DWrapMT::~PhysicsServer2DWrapMT() {
memdelete(physics_2d_server);
//finish();
diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h
index 4d5e317c8c..8196ede069 100644
--- a/servers/physics_2d/physics_2d_server_wrap_mt.h
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.h
@@ -34,7 +34,7 @@
#include "core/command_queue_mt.h"
#include "core/os/thread.h"
#include "core/project_settings.h"
-#include "servers/physics_2d_server.h"
+#include "servers/physics_server_2d.h"
#ifdef DEBUG_SYNC
#define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
@@ -42,9 +42,9 @@
#define SYNC_DEBUG
#endif
-class Physics2DServerWrapMT : public Physics2DServer {
+class PhysicsServer2DWrapMT : public PhysicsServer2D {
- mutable Physics2DServer *physics_2d_server;
+ mutable PhysicsServer2D *physics_2d_server;
mutable CommandQueueMT command_queue;
@@ -71,8 +71,8 @@ class Physics2DServerWrapMT : public Physics2DServer {
int pool_max_size;
public:
-#define ServerName Physics2DServer
-#define ServerNameWrapMT Physics2DServerWrapMT
+#define ServerName PhysicsServer2D
+#define ServerNameWrapMT PhysicsServer2DWrapMT
#define server_name physics_2d_server
#include "servers/server_wrap_mt_common.h"
@@ -110,7 +110,7 @@ public:
FUNC2RC(real_t, space_get_param, RID, SpaceParameter);
// this function only works on physics process, errors and returns null otherwise
- Physics2DDirectSpaceState *space_get_direct_state(RID p_space) {
+ PhysicsDirectSpaceState2D *space_get_direct_state(RID p_space) {
ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
return physics_2d_server->space_get_direct_state(p_space);
@@ -268,7 +268,7 @@ public:
}
// this function only works on physics process, errors and returns null otherwise
- Physics2DDirectBodyState *body_get_direct_state(RID p_body) {
+ PhysicsDirectBodyState2D *body_get_direct_state(RID p_body) {
ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
return physics_2d_server->body_get_direct_state(p_body);
@@ -320,19 +320,19 @@ public:
return physics_2d_server->get_process_info(p_info);
}
- Physics2DServerWrapMT(Physics2DServer *p_contained, bool p_create_thread);
- ~Physics2DServerWrapMT();
+ PhysicsServer2DWrapMT(PhysicsServer2D *p_contained, bool p_create_thread);
+ ~PhysicsServer2DWrapMT();
template <class T>
- static Physics2DServer *init_server() {
+ static PhysicsServer2D *init_server() {
int tm = GLOBAL_DEF("physics/2d/thread_model", 1);
if (tm == 0) // single unsafe
return memnew(T);
else if (tm == 1) // single safe
- return memnew(Physics2DServerWrapMT(memnew(T), false));
+ return memnew(PhysicsServer2DWrapMT(memnew(T), false));
else // multi threaded
- return memnew(Physics2DServerWrapMT(memnew(T), true));
+ return memnew(PhysicsServer2DWrapMT(memnew(T), true));
}
#undef ServerNameWrapMT
diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h
index fa56f2a250..48f3bea1e1 100644
--- a/servers/physics_2d/shape_2d_sw.h
+++ b/servers/physics_2d/shape_2d_sw.h
@@ -31,7 +31,7 @@
#ifndef SHAPE_2D_2DSW_H
#define SHAPE_2D_2DSW_H
-#include "servers/physics_2d_server.h"
+#include "servers/physics_server_2d.h"
#define _SEGMENT_IS_VALID_SUPPORT_THRESHOLD 0.99998
/*
@@ -72,7 +72,7 @@ public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
_FORCE_INLINE_ RID get_self() const { return self; }
- virtual Physics2DServer::ShapeType get_type() const = 0;
+ virtual PhysicsServer2D::ShapeType get_type() const = 0;
_FORCE_INLINE_ Rect2 get_aabb() const { return aabb; }
_FORCE_INLINE_ bool is_configured() const { return configured; }
@@ -165,7 +165,7 @@ public:
_FORCE_INLINE_ Vector2 get_normal() const { return normal; }
_FORCE_INLINE_ real_t get_d() const { return d; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_LINE; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_LINE; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -203,7 +203,7 @@ public:
_FORCE_INLINE_ real_t get_length() const { return length; }
_FORCE_INLINE_ bool get_slips_on_slope() const { return slips_on_slope; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_RAY; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_RAY; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -242,7 +242,7 @@ public:
_FORCE_INLINE_ const Vector2 &get_b() const { return b; }
_FORCE_INLINE_ const Vector2 &get_normal() const { return n; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_SEGMENT; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_SEGMENT; }
_FORCE_INLINE_ Vector2 get_xformed_normal(const Transform2D &p_xform) const {
@@ -285,7 +285,7 @@ class CircleShape2DSW : public Shape2DSW {
public:
_FORCE_INLINE_ const real_t &get_radius() const { return radius; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CIRCLE; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_CIRCLE; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -319,7 +319,7 @@ class RectangleShape2DSW : public Shape2DSW {
public:
_FORCE_INLINE_ const Vector2 &get_half_extents() const { return half_extents; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_RECTANGLE; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_RECTANGLE; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -395,7 +395,7 @@ public:
_FORCE_INLINE_ const real_t &get_radius() const { return radius; }
_FORCE_INLINE_ const real_t &get_height() const { return height; }
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CAPSULE; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_CAPSULE; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -452,7 +452,7 @@ public:
return (p_xform.xform(b) - p_xform.xform(a)).normalized().tangent();
}
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CONVEX_POLYGON; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_CONVEX_POLYGON; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); }
virtual void get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const;
@@ -531,7 +531,7 @@ class ConcavePolygonShape2DSW : public ConcaveShape2DSW {
int _generate_bvh(BVH *p_bvh, int p_len, int p_depth);
public:
- virtual Physics2DServer::ShapeType get_type() const { return Physics2DServer::SHAPE_CONCAVE_POLYGON; }
+ virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_CONCAVE_POLYGON; }
virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 2009cb823d..72f3e8d1b4 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -33,7 +33,7 @@
#include "collision_solver_2d_sw.h"
#include "core/os/os.h"
#include "core/pair.h"
-#include "physics_2d_server_sw.h"
+#include "physics_server_2d_sw.h"
_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (!(p_object->get_collision_layer() & p_collision_mask)) {
@@ -198,7 +198,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
if (p_result_max <= 0)
return 0;
- Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.getornull(p_shape);
+ Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
Rect2 aabb = p_xform.xform(shape->get_aabb());
@@ -240,7 +240,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform2D &p_xform, const Vector2 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
- Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.getornull(p_shape);
+ Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, false);
Rect2 aabb = p_xform.xform(shape->get_aabb());
@@ -313,7 +313,7 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
if (p_result_max <= 0)
return 0;
- Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.getornull(p_shape);
+ Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
Rect2 aabb = p_shape_xform.xform(shape->get_aabb());
@@ -325,14 +325,14 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
bool collided = false;
r_result_count = 0;
- Physics2DServerSW::CollCbkData cbk;
+ PhysicsServer2DSW::CollCbkData cbk;
cbk.max = p_result_max;
cbk.amount = 0;
cbk.passed = 0;
cbk.ptr = r_results;
- CollisionSolver2DSW::CallbackResult cbkres = Physics2DServerSW::_shape_col_cbk;
+ CollisionSolver2DSW::CallbackResult cbkres = PhysicsServer2DSW::_shape_col_cbk;
- Physics2DServerSW::CollCbkData *cbkptr = &cbk;
+ PhysicsServer2DSW::CollCbkData *cbkptr = &cbk;
for (int i = 0; i < amount; i++) {
@@ -404,7 +404,7 @@ static void _rest_cbk_result(const Vector2 &p_point_A, const Vector2 &p_point_B,
bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
- Shape2DSW *shape = Physics2DServerSW::singletonsw->shape_owner.getornull(p_shape);
+ Shape2DSW *shape = PhysicsServer2DSW::singletonsw->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
Rect2 aabb = p_shape_xform.xform(shape->get_aabb());
@@ -503,7 +503,7 @@ int Space2DSW::_cull_aabb_for_body(Body2DSW *p_body, const Rect2 &p_aabb) {
return amount;
}
-int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, Physics2DServer::SeparationResult *r_results, int p_result_max, real_t p_margin) {
+int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, PhysicsServer2D::SeparationResult *r_results, int p_result_max, real_t p_margin) {
Rect2 body_aabb;
@@ -514,7 +514,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
if (p_body->is_shape_set_as_disabled(i))
continue;
- if (p_body->get_shape(i)->get_type() != Physics2DServer::SHAPE_RAY)
+ if (p_body->get_shape(i)->get_type() != PhysicsServer2D::SHAPE_RAY)
continue;
if (!shapes_found) {
@@ -548,10 +548,10 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
const int max_results = 32;
int recover_attempts = 4;
Vector2 sr[max_results * 2];
- Physics2DServerSW::CollCbkData cbk;
+ PhysicsServer2DSW::CollCbkData cbk;
cbk.max = max_results;
- Physics2DServerSW::CollCbkData *cbkptr = &cbk;
- CollisionSolver2DSW::CallbackResult cbkres = Physics2DServerSW::_shape_col_cbk;
+ PhysicsServer2DSW::CollCbkData *cbkptr = &cbk;
+ CollisionSolver2DSW::CallbackResult cbkres = PhysicsServer2DSW::_shape_col_cbk;
do {
@@ -567,7 +567,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
Shape2DSW *body_shape = p_body->get_shape(j);
- if (body_shape->get_type() != Physics2DServer::SHAPE_RAY)
+ if (body_shape->get_type() != PhysicsServer2D::SHAPE_RAY)
continue;
Transform2D body_shape_xform = body_transform * p_body->get_shape_transform(j);
@@ -584,7 +584,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
if (CollisionObject2DSW::TYPE_BODY == col_obj->get_type()) {
const Body2DSW *b = static_cast<const Body2DSW *>(col_obj);
- if (p_infinite_inertia && Physics2DServer::BODY_MODE_STATIC != b->get_mode() && Physics2DServer::BODY_MODE_KINEMATIC != b->get_mode()) {
+ if (p_infinite_inertia && PhysicsServer2D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer2D::BODY_MODE_KINEMATIC != b->get_mode()) {
continue;
}
}
@@ -632,7 +632,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
if (ray_index != -1) {
- Physics2DServer::SeparationResult &result = r_results[ray_index];
+ PhysicsServer2D::SeparationResult &result = r_results[ray_index];
for (int k = 0; k < cbk.amount; k++) {
Vector2 a = sr[k * 2 + 0];
@@ -687,7 +687,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
return rays_found;
}
-bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, Physics2DServer::MotionResult *r_result, bool p_exclude_raycast_shapes) {
+bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer2D::MotionResult *r_result, bool p_exclude_raycast_shapes) {
//give me back regular physics engine logic
//this is madness
@@ -709,7 +709,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (p_body->is_shape_set_as_disabled(i))
continue;
- if (p_exclude_raycast_shapes && p_body->get_shape(i)->get_type() == Physics2DServer::SHAPE_RAY)
+ if (p_exclude_raycast_shapes && p_body->get_shape(i)->get_type() == PhysicsServer2D::SHAPE_RAY)
continue;
if (!shapes_found) {
@@ -722,7 +722,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (!shapes_found) {
if (r_result) {
- *r_result = Physics2DServer::MotionResult();
+ *r_result = PhysicsServer2D::MotionResult();
r_result->motion = p_motion;
}
return false;
@@ -749,7 +749,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
do {
- Physics2DServerSW::CollCbkData cbk;
+ PhysicsServer2DSW::CollCbkData cbk;
cbk.max = max_results;
cbk.amount = 0;
cbk.passed = 0;
@@ -757,8 +757,8 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
cbk.invalid_by_dir = 0;
excluded_shape_pair_count = 0; //last step is the one valid
- Physics2DServerSW::CollCbkData *cbkptr = &cbk;
- CollisionSolver2DSW::CallbackResult cbkres = Physics2DServerSW::_shape_col_cbk;
+ PhysicsServer2DSW::CollCbkData *cbkptr = &cbk;
+ CollisionSolver2DSW::CallbackResult cbkres = PhysicsServer2DSW::_shape_col_cbk;
bool collided = false;
@@ -769,7 +769,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
continue;
Shape2DSW *body_shape = p_body->get_shape(j);
- if (p_exclude_raycast_shapes && body_shape->get_type() == Physics2DServer::SHAPE_RAY) {
+ if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer2D::SHAPE_RAY) {
continue;
}
@@ -781,7 +781,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (CollisionObject2DSW::TYPE_BODY == col_obj->get_type()) {
const Body2DSW *b = static_cast<const Body2DSW *>(col_obj);
- if (p_infinite_inertia && Physics2DServer::BODY_MODE_STATIC != b->get_mode() && Physics2DServer::BODY_MODE_KINEMATIC != b->get_mode()) {
+ if (p_infinite_inertia && PhysicsServer2D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer2D::BODY_MODE_KINEMATIC != b->get_mode()) {
continue;
}
}
@@ -798,7 +798,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (col_obj->get_type() == CollisionObject2DSW::TYPE_BODY) {
const Body2DSW *b = static_cast<const Body2DSW *>(col_obj);
- if (b->get_mode() == Physics2DServer::BODY_MODE_KINEMATIC || b->get_mode() == Physics2DServer::BODY_MODE_RIGID) {
+ if (b->get_mode() == PhysicsServer2D::BODY_MODE_KINEMATIC || b->get_mode() == PhysicsServer2D::BODY_MODE_RIGID) {
//fix for moving platforms (kinematic and dynamic), margin is increased by how much it moved in the given direction
Vector2 lv = b->get_linear_velocity();
//compute displacement from linear velocity
@@ -884,7 +884,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
continue;
Shape2DSW *body_shape = p_body->get_shape(body_shape_idx);
- if (p_exclude_raycast_shapes && body_shape->get_type() == Physics2DServer::SHAPE_RAY) {
+ if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer2D::SHAPE_RAY) {
continue;
}
@@ -903,7 +903,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (CollisionObject2DSW::TYPE_BODY == col_obj->get_type()) {
const Body2DSW *b = static_cast<const Body2DSW *>(col_obj);
- if (p_infinite_inertia && Physics2DServer::BODY_MODE_STATIC != b->get_mode() && Physics2DServer::BODY_MODE_KINEMATIC != b->get_mode()) {
+ if (p_infinite_inertia && PhysicsServer2D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer2D::BODY_MODE_KINEMATIC != b->get_mode()) {
continue;
}
}
@@ -964,7 +964,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (col_obj->is_shape_set_as_one_way_collision(col_shape_idx)) {
Vector2 cd[2];
- Physics2DServerSW::CollCbkData cbk;
+ PhysicsServer2DSW::CollCbkData cbk;
cbk.max = 1;
cbk.amount = 0;
cbk.passed = 0;
@@ -974,7 +974,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
cbk.valid_depth = 10e20;
Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(col_shape_idx), col_obj_shape_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0);
+ bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(col_shape_idx), col_obj_shape_xform, Vector2(), PhysicsServer2DSW::_shape_col_cbk, &cbk, &sep, 0);
if (!collided || cbk.amount == 0) {
continue;
}
@@ -1034,7 +1034,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
Transform2D body_shape_xform = ugt * p_body->get_shape_transform(j);
Shape2DSW *body_shape = p_body->get_shape(j);
- if (p_exclude_raycast_shapes && body_shape->get_type() == Physics2DServer::SHAPE_RAY) {
+ if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer2D::SHAPE_RAY) {
continue;
}
@@ -1049,7 +1049,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
if (CollisionObject2DSW::TYPE_BODY == col_obj->get_type()) {
const Body2DSW *b = static_cast<const Body2DSW *>(col_obj);
- if (p_infinite_inertia && Physics2DServer::BODY_MODE_STATIC != b->get_mode() && Physics2DServer::BODY_MODE_KINEMATIC != b->get_mode()) {
+ if (p_infinite_inertia && PhysicsServer2D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer2D::BODY_MODE_KINEMATIC != b->get_mode()) {
continue;
}
}
@@ -1277,33 +1277,33 @@ void Space2DSW::update() {
broadphase->update();
}
-void Space2DSW::set_param(Physics2DServer::SpaceParameter p_param, real_t p_value) {
+void Space2DSW::set_param(PhysicsServer2D::SpaceParameter p_param, real_t p_value) {
switch (p_param) {
- case Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
- case Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
- case Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
- case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
- case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
- case Physics2DServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
- case Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
- case Physics2DServer::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
+ case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
}
}
-real_t Space2DSW::get_param(Physics2DServer::SpaceParameter p_param) const {
+real_t Space2DSW::get_param(PhysicsServer2D::SpaceParameter p_param) const {
switch (p_param) {
- case Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
- case Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
- case Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
- case Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
- case Physics2DServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
- case Physics2DServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
- case Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
- case Physics2DServer::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
+ case PhysicsServer2D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
+ case PhysicsServer2D::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
+ case PhysicsServer2D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
+ case PhysicsServer2D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
+ case PhysicsServer2D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
+ case PhysicsServer2D::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
+ case PhysicsServer2D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
+ case PhysicsServer2D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
}
return 0;
}
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 919c65d849..f4971635b9 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -41,9 +41,9 @@
#include "core/project_settings.h"
#include "core/typedefs.h"
-class Physics2DDirectSpaceStateSW : public Physics2DDirectSpaceState {
+class Physics2DDirectSpaceStateSW : public PhysicsDirectSpaceState2D {
- GDCLASS(Physics2DDirectSpaceStateSW, Physics2DDirectSpaceState);
+ GDCLASS(Physics2DDirectSpaceStateSW, PhysicsDirectSpaceState2D);
int _intersect_point_impl(const Vector2 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_pick_point, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = ObjectID());
@@ -175,8 +175,8 @@ public:
void lock();
void unlock();
- void set_param(Physics2DServer::SpaceParameter p_param, real_t p_value);
- real_t get_param(Physics2DServer::SpaceParameter p_param) const;
+ void set_param(PhysicsServer2D::SpaceParameter p_param, real_t p_value);
+ real_t get_param(PhysicsServer2D::SpaceParameter p_param) const;
void set_island_count(int p_island_count) { island_count = p_island_count; }
int get_island_count() const { return island_count; }
@@ -186,8 +186,8 @@ public:
int get_collision_pairs() const { return collision_pairs; }
- bool test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, Physics2DServer::MotionResult *r_result, bool p_exclude_raycast_shapes = true);
- int test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, Physics2DServer::SeparationResult *r_results, int p_result_max, real_t p_margin);
+ bool test_body_motion(Body2DSW *p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer2D::MotionResult *r_result, bool p_exclude_raycast_shapes = true);
+ int test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, PhysicsServer2D::SeparationResult *r_results, int p_result_max, real_t p_margin);
void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
_FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index 21f18229e7..198fccdb80 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -50,7 +50,7 @@ void Step2DSW::_populate_island(Body2DSW *p_body, Body2DSW **p_island, Constrain
if (i == E->get())
continue;
Body2DSW *b = c->get_body_ptr()[i];
- if (b->get_island_step() == _step || b->get_mode() == Physics2DServer::BODY_MODE_STATIC || b->get_mode() == Physics2DServer::BODY_MODE_KINEMATIC)
+ if (b->get_island_step() == _step || b->get_mode() == PhysicsServer2D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer2D::BODY_MODE_KINEMATIC)
continue; //no go
_populate_island(c->get_body_ptr()[i], p_island, p_constraint_island);
}
@@ -101,7 +101,7 @@ void Step2DSW::_check_suspend(Body2DSW *p_island, real_t p_delta) {
Body2DSW *b = p_island;
while (b) {
- if (b->get_mode() == Physics2DServer::BODY_MODE_STATIC || b->get_mode() == Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (b->get_mode() == PhysicsServer2D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer2D::BODY_MODE_KINEMATIC) {
b = b->get_island_next();
continue; //ignore for static
}
@@ -117,7 +117,7 @@ void Step2DSW::_check_suspend(Body2DSW *p_island, real_t p_delta) {
b = p_island;
while (b) {
- if (b->get_mode() == Physics2DServer::BODY_MODE_STATIC || b->get_mode() == Physics2DServer::BODY_MODE_KINEMATIC) {
+ if (b->get_mode() == PhysicsServer2D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer2D::BODY_MODE_KINEMATIC) {
b = b->get_island_next();
continue; //ignore for static
}
diff --git a/servers/physics/SCsub b/servers/physics_3d/SCsub
index c5cc889112..c5cc889112 100644
--- a/servers/physics/SCsub
+++ b/servers/physics_3d/SCsub
diff --git a/servers/physics/area_sw.cpp b/servers/physics_3d/area_3d_sw.cpp
index 4b54a56253..99d4d2ec1b 100644
--- a/servers/physics/area_sw.cpp
+++ b/servers/physics_3d/area_3d_sw.cpp
@@ -28,30 +28,30 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "area_sw.h"
-#include "body_sw.h"
-#include "space_sw.h"
+#include "area_3d_sw.h"
+#include "body_3d_sw.h"
+#include "space_3d_sw.h"
-AreaSW::BodyKey::BodyKey(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
+Area3DSW::BodyKey::BodyKey(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
rid = p_body->get_self();
instance_id = p_body->get_instance_id();
body_shape = p_body_shape;
area_shape = p_area_shape;
}
-AreaSW::BodyKey::BodyKey(AreaSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
+Area3DSW::BodyKey::BodyKey(Area3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
rid = p_body->get_self();
instance_id = p_body->get_instance_id();
body_shape = p_body_shape;
area_shape = p_area_shape;
}
-void AreaSW::_shapes_changed() {
+void Area3DSW::_shapes_changed() {
if (!moved_list.in_list() && get_space())
get_space()->area_add_to_moved_list(&moved_list);
}
-void AreaSW::set_transform(const Transform &p_transform) {
+void Area3DSW::set_transform(const Transform &p_transform) {
if (!moved_list.in_list() && get_space())
get_space()->area_add_to_moved_list(&moved_list);
@@ -60,7 +60,7 @@ void AreaSW::set_transform(const Transform &p_transform) {
_set_inv_transform(p_transform.affine_inverse());
}
-void AreaSW::set_space(SpaceSW *p_space) {
+void Area3DSW::set_space(Space3DSW *p_space) {
if (get_space()) {
if (monitor_query_list.in_list())
@@ -75,7 +75,7 @@ void AreaSW::set_space(SpaceSW *p_space) {
_set_space(p_space);
}
-void AreaSW::set_monitor_callback(ObjectID p_id, const StringName &p_method) {
+void Area3DSW::set_monitor_callback(ObjectID p_id, const StringName &p_method) {
if (p_id == monitor_callback_id) {
monitor_callback_method = p_method;
@@ -96,7 +96,7 @@ void AreaSW::set_monitor_callback(ObjectID p_id, const StringName &p_method) {
get_space()->area_add_to_moved_list(&moved_list);
}
-void AreaSW::set_area_monitor_callback(ObjectID p_id, const StringName &p_method) {
+void Area3DSW::set_area_monitor_callback(ObjectID p_id, const StringName &p_method) {
if (p_id == area_monitor_callback_id) {
area_monitor_callback_method = p_method;
@@ -117,46 +117,46 @@ void AreaSW::set_area_monitor_callback(ObjectID p_id, const StringName &p_method
get_space()->area_add_to_moved_list(&moved_list);
}
-void AreaSW::set_space_override_mode(PhysicsServer::AreaSpaceOverrideMode p_mode) {
- bool do_override = p_mode != PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED;
- if (do_override == (space_override_mode != PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED))
+void Area3DSW::set_space_override_mode(PhysicsServer3D::AreaSpaceOverrideMode p_mode) {
+ bool do_override = p_mode != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
+ if (do_override == (space_override_mode != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED))
return;
_unregister_shapes();
space_override_mode = p_mode;
_shape_changed();
}
-void AreaSW::set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value) {
+void Area3DSW::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) {
switch (p_param) {
- case PhysicsServer::AREA_PARAM_GRAVITY: gravity = p_value; break;
- case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
- case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
- case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
- case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
- case PhysicsServer::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
- case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
- case PhysicsServer::AREA_PARAM_PRIORITY: priority = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY: gravity = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: gravity_vector = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: gravity_is_point = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: gravity_distance_scale = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: point_attenuation = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: linear_damp = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: angular_damp = p_value; break;
+ case PhysicsServer3D::AREA_PARAM_PRIORITY: priority = p_value; break;
}
}
-Variant AreaSW::get_param(PhysicsServer::AreaParameter p_param) const {
+Variant Area3DSW::get_param(PhysicsServer3D::AreaParameter p_param) const {
switch (p_param) {
- case PhysicsServer::AREA_PARAM_GRAVITY: return gravity;
- case PhysicsServer::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
- case PhysicsServer::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
- case PhysicsServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
- case PhysicsServer::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
- case PhysicsServer::AREA_PARAM_LINEAR_DAMP: return linear_damp;
- case PhysicsServer::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
- case PhysicsServer::AREA_PARAM_PRIORITY: return priority;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY: return gravity;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR: return gravity_vector;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT: return gravity_is_point;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_DISTANCE_SCALE: return gravity_distance_scale;
+ case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_ATTENUATION: return point_attenuation;
+ case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP: return linear_damp;
+ case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP: return angular_damp;
+ case PhysicsServer3D::AREA_PARAM_PRIORITY: return priority;
}
return Variant();
}
-void AreaSW::_queue_monitor_update() {
+void Area3DSW::_queue_monitor_update() {
ERR_FAIL_COND(!get_space());
@@ -164,7 +164,7 @@ void AreaSW::_queue_monitor_update() {
get_space()->area_add_to_monitor_query_list(&monitor_query_list);
}
-void AreaSW::set_monitorable(bool p_monitorable) {
+void Area3DSW::set_monitorable(bool p_monitorable) {
if (monitorable == p_monitorable)
return;
@@ -173,7 +173,7 @@ void AreaSW::set_monitorable(bool p_monitorable) {
_set_static(!monitorable);
}
-void AreaSW::call_queries() {
+void Area3DSW::call_queries() {
if (monitor_callback_id.is_valid() && !monitored_bodies.empty()) {
@@ -194,7 +194,7 @@ void AreaSW::call_queries() {
if (E->get().state == 0)
continue; //nothing happened
- res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
+ res[0] = E->get().state > 0 ? PhysicsServer3D::AREA_BODY_ADDED : PhysicsServer3D::AREA_BODY_REMOVED;
res[1] = E->key().rid;
res[2] = E->key().instance_id;
res[3] = E->key().body_shape;
@@ -226,7 +226,7 @@ void AreaSW::call_queries() {
if (E->get().state == 0)
continue; //nothing happened
- res[0] = E->get().state > 0 ? PhysicsServer::AREA_BODY_ADDED : PhysicsServer::AREA_BODY_REMOVED;
+ res[0] = E->get().state > 0 ? PhysicsServer3D::AREA_BODY_ADDED : PhysicsServer3D::AREA_BODY_REMOVED;
res[1] = E->key().rid;
res[2] = E->key().instance_id;
res[3] = E->key().body_shape;
@@ -241,13 +241,13 @@ void AreaSW::call_queries() {
//get_space()->area_remove_from_monitor_query_list(&monitor_query_list);
}
-AreaSW::AreaSW() :
- CollisionObjectSW(TYPE_AREA),
+Area3DSW::Area3DSW() :
+ CollisionObject3DSW(TYPE_AREA),
monitor_query_list(this),
moved_list(this) {
_set_static(true); //areas are never active
- space_override_mode = PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED;
+ space_override_mode = PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
gravity = 9.80665;
gravity_vector = Vector3(0, -1, 0);
gravity_is_point = false;
@@ -260,5 +260,5 @@ AreaSW::AreaSW() :
monitorable = false;
}
-AreaSW::~AreaSW() {
+Area3DSW::~Area3DSW() {
}
diff --git a/servers/physics/area_sw.h b/servers/physics_3d/area_3d_sw.h
index 4da2b00d20..bc57790206 100644
--- a/servers/physics/area_sw.h
+++ b/servers/physics_3d/area_3d_sw.h
@@ -31,18 +31,18 @@
#ifndef AREA_SW_H
#define AREA_SW_H
-#include "collision_object_sw.h"
+#include "collision_object_3d_sw.h"
#include "core/self_list.h"
-#include "servers/physics_server.h"
-//#include "servers/physics/query_sw.h"
+#include "servers/physics_server_3d.h"
+//#include "servers/physics_3d/query_sw.h"
-class SpaceSW;
-class BodySW;
-class ConstraintSW;
+class Space3DSW;
+class Body3DSW;
+class Constraint3DSW;
-class AreaSW : public CollisionObjectSW {
+class Area3DSW : public CollisionObject3DSW {
- PhysicsServer::AreaSpaceOverrideMode space_override_mode;
+ PhysicsServer3D::AreaSpaceOverrideMode space_override_mode;
real_t gravity;
Vector3 gravity_vector;
bool gravity_is_point;
@@ -59,8 +59,8 @@ class AreaSW : public CollisionObjectSW {
ObjectID area_monitor_callback_id;
StringName area_monitor_callback_method;
- SelfList<AreaSW> monitor_query_list;
- SelfList<AreaSW> moved_list;
+ SelfList<Area3DSW> monitor_query_list;
+ SelfList<Area3DSW> moved_list;
struct BodyKey {
@@ -83,8 +83,8 @@ class AreaSW : public CollisionObjectSW {
}
_FORCE_INLINE_ BodyKey() {}
- BodyKey(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
- BodyKey(AreaSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
+ BodyKey(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
+ BodyKey(Area3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
};
struct BodyState {
@@ -101,7 +101,7 @@ class AreaSW : public CollisionObjectSW {
//virtual void shape_changed_notify(ShapeSW *p_shape);
//virtual void shape_deleted_notify(ShapeSW *p_shape);
- Set<ConstraintSW *> constraints;
+ Set<Constraint3DSW *> constraints;
virtual void _shapes_changed();
void _queue_monitor_update();
@@ -116,17 +116,17 @@ public:
void set_area_monitor_callback(ObjectID p_id, const StringName &p_method);
_FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id.is_valid(); }
- _FORCE_INLINE_ void add_body_to_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
- _FORCE_INLINE_ void remove_body_from_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
+ _FORCE_INLINE_ void add_body_to_query(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
+ _FORCE_INLINE_ void remove_body_from_query(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape);
- _FORCE_INLINE_ void add_area_to_query(AreaSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
- _FORCE_INLINE_ void remove_area_from_query(AreaSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
+ _FORCE_INLINE_ void add_area_to_query(Area3DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
+ _FORCE_INLINE_ void remove_area_from_query(Area3DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape);
- void set_param(PhysicsServer::AreaParameter p_param, const Variant &p_value);
- Variant get_param(PhysicsServer::AreaParameter p_param) const;
+ void set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value);
+ Variant get_param(PhysicsServer3D::AreaParameter p_param) const;
- void set_space_override_mode(PhysicsServer::AreaSpaceOverrideMode p_mode);
- PhysicsServer::AreaSpaceOverrideMode get_space_override_mode() const { return space_override_mode; }
+ void set_space_override_mode(PhysicsServer3D::AreaSpaceOverrideMode p_mode);
+ PhysicsServer3D::AreaSpaceOverrideMode get_space_override_mode() const { return space_override_mode; }
_FORCE_INLINE_ void set_gravity(real_t p_gravity) { gravity = p_gravity; }
_FORCE_INLINE_ real_t get_gravity() const { return gravity; }
@@ -152,9 +152,9 @@ public:
_FORCE_INLINE_ void set_priority(int p_priority) { priority = p_priority; }
_FORCE_INLINE_ int get_priority() const { return priority; }
- _FORCE_INLINE_ void add_constraint(ConstraintSW *p_constraint) { constraints.insert(p_constraint); }
- _FORCE_INLINE_ void remove_constraint(ConstraintSW *p_constraint) { constraints.erase(p_constraint); }
- _FORCE_INLINE_ const Set<ConstraintSW *> &get_constraints() const { return constraints; }
+ _FORCE_INLINE_ void add_constraint(Constraint3DSW *p_constraint) { constraints.insert(p_constraint); }
+ _FORCE_INLINE_ void remove_constraint(Constraint3DSW *p_constraint) { constraints.erase(p_constraint); }
+ _FORCE_INLINE_ const Set<Constraint3DSW *> &get_constraints() const { return constraints; }
_FORCE_INLINE_ void clear_constraints() { constraints.clear(); }
void set_monitorable(bool p_monitorable);
@@ -162,22 +162,22 @@ public:
void set_transform(const Transform &p_transform);
- void set_space(SpaceSW *p_space);
+ void set_space(Space3DSW *p_space);
void call_queries();
- AreaSW();
- ~AreaSW();
+ Area3DSW();
+ ~Area3DSW();
};
-void AreaSW::add_body_to_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
+void Area3DSW::add_body_to_query(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
BodyKey bk(p_body, p_body_shape, p_area_shape);
monitored_bodies[bk].inc();
if (!monitor_query_list.in_list())
_queue_monitor_update();
}
-void AreaSW::remove_body_from_query(BodySW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
+void Area3DSW::remove_body_from_query(Body3DSW *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
BodyKey bk(p_body, p_body_shape, p_area_shape);
monitored_bodies[bk].dec();
@@ -185,14 +185,14 @@ void AreaSW::remove_body_from_query(BodySW *p_body, uint32_t p_body_shape, uint3
_queue_monitor_update();
}
-void AreaSW::add_area_to_query(AreaSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) {
+void Area3DSW::add_area_to_query(Area3DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) {
BodyKey bk(p_area, p_area_shape, p_self_shape);
monitored_areas[bk].inc();
if (!monitor_query_list.in_list())
_queue_monitor_update();
}
-void AreaSW::remove_area_from_query(AreaSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) {
+void Area3DSW::remove_area_from_query(Area3DSW *p_area, uint32_t p_area_shape, uint32_t p_self_shape) {
BodyKey bk(p_area, p_area_shape, p_self_shape);
monitored_areas[bk].dec();
diff --git a/servers/physics/area_pair_sw.cpp b/servers/physics_3d/area_pair_3d_sw.cpp
index 966a440930..3300e9dede 100644
--- a/servers/physics/area_pair_sw.cpp
+++ b/servers/physics_3d/area_pair_3d_sw.cpp
@@ -28,16 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "area_pair_sw.h"
-#include "collision_solver_sw.h"
+#include "area_pair_3d_sw.h"
+#include "collision_solver_3d_sw.h"
-bool AreaPairSW::setup(real_t p_step) {
+bool AreaPair3DSW::setup(real_t p_step) {
bool result = false;
if (area->is_shape_set_as_disabled(area_shape) || body->is_shape_set_as_disabled(body_shape)) {
result = false;
- } else if (area->test_collision_mask(body) && CollisionSolverSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), NULL, this)) {
+ } else if (area->test_collision_mask(body) && CollisionSolver3DSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), NULL, this)) {
result = true;
}
@@ -45,14 +45,14 @@ bool AreaPairSW::setup(real_t p_step) {
if (result) {
- if (area->get_space_override_mode() != PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED)
body->add_area(area);
if (area->has_monitor_callback())
area->add_body_to_query(body, body_shape, area_shape);
} else {
- if (area->get_space_override_mode() != PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED)
body->remove_area(area);
if (area->has_monitor_callback())
area->remove_body_from_query(body, body_shape, area_shape);
@@ -64,10 +64,10 @@ bool AreaPairSW::setup(real_t p_step) {
return false; //never do any post solving
}
-void AreaPairSW::solve(real_t p_step) {
+void AreaPair3DSW::solve(real_t p_step) {
}
-AreaPairSW::AreaPairSW(BodySW *p_body, int p_body_shape, AreaSW *p_area, int p_area_shape) {
+AreaPair3DSW::AreaPair3DSW(Body3DSW *p_body, int p_body_shape, Area3DSW *p_area, int p_area_shape) {
body = p_body;
area = p_area;
@@ -76,15 +76,15 @@ AreaPairSW::AreaPairSW(BodySW *p_body, int p_body_shape, AreaSW *p_area, int p_a
colliding = false;
body->add_constraint(this, 0);
area->add_constraint(this);
- if (p_body->get_mode() == PhysicsServer::BODY_MODE_KINEMATIC)
+ if (p_body->get_mode() == PhysicsServer3D::BODY_MODE_KINEMATIC)
p_body->set_active(true);
}
-AreaPairSW::~AreaPairSW() {
+AreaPair3DSW::~AreaPair3DSW() {
if (colliding) {
- if (area->get_space_override_mode() != PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED)
+ if (area->get_space_override_mode() != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED)
body->remove_area(area);
if (area->has_monitor_callback())
area->remove_body_from_query(body, body_shape, area_shape);
@@ -95,12 +95,12 @@ AreaPairSW::~AreaPairSW() {
////////////////////////////////////////////////////
-bool Area2PairSW::setup(real_t p_step) {
+bool Area2Pair3DSW::setup(real_t p_step) {
bool result = false;
if (area_a->is_shape_set_as_disabled(shape_a) || area_b->is_shape_set_as_disabled(shape_b)) {
result = false;
- } else if (area_a->test_collision_mask(area_b) && CollisionSolverSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), NULL, this)) {
+ } else if (area_a->test_collision_mask(area_b) && CollisionSolver3DSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), NULL, this)) {
result = true;
}
@@ -129,10 +129,10 @@ bool Area2PairSW::setup(real_t p_step) {
return false; //never do any post solving
}
-void Area2PairSW::solve(real_t p_step) {
+void Area2Pair3DSW::solve(real_t p_step) {
}
-Area2PairSW::Area2PairSW(AreaSW *p_area_a, int p_shape_a, AreaSW *p_area_b, int p_shape_b) {
+Area2Pair3DSW::Area2Pair3DSW(Area3DSW *p_area_a, int p_shape_a, Area3DSW *p_area_b, int p_shape_b) {
area_a = p_area_a;
area_b = p_area_b;
@@ -143,7 +143,7 @@ Area2PairSW::Area2PairSW(AreaSW *p_area_a, int p_shape_a, AreaSW *p_area_b, int
area_b->add_constraint(this);
}
-Area2PairSW::~Area2PairSW() {
+Area2Pair3DSW::~Area2Pair3DSW() {
if (colliding) {
diff --git a/servers/physics/area_pair_sw.h b/servers/physics_3d/area_pair_3d_sw.h
index 97a37ebf90..6f7e1ee3b5 100644
--- a/servers/physics/area_pair_sw.h
+++ b/servers/physics_3d/area_pair_3d_sw.h
@@ -31,14 +31,14 @@
#ifndef AREA_PAIR_SW_H
#define AREA_PAIR_SW_H
-#include "area_sw.h"
-#include "body_sw.h"
-#include "constraint_sw.h"
+#include "area_3d_sw.h"
+#include "body_3d_sw.h"
+#include "constraint_3d_sw.h"
-class AreaPairSW : public ConstraintSW {
+class AreaPair3DSW : public Constraint3DSW {
- BodySW *body;
- AreaSW *area;
+ Body3DSW *body;
+ Area3DSW *area;
int body_shape;
int area_shape;
bool colliding;
@@ -47,14 +47,14 @@ public:
bool setup(real_t p_step);
void solve(real_t p_step);
- AreaPairSW(BodySW *p_body, int p_body_shape, AreaSW *p_area, int p_area_shape);
- ~AreaPairSW();
+ AreaPair3DSW(Body3DSW *p_body, int p_body_shape, Area3DSW *p_area, int p_area_shape);
+ ~AreaPair3DSW();
};
-class Area2PairSW : public ConstraintSW {
+class Area2Pair3DSW : public Constraint3DSW {
- AreaSW *area_a;
- AreaSW *area_b;
+ Area3DSW *area_a;
+ Area3DSW *area_b;
int shape_a;
int shape_b;
bool colliding;
@@ -63,8 +63,8 @@ public:
bool setup(real_t p_step);
void solve(real_t p_step);
- Area2PairSW(AreaSW *p_area_a, int p_shape_a, AreaSW *p_area_b, int p_shape_b);
- ~Area2PairSW();
+ Area2Pair3DSW(Area3DSW *p_area_a, int p_shape_a, Area3DSW *p_area_b, int p_shape_b);
+ ~Area2Pair3DSW();
};
#endif // AREA_PAIR__SW_H
diff --git a/servers/physics/body_sw.cpp b/servers/physics_3d/body_3d_sw.cpp
index 8819941f04..dcdc373dc9 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics_3d/body_3d_sw.cpp
@@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "body_sw.h"
-#include "area_sw.h"
-#include "space_sw.h"
+#include "body_3d_sw.h"
+#include "area_3d_sw.h"
+#include "space_3d_sw.h"
-void BodySW::_update_inertia() {
+void Body3DSW::_update_inertia() {
if (get_space() && !inertia_update_list.in_list())
get_space()->body_add_to_inertia_update_list(&inertia_update_list);
}
-void BodySW::_update_transform_dependant() {
+void Body3DSW::_update_transform_dependant() {
center_of_mass = get_transform().basis.xform(center_of_mass_local);
principal_inertia_axes = get_transform().basis * principal_inertia_axes_local;
@@ -51,13 +51,13 @@ void BodySW::_update_transform_dependant() {
_inv_inertia_tensor = tb * diag * tbt;
}
-void BodySW::update_inertias() {
+void Body3DSW::update_inertias() {
//update shapes and motions
switch (mode) {
- case PhysicsServer::BODY_MODE_RIGID: {
+ case PhysicsServer3D::BODY_MODE_RIGID: {
//update tensor for all shapes, not the best way but should be somehow OK. (inspired from bullet)
real_t total_area = 0;
@@ -91,7 +91,7 @@ void BodySW::update_inertias() {
continue;
}
- const ShapeSW *shape = get_shape(i);
+ const Shape3DSW *shape = get_shape(i);
real_t area = get_shape_area(i);
@@ -119,13 +119,13 @@ void BodySW::update_inertias() {
} break;
- case PhysicsServer::BODY_MODE_KINEMATIC:
- case PhysicsServer::BODY_MODE_STATIC: {
+ case PhysicsServer3D::BODY_MODE_KINEMATIC:
+ case PhysicsServer3D::BODY_MODE_STATIC: {
_inv_inertia_tensor.set_zero();
_inv_mass = 0;
} break;
- case PhysicsServer::BODY_MODE_CHARACTER: {
+ case PhysicsServer3D::BODY_MODE_CHARACTER: {
_inv_inertia_tensor.set_zero();
_inv_mass = 1.0 / mass;
@@ -138,7 +138,7 @@ void BodySW::update_inertias() {
_update_transform_dependant();
}
-void BodySW::set_active(bool p_active) {
+void Body3DSW::set_active(bool p_active) {
if (active == p_active)
return;
@@ -148,7 +148,7 @@ void BodySW::set_active(bool p_active) {
if (get_space())
get_space()->body_remove_from_active_list(&active_list);
} else {
- if (mode == PhysicsServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer3D::BODY_MODE_STATIC)
return; //static bodies can't become active
if (get_space())
get_space()->body_add_to_active_list(&active_list);
@@ -168,31 +168,31 @@ void BodySW::set_active(bool p_active) {
*/
}
-void BodySW::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) {
+void Body3DSW::set_param(PhysicsServer3D::BodyParameter p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::BODY_PARAM_BOUNCE: {
+ case PhysicsServer3D::BODY_PARAM_BOUNCE: {
bounce = p_value;
} break;
- case PhysicsServer::BODY_PARAM_FRICTION: {
+ case PhysicsServer3D::BODY_PARAM_FRICTION: {
friction = p_value;
} break;
- case PhysicsServer::BODY_PARAM_MASS: {
+ case PhysicsServer3D::BODY_PARAM_MASS: {
ERR_FAIL_COND(p_value <= 0);
mass = p_value;
_update_inertia();
} break;
- case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: {
+ case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: {
gravity_scale = p_value;
} break;
- case PhysicsServer::BODY_PARAM_LINEAR_DAMP: {
+ case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP: {
linear_damp = p_value;
} break;
- case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: {
+ case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP: {
angular_damp = p_value;
} break;
@@ -201,28 +201,28 @@ void BodySW::set_param(PhysicsServer::BodyParameter p_param, real_t p_value) {
}
}
-real_t BodySW::get_param(PhysicsServer::BodyParameter p_param) const {
+real_t Body3DSW::get_param(PhysicsServer3D::BodyParameter p_param) const {
switch (p_param) {
- case PhysicsServer::BODY_PARAM_BOUNCE: {
+ case PhysicsServer3D::BODY_PARAM_BOUNCE: {
return bounce;
} break;
- case PhysicsServer::BODY_PARAM_FRICTION: {
+ case PhysicsServer3D::BODY_PARAM_FRICTION: {
return friction;
} break;
- case PhysicsServer::BODY_PARAM_MASS: {
+ case PhysicsServer3D::BODY_PARAM_MASS: {
return mass;
} break;
- case PhysicsServer::BODY_PARAM_GRAVITY_SCALE: {
+ case PhysicsServer3D::BODY_PARAM_GRAVITY_SCALE: {
return gravity_scale;
} break;
- case PhysicsServer::BODY_PARAM_LINEAR_DAMP: {
+ case PhysicsServer3D::BODY_PARAM_LINEAR_DAMP: {
return linear_damp;
} break;
- case PhysicsServer::BODY_PARAM_ANGULAR_DAMP: {
+ case PhysicsServer3D::BODY_PARAM_ANGULAR_DAMP: {
return angular_damp;
} break;
@@ -234,36 +234,36 @@ real_t BodySW::get_param(PhysicsServer::BodyParameter p_param) const {
return 0;
}
-void BodySW::set_mode(PhysicsServer::BodyMode p_mode) {
+void Body3DSW::set_mode(PhysicsServer3D::BodyMode p_mode) {
- PhysicsServer::BodyMode prev = mode;
+ PhysicsServer3D::BodyMode prev = mode;
mode = p_mode;
switch (p_mode) {
//CLEAR UP EVERYTHING IN CASE IT NOT WORKS!
- case PhysicsServer::BODY_MODE_STATIC:
- case PhysicsServer::BODY_MODE_KINEMATIC: {
+ case PhysicsServer3D::BODY_MODE_STATIC:
+ case PhysicsServer3D::BODY_MODE_KINEMATIC: {
_set_inv_transform(get_transform().affine_inverse());
_inv_mass = 0;
- _set_static(p_mode == PhysicsServer::BODY_MODE_STATIC);
- //set_active(p_mode==PhysicsServer::BODY_MODE_KINEMATIC);
- set_active(p_mode == PhysicsServer::BODY_MODE_KINEMATIC && contacts.size());
+ _set_static(p_mode == PhysicsServer3D::BODY_MODE_STATIC);
+ //set_active(p_mode==PhysicsServer3D::BODY_MODE_KINEMATIC);
+ set_active(p_mode == PhysicsServer3D::BODY_MODE_KINEMATIC && contacts.size());
linear_velocity = Vector3();
angular_velocity = Vector3();
- if (mode == PhysicsServer::BODY_MODE_KINEMATIC && prev != mode) {
+ if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && prev != mode) {
first_time_kinematic = true;
}
} break;
- case PhysicsServer::BODY_MODE_RIGID: {
+ case PhysicsServer3D::BODY_MODE_RIGID: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_set_static(false);
set_active(true);
} break;
- case PhysicsServer::BODY_MODE_CHARACTER: {
+ case PhysicsServer3D::BODY_MODE_CHARACTER: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
_set_static(false);
@@ -278,22 +278,22 @@ void BodySW::set_mode(PhysicsServer::BodyMode p_mode) {
_update_queries();
*/
}
-PhysicsServer::BodyMode BodySW::get_mode() const {
+PhysicsServer3D::BodyMode Body3DSW::get_mode() const {
return mode;
}
-void BodySW::_shapes_changed() {
+void Body3DSW::_shapes_changed() {
_update_inertia();
}
-void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_variant) {
+void Body3DSW::set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant) {
switch (p_state) {
- case PhysicsServer::BODY_STATE_TRANSFORM: {
+ case PhysicsServer3D::BODY_STATE_TRANSFORM: {
- if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
new_transform = p_variant;
//wakeup_neighbours();
set_active(true);
@@ -303,7 +303,7 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian
first_time_kinematic = false;
}
- } else if (mode == PhysicsServer::BODY_MODE_STATIC) {
+ } else if (mode == PhysicsServer3D::BODY_MODE_STATIC) {
_set_transform(p_variant);
_set_inv_transform(get_transform().affine_inverse());
wakeup_neighbours();
@@ -319,27 +319,27 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian
wakeup();
} break;
- case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: {
+ case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY: {
/*
- if (mode==PhysicsServer::BODY_MODE_STATIC)
+ if (mode==PhysicsServer3D::BODY_MODE_STATIC)
break;
*/
linear_velocity = p_variant;
wakeup();
} break;
- case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: {
+ case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY: {
/*
- if (mode!=PhysicsServer::BODY_MODE_RIGID)
+ if (mode!=PhysicsServer3D::BODY_MODE_RIGID)
break;
*/
angular_velocity = p_variant;
wakeup();
} break;
- case PhysicsServer::BODY_STATE_SLEEPING: {
+ case PhysicsServer3D::BODY_STATE_SLEEPING: {
//?
- if (mode == PhysicsServer::BODY_MODE_STATIC || mode == PhysicsServer::BODY_MODE_KINEMATIC)
+ if (mode == PhysicsServer3D::BODY_MODE_STATIC || mode == PhysicsServer3D::BODY_MODE_KINEMATIC)
break;
bool do_sleep = p_variant;
if (do_sleep) {
@@ -352,30 +352,30 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian
set_active(true);
}
} break;
- case PhysicsServer::BODY_STATE_CAN_SLEEP: {
+ case PhysicsServer3D::BODY_STATE_CAN_SLEEP: {
can_sleep = p_variant;
- if (mode == PhysicsServer::BODY_MODE_RIGID && !active && !can_sleep)
+ if (mode == PhysicsServer3D::BODY_MODE_RIGID && !active && !can_sleep)
set_active(true);
} break;
}
}
-Variant BodySW::get_state(PhysicsServer::BodyState p_state) const {
+Variant Body3DSW::get_state(PhysicsServer3D::BodyState p_state) const {
switch (p_state) {
- case PhysicsServer::BODY_STATE_TRANSFORM: {
+ case PhysicsServer3D::BODY_STATE_TRANSFORM: {
return get_transform();
} break;
- case PhysicsServer::BODY_STATE_LINEAR_VELOCITY: {
+ case PhysicsServer3D::BODY_STATE_LINEAR_VELOCITY: {
return linear_velocity;
} break;
- case PhysicsServer::BODY_STATE_ANGULAR_VELOCITY: {
+ case PhysicsServer3D::BODY_STATE_ANGULAR_VELOCITY: {
return angular_velocity;
} break;
- case PhysicsServer::BODY_STATE_SLEEPING: {
+ case PhysicsServer3D::BODY_STATE_SLEEPING: {
return !is_active();
} break;
- case PhysicsServer::BODY_STATE_CAN_SLEEP: {
+ case PhysicsServer3D::BODY_STATE_CAN_SLEEP: {
return can_sleep;
} break;
}
@@ -383,7 +383,7 @@ Variant BodySW::get_state(PhysicsServer::BodyState p_state) const {
return Variant();
}
-void BodySW::set_space(SpaceSW *p_space) {
+void Body3DSW::set_space(Space3DSW *p_space) {
if (get_space()) {
@@ -414,7 +414,7 @@ void BodySW::set_space(SpaceSW *p_space) {
first_integration = true;
}
-void BodySW::_compute_area_gravity_and_dampenings(const AreaSW *p_area) {
+void Body3DSW::_compute_area_gravity_and_dampenings(const Area3DSW *p_area) {
if (p_area->is_gravity_point()) {
if (p_area->get_gravity_distance_scale() > 0) {
@@ -431,7 +431,7 @@ void BodySW::_compute_area_gravity_and_dampenings(const AreaSW *p_area) {
area_angular_damp += p_area->get_angular_damp();
}
-void BodySW::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
+void Body3DSW::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock) {
if (lock) {
locked_axis |= p_axis;
} else {
@@ -439,16 +439,16 @@ void BodySW::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
}
}
-bool BodySW::is_axis_locked(PhysicsServer::BodyAxis p_axis) const {
+bool Body3DSW::is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const {
return locked_axis & p_axis;
}
-void BodySW::integrate_forces(real_t p_step) {
+void Body3DSW::integrate_forces(real_t p_step) {
- if (mode == PhysicsServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer3D::BODY_MODE_STATIC)
return;
- AreaSW *def_area = get_space()->get_default_area();
+ Area3DSW *def_area = get_space()->get_default_area();
// AreaSW *damp_area = def_area;
ERR_FAIL_COND(!def_area);
@@ -463,20 +463,20 @@ void BodySW::integrate_forces(real_t p_step) {
const AreaCMP *aa = &areas[0];
// damp_area = aa[ac-1].area;
for (int i = ac - 1; i >= 0 && !stopped; i--) {
- PhysicsServer::AreaSpaceOverrideMode mode = aa[i].area->get_space_override_mode();
+ PhysicsServer3D::AreaSpaceOverrideMode mode = aa[i].area->get_space_override_mode();
switch (mode) {
- case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE:
- case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: {
+ case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE:
+ case PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: {
_compute_area_gravity_and_dampenings(aa[i].area);
- stopped = mode == PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE;
+ stopped = mode == PhysicsServer3D::AREA_SPACE_OVERRIDE_COMBINE_REPLACE;
} break;
- case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE:
- case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: {
+ case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE:
+ case PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: {
gravity = Vector3(0, 0, 0);
area_angular_damp = 0;
area_linear_damp = 0;
_compute_area_gravity_and_dampenings(aa[i].area);
- stopped = mode == PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE;
+ stopped = mode == PhysicsServer3D::AREA_SPACE_OVERRIDE_REPLACE;
} break;
default: {
}
@@ -508,7 +508,7 @@ void BodySW::integrate_forces(real_t p_step) {
Vector3 motion;
bool do_motion = false;
- if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
//compute motion, angular and etc. velocities from prev transform
linear_velocity = (new_transform.origin - get_transform().origin) / p_step;
@@ -573,9 +573,9 @@ void BodySW::integrate_forces(real_t p_step) {
contact_count = 0;
}
-void BodySW::integrate_velocities(real_t p_step) {
+void Body3DSW::integrate_velocities(real_t p_step) {
- if (mode == PhysicsServer::BODY_MODE_STATIC)
+ if (mode == PhysicsServer3D::BODY_MODE_STATIC)
return;
if (fi_callback)
@@ -583,7 +583,7 @@ void BodySW::integrate_velocities(real_t p_step) {
//apply axis lock linear
for (int i = 0; i < 3; i++) {
- if (is_axis_locked((PhysicsServer::BodyAxis)(1 << i))) {
+ if (is_axis_locked((PhysicsServer3D::BodyAxis)(1 << i))) {
linear_velocity[i] = 0;
biased_linear_velocity[i] = 0;
new_transform.origin[i] = get_transform().origin[i];
@@ -591,13 +591,13 @@ void BodySW::integrate_velocities(real_t p_step) {
}
//apply axis lock angular
for (int i = 0; i < 3; i++) {
- if (is_axis_locked((PhysicsServer::BodyAxis)(1 << (i + 3)))) {
+ if (is_axis_locked((PhysicsServer3D::BodyAxis)(1 << (i + 3)))) {
angular_velocity[i] = 0;
biased_angular_velocity[i] = 0;
}
}
- if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC) {
_set_transform(new_transform, false);
_set_inv_transform(new_transform.affine_inverse());
@@ -675,20 +675,20 @@ void BodySW::simulate_motion(const Transform& p_xform,real_t p_step) {
}
*/
-void BodySW::wakeup_neighbours() {
+void Body3DSW::wakeup_neighbours() {
- for (Map<ConstraintSW *, int>::Element *E = constraint_map.front(); E; E = E->next()) {
+ for (Map<Constraint3DSW *, int>::Element *E = constraint_map.front(); E; E = E->next()) {
- const ConstraintSW *c = E->key();
- BodySW **n = c->get_body_ptr();
+ const Constraint3DSW *c = E->key();
+ Body3DSW **n = c->get_body_ptr();
int bc = c->get_body_count();
for (int i = 0; i < bc; i++) {
if (i == E->get())
continue;
- BodySW *b = n[i];
- if (b->mode != PhysicsServer::BODY_MODE_RIGID)
+ Body3DSW *b = n[i];
+ if (b->mode != PhysicsServer3D::BODY_MODE_RIGID)
continue;
if (!b->is_active())
@@ -697,11 +697,11 @@ void BodySW::wakeup_neighbours() {
}
}
-void BodySW::call_queries() {
+void Body3DSW::call_queries() {
if (fi_callback) {
- PhysicsDirectBodyStateSW *dbs = PhysicsDirectBodyStateSW::singleton;
+ PhysicsDirectBodyState3DSW *dbs = PhysicsDirectBodyState3DSW::singleton;
dbs->body = this;
Variant v = dbs;
@@ -720,11 +720,11 @@ void BodySW::call_queries() {
}
}
-bool BodySW::sleep_test(real_t p_step) {
+bool Body3DSW::sleep_test(real_t p_step) {
- if (mode == PhysicsServer::BODY_MODE_STATIC || mode == PhysicsServer::BODY_MODE_KINEMATIC)
+ if (mode == PhysicsServer3D::BODY_MODE_STATIC || mode == PhysicsServer3D::BODY_MODE_KINEMATIC)
return true; //
- else if (mode == PhysicsServer::BODY_MODE_CHARACTER)
+ else if (mode == PhysicsServer3D::BODY_MODE_CHARACTER)
return !active; // characters don't sleep unless asked to sleep
else if (!can_sleep)
return false;
@@ -741,7 +741,7 @@ bool BodySW::sleep_test(real_t p_step) {
}
}
-void BodySW::set_force_integration_callback(ObjectID p_id, const StringName &p_method, const Variant &p_udata) {
+void Body3DSW::set_force_integration_callback(ObjectID p_id, const StringName &p_method, const Variant &p_udata) {
if (fi_callback) {
@@ -758,18 +758,18 @@ void BodySW::set_force_integration_callback(ObjectID p_id, const StringName &p_m
}
}
-void BodySW::set_kinematic_margin(real_t p_margin) {
+void Body3DSW::set_kinematic_margin(real_t p_margin) {
kinematic_safe_margin = p_margin;
}
-BodySW::BodySW() :
- CollisionObjectSW(TYPE_BODY),
+Body3DSW::Body3DSW() :
+ CollisionObject3DSW(TYPE_BODY),
locked_axis(0),
active_list(this),
inertia_update_list(this),
direct_state_query_list(this) {
- mode = PhysicsServer::BODY_MODE_RIGID;
+ mode = PhysicsServer3D::BODY_MODE_RIGID;
active = true;
mass = 1;
@@ -800,15 +800,15 @@ BodySW::BodySW() :
fi_callback = NULL;
}
-BodySW::~BodySW() {
+Body3DSW::~Body3DSW() {
if (fi_callback)
memdelete(fi_callback);
}
-PhysicsDirectBodyStateSW *PhysicsDirectBodyStateSW::singleton = NULL;
+PhysicsDirectBodyState3DSW *PhysicsDirectBodyState3DSW::singleton = NULL;
-PhysicsDirectSpaceState *PhysicsDirectBodyStateSW::get_space_state() {
+PhysicsDirectSpaceState3D *PhysicsDirectBodyState3DSW::get_space_state() {
return body->get_space()->get_direct_state();
}
diff --git a/servers/physics/body_sw.h b/servers/physics_3d/body_3d_sw.h
index d712b09878..7020805af0 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics_3d/body_3d_sw.h
@@ -31,15 +31,15 @@
#ifndef BODY_SW_H
#define BODY_SW_H
-#include "area_sw.h"
-#include "collision_object_sw.h"
+#include "area_3d_sw.h"
+#include "collision_object_3d_sw.h"
#include "core/vset.h"
-class ConstraintSW;
+class Constraint3DSW;
-class BodySW : public CollisionObjectSW {
+class Body3DSW : public CollisionObject3DSW {
- PhysicsServer::BodyMode mode;
+ PhysicsServer3D::BodyMode mode;
Vector3 linear_velocity;
Vector3 angular_velocity;
@@ -79,9 +79,9 @@ class BodySW : public CollisionObjectSW {
real_t area_angular_damp;
real_t area_linear_damp;
- SelfList<BodySW> active_list;
- SelfList<BodySW> inertia_update_list;
- SelfList<BodySW> direct_state_query_list;
+ SelfList<Body3DSW> active_list;
+ SelfList<Body3DSW> inertia_update_list;
+ SelfList<Body3DSW> direct_state_query_list;
VSet<RID> exceptions;
bool omit_force_integration;
@@ -96,16 +96,16 @@ class BodySW : public CollisionObjectSW {
virtual void _shapes_changed();
Transform new_transform;
- Map<ConstraintSW *, int> constraint_map;
+ Map<Constraint3DSW *, int> constraint_map;
struct AreaCMP {
- AreaSW *area;
+ Area3DSW *area;
int refCount;
_FORCE_INLINE_ bool operator==(const AreaCMP &p_cmp) const { return area->get_self() == p_cmp.area->get_self(); }
_FORCE_INLINE_ bool operator<(const AreaCMP &p_cmp) const { return area->get_priority() < p_cmp.area->get_priority(); }
_FORCE_INLINE_ AreaCMP() {}
- _FORCE_INLINE_ AreaCMP(AreaSW *p_area) {
+ _FORCE_INLINE_ AreaCMP(Area3DSW *p_area) {
area = p_area;
refCount = 1;
}
@@ -139,14 +139,14 @@ class BodySW : public CollisionObjectSW {
ForceIntegrationCallback *fi_callback;
uint64_t island_step;
- BodySW *island_next;
- BodySW *island_list_next;
+ Body3DSW *island_next;
+ Body3DSW *island_list_next;
- _FORCE_INLINE_ void _compute_area_gravity_and_dampenings(const AreaSW *p_area);
+ _FORCE_INLINE_ void _compute_area_gravity_and_dampenings(const Area3DSW *p_area);
_FORCE_INLINE_ void _update_transform_dependant();
- friend class PhysicsDirectBodyStateSW; // i give up, too many functions to expose
+ friend class PhysicsDirectBodyState3DSW; // i give up, too many functions to expose
public:
void set_force_integration_callback(ObjectID p_id, const StringName &p_method, const Variant &p_udata = Variant());
@@ -154,7 +154,7 @@ public:
void set_kinematic_margin(real_t p_margin);
_FORCE_INLINE_ real_t get_kinematic_margin() { return kinematic_safe_margin; }
- _FORCE_INLINE_ void add_area(AreaSW *p_area) {
+ _FORCE_INLINE_ void add_area(Area3DSW *p_area) {
int index = areas.find(AreaCMP(p_area));
if (index > -1) {
areas.write[index].refCount += 1;
@@ -163,7 +163,7 @@ public:
}
}
- _FORCE_INLINE_ void remove_area(AreaSW *p_area) {
+ _FORCE_INLINE_ void remove_area(Area3DSW *p_area) {
int index = areas.find(AreaCMP(p_area));
if (index > -1) {
areas.write[index].refCount -= 1;
@@ -175,7 +175,7 @@ public:
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) {
contacts.resize(p_size);
contact_count = 0;
- if (mode == PhysicsServer::BODY_MODE_KINEMATIC && p_size) set_active(true);
+ if (mode == PhysicsServer3D::BODY_MODE_KINEMATIC && p_size) set_active(true);
}
_FORCE_INLINE_ int get_max_contacts_reported() const { return contacts.size(); }
@@ -190,15 +190,15 @@ public:
_FORCE_INLINE_ uint64_t get_island_step() const { return island_step; }
_FORCE_INLINE_ void set_island_step(uint64_t p_step) { island_step = p_step; }
- _FORCE_INLINE_ BodySW *get_island_next() const { return island_next; }
- _FORCE_INLINE_ void set_island_next(BodySW *p_next) { island_next = p_next; }
+ _FORCE_INLINE_ Body3DSW *get_island_next() const { return island_next; }
+ _FORCE_INLINE_ void set_island_next(Body3DSW *p_next) { island_next = p_next; }
- _FORCE_INLINE_ BodySW *get_island_list_next() const { return island_list_next; }
- _FORCE_INLINE_ void set_island_list_next(BodySW *p_next) { island_list_next = p_next; }
+ _FORCE_INLINE_ Body3DSW *get_island_list_next() const { return island_list_next; }
+ _FORCE_INLINE_ void set_island_list_next(Body3DSW *p_next) { island_list_next = p_next; }
- _FORCE_INLINE_ void add_constraint(ConstraintSW *p_constraint, int p_pos) { constraint_map[p_constraint] = p_pos; }
- _FORCE_INLINE_ void remove_constraint(ConstraintSW *p_constraint) { constraint_map.erase(p_constraint); }
- const Map<ConstraintSW *, int> &get_constraint_map() const { return constraint_map; }
+ _FORCE_INLINE_ void add_constraint(Constraint3DSW *p_constraint, int p_pos) { constraint_map[p_constraint] = p_pos; }
+ _FORCE_INLINE_ void remove_constraint(Constraint3DSW *p_constraint) { constraint_map.erase(p_constraint); }
+ const Map<Constraint3DSW *, int> &get_constraint_map() const { return constraint_map; }
_FORCE_INLINE_ void clear_constraint_map() { constraint_map.clear(); }
_FORCE_INLINE_ void set_omit_force_integration(bool p_omit_force_integration) { omit_force_integration = p_omit_force_integration; }
@@ -268,19 +268,19 @@ public:
_FORCE_INLINE_ bool is_active() const { return active; }
_FORCE_INLINE_ void wakeup() {
- if ((!get_space()) || mode == PhysicsServer::BODY_MODE_STATIC || mode == PhysicsServer::BODY_MODE_KINEMATIC)
+ if ((!get_space()) || mode == PhysicsServer3D::BODY_MODE_STATIC || mode == PhysicsServer3D::BODY_MODE_KINEMATIC)
return;
set_active(true);
}
- void set_param(PhysicsServer::BodyParameter p_param, real_t);
- real_t get_param(PhysicsServer::BodyParameter p_param) const;
+ void set_param(PhysicsServer3D::BodyParameter p_param, real_t);
+ real_t get_param(PhysicsServer3D::BodyParameter p_param) const;
- void set_mode(PhysicsServer::BodyMode p_mode);
- PhysicsServer::BodyMode get_mode() const;
+ void set_mode(PhysicsServer3D::BodyMode p_mode);
+ PhysicsServer3D::BodyMode get_mode() const;
- void set_state(PhysicsServer::BodyState p_state, const Variant &p_variant);
- Variant get_state(PhysicsServer::BodyState p_state) const;
+ void set_state(PhysicsServer3D::BodyState p_state, const Variant &p_variant);
+ Variant get_state(PhysicsServer3D::BodyState p_state) const;
void set_applied_force(const Vector3 &p_force) { applied_force = p_force; }
Vector3 get_applied_force() const { return applied_force; }
@@ -291,7 +291,7 @@ public:
_FORCE_INLINE_ void set_continuous_collision_detection(bool p_enable) { continuous_cd = p_enable; }
_FORCE_INLINE_ bool is_continuous_collision_detection_enabled() const { return continuous_cd; }
- void set_space(SpaceSW *p_space);
+ void set_space(Space3DSW *p_space);
void update_inertias();
@@ -302,8 +302,8 @@ public:
_FORCE_INLINE_ Vector3 get_gravity() const { return gravity; }
_FORCE_INLINE_ real_t get_bounce() const { return bounce; }
- void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock);
- bool is_axis_locked(PhysicsServer::BodyAxis p_axis) const;
+ void set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool lock);
+ bool is_axis_locked(PhysicsServer3D::BodyAxis p_axis) const;
void integrate_forces(real_t p_step);
void integrate_velocities(real_t p_step);
@@ -335,13 +335,13 @@ public:
bool sleep_test(real_t p_step);
- BodySW();
- ~BodySW();
+ Body3DSW();
+ ~Body3DSW();
};
//add contact inline
-void BodySW::add_contact(const Vector3 &p_local_pos, const Vector3 &p_local_normal, real_t p_depth, int p_local_shape, const Vector3 &p_collider_pos, int p_collider_shape, ObjectID p_collider_instance_id, const RID &p_collider, const Vector3 &p_collider_velocity_at_pos) {
+void Body3DSW::add_contact(const Vector3 &p_local_pos, const Vector3 &p_local_normal, real_t p_depth, int p_local_shape, const Vector3 &p_collider_pos, int p_collider_shape, ObjectID p_collider_instance_id, const RID &p_collider, const Vector3 &p_collider_velocity_at_pos) {
int c_max = contacts.size();
@@ -385,13 +385,13 @@ void BodySW::add_contact(const Vector3 &p_local_pos, const Vector3 &p_local_norm
c[idx].collider_velocity_at_pos = p_collider_velocity_at_pos;
}
-class PhysicsDirectBodyStateSW : public PhysicsDirectBodyState {
+class PhysicsDirectBodyState3DSW : public PhysicsDirectBodyState3D {
- GDCLASS(PhysicsDirectBodyStateSW, PhysicsDirectBodyState);
+ GDCLASS(PhysicsDirectBodyState3DSW, PhysicsDirectBodyState3D);
public:
- static PhysicsDirectBodyStateSW *singleton;
- BodySW *body;
+ static PhysicsDirectBodyState3DSW *singleton;
+ Body3DSW *body;
real_t step;
virtual Vector3 get_total_gravity() const { return body->gravity; } // get gravity vector working on this body space/area
@@ -411,7 +411,7 @@ public:
virtual void set_angular_velocity(const Vector3 &p_velocity) { body->set_angular_velocity(p_velocity); }
virtual Vector3 get_angular_velocity() const { return body->get_angular_velocity(); }
- virtual void set_transform(const Transform &p_transform) { body->set_state(PhysicsServer::BODY_STATE_TRANSFORM, p_transform); }
+ virtual void set_transform(const Transform &p_transform) { body->set_state(PhysicsServer3D::BODY_STATE_TRANSFORM, p_transform); }
virtual Transform get_transform() const { return body->get_transform(); }
virtual void add_central_force(const Vector3 &p_force) { body->add_central_force(p_force); }
@@ -463,10 +463,10 @@ public:
return body->contacts[p_contact_idx].collider_velocity_at_pos;
}
- virtual PhysicsDirectSpaceState *get_space_state();
+ virtual PhysicsDirectSpaceState3D *get_space_state();
virtual real_t get_step() const { return step; }
- PhysicsDirectBodyStateSW() {
+ PhysicsDirectBodyState3DSW() {
singleton = this;
body = NULL;
}
diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics_3d/body_pair_3d_sw.cpp
index 31fc1b07d9..9c3c847afe 100644
--- a/servers/physics/body_pair_sw.cpp
+++ b/servers/physics_3d/body_pair_3d_sw.cpp
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "body_pair_sw.h"
+#include "body_pair_3d_sw.h"
-#include "collision_solver_sw.h"
+#include "collision_solver_3d_sw.h"
#include "core/os/os.h"
-#include "space_sw.h"
+#include "space_3d_sw.h"
/*
#define NO_ACCUMULATE_IMPULSES
@@ -49,13 +49,13 @@
#define MIN_VELOCITY 0.0001
#define MAX_BIAS_ROTATION (Math_PI / 8)
-void BodyPairSW::_contact_added_callback(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata) {
+void BodyPair3DSW::_contact_added_callback(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata) {
- BodyPairSW *pair = (BodyPairSW *)p_userdata;
+ BodyPair3DSW *pair = (BodyPair3DSW *)p_userdata;
pair->contact_added_callback(p_point_A, p_point_B);
}
-void BodyPairSW::contact_added_callback(const Vector3 &p_point_A, const Vector3 &p_point_B) {
+void BodyPair3DSW::contact_added_callback(const Vector3 &p_point_A, const Vector3 &p_point_B) {
// check if we already have the contact
@@ -141,7 +141,7 @@ void BodyPairSW::contact_added_callback(const Vector3 &p_point_A, const Vector3
}
}
-void BodyPairSW::validate_contacts() {
+void BodyPair3DSW::validate_contacts() {
//make sure to erase contacts that are no longer valid
@@ -169,7 +169,7 @@ void BodyPairSW::validate_contacts() {
}
}
-bool BodyPairSW::_test_ccd(real_t p_step, BodySW *p_A, int p_shape_A, const Transform &p_xform_A, BodySW *p_B, int p_shape_B, const Transform &p_xform_B) {
+bool BodyPair3DSW::_test_ccd(real_t p_step, Body3DSW *p_A, int p_shape_A, const Transform &p_xform_A, Body3DSW *p_B, int p_shape_B, const Transform &p_xform_B) {
Vector3 motion = p_A->get_linear_velocity() * p_step;
real_t mlen = motion.length();
@@ -211,18 +211,18 @@ bool BodyPairSW::_test_ccd(real_t p_step, BodySW *p_A, int p_shape_A, const Tran
return true;
}
-real_t combine_bounce(BodySW *A, BodySW *B) {
+real_t combine_bounce(Body3DSW *A, Body3DSW *B) {
return CLAMP(A->get_bounce() + B->get_bounce(), 0, 1);
}
-real_t combine_friction(BodySW *A, BodySW *B) {
+real_t combine_friction(Body3DSW *A, Body3DSW *B) {
return ABS(MIN(A->get_friction(), B->get_friction()));
}
-bool BodyPairSW::setup(real_t p_step) {
+bool BodyPair3DSW::setup(real_t p_step) {
//cannot collide
- if (!A->test_collision_mask(B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC && A->get_max_contacts_reported() == 0 && B->get_max_contacts_reported() == 0)) {
+ if (!A->test_collision_mask(B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC && A->get_max_contacts_reported() == 0 && B->get_max_contacts_reported() == 0)) {
collided = false;
return false;
}
@@ -244,21 +244,21 @@ bool BodyPairSW::setup(real_t p_step) {
xform_Bu.origin -= offset_A;
Transform xform_B = xform_Bu * B->get_shape_transform(shape_B);
- ShapeSW *shape_A_ptr = A->get_shape(shape_A);
- ShapeSW *shape_B_ptr = B->get_shape(shape_B);
+ Shape3DSW *shape_A_ptr = A->get_shape(shape_A);
+ Shape3DSW *shape_B_ptr = B->get_shape(shape_B);
- bool collided = CollisionSolverSW::solve_static(shape_A_ptr, xform_A, shape_B_ptr, xform_B, _contact_added_callback, this, &sep_axis);
+ bool collided = CollisionSolver3DSW::solve_static(shape_A_ptr, xform_A, shape_B_ptr, xform_B, _contact_added_callback, this, &sep_axis);
this->collided = collided;
if (!collided) {
//test ccd (currently just a raycast)
- if (A->is_continuous_collision_detection_enabled() && A->get_mode() > PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (A->is_continuous_collision_detection_enabled() && A->get_mode() > PhysicsServer3D::BODY_MODE_KINEMATIC && B->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) {
_test_ccd(p_step, A, shape_A, xform_A, B, shape_B, xform_B);
}
- if (B->is_continuous_collision_detection_enabled() && B->get_mode() > PhysicsServer::BODY_MODE_KINEMATIC && A->get_mode() <= PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (B->is_continuous_collision_detection_enabled() && B->get_mode() > PhysicsServer3D::BODY_MODE_KINEMATIC && A->get_mode() <= PhysicsServer3D::BODY_MODE_KINEMATIC) {
_test_ccd(p_step, B, shape_B, xform_B, A, shape_A, xform_A);
}
@@ -353,7 +353,7 @@ bool BodyPairSW::setup(real_t p_step) {
return true;
}
-void BodyPairSW::solve(real_t p_step) {
+void BodyPair3DSW::solve(real_t p_step) {
if (!collided)
return;
@@ -474,8 +474,8 @@ void BodyPairSW::solve(real_t p_step) {
}
}
-BodyPairSW::BodyPairSW(BodySW *p_A, int p_shape_A, BodySW *p_B, int p_shape_B) :
- ConstraintSW(_arr, 2) {
+BodyPair3DSW::BodyPair3DSW(Body3DSW *p_A, int p_shape_A, Body3DSW *p_B, int p_shape_B) :
+ Constraint3DSW(_arr, 2) {
A = p_A;
B = p_B;
@@ -488,7 +488,7 @@ BodyPairSW::BodyPairSW(BodySW *p_A, int p_shape_A, BodySW *p_B, int p_shape_B) :
collided = false;
}
-BodyPairSW::~BodyPairSW() {
+BodyPair3DSW::~BodyPair3DSW() {
A->remove_constraint(this);
B->remove_constraint(this);
diff --git a/servers/physics/body_pair_sw.h b/servers/physics_3d/body_pair_3d_sw.h
index 235aab23b5..61c219657c 100644
--- a/servers/physics/body_pair_sw.h
+++ b/servers/physics_3d/body_pair_3d_sw.h
@@ -31,10 +31,10 @@
#ifndef BODY_PAIR_SW_H
#define BODY_PAIR_SW_H
-#include "body_sw.h"
-#include "constraint_sw.h"
+#include "body_3d_sw.h"
+#include "constraint_3d_sw.h"
-class BodyPairSW : public ConstraintSW {
+class BodyPair3DSW : public Constraint3DSW {
enum {
MAX_CONTACTS = 4
@@ -42,11 +42,11 @@ class BodyPairSW : public ConstraintSW {
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
int shape_A;
@@ -82,16 +82,16 @@ class BodyPairSW : public ConstraintSW {
void contact_added_callback(const Vector3 &p_point_A, const Vector3 &p_point_B);
void validate_contacts();
- bool _test_ccd(real_t p_step, BodySW *p_A, int p_shape_A, const Transform &p_xform_A, BodySW *p_B, int p_shape_B, const Transform &p_xform_B);
+ bool _test_ccd(real_t p_step, Body3DSW *p_A, int p_shape_A, const Transform &p_xform_A, Body3DSW *p_B, int p_shape_B, const Transform &p_xform_B);
- SpaceSW *space;
+ Space3DSW *space;
public:
bool setup(real_t p_step);
void solve(real_t p_step);
- BodyPairSW(BodySW *p_A, int p_shape_A, BodySW *p_B, int p_shape_B);
- ~BodyPairSW();
+ BodyPair3DSW(Body3DSW *p_A, int p_shape_A, Body3DSW *p_B, int p_shape_B);
+ ~BodyPair3DSW();
};
#endif // BODY_PAIR__SW_H
diff --git a/servers/physics/broad_phase_basic.cpp b/servers/physics_3d/broad_phase_3d_basic.cpp
index f49bf9d4cc..bc0af98e4a 100644
--- a/servers/physics/broad_phase_basic.cpp
+++ b/servers/physics_3d/broad_phase_3d_basic.cpp
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "broad_phase_basic.h"
+#include "broad_phase_3d_basic.h"
#include "core/list.h"
#include "core/print_string.h"
-BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subindex) {
+BroadPhase3DSW::ID BroadPhase3DBasic::create(CollisionObject3DSW *p_object, int p_subindex) {
ERR_FAIL_COND_V(p_object == NULL, 0);
@@ -47,19 +47,19 @@ BroadPhaseSW::ID BroadPhaseBasic::create(CollisionObjectSW *p_object, int p_subi
return current;
}
-void BroadPhaseBasic::move(ID p_id, const AABB &p_aabb) {
+void BroadPhase3DBasic::move(ID p_id, const AABB &p_aabb) {
Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND(!E);
E->get().aabb = p_aabb;
}
-void BroadPhaseBasic::set_static(ID p_id, bool p_static) {
+void BroadPhase3DBasic::set_static(ID p_id, bool p_static) {
Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND(!E);
E->get()._static = p_static;
}
-void BroadPhaseBasic::remove(ID p_id) {
+void BroadPhase3DBasic::remove(ID p_id) {
Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND(!E);
@@ -85,26 +85,26 @@ void BroadPhaseBasic::remove(ID p_id) {
element_map.erase(E);
}
-CollisionObjectSW *BroadPhaseBasic::get_object(ID p_id) const {
+CollisionObject3DSW *BroadPhase3DBasic::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND_V(!E, NULL);
return E->get().owner;
}
-bool BroadPhaseBasic::is_static(ID p_id) const {
+bool BroadPhase3DBasic::is_static(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND_V(!E, false);
return E->get()._static;
}
-int BroadPhaseBasic::get_subindex(ID p_id) const {
+int BroadPhase3DBasic::get_subindex(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
ERR_FAIL_COND_V(!E, -1);
return E->get().subindex;
}
-int BroadPhaseBasic::cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhase3DBasic::cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
int rc = 0;
@@ -124,7 +124,7 @@ int BroadPhaseBasic::cull_point(const Vector3 &p_point, CollisionObjectSW **p_re
return rc;
}
-int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhase3DBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
int rc = 0;
@@ -143,7 +143,7 @@ int BroadPhaseBasic::cull_segment(const Vector3 &p_from, const Vector3 &p_to, Co
return rc;
}
-int BroadPhaseBasic::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhase3DBasic::cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
int rc = 0;
@@ -163,18 +163,18 @@ int BroadPhaseBasic::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results
return rc;
}
-void BroadPhaseBasic::set_pair_callback(PairCallback p_pair_callback, void *p_userdata) {
+void BroadPhase3DBasic::set_pair_callback(PairCallback p_pair_callback, void *p_userdata) {
pair_userdata = p_userdata;
pair_callback = p_pair_callback;
}
-void BroadPhaseBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
+void BroadPhase3DBasic::set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) {
unpair_userdata = p_userdata;
unpair_callback = p_unpair_callback;
}
-void BroadPhaseBasic::update() {
+void BroadPhase3DBasic::update() {
// recompute pairs
for (Map<ID, Element>::Element *I = element_map.front(); I; I = I->next()) {
@@ -210,12 +210,12 @@ void BroadPhaseBasic::update() {
}
}
-BroadPhaseSW *BroadPhaseBasic::_create() {
+BroadPhase3DSW *BroadPhase3DBasic::_create() {
- return memnew(BroadPhaseBasic);
+ return memnew(BroadPhase3DBasic);
}
-BroadPhaseBasic::BroadPhaseBasic() {
+BroadPhase3DBasic::BroadPhase3DBasic() {
current = 1;
unpair_callback = NULL;
diff --git a/servers/physics/broad_phase_basic.h b/servers/physics_3d/broad_phase_3d_basic.h
index 424889d8aa..00263dad0a 100644
--- a/servers/physics/broad_phase_basic.h
+++ b/servers/physics_3d/broad_phase_3d_basic.h
@@ -31,14 +31,14 @@
#ifndef BROAD_PHASE_BASIC_H
#define BROAD_PHASE_BASIC_H
-#include "broad_phase_sw.h"
+#include "broad_phase_3d_sw.h"
#include "core/map.h"
-class BroadPhaseBasic : public BroadPhaseSW {
+class BroadPhase3DBasic : public BroadPhase3DSW {
struct Element {
- CollisionObjectSW *owner;
+ CollisionObject3DSW *owner;
bool _static;
AABB aabb;
int subindex;
@@ -83,26 +83,26 @@ class BroadPhaseBasic : public BroadPhaseSW {
public:
// 0 is an invalid ID
- virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
+ virtual ID create(CollisionObject3DSW *p_object, int p_subindex = 0);
virtual void move(ID p_id, const AABB &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
- virtual CollisionObjectSW *get_object(ID p_id) const;
+ virtual CollisionObject3DSW *get_object(ID p_id) const;
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
virtual void update();
- static BroadPhaseSW *_create();
- BroadPhaseBasic();
+ static BroadPhase3DSW *_create();
+ BroadPhase3DBasic();
};
#endif // BROAD_PHASE_BASIC_H
diff --git a/servers/physics/broad_phase_sw.cpp b/servers/physics_3d/broad_phase_3d_sw.cpp
index a6fc253b1b..b15b08ddfe 100644
--- a/servers/physics/broad_phase_sw.cpp
+++ b/servers/physics_3d/broad_phase_3d_sw.cpp
@@ -28,9 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "broad_phase_sw.h"
+#include "broad_phase_3d_sw.h"
-BroadPhaseSW::CreateFunction BroadPhaseSW::create_func = NULL;
+BroadPhase3DSW::CreateFunction BroadPhase3DSW::create_func = NULL;
-BroadPhaseSW::~BroadPhaseSW() {
+BroadPhase3DSW::~BroadPhase3DSW() {
}
diff --git a/servers/physics/broad_phase_sw.h b/servers/physics_3d/broad_phase_3d_sw.h
index e69a2d24ed..dd6984cbca 100644
--- a/servers/physics/broad_phase_sw.h
+++ b/servers/physics_3d/broad_phase_3d_sw.h
@@ -34,40 +34,40 @@
#include "core/math/aabb.h"
#include "core/math/math_funcs.h"
-class CollisionObjectSW;
+class CollisionObject3DSW;
-class BroadPhaseSW {
+class BroadPhase3DSW {
public:
- typedef BroadPhaseSW *(*CreateFunction)();
+ typedef BroadPhase3DSW *(*CreateFunction)();
static CreateFunction create_func;
typedef uint32_t ID;
- typedef void *(*PairCallback)(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_userdata);
- typedef void (*UnpairCallback)(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_data, void *p_userdata);
+ typedef void *(*PairCallback)(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_userdata);
+ typedef void (*UnpairCallback)(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_data, void *p_userdata);
// 0 is an invalid ID
- virtual ID create(CollisionObjectSW *p_object_, int p_subindex = 0) = 0;
+ virtual ID create(CollisionObject3DSW *p_object_, int p_subindex = 0) = 0;
virtual void move(ID p_id, const AABB &p_aabb) = 0;
virtual void set_static(ID p_id, bool p_static) = 0;
virtual void remove(ID p_id) = 0;
- virtual CollisionObjectSW *get_object(ID p_id) const = 0;
+ virtual CollisionObject3DSW *get_object(ID p_id) const = 0;
virtual bool is_static(ID p_id) const = 0;
virtual int get_subindex(ID p_id) const = 0;
- virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0;
virtual void update() = 0;
- virtual ~BroadPhaseSW();
+ virtual ~BroadPhase3DSW();
};
#endif // BROAD_PHASE__SW_H
diff --git a/servers/physics/broad_phase_octree.cpp b/servers/physics_3d/broad_phase_octree.cpp
index a9aa662abf..50ac17e027 100644
--- a/servers/physics/broad_phase_octree.cpp
+++ b/servers/physics_3d/broad_phase_octree.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "broad_phase_octree.h"
-#include "collision_object_sw.h"
+#include "collision_object_3d_sw.h"
-BroadPhaseSW::ID BroadPhaseOctree::create(CollisionObjectSW *p_object, int p_subindex) {
+BroadPhase3DSW::ID BroadPhaseOctree::create(CollisionObject3DSW *p_object, int p_subindex) {
ID oid = octree.create(p_object, AABB(), p_subindex, false, 1 << p_object->get_type(), 0);
return oid;
@@ -44,7 +44,7 @@ void BroadPhaseOctree::move(ID p_id, const AABB &p_aabb) {
void BroadPhaseOctree::set_static(ID p_id, bool p_static) {
- CollisionObjectSW *it = octree.get(p_id);
+ CollisionObject3DSW *it = octree.get(p_id);
octree.set_pairable(p_id, !p_static, 1 << it->get_type(), p_static ? 0 : 0xFFFFF); //pair everything, don't care 1?
}
void BroadPhaseOctree::remove(ID p_id) {
@@ -52,9 +52,9 @@ void BroadPhaseOctree::remove(ID p_id) {
octree.erase(p_id);
}
-CollisionObjectSW *BroadPhaseOctree::get_object(ID p_id) const {
+CollisionObject3DSW *BroadPhaseOctree::get_object(ID p_id) const {
- CollisionObjectSW *it = octree.get(p_id);
+ CollisionObject3DSW *it = octree.get(p_id);
ERR_FAIL_COND_V(!it, NULL);
return it;
}
@@ -67,22 +67,22 @@ int BroadPhaseOctree::get_subindex(ID p_id) const {
return octree.get_subindex(p_id);
}
-int BroadPhaseOctree::cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhaseOctree::cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
return octree.cull_point(p_point, p_results, p_max_results, p_result_indices);
}
-int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhaseOctree::cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
return octree.cull_segment(p_from, p_to, p_results, p_max_results, p_result_indices);
}
-int BroadPhaseOctree::cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices) {
+int BroadPhaseOctree::cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices) {
return octree.cull_aabb(p_aabb, p_results, p_max_results, p_result_indices);
}
-void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, CollisionObjectSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObjectSW *p_object_B, int subindex_B) {
+void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, CollisionObject3DSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObject3DSW *p_object_B, int subindex_B) {
BroadPhaseOctree *bpo = (BroadPhaseOctree *)(self);
if (!bpo->pair_callback)
@@ -91,7 +91,7 @@ void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, Collisio
return bpo->pair_callback(p_object_A, subindex_A, p_object_B, subindex_B, bpo->pair_userdata);
}
-void BroadPhaseOctree::_unpair_callback(void *self, OctreeElementID p_A, CollisionObjectSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObjectSW *p_object_B, int subindex_B, void *pairdata) {
+void BroadPhaseOctree::_unpair_callback(void *self, OctreeElementID p_A, CollisionObject3DSW *p_object_A, int subindex_A, OctreeElementID p_B, CollisionObject3DSW *p_object_B, int subindex_B, void *pairdata) {
BroadPhaseOctree *bpo = (BroadPhaseOctree *)(self);
if (!bpo->unpair_callback)
@@ -115,7 +115,7 @@ void BroadPhaseOctree::update() {
// does.. not?
}
-BroadPhaseSW *BroadPhaseOctree::_create() {
+BroadPhase3DSW *BroadPhaseOctree::_create() {
return memnew(BroadPhaseOctree);
}
diff --git a/servers/physics/broad_phase_octree.h b/servers/physics_3d/broad_phase_octree.h
index e2a1d82b69..25cf5b32da 100644
--- a/servers/physics/broad_phase_octree.h
+++ b/servers/physics_3d/broad_phase_octree.h
@@ -31,15 +31,15 @@
#ifndef BROAD_PHASE_OCTREE_H
#define BROAD_PHASE_OCTREE_H
-#include "broad_phase_sw.h"
+#include "broad_phase_3d_sw.h"
#include "core/math/octree.h"
-class BroadPhaseOctree : public BroadPhaseSW {
+class BroadPhaseOctree : public BroadPhase3DSW {
- Octree<CollisionObjectSW, true> octree;
+ Octree<CollisionObject3DSW, true> octree;
- static void *_pair_callback(void *, OctreeElementID, CollisionObjectSW *, int, OctreeElementID, CollisionObjectSW *, int);
- static void _unpair_callback(void *, OctreeElementID, CollisionObjectSW *, int, OctreeElementID, CollisionObjectSW *, int, void *);
+ static void *_pair_callback(void *, OctreeElementID, CollisionObject3DSW *, int, OctreeElementID, CollisionObject3DSW *, int);
+ static void _unpair_callback(void *, OctreeElementID, CollisionObject3DSW *, int, OctreeElementID, CollisionObject3DSW *, int, void *);
PairCallback pair_callback;
void *pair_userdata;
@@ -48,25 +48,25 @@ class BroadPhaseOctree : public BroadPhaseSW {
public:
// 0 is an invalid ID
- virtual ID create(CollisionObjectSW *p_object, int p_subindex = 0);
+ virtual ID create(CollisionObject3DSW *p_object, int p_subindex = 0);
virtual void move(ID p_id, const AABB &p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
- virtual CollisionObjectSW *get_object(ID p_id) const;
+ virtual CollisionObject3DSW *get_object(ID p_id) const;
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_point(const Vector3 &p_point, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const AABB &p_aabb, CollisionObjectSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
virtual void update();
- static BroadPhaseSW *_create();
+ static BroadPhase3DSW *_create();
BroadPhaseOctree();
};
diff --git a/servers/physics/collision_object_sw.cpp b/servers/physics_3d/collision_object_3d_sw.cpp
index 3cabf75ab6..34e1c0f736 100644
--- a/servers/physics/collision_object_sw.cpp
+++ b/servers/physics_3d/collision_object_3d_sw.cpp
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "collision_object_sw.h"
-#include "servers/physics/physics_server_sw.h"
-#include "space_sw.h"
+#include "collision_object_3d_sw.h"
+#include "servers/physics_3d/physics_server_3d_sw.h"
+#include "space_3d_sw.h"
-void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform, bool p_disabled) {
+void CollisionObject3DSW::add_shape(Shape3DSW *p_shape, const Transform &p_transform, bool p_disabled) {
Shape s;
s.shape = p_shape;
@@ -44,13 +44,13 @@ void CollisionObjectSW::add_shape(ShapeSW *p_shape, const Transform &p_transform
p_shape->add_owner(this);
if (!pending_shape_update_list.in_list()) {
- PhysicsServerSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer3DSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes();
//_shapes_changed();
}
-void CollisionObjectSW::set_shape(int p_index, ShapeSW *p_shape) {
+void CollisionObject3DSW::set_shape(int p_index, Shape3DSW *p_shape) {
ERR_FAIL_INDEX(p_index, shapes.size());
shapes[p_index].shape->remove_owner(this);
@@ -58,32 +58,32 @@ void CollisionObjectSW::set_shape(int p_index, ShapeSW *p_shape) {
p_shape->add_owner(this);
if (!pending_shape_update_list.in_list()) {
- PhysicsServerSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer3DSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes();
//_shapes_changed();
}
-void CollisionObjectSW::set_shape_transform(int p_index, const Transform &p_transform) {
+void CollisionObject3DSW::set_shape_transform(int p_index, const Transform &p_transform) {
ERR_FAIL_INDEX(p_index, shapes.size());
shapes.write[p_index].xform = p_transform;
shapes.write[p_index].xform_inv = p_transform.affine_inverse();
if (!pending_shape_update_list.in_list()) {
- PhysicsServerSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer3DSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes();
//_shapes_changed();
}
-void CollisionObjectSW::set_shape_as_disabled(int p_idx, bool p_enable) {
+void CollisionObject3DSW::set_shape_as_disabled(int p_idx, bool p_enable) {
shapes.write[p_idx].disabled = p_enable;
if (!pending_shape_update_list.in_list()) {
- PhysicsServerSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer3DSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
}
}
-void CollisionObjectSW::remove_shape(ShapeSW *p_shape) {
+void CollisionObject3DSW::remove_shape(Shape3DSW *p_shape) {
//remove a shape, all the times it appears
for (int i = 0; i < shapes.size(); i++) {
@@ -95,7 +95,7 @@ void CollisionObjectSW::remove_shape(ShapeSW *p_shape) {
}
}
-void CollisionObjectSW::remove_shape(int p_index) {
+void CollisionObject3DSW::remove_shape(int p_index) {
//remove anything from shape to be erased to end, so subindices don't change
ERR_FAIL_INDEX(p_index, shapes.size());
@@ -111,13 +111,13 @@ void CollisionObjectSW::remove_shape(int p_index) {
shapes.remove(p_index);
if (!pending_shape_update_list.in_list()) {
- PhysicsServerSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
+ PhysicsServer3DSW::singleton->pending_shape_update_list.add(&pending_shape_update_list);
}
//_update_shapes();
//_shapes_changed();
}
-void CollisionObjectSW::_set_static(bool p_static) {
+void CollisionObject3DSW::_set_static(bool p_static) {
if (_static == p_static)
return;
_static = p_static;
@@ -132,7 +132,7 @@ void CollisionObjectSW::_set_static(bool p_static) {
}
}
-void CollisionObjectSW::_unregister_shapes() {
+void CollisionObject3DSW::_unregister_shapes() {
for (int i = 0; i < shapes.size(); i++) {
@@ -144,7 +144,7 @@ void CollisionObjectSW::_unregister_shapes() {
}
}
-void CollisionObjectSW::_update_shapes() {
+void CollisionObject3DSW::_update_shapes() {
if (!space)
return;
@@ -171,7 +171,7 @@ void CollisionObjectSW::_update_shapes() {
}
}
-void CollisionObjectSW::_update_shapes_with_motion(const Vector3 &p_motion) {
+void CollisionObject3DSW::_update_shapes_with_motion(const Vector3 &p_motion) {
if (!space)
return;
@@ -195,7 +195,7 @@ void CollisionObjectSW::_update_shapes_with_motion(const Vector3 &p_motion) {
}
}
-void CollisionObjectSW::_set_space(SpaceSW *p_space) {
+void CollisionObject3DSW::_set_space(Space3DSW *p_space) {
if (space) {
@@ -220,13 +220,13 @@ void CollisionObjectSW::_set_space(SpaceSW *p_space) {
}
}
-void CollisionObjectSW::_shape_changed() {
+void CollisionObject3DSW::_shape_changed() {
_update_shapes();
_shapes_changed();
}
-CollisionObjectSW::CollisionObjectSW(Type p_type) :
+CollisionObject3DSW::CollisionObject3DSW(Type p_type) :
pending_shape_update_list(this) {
_static = true;
diff --git a/servers/physics/collision_object_sw.h b/servers/physics_3d/collision_object_3d_sw.h
index 7c0e66ff90..582d447189 100644
--- a/servers/physics/collision_object_sw.h
+++ b/servers/physics_3d/collision_object_3d_sw.h
@@ -31,10 +31,10 @@
#ifndef COLLISION_OBJECT_SW_H
#define COLLISION_OBJECT_SW_H
-#include "broad_phase_sw.h"
+#include "broad_phase_3d_sw.h"
#include "core/self_list.h"
-#include "servers/physics_server.h"
-#include "shape_sw.h"
+#include "servers/physics_server_3d.h"
+#include "shape_3d_sw.h"
#ifdef DEBUG_ENABLED
#define MAX_OBJECT_DISTANCE 3.1622776601683791e+18
@@ -42,9 +42,9 @@
#define MAX_OBJECT_DISTANCE_X2 (MAX_OBJECT_DISTANCE * MAX_OBJECT_DISTANCE)
#endif
-class SpaceSW;
+class Space3DSW;
-class CollisionObjectSW : public ShapeOwnerSW {
+class CollisionObject3DSW : public ShapeOwner3DSW {
public:
enum Type {
TYPE_AREA,
@@ -62,22 +62,22 @@ private:
Transform xform;
Transform xform_inv;
- BroadPhaseSW::ID bpid;
+ BroadPhase3DSW::ID bpid;
AABB aabb_cache; //for rayqueries
real_t area_cache;
- ShapeSW *shape;
+ Shape3DSW *shape;
bool disabled;
Shape() { disabled = false; }
};
Vector<Shape> shapes;
- SpaceSW *space;
+ Space3DSW *space;
Transform transform;
Transform inv_transform;
bool _static;
- SelfList<CollisionObjectSW> pending_shape_update_list;
+ SelfList<CollisionObject3DSW> pending_shape_update_list;
void _update_shapes();
@@ -98,11 +98,11 @@ protected:
void _set_static(bool p_static);
virtual void _shapes_changed() = 0;
- void _set_space(SpaceSW *p_space);
+ void _set_space(Space3DSW *p_space);
bool ray_pickable;
- CollisionObjectSW(Type p_type);
+ CollisionObject3DSW(Type p_type);
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
@@ -114,15 +114,15 @@ public:
void _shape_changed();
_FORCE_INLINE_ Type get_type() const { return type; }
- void add_shape(ShapeSW *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
- void set_shape(int p_index, ShapeSW *p_shape);
+ void add_shape(Shape3DSW *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false);
+ void set_shape(int p_index, Shape3DSW *p_shape);
void set_shape_transform(int p_index, const Transform &p_transform);
_FORCE_INLINE_ int get_shape_count() const { return shapes.size(); }
_FORCE_INLINE_ bool is_shape_disabled(int p_index) const {
CRASH_BAD_INDEX(p_index, shapes.size());
return shapes[p_index].disabled;
}
- _FORCE_INLINE_ ShapeSW *get_shape(int p_index) const { return shapes[p_index].shape; }
+ _FORCE_INLINE_ Shape3DSW *get_shape(int p_index) const { return shapes[p_index].shape; }
_FORCE_INLINE_ const Transform &get_shape_transform(int p_index) const { return shapes[p_index].xform; }
_FORCE_INLINE_ const Transform &get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; }
_FORCE_INLINE_ const AABB &get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; }
@@ -130,7 +130,7 @@ public:
_FORCE_INLINE_ Transform get_transform() const { return transform; }
_FORCE_INLINE_ Transform get_inv_transform() const { return inv_transform; }
- _FORCE_INLINE_ SpaceSW *get_space() const { return space; }
+ _FORCE_INLINE_ Space3DSW *get_space() const { return space; }
_FORCE_INLINE_ void set_ray_pickable(bool p_enable) { ray_pickable = p_enable; }
_FORCE_INLINE_ bool is_ray_pickable() const { return ray_pickable; }
@@ -147,18 +147,18 @@ public:
_FORCE_INLINE_ void set_collision_mask(uint32_t p_mask) { collision_mask = p_mask; }
_FORCE_INLINE_ uint32_t get_collision_mask() const { return collision_mask; }
- _FORCE_INLINE_ bool test_collision_mask(CollisionObjectSW *p_other) const {
+ _FORCE_INLINE_ bool test_collision_mask(CollisionObject3DSW *p_other) const {
return collision_layer & p_other->collision_mask || p_other->collision_layer & collision_mask;
}
- void remove_shape(ShapeSW *p_shape);
+ void remove_shape(Shape3DSW *p_shape);
void remove_shape(int p_index);
- virtual void set_space(SpaceSW *p_space) = 0;
+ virtual void set_space(Space3DSW *p_space) = 0;
_FORCE_INLINE_ bool is_static() const { return _static; }
- virtual ~CollisionObjectSW() {}
+ virtual ~CollisionObject3DSW() {}
};
#endif // COLLISION_OBJECT_SW_H
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp
index 0e0dfd3cf2..ae205ceb48 100644
--- a/servers/physics/collision_solver_sat.cpp
+++ b/servers/physics_3d/collision_solver_3d_sat.cpp
@@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "collision_solver_sat.h"
+#include "collision_solver_3d_sat.h"
#include "core/math/geometry.h"
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.02
struct _CollectorCallback {
- CollisionSolverSW::CallbackResult callback;
+ CollisionSolver3DSW::CallbackResult callback;
void *userdata;
bool swap;
bool collided;
@@ -426,15 +426,15 @@ public:
/****** SAT TESTS *******/
-typedef void (*CollisionFunc)(const ShapeSW *, const Transform &, const ShapeSW *, const Transform &, _CollectorCallback *p_callback, real_t, real_t);
+typedef void (*CollisionFunc)(const Shape3DSW *, const Transform &, const Shape3DSW *, const Transform &, _CollectorCallback *p_callback, real_t, real_t);
template <bool withMargin>
-static void _collision_sphere_sphere(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_sphere(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
- const SphereShapeSW *sphere_B = static_cast<const SphereShapeSW *>(p_b);
+ const SphereShape3DSW *sphere_A = static_cast<const SphereShape3DSW *>(p_a);
+ const SphereShape3DSW *sphere_B = static_cast<const SphereShape3DSW *>(p_b);
- SeparatorAxisTest<SphereShapeSW, SphereShapeSW, withMargin> separator(sphere_A, p_transform_a, sphere_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<SphereShape3DSW, SphereShape3DSW, withMargin> separator(sphere_A, p_transform_a, sphere_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
// previous axis
@@ -448,12 +448,12 @@ static void _collision_sphere_sphere(const ShapeSW *p_a, const Transform &p_tran
}
template <bool withMargin>
-static void _collision_sphere_box(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_box(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
- const BoxShapeSW *box_B = static_cast<const BoxShapeSW *>(p_b);
+ const SphereShape3DSW *sphere_A = static_cast<const SphereShape3DSW *>(p_a);
+ const BoxShape3DSW *box_B = static_cast<const BoxShape3DSW *>(p_b);
- SeparatorAxisTest<SphereShapeSW, BoxShapeSW, withMargin> separator(sphere_A, p_transform_a, box_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<SphereShape3DSW, BoxShape3DSW, withMargin> separator(sphere_A, p_transform_a, box_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -498,12 +498,12 @@ static void _collision_sphere_box(const ShapeSW *p_a, const Transform &p_transfo
}
template <bool withMargin>
-static void _collision_sphere_capsule(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_capsule(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
- const CapsuleShapeSW *capsule_B = static_cast<const CapsuleShapeSW *>(p_b);
+ const SphereShape3DSW *sphere_A = static_cast<const SphereShape3DSW *>(p_a);
+ const CapsuleShape3DSW *capsule_B = static_cast<const CapsuleShape3DSW *>(p_b);
- SeparatorAxisTest<SphereShapeSW, CapsuleShapeSW, withMargin> separator(sphere_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<SphereShape3DSW, CapsuleShape3DSW, withMargin> separator(sphere_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -537,16 +537,16 @@ static void _collision_sphere_capsule(const ShapeSW *p_a, const Transform &p_tra
}
template <bool withMargin>
-static void _collision_sphere_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_cylinder(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_sphere_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_convex_polygon(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
- const ConvexPolygonShapeSW *convex_polygon_B = static_cast<const ConvexPolygonShapeSW *>(p_b);
+ const SphereShape3DSW *sphere_A = static_cast<const SphereShape3DSW *>(p_a);
+ const ConvexPolygonShape3DSW *convex_polygon_B = static_cast<const ConvexPolygonShape3DSW *>(p_b);
- SeparatorAxisTest<SphereShapeSW, ConvexPolygonShapeSW, withMargin> separator(sphere_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<SphereShape3DSW, ConvexPolygonShape3DSW, withMargin> separator(sphere_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -601,12 +601,12 @@ static void _collision_sphere_convex_polygon(const ShapeSW *p_a, const Transform
}
template <bool withMargin>
-static void _collision_sphere_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_sphere_face(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
- const FaceShapeSW *face_B = static_cast<const FaceShapeSW *>(p_b);
+ const SphereShape3DSW *sphere_A = static_cast<const SphereShape3DSW *>(p_a);
+ const FaceShape3DSW *face_B = static_cast<const FaceShape3DSW *>(p_b);
- SeparatorAxisTest<SphereShapeSW, FaceShapeSW, withMargin> separator(sphere_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<SphereShape3DSW, FaceShape3DSW, withMargin> separator(sphere_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
Vector3 vertex[3] = {
p_transform_b.xform(face_B->vertex[0]),
@@ -639,12 +639,12 @@ static void _collision_sphere_face(const ShapeSW *p_a, const Transform &p_transf
}
template <bool withMargin>
-static void _collision_box_box(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_box_box(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const BoxShapeSW *box_A = static_cast<const BoxShapeSW *>(p_a);
- const BoxShapeSW *box_B = static_cast<const BoxShapeSW *>(p_b);
+ const BoxShape3DSW *box_A = static_cast<const BoxShape3DSW *>(p_a);
+ const BoxShape3DSW *box_B = static_cast<const BoxShape3DSW *>(p_b);
- SeparatorAxisTest<BoxShapeSW, BoxShapeSW, withMargin> separator(box_A, p_transform_a, box_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<BoxShape3DSW, BoxShape3DSW, withMargin> separator(box_A, p_transform_a, box_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -737,12 +737,12 @@ static void _collision_box_box(const ShapeSW *p_a, const Transform &p_transform_
}
template <bool withMargin>
-static void _collision_box_capsule(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_box_capsule(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const BoxShapeSW *box_A = static_cast<const BoxShapeSW *>(p_a);
- const CapsuleShapeSW *capsule_B = static_cast<const CapsuleShapeSW *>(p_b);
+ const BoxShape3DSW *box_A = static_cast<const BoxShape3DSW *>(p_a);
+ const CapsuleShape3DSW *capsule_B = static_cast<const CapsuleShape3DSW *>(p_b);
- SeparatorAxisTest<BoxShapeSW, CapsuleShapeSW, withMargin> separator(box_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<BoxShape3DSW, CapsuleShape3DSW, withMargin> separator(box_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -832,16 +832,16 @@ static void _collision_box_capsule(const ShapeSW *p_a, const Transform &p_transf
}
template <bool withMargin>
-static void _collision_box_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_box_cylinder(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_box_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_box_convex_polygon(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const BoxShapeSW *box_A = static_cast<const BoxShapeSW *>(p_a);
- const ConvexPolygonShapeSW *convex_polygon_B = static_cast<const ConvexPolygonShapeSW *>(p_b);
+ const BoxShape3DSW *box_A = static_cast<const BoxShape3DSW *>(p_a);
+ const ConvexPolygonShape3DSW *convex_polygon_B = static_cast<const ConvexPolygonShape3DSW *>(p_b);
- SeparatorAxisTest<BoxShapeSW, ConvexPolygonShapeSW, withMargin> separator(box_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<BoxShape3DSW, ConvexPolygonShape3DSW, withMargin> separator(box_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -953,12 +953,12 @@ static void _collision_box_convex_polygon(const ShapeSW *p_a, const Transform &p
}
template <bool withMargin>
-static void _collision_box_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_box_face(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const BoxShapeSW *box_A = static_cast<const BoxShapeSW *>(p_a);
- const FaceShapeSW *face_B = static_cast<const FaceShapeSW *>(p_b);
+ const BoxShape3DSW *box_A = static_cast<const BoxShape3DSW *>(p_a);
+ const FaceShape3DSW *face_B = static_cast<const FaceShape3DSW *>(p_b);
- SeparatorAxisTest<BoxShapeSW, FaceShapeSW, withMargin> separator(box_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<BoxShape3DSW, FaceShape3DSW, withMargin> separator(box_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
Vector3 vertex[3] = {
p_transform_b.xform(face_B->vertex[0]),
@@ -1057,12 +1057,12 @@ static void _collision_box_face(const ShapeSW *p_a, const Transform &p_transform
}
template <bool withMargin>
-static void _collision_capsule_capsule(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_capsule_capsule(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const CapsuleShapeSW *capsule_A = static_cast<const CapsuleShapeSW *>(p_a);
- const CapsuleShapeSW *capsule_B = static_cast<const CapsuleShapeSW *>(p_b);
+ const CapsuleShape3DSW *capsule_A = static_cast<const CapsuleShape3DSW *>(p_a);
+ const CapsuleShape3DSW *capsule_B = static_cast<const CapsuleShape3DSW *>(p_b);
- SeparatorAxisTest<CapsuleShapeSW, CapsuleShapeSW, withMargin> separator(capsule_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<CapsuleShape3DSW, CapsuleShape3DSW, withMargin> separator(capsule_A, p_transform_a, capsule_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -1112,16 +1112,16 @@ static void _collision_capsule_capsule(const ShapeSW *p_a, const Transform &p_tr
}
template <bool withMargin>
-static void _collision_capsule_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_capsule_cylinder(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_capsule_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_capsule_convex_polygon(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const CapsuleShapeSW *capsule_A = static_cast<const CapsuleShapeSW *>(p_a);
- const ConvexPolygonShapeSW *convex_polygon_B = static_cast<const ConvexPolygonShapeSW *>(p_b);
+ const CapsuleShape3DSW *capsule_A = static_cast<const CapsuleShape3DSW *>(p_a);
+ const ConvexPolygonShape3DSW *convex_polygon_B = static_cast<const ConvexPolygonShape3DSW *>(p_b);
- SeparatorAxisTest<CapsuleShapeSW, ConvexPolygonShapeSW, withMargin> separator(capsule_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<CapsuleShape3DSW, ConvexPolygonShape3DSW, withMargin> separator(capsule_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -1181,12 +1181,12 @@ static void _collision_capsule_convex_polygon(const ShapeSW *p_a, const Transfor
}
template <bool withMargin>
-static void _collision_capsule_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_capsule_face(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const CapsuleShapeSW *capsule_A = static_cast<const CapsuleShapeSW *>(p_a);
- const FaceShapeSW *face_B = static_cast<const FaceShapeSW *>(p_b);
+ const CapsuleShape3DSW *capsule_A = static_cast<const CapsuleShape3DSW *>(p_a);
+ const FaceShape3DSW *face_B = static_cast<const FaceShape3DSW *>(p_b);
- SeparatorAxisTest<CapsuleShapeSW, FaceShapeSW, withMargin> separator(capsule_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<CapsuleShape3DSW, FaceShape3DSW, withMargin> separator(capsule_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
Vector3 vertex[3] = {
p_transform_b.xform(face_B->vertex[0]),
@@ -1236,24 +1236,24 @@ static void _collision_capsule_face(const ShapeSW *p_a, const Transform &p_trans
}
template <bool withMargin>
-static void _collision_cylinder_cylinder(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_cylinder_cylinder(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_cylinder_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_cylinder_convex_polygon(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_cylinder_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_cylinder_face(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
}
template <bool withMargin>
-static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_convex_polygon_convex_polygon(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const ConvexPolygonShapeSW *convex_polygon_A = static_cast<const ConvexPolygonShapeSW *>(p_a);
- const ConvexPolygonShapeSW *convex_polygon_B = static_cast<const ConvexPolygonShapeSW *>(p_b);
+ const ConvexPolygonShape3DSW *convex_polygon_A = static_cast<const ConvexPolygonShape3DSW *>(p_a);
+ const ConvexPolygonShape3DSW *convex_polygon_B = static_cast<const ConvexPolygonShape3DSW *>(p_b);
- SeparatorAxisTest<ConvexPolygonShapeSW, ConvexPolygonShapeSW, withMargin> separator(convex_polygon_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<ConvexPolygonShape3DSW, ConvexPolygonShape3DSW, withMargin> separator(convex_polygon_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
if (!separator.test_previous_axis())
return;
@@ -1362,12 +1362,12 @@ static void _collision_convex_polygon_convex_polygon(const ShapeSW *p_a, const T
}
template <bool withMargin>
-static void _collision_convex_polygon_face(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
+static void _collision_convex_polygon_face(const Shape3DSW *p_a, const Transform &p_transform_a, const Shape3DSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {
- const ConvexPolygonShapeSW *convex_polygon_A = static_cast<const ConvexPolygonShapeSW *>(p_a);
- const FaceShapeSW *face_B = static_cast<const FaceShapeSW *>(p_b);
+ const ConvexPolygonShape3DSW *convex_polygon_A = static_cast<const ConvexPolygonShape3DSW *>(p_a);
+ const FaceShape3DSW *face_B = static_cast<const FaceShape3DSW *>(p_b);
- SeparatorAxisTest<ConvexPolygonShapeSW, FaceShapeSW, withMargin> separator(convex_polygon_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
+ SeparatorAxisTest<ConvexPolygonShape3DSW, FaceShape3DSW, withMargin> separator(convex_polygon_A, p_transform_a, face_B, p_transform_b, p_collector, p_margin_a, p_margin_b);
const Geometry::MeshData &mesh = convex_polygon_A->get_mesh();
@@ -1462,18 +1462,18 @@ static void _collision_convex_polygon_face(const ShapeSW *p_a, const Transform &
separator.generate_contacts();
}
-bool sat_calculate_penetration(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CollisionSolverSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap, Vector3 *r_prev_axis, real_t p_margin_a, real_t p_margin_b) {
+bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap, Vector3 *r_prev_axis, real_t p_margin_a, real_t p_margin_b) {
- PhysicsServer::ShapeType type_A = p_shape_A->get_type();
+ PhysicsServer3D::ShapeType type_A = p_shape_A->get_type();
- ERR_FAIL_COND_V(type_A == PhysicsServer::SHAPE_PLANE, false);
- ERR_FAIL_COND_V(type_A == PhysicsServer::SHAPE_RAY, false);
+ ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_PLANE, false);
+ ERR_FAIL_COND_V(type_A == PhysicsServer3D::SHAPE_RAY, false);
ERR_FAIL_COND_V(p_shape_A->is_concave(), false);
- PhysicsServer::ShapeType type_B = p_shape_B->get_type();
+ PhysicsServer3D::ShapeType type_B = p_shape_B->get_type();
- ERR_FAIL_COND_V(type_B == PhysicsServer::SHAPE_PLANE, false);
- ERR_FAIL_COND_V(type_B == PhysicsServer::SHAPE_RAY, false);
+ ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_PLANE, false);
+ ERR_FAIL_COND_V(type_B == PhysicsServer3D::SHAPE_RAY, false);
ERR_FAIL_COND_V(p_shape_B->is_concave(), false);
static const CollisionFunc collision_table[6][6] = {
@@ -1561,8 +1561,8 @@ bool sat_calculate_penetration(const ShapeSW *p_shape_A, const Transform &p_tran
callback.collided = false;
callback.prev_axis = r_prev_axis;
- const ShapeSW *A = p_shape_A;
- const ShapeSW *B = p_shape_B;
+ const Shape3DSW *A = p_shape_A;
+ const Shape3DSW *B = p_shape_B;
const Transform *transform_A = &p_transform_A;
const Transform *transform_B = &p_transform_B;
real_t margin_A = p_margin_a;
diff --git a/servers/physics/collision_solver_sat.h b/servers/physics_3d/collision_solver_3d_sat.h
index 31895231f0..ed564395ab 100644
--- a/servers/physics/collision_solver_sat.h
+++ b/servers/physics_3d/collision_solver_3d_sat.h
@@ -31,8 +31,8 @@
#ifndef COLLISION_SOLVER_SAT_H
#define COLLISION_SOLVER_SAT_H
-#include "collision_solver_sw.h"
+#include "collision_solver_3d_sw.h"
-bool sat_calculate_penetration(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CollisionSolverSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector3 *r_prev_axis = NULL, real_t p_margin_a = 0, real_t p_margin_b = 0);
+bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector3 *r_prev_axis = NULL, real_t p_margin_a = 0, real_t p_margin_b = 0);
#endif // COLLISION_SOLVER_SAT_H
diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics_3d/collision_solver_3d_sw.cpp
index ce24ba6bca..34ea836cd0 100644
--- a/servers/physics/collision_solver_sw.cpp
+++ b/servers/physics_3d/collision_solver_3d_sw.cpp
@@ -28,18 +28,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "collision_solver_sw.h"
-#include "collision_solver_sat.h"
+#include "collision_solver_3d_sw.h"
+#include "collision_solver_3d_sat.h"
#include "gjk_epa.h"
#define collision_solver sat_calculate_penetration
//#define collision_solver gjk_epa_calculate_penetration
-bool CollisionSolverSW::solve_static_plane(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
+bool CollisionSolver3DSW::solve_static_plane(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
- const PlaneShapeSW *plane = static_cast<const PlaneShapeSW *>(p_shape_A);
- if (p_shape_B->get_type() == PhysicsServer::SHAPE_PLANE)
+ const PlaneShape3DSW *plane = static_cast<const PlaneShape3DSW *>(p_shape_A);
+ if (p_shape_B->get_type() == PhysicsServer3D::SHAPE_PLANE)
return false;
Plane p = p_transform_A.xform(plane->get_plane());
@@ -71,9 +71,9 @@ bool CollisionSolverSW::solve_static_plane(const ShapeSW *p_shape_A, const Trans
return found;
}
-bool CollisionSolverSW::solve_ray(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
+bool CollisionSolver3DSW::solve_ray(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
- const RayShapeSW *ray = static_cast<const RayShapeSW *>(p_shape_A);
+ const RayShape3DSW *ray = static_cast<const RayShape3DSW *>(p_shape_A);
Vector3 from = p_transform_A.origin;
Vector3 to = from + p_transform_A.basis.get_axis(2) * ray->get_length();
@@ -106,9 +106,9 @@ bool CollisionSolverSW::solve_ray(const ShapeSW *p_shape_A, const Transform &p_t
struct _ConcaveCollisionInfo {
const Transform *transform_A;
- const ShapeSW *shape_A;
+ const Shape3DSW *shape_A;
const Transform *transform_B;
- CollisionSolverSW::CallbackResult result_callback;
+ CollisionSolver3DSW::CallbackResult result_callback;
void *userdata;
bool swap_result;
bool collided;
@@ -120,7 +120,7 @@ struct _ConcaveCollisionInfo {
Vector3 close_A, close_B;
};
-void CollisionSolverSW::concave_callback(void *p_userdata, ShapeSW *p_convex) {
+void CollisionSolver3DSW::concave_callback(void *p_userdata, Shape3DSW *p_convex) {
_ConcaveCollisionInfo &cinfo = *(_ConcaveCollisionInfo *)(p_userdata);
cinfo.aabb_tests++;
@@ -133,9 +133,9 @@ void CollisionSolverSW::concave_callback(void *p_userdata, ShapeSW *p_convex) {
cinfo.collisions++;
}
-bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A, real_t p_margin_B) {
+bool CollisionSolver3DSW::solve_concave(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A, real_t p_margin_B) {
- const ConcaveShapeSW *concave_B = static_cast<const ConcaveShapeSW *>(p_shape_B);
+ const ConcaveShape3DSW *concave_B = static_cast<const ConcaveShape3DSW *>(p_shape_B);
_ConcaveCollisionInfo cinfo;
cinfo.transform_A = &p_transform_A;
@@ -179,10 +179,10 @@ bool CollisionSolverSW::solve_concave(const ShapeSW *p_shape_A, const Transform
return cinfo.collided;
}
-bool CollisionSolverSW::solve_static(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis, real_t p_margin_A, real_t p_margin_B) {
+bool CollisionSolver3DSW::solve_static(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis, real_t p_margin_A, real_t p_margin_B) {
- PhysicsServer::ShapeType type_A = p_shape_A->get_type();
- PhysicsServer::ShapeType type_B = p_shape_B->get_type();
+ PhysicsServer3D::ShapeType type_A = p_shape_A->get_type();
+ PhysicsServer3D::ShapeType type_B = p_shape_B->get_type();
bool concave_A = p_shape_A->is_concave();
bool concave_B = p_shape_B->is_concave();
@@ -194,11 +194,11 @@ bool CollisionSolverSW::solve_static(const ShapeSW *p_shape_A, const Transform &
swap = true;
}
- if (type_A == PhysicsServer::SHAPE_PLANE) {
+ if (type_A == PhysicsServer3D::SHAPE_PLANE) {
- if (type_B == PhysicsServer::SHAPE_PLANE)
+ if (type_B == PhysicsServer3D::SHAPE_PLANE)
return false;
- if (type_B == PhysicsServer::SHAPE_RAY) {
+ if (type_B == PhysicsServer3D::SHAPE_RAY) {
return false;
}
@@ -208,9 +208,9 @@ bool CollisionSolverSW::solve_static(const ShapeSW *p_shape_A, const Transform &
return solve_static_plane(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
}
- } else if (type_A == PhysicsServer::SHAPE_RAY) {
+ } else if (type_A == PhysicsServer3D::SHAPE_RAY) {
- if (type_B == PhysicsServer::SHAPE_RAY)
+ if (type_B == PhysicsServer3D::SHAPE_RAY)
return false;
if (swap) {
@@ -235,7 +235,7 @@ bool CollisionSolverSW::solve_static(const ShapeSW *p_shape_A, const Transform &
}
}
-void CollisionSolverSW::concave_distance_callback(void *p_userdata, ShapeSW *p_convex) {
+void CollisionSolver3DSW::concave_distance_callback(void *p_userdata, Shape3DSW *p_convex) {
_ConcaveCollisionInfo &cinfo = *(_ConcaveCollisionInfo *)(p_userdata);
cinfo.aabb_tests++;
@@ -257,10 +257,10 @@ void CollisionSolverSW::concave_distance_callback(void *p_userdata, ShapeSW *p_c
cinfo.collisions++;
}
-bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B) {
+bool CollisionSolver3DSW::solve_distance_plane(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B) {
- const PlaneShapeSW *plane = static_cast<const PlaneShapeSW *>(p_shape_A);
- if (p_shape_B->get_type() == PhysicsServer::SHAPE_PLANE)
+ const PlaneShape3DSW *plane = static_cast<const PlaneShape3DSW *>(p_shape_A);
+ if (p_shape_B->get_type() == PhysicsServer3D::SHAPE_PLANE)
return false;
Plane p = p_transform_A.xform(plane->get_plane());
@@ -292,12 +292,12 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A, const Tra
return collided;
}
-bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis) {
+bool CollisionSolver3DSW::solve_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis) {
if (p_shape_A->is_concave())
return false;
- if (p_shape_B->get_type() == PhysicsServer::SHAPE_PLANE) {
+ if (p_shape_B->get_type() == PhysicsServer3D::SHAPE_PLANE) {
Vector3 a, b;
bool col = solve_distance_plane(p_shape_B, p_transform_B, p_shape_A, p_transform_A, a, b);
@@ -310,7 +310,7 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A, const Transform
if (p_shape_A->is_concave())
return false;
- const ConcaveShapeSW *concave_B = static_cast<const ConcaveShapeSW *>(p_shape_B);
+ const ConcaveShape3DSW *concave_B = static_cast<const ConcaveShape3DSW *>(p_shape_B);
_ConcaveCollisionInfo cinfo;
cinfo.transform_A = &p_transform_A;
diff --git a/servers/physics/collision_solver_sw.h b/servers/physics_3d/collision_solver_3d_sw.h
index d4dc1ac2a2..5f60d94e7f 100644
--- a/servers/physics/collision_solver_sw.h
+++ b/servers/physics_3d/collision_solver_3d_sw.h
@@ -31,23 +31,23 @@
#ifndef COLLISION_SOLVER_SW_H
#define COLLISION_SOLVER_SW_H
-#include "shape_sw.h"
+#include "shape_3d_sw.h"
-class CollisionSolverSW {
+class CollisionSolver3DSW {
public:
typedef void (*CallbackResult)(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata);
private:
- static void concave_callback(void *p_userdata, ShapeSW *p_convex);
- static bool solve_static_plane(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
- static bool solve_ray(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
- static bool solve_concave(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static void concave_distance_callback(void *p_userdata, ShapeSW *p_convex);
- static bool solve_distance_plane(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B);
+ static void concave_callback(void *p_userdata, Shape3DSW *p_convex);
+ static bool solve_static_plane(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
+ static bool solve_ray(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
+ static bool solve_concave(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static void concave_distance_callback(void *p_userdata, Shape3DSW *p_convex);
+ static bool solve_distance_plane(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B);
public:
- static bool solve_static(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static bool solve_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = NULL);
+ static bool solve_static(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = NULL);
};
#endif // COLLISION_SOLVER__SW_H
diff --git a/servers/physics/constraint_sw.h b/servers/physics_3d/constraint_3d_sw.h
index 22f31b411b..23bc5d3b32 100644
--- a/servers/physics/constraint_sw.h
+++ b/servers/physics_3d/constraint_3d_sw.h
@@ -31,22 +31,22 @@
#ifndef CONSTRAINT_SW_H
#define CONSTRAINT_SW_H
-#include "body_sw.h"
+#include "body_3d_sw.h"
-class ConstraintSW {
+class Constraint3DSW {
- BodySW **_body_ptr;
+ Body3DSW **_body_ptr;
int _body_count;
uint64_t island_step;
- ConstraintSW *island_next;
- ConstraintSW *island_list_next;
+ Constraint3DSW *island_next;
+ Constraint3DSW *island_list_next;
int priority;
bool disabled_collisions_between_bodies;
RID self;
protected:
- ConstraintSW(BodySW **p_body_ptr = NULL, int p_body_count = 0) {
+ Constraint3DSW(Body3DSW **p_body_ptr = NULL, int p_body_count = 0) {
_body_ptr = p_body_ptr;
_body_count = p_body_count;
island_step = 0;
@@ -61,13 +61,13 @@ public:
_FORCE_INLINE_ uint64_t get_island_step() const { return island_step; }
_FORCE_INLINE_ void set_island_step(uint64_t p_step) { island_step = p_step; }
- _FORCE_INLINE_ ConstraintSW *get_island_next() const { return island_next; }
- _FORCE_INLINE_ void set_island_next(ConstraintSW *p_next) { island_next = p_next; }
+ _FORCE_INLINE_ Constraint3DSW *get_island_next() const { return island_next; }
+ _FORCE_INLINE_ void set_island_next(Constraint3DSW *p_next) { island_next = p_next; }
- _FORCE_INLINE_ ConstraintSW *get_island_list_next() const { return island_list_next; }
- _FORCE_INLINE_ void set_island_list_next(ConstraintSW *p_next) { island_list_next = p_next; }
+ _FORCE_INLINE_ Constraint3DSW *get_island_list_next() const { return island_list_next; }
+ _FORCE_INLINE_ void set_island_list_next(Constraint3DSW *p_next) { island_list_next = p_next; }
- _FORCE_INLINE_ BodySW **get_body_ptr() const { return _body_ptr; }
+ _FORCE_INLINE_ Body3DSW **get_body_ptr() const { return _body_ptr; }
_FORCE_INLINE_ int get_body_count() const { return _body_count; }
_FORCE_INLINE_ void set_priority(int p_priority) { priority = p_priority; }
@@ -79,7 +79,7 @@ public:
virtual bool setup(real_t p_step) = 0;
virtual void solve(real_t p_step) = 0;
- virtual ~ConstraintSW() {}
+ virtual ~Constraint3DSW() {}
};
#endif // CONSTRAINT__SW_H
diff --git a/servers/physics/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp
index abf0c0dc15..bd0d429e7b 100644
--- a/servers/physics/gjk_epa.cpp
+++ b/servers/physics_3d/gjk_epa.cpp
@@ -103,7 +103,7 @@ typedef unsigned char U1;
// MinkowskiDiff
struct MinkowskiDiff {
- const ShapeSW* m_shapes[2];
+ const Shape3DSW* m_shapes[2];
Transform transform_A;
Transform transform_B;
@@ -783,8 +783,8 @@ struct GJK
};
//
- static void Initialize( const ShapeSW* shape0,const Transform& wtrs0,
- const ShapeSW* shape1,const Transform& wtrs1,
+ static void Initialize( const Shape3DSW* shape0,const Transform& wtrs0,
+ const Shape3DSW* shape1,const Transform& wtrs1,
sResults& results,
tShape& shape,
bool withmargins)
@@ -810,9 +810,9 @@ struct GJK
//
//
-bool Distance( const ShapeSW* shape0,
+bool Distance( const Shape3DSW* shape0,
const Transform& wtrs0,
- const ShapeSW* shape1,
+ const Shape3DSW* shape1,
const Transform& wtrs1,
const Vector3& guess,
sResults& results)
@@ -848,9 +848,9 @@ bool Distance( const ShapeSW* shape0,
}
//
-bool Penetration( const ShapeSW* shape0,
+bool Penetration( const Shape3DSW* shape0,
const Transform& wtrs0,
- const ShapeSW* shape1,
+ const Shape3DSW* shape1,
const Transform& wtrs1,
const Vector3& guess,
sResults& results
@@ -914,7 +914,7 @@ bool Penetration( const ShapeSW* shape0,
/* clang-format on */
-bool gjk_epa_calculate_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B) {
+bool gjk_epa_calculate_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B) {
GjkEpa2::sResults res;
@@ -928,7 +928,7 @@ bool gjk_epa_calculate_distance(const ShapeSW *p_shape_A, const Transform &p_tra
return false;
}
-bool gjk_epa_calculate_penetration(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CollisionSolverSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap) {
+bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap) {
GjkEpa2::sResults res;
diff --git a/servers/physics/gjk_epa.h b/servers/physics_3d/gjk_epa.h
index 38c616cde0..dec0f269e1 100644
--- a/servers/physics/gjk_epa.h
+++ b/servers/physics_3d/gjk_epa.h
@@ -31,10 +31,10 @@
#ifndef GJK_EPA_H
#define GJK_EPA_H
-#include "collision_solver_sw.h"
-#include "shape_sw.h"
+#include "collision_solver_3d_sw.h"
+#include "shape_3d_sw.h"
-bool gjk_epa_calculate_penetration(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, CollisionSolverSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false);
-bool gjk_epa_calculate_distance(const ShapeSW *p_shape_A, const Transform &p_transform_A, const ShapeSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B);
+bool gjk_epa_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false);
+bool gjk_epa_calculate_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_result_A, Vector3 &r_result_B);
#endif
diff --git a/servers/physics/joints/SCsub b/servers/physics_3d/joints/SCsub
index d730144861..d730144861 100644
--- a/servers/physics/joints/SCsub
+++ b/servers/physics_3d/joints/SCsub
diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp
index 58f66f7ea2..782e8322fe 100644
--- a/servers/physics/joints/cone_twist_joint_sw.cpp
+++ b/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp
@@ -49,7 +49,7 @@ subject to the following restrictions:
Written by: Marcus Hennix
*/
-#include "cone_twist_joint_sw.h"
+#include "cone_twist_joint_3d_sw.h"
static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
@@ -85,8 +85,8 @@ static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) {
return (y < 0.0f) ? -angle : angle;
}
-ConeTwistJointSW::ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rbAFrame, const Transform &rbBFrame) :
- JointSW(_arr, 2) {
+ConeTwistJoint3DSW::ConeTwistJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &rbAFrame, const Transform &rbBFrame) :
+ Joint3DSW(_arr, 2) {
A = rbA;
B = rbB;
@@ -110,7 +110,7 @@ ConeTwistJointSW::ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rb
m_appliedImpulse = 0;
}
-bool ConeTwistJointSW::setup(real_t p_timestep) {
+bool ConeTwistJoint3DSW::setup(real_t p_timestep) {
m_appliedImpulse = real_t(0.);
//set bias, sign, clear accumulator
@@ -136,7 +136,7 @@ bool ConeTwistJointSW::setup(real_t p_timestep) {
plane_space(normal[0], normal[1], normal[2]);
for (int i = 0; i < 3; i++) {
- memnew_placement(&m_jac[i], JacobianEntrySW(
+ memnew_placement(&m_jac[i], JacobianEntry3DSW(
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
@@ -237,7 +237,7 @@ bool ConeTwistJointSW::setup(real_t p_timestep) {
return true;
}
-void ConeTwistJointSW::solve(real_t p_timestep) {
+void ConeTwistJoint3DSW::solve(real_t p_timestep) {
Vector3 pivotAInW = A->get_transform().xform(m_rbAFrame.origin);
Vector3 pivotBInW = B->get_transform().xform(m_rbBFrame.origin);
@@ -308,58 +308,58 @@ void ConeTwistJointSW::solve(real_t p_timestep) {
}
}
-void ConeTwistJointSW::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) {
+void ConeTwistJoint3DSW::set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN: {
m_swingSpan1 = p_value;
m_swingSpan2 = p_value;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN: {
m_twistSpan = p_value;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_BIAS: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: {
m_biasFactor = p_value;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: {
m_limitSoftness = p_value;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_RELAXATION: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: {
m_relaxationFactor = p_value;
} break;
- case PhysicsServer::CONE_TWIST_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::CONE_TWIST_MAX: break; // Can't happen, but silences warning
}
}
-real_t ConeTwistJointSW::get_param(PhysicsServer::ConeTwistJointParam p_param) const {
+real_t ConeTwistJoint3DSW::get_param(PhysicsServer3D::ConeTwistJointParam p_param) const {
switch (p_param) {
- case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_SWING_SPAN: {
return m_swingSpan1;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_TWIST_SPAN: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_TWIST_SPAN: {
return m_twistSpan;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_BIAS: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_BIAS: {
return m_biasFactor;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_SOFTNESS: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_SOFTNESS: {
return m_limitSoftness;
} break;
- case PhysicsServer::CONE_TWIST_JOINT_RELAXATION: {
+ case PhysicsServer3D::CONE_TWIST_JOINT_RELAXATION: {
return m_relaxationFactor;
} break;
- case PhysicsServer::CONE_TWIST_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::CONE_TWIST_MAX: break; // Can't happen, but silences warning
}
return 0;
diff --git a/servers/physics/joints/cone_twist_joint_sw.h b/servers/physics_3d/joints/cone_twist_joint_3d_sw.h
index 857aaa0d86..5521419e89 100644
--- a/servers/physics/joints/cone_twist_joint_sw.h
+++ b/servers/physics_3d/joints/cone_twist_joint_3d_sw.h
@@ -52,25 +52,25 @@ Written by: Marcus Hennix
#ifndef CONE_TWIST_JOINT_SW_H
#define CONE_TWIST_JOINT_SW_H
-#include "servers/physics/joints/jacobian_entry_sw.h"
-#include "servers/physics/joints_sw.h"
+#include "servers/physics_3d/joints/jacobian_entry_3d_sw.h"
+#include "servers/physics_3d/joints_3d_sw.h"
///ConeTwistJointSW can be used to simulate ragdoll joints (upper arm, leg etc)
-class ConeTwistJointSW : public JointSW {
+class ConeTwistJoint3DSW : public Joint3DSW {
#ifdef IN_PARALLELL_SOLVER
public:
#endif
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
- JacobianEntrySW m_jac[3]; //3 orthogonal linear constraints
+ JacobianEntry3DSW m_jac[3]; //3 orthogonal linear constraints
real_t m_appliedImpulse;
Transform m_rbAFrame;
@@ -102,12 +102,12 @@ public:
bool m_solveSwingLimit;
public:
- virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; }
+ virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_CONE_TWIST; }
virtual bool setup(real_t p_timestep);
virtual void solve(real_t p_timestep);
- ConeTwistJointSW(BodySW *rbA, BodySW *rbB, const Transform &rbAFrame, const Transform &rbBFrame);
+ ConeTwistJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &rbAFrame, const Transform &rbBFrame);
void setAngularOnly(bool angularOnly) {
m_angularOnly = angularOnly;
@@ -135,8 +135,8 @@ public:
return m_twistLimitSign;
}
- void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value);
- real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const;
+ void set_param(PhysicsServer3D::ConeTwistJointParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer3D::ConeTwistJointParam p_param) const;
};
#endif // CONE_TWIST_JOINT_SW_H
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp
index 8f0ccab7f7..d28fafdb00 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.cpp
+++ b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.cpp
@@ -54,13 +54,13 @@ email: projectileman@yahoo.com
http://gimpact.sf.net
*/
-#include "generic_6dof_joint_sw.h"
+#include "generic_6dof_joint_3d_sw.h"
#define GENERIC_D6_DISABLE_WARMSTARTING 1
//////////////////////////// G6DOFRotationalLimitMotorSW ////////////////////////////////////
-int G6DOFRotationalLimitMotorSW::testLimitValue(real_t test_value) {
+int G6DOFRotationalLimitMotor3DSW::testLimitValue(real_t test_value) {
if (m_loLimit > m_hiLimit) {
m_currentLimit = 0; //Free from violation
return 0;
@@ -80,9 +80,9 @@ int G6DOFRotationalLimitMotorSW::testLimitValue(real_t test_value) {
return 0;
}
-real_t G6DOFRotationalLimitMotorSW::solveAngularLimits(
+real_t G6DOFRotationalLimitMotor3DSW::solveAngularLimits(
real_t timeStep, Vector3 &axis, real_t jacDiagABInv,
- BodySW *body0, BodySW *body1) {
+ Body3DSW *body0, Body3DSW *body1) {
if (!needApplyTorques()) return 0.0f;
real_t target_velocity = m_targetVelocity;
@@ -145,11 +145,11 @@ real_t G6DOFRotationalLimitMotorSW::solveAngularLimits(
//////////////////////////// End G6DOFRotationalLimitMotorSW ////////////////////////////////////
//////////////////////////// G6DOFTranslationalLimitMotorSW ////////////////////////////////////
-real_t G6DOFTranslationalLimitMotorSW::solveLinearAxis(
+real_t G6DOFTranslationalLimitMotor3DSW::solveLinearAxis(
real_t timeStep,
real_t jacDiagABInv,
- BodySW *body1, const Vector3 &pointInA,
- BodySW *body2, const Vector3 &pointInB,
+ Body3DSW *body1, const Vector3 &pointInA,
+ Body3DSW *body2, const Vector3 &pointInB,
int limit_index,
const Vector3 &axis_normal_on_a,
const Vector3 &anchorPos) {
@@ -209,8 +209,8 @@ real_t G6DOFTranslationalLimitMotorSW::solveLinearAxis(
//////////////////////////// G6DOFTranslationalLimitMotorSW ////////////////////////////////////
-Generic6DOFJointSW::Generic6DOFJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
- JointSW(_arr, 2),
+Generic6DOFJoint3DSW::Generic6DOFJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
+ Joint3DSW(_arr, 2),
m_frameInA(frameInA),
m_frameInB(frameInB),
m_useLinearReferenceFrameA(useLinearReferenceFrameA) {
@@ -220,7 +220,7 @@ Generic6DOFJointSW::Generic6DOFJointSW(BodySW *rbA, BodySW *rbB, const Transform
B->add_constraint(this, 1);
}
-void Generic6DOFJointSW::calculateAngleInfo() {
+void Generic6DOFJoint3DSW::calculateAngleInfo() {
Basis relative_frame = m_calculatedTransformB.basis.inverse() * m_calculatedTransformA.basis;
m_calculatedAxisAngleDiff = relative_frame.get_euler_xyz();
@@ -261,17 +261,17 @@ void Generic6DOFJointSW::calculateAngleInfo() {
*/
}
-void Generic6DOFJointSW::calculateTransforms() {
+void Generic6DOFJoint3DSW::calculateTransforms() {
m_calculatedTransformA = A->get_transform() * m_frameInA;
m_calculatedTransformB = B->get_transform() * m_frameInB;
calculateAngleInfo();
}
-void Generic6DOFJointSW::buildLinearJacobian(
- JacobianEntrySW &jacLinear, const Vector3 &normalWorld,
+void Generic6DOFJoint3DSW::buildLinearJacobian(
+ JacobianEntry3DSW &jacLinear, const Vector3 &normalWorld,
const Vector3 &pivotAInW, const Vector3 &pivotBInW) {
- memnew_placement(&jacLinear, JacobianEntrySW(
+ memnew_placement(&jacLinear, JacobianEntry3DSW(
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
@@ -283,16 +283,16 @@ void Generic6DOFJointSW::buildLinearJacobian(
B->get_inv_mass()));
}
-void Generic6DOFJointSW::buildAngularJacobian(
- JacobianEntrySW &jacAngular, const Vector3 &jointAxisW) {
- memnew_placement(&jacAngular, JacobianEntrySW(jointAxisW,
+void Generic6DOFJoint3DSW::buildAngularJacobian(
+ JacobianEntry3DSW &jacAngular, const Vector3 &jointAxisW) {
+ memnew_placement(&jacAngular, JacobianEntry3DSW(jointAxisW,
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
A->get_inv_inertia(),
B->get_inv_inertia()));
}
-bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) {
+bool Generic6DOFJoint3DSW::testAngularLimitMotor(int axis_index) {
real_t angle = m_calculatedAxisAngleDiff[axis_index];
//test limits
@@ -300,7 +300,7 @@ bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) {
return m_angularLimits[axis_index].needApplyTorques();
}
-bool Generic6DOFJointSW::setup(real_t p_timestep) {
+bool Generic6DOFJoint3DSW::setup(real_t p_timestep) {
// Clear accumulated impulses for the next simulation step
m_linearLimits.m_accumulatedImpulse = Vector3(real_t(0.), real_t(0.), real_t(0.));
@@ -349,7 +349,7 @@ bool Generic6DOFJointSW::setup(real_t p_timestep) {
return true;
}
-void Generic6DOFJointSW::solve(real_t p_timestep) {
+void Generic6DOFJoint3DSW::solve(real_t p_timestep) {
m_timeStep = p_timestep;
//calculateTransforms();
@@ -397,19 +397,19 @@ void Generic6DOFJointSW::solve(real_t p_timestep) {
}
}
-void Generic6DOFJointSW::updateRHS(real_t timeStep) {
+void Generic6DOFJoint3DSW::updateRHS(real_t timeStep) {
(void)timeStep;
}
-Vector3 Generic6DOFJointSW::getAxis(int axis_index) const {
+Vector3 Generic6DOFJoint3DSW::getAxis(int axis_index) const {
return m_calculatedAxis[axis_index];
}
-real_t Generic6DOFJointSW::getAngle(int axis_index) const {
+real_t Generic6DOFJoint3DSW::getAngle(int axis_index) const {
return m_calculatedAxisAngleDiff[axis_index];
}
-void Generic6DOFJointSW::calcAnchorPos(void) {
+void Generic6DOFJoint3DSW::calcAnchorPos(void) {
real_t imA = A->get_inv_mass();
real_t imB = B->get_inv_mass();
real_t weight;
@@ -423,263 +423,263 @@ void Generic6DOFJointSW::calcAnchorPos(void) {
m_AnchorPos = pA * weight + pB * (real_t(1.0) - weight);
} // Generic6DOFJointSW::calcAnchorPos()
-void Generic6DOFJointSW::set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value) {
+void Generic6DOFJoint3DSW::set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value) {
ERR_FAIL_INDEX(p_axis, 3);
switch (p_param) {
- case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT: {
m_linearLimits.m_lowerLimit[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT: {
m_linearLimits.m_upperLimit[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
m_linearLimits.m_limitSoftness[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION: {
m_linearLimits.m_restitution[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING: {
m_linearLimits.m_damping[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: {
m_angularLimits[p_axis].m_loLimit = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: {
m_angularLimits[p_axis].m_hiLimit = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
m_angularLimits[p_axis].m_limitSoftness = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING: {
m_angularLimits[p_axis].m_damping = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: {
m_angularLimits[p_axis].m_bounce = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
m_angularLimits[p_axis].m_maxLimitForce = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: {
m_angularLimits[p_axis].m_ERP = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: {
m_angularLimits[p_axis].m_targetVelocity = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: {
m_angularLimits[p_axis].m_maxLimitForce = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
}
}
-real_t Generic6DOFJointSW::get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const {
+real_t Generic6DOFJoint3DSW::get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const {
ERR_FAIL_INDEX_V(p_axis, 3, 0);
switch (p_param) {
- case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_LOWER_LIMIT: {
return m_linearLimits.m_lowerLimit[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_UPPER_LIMIT: {
return m_linearLimits.m_upperLimit[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS: {
return m_linearLimits.m_limitSoftness[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_RESTITUTION: {
return m_linearLimits.m_restitution[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_DAMPING: {
return m_linearLimits.m_damping[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LOWER_LIMIT: {
return m_angularLimits[p_axis].m_loLimit;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_UPPER_LIMIT: {
return m_angularLimits[p_axis].m_hiLimit;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS: {
return m_angularLimits[p_axis].m_limitSoftness;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_DAMPING: {
return m_angularLimits[p_axis].m_damping;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_RESTITUTION: {
return m_angularLimits[p_axis].m_bounce;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_FORCE_LIMIT: {
return m_angularLimits[p_axis].m_maxLimitForce;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_ERP: {
return m_angularLimits[p_axis].m_ERP;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY: {
return m_angularLimits[p_axis].m_targetVelocity;
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: {
return m_angularLimits[p_axis].m_maxMotorForce;
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_STIFFNESS: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_DAMPING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: {
+ case PhysicsServer3D::G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_DAMPING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
+ case PhysicsServer3D::G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::G6DOF_JOINT_MAX: break; // Can't happen, but silences warning
}
return 0;
}
-void Generic6DOFJointSW::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) {
+void Generic6DOFJoint3DSW::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value) {
ERR_FAIL_INDEX(p_axis, 3);
switch (p_flag) {
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
m_linearLimits.enable_limit[p_axis] = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
m_angularLimits[p_axis].m_enableLimit = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_MOTOR: {
m_angularLimits[p_axis].m_enableMotor = p_value;
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
}
}
-bool Generic6DOFJointSW::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const {
+bool Generic6DOFJoint3DSW::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const {
ERR_FAIL_INDEX_V(p_axis, 3, 0);
switch (p_flag) {
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
return m_linearLimits.enable_limit[p_axis];
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
return m_angularLimits[p_axis].m_enableLimit;
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_MOTOR: {
return m_angularLimits[p_axis].m_enableMotor;
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING: {
// Not implemented in GodotPhysics backend
} break;
- case PhysicsServer::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::G6DOF_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
}
return 0;
diff --git a/servers/physics/joints/generic_6dof_joint_sw.h b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h
index 07626ffa97..ba6e6ffb01 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.h
+++ b/servers/physics_3d/joints/generic_6dof_joint_3d_sw.h
@@ -35,8 +35,8 @@ Adapted to Godot from the Bullet library.
#ifndef GENERIC_6DOF_JOINT_SW_H
#define GENERIC_6DOF_JOINT_SW_H
-#include "servers/physics/joints/jacobian_entry_sw.h"
-#include "servers/physics/joints_sw.h"
+#include "servers/physics_3d/joints/jacobian_entry_3d_sw.h"
+#include "servers/physics_3d/joints_3d_sw.h"
/*
Bullet Continuous Collision Detection and Physics Library
@@ -61,7 +61,7 @@ http://gimpact.sf.net
*/
//! Rotation Limit structure for generic joints
-class G6DOFRotationalLimitMotorSW {
+class G6DOFRotationalLimitMotor3DSW {
public:
//! limit_parameters
//!@{
@@ -86,7 +86,7 @@ public:
real_t m_accumulatedImpulse;
//!@}
- G6DOFRotationalLimitMotorSW() {
+ G6DOFRotationalLimitMotor3DSW() {
m_accumulatedImpulse = 0.f;
m_targetVelocity = 0;
m_maxMotorForce = 0.1f;
@@ -103,7 +103,7 @@ public:
m_enableLimit = false;
}
- G6DOFRotationalLimitMotorSW(const G6DOFRotationalLimitMotorSW &limot) {
+ G6DOFRotationalLimitMotor3DSW(const G6DOFRotationalLimitMotor3DSW &limot) {
m_targetVelocity = limot.m_targetVelocity;
m_maxMotorForce = limot.m_maxMotorForce;
m_limitSoftness = limot.m_limitSoftness;
@@ -133,10 +133,10 @@ public:
int testLimitValue(real_t test_value);
//! apply the correction impulses for two bodies
- real_t solveAngularLimits(real_t timeStep, Vector3 &axis, real_t jacDiagABInv, BodySW *body0, BodySW *body1);
+ real_t solveAngularLimits(real_t timeStep, Vector3 &axis, real_t jacDiagABInv, Body3DSW *body0, Body3DSW *body1);
};
-class G6DOFTranslationalLimitMotorSW {
+class G6DOFTranslationalLimitMotor3DSW {
public:
Vector3 m_lowerLimit; //!< the constraint lower limits
Vector3 m_upperLimit; //!< the constraint upper limits
@@ -149,7 +149,7 @@ public:
//!@}
bool enable_limit[3];
- G6DOFTranslationalLimitMotorSW() {
+ G6DOFTranslationalLimitMotor3DSW() {
m_lowerLimit = Vector3(0.f, 0.f, 0.f);
m_upperLimit = Vector3(0.f, 0.f, 0.f);
m_accumulatedImpulse = Vector3(0.f, 0.f, 0.f);
@@ -163,7 +163,7 @@ public:
enable_limit[2] = true;
}
- G6DOFTranslationalLimitMotorSW(const G6DOFTranslationalLimitMotorSW &other) {
+ G6DOFTranslationalLimitMotor3DSW(const G6DOFTranslationalLimitMotor3DSW &other) {
m_lowerLimit = other.m_lowerLimit;
m_upperLimit = other.m_upperLimit;
m_accumulatedImpulse = other.m_accumulatedImpulse;
@@ -187,22 +187,22 @@ public:
real_t solveLinearAxis(
real_t timeStep,
real_t jacDiagABInv,
- BodySW *body1, const Vector3 &pointInA,
- BodySW *body2, const Vector3 &pointInB,
+ Body3DSW *body1, const Vector3 &pointInA,
+ Body3DSW *body2, const Vector3 &pointInB,
int limit_index,
const Vector3 &axis_normal_on_a,
const Vector3 &anchorPos);
};
-class Generic6DOFJointSW : public JointSW {
+class Generic6DOFJoint3DSW : public Joint3DSW {
protected:
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
//! relative_frames
@@ -213,18 +213,18 @@ protected:
//! Jacobians
//!@{
- JacobianEntrySW m_jacLinear[3]; //!< 3 orthogonal linear constraints
- JacobianEntrySW m_jacAng[3]; //!< 3 orthogonal angular constraints
+ JacobianEntry3DSW m_jacLinear[3]; //!< 3 orthogonal linear constraints
+ JacobianEntry3DSW m_jacAng[3]; //!< 3 orthogonal angular constraints
//!@}
//! Linear_Limit_parameters
//!@{
- G6DOFTranslationalLimitMotorSW m_linearLimits;
+ G6DOFTranslationalLimitMotor3DSW m_linearLimits;
//!@}
//! hinge_parameters
//!@{
- G6DOFRotationalLimitMotorSW m_angularLimits[3];
+ G6DOFRotationalLimitMotor3DSW m_angularLimits[3];
//!@}
protected:
@@ -242,25 +242,25 @@ protected:
//!@}
- Generic6DOFJointSW &operator=(Generic6DOFJointSW &other) {
+ Generic6DOFJoint3DSW &operator=(Generic6DOFJoint3DSW &other) {
ERR_PRINT("pito");
(void)other;
return *this;
}
void buildLinearJacobian(
- JacobianEntrySW &jacLinear, const Vector3 &normalWorld,
+ JacobianEntry3DSW &jacLinear, const Vector3 &normalWorld,
const Vector3 &pivotAInW, const Vector3 &pivotBInW);
- void buildAngularJacobian(JacobianEntrySW &jacAngular, const Vector3 &jointAxisW);
+ void buildAngularJacobian(JacobianEntry3DSW &jacAngular, const Vector3 &jointAxisW);
//! calcs the euler angles between the two bodies.
void calculateAngleInfo();
public:
- Generic6DOFJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
+ Generic6DOFJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
- virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; }
+ virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_6DOF; }
virtual bool setup(real_t p_timestep);
virtual void solve(real_t p_timestep);
@@ -348,12 +348,12 @@ public:
}
//! Retrieves the angular limit informacion
- G6DOFRotationalLimitMotorSW *getRotationalLimitMotor(int index) {
+ G6DOFRotationalLimitMotor3DSW *getRotationalLimitMotor(int index) {
return &m_angularLimits[index];
}
//! Retrieves the limit informacion
- G6DOFTranslationalLimitMotorSW *getTranslationalLimitMotor() {
+ G6DOFTranslationalLimitMotor3DSW *getTranslationalLimitMotor() {
return &m_linearLimits;
}
@@ -382,20 +382,20 @@ public:
return m_angularLimits[limitIndex - 3].isLimited();
}
- const BodySW *getRigidBodyA() const {
+ const Body3DSW *getRigidBodyA() const {
return A;
}
- const BodySW *getRigidBodyB() const {
+ const Body3DSW *getRigidBodyB() const {
return B;
}
virtual void calcAnchorPos(void); // overridable
- void set_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param, real_t p_value);
- real_t get_param(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisParam p_param) const;
+ void set_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param, real_t p_value);
+ real_t get_param(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisParam p_param) const;
- void set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value);
- bool get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const;
+ void set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag, bool p_value);
+ bool get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const;
};
#endif // GENERIC_6DOF_JOINT_SW_H
diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp
index 1ad3e738ba..57605aac7b 100644
--- a/servers/physics/joints/hinge_joint_sw.cpp
+++ b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp
@@ -47,7 +47,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-#include "hinge_joint_sw.h"
+#include "hinge_joint_3d_sw.h"
static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
@@ -68,8 +68,8 @@ static void plane_space(const Vector3 &n, Vector3 &p, Vector3 &q) {
}
}
-HingeJointSW::HingeJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameA, const Transform &frameB) :
- JointSW(_arr, 2) {
+HingeJoint3DSW::HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameA, const Transform &frameB) :
+ Joint3DSW(_arr, 2) {
A = rbA;
B = rbB;
@@ -100,9 +100,9 @@ HingeJointSW::HingeJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameA, co
B->add_constraint(this, 1);
}
-HingeJointSW::HingeJointSW(BodySW *rbA, BodySW *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB,
+HingeJoint3DSW::HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB,
const Vector3 &axisInA, const Vector3 &axisInB) :
- JointSW(_arr, 2) {
+ Joint3DSW(_arr, 2) {
A = rbA;
B = rbB;
@@ -157,7 +157,7 @@ HingeJointSW::HingeJointSW(BodySW *rbA, BodySW *rbB, const Vector3 &pivotInA, co
B->add_constraint(this, 1);
}
-bool HingeJointSW::setup(real_t p_step) {
+bool HingeJoint3DSW::setup(real_t p_step) {
m_appliedImpulse = real_t(0.);
@@ -176,7 +176,7 @@ bool HingeJointSW::setup(real_t p_step) {
plane_space(normal[0], normal[1], normal[2]);
for (int i = 0; i < 3; i++) {
- memnew_placement(&m_jac[i], JacobianEntrySW(
+ memnew_placement(&m_jac[i], JacobianEntry3DSW(
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
@@ -202,19 +202,19 @@ bool HingeJointSW::setup(real_t p_step) {
Vector3 jointAxis1 = A->get_transform().basis.xform(jointAxis1local);
Vector3 hingeAxisWorld = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2));
- memnew_placement(&m_jacAng[0], JacobianEntrySW(jointAxis0,
+ memnew_placement(&m_jacAng[0], JacobianEntry3DSW(jointAxis0,
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
A->get_inv_inertia(),
B->get_inv_inertia()));
- memnew_placement(&m_jacAng[1], JacobianEntrySW(jointAxis1,
+ memnew_placement(&m_jacAng[1], JacobianEntry3DSW(jointAxis1,
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
A->get_inv_inertia(),
B->get_inv_inertia()));
- memnew_placement(&m_jacAng[2], JacobianEntrySW(hingeAxisWorld,
+ memnew_placement(&m_jacAng[2], JacobianEntry3DSW(hingeAxisWorld,
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
A->get_inv_inertia(),
@@ -253,7 +253,7 @@ bool HingeJointSW::setup(real_t p_step) {
return true;
}
-void HingeJointSW::solve(real_t p_step) {
+void HingeJoint3DSW::solve(real_t p_step) {
Vector3 pivotAInW = A->get_transform().xform(m_rbAFrame.origin);
Vector3 pivotBInW = B->get_transform().xform(m_rbBFrame.origin);
@@ -388,7 +388,7 @@ static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) {
return (y < 0.0f) ? -angle : angle;
}
-real_t HingeJointSW::get_hinge_angle() {
+real_t HingeJoint3DSW::get_hinge_angle() {
const Vector3 refAxis0 = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(0));
const Vector3 refAxis1 = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(1));
const Vector3 swingAxis = B->get_transform().basis.xform(m_rbBFrame.basis.get_axis(1));
@@ -396,54 +396,54 @@ real_t HingeJointSW::get_hinge_angle() {
return atan2fast(swingAxis.dot(refAxis0), swingAxis.dot(refAxis1));
}
-void HingeJointSW::set_param(PhysicsServer::HingeJointParam p_param, real_t p_value) {
+void HingeJoint3DSW::set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::HINGE_JOINT_BIAS: tau = p_value; break;
- case PhysicsServer::HINGE_JOINT_LIMIT_UPPER: m_upperLimit = p_value; break;
- case PhysicsServer::HINGE_JOINT_LIMIT_LOWER: m_lowerLimit = p_value; break;
- case PhysicsServer::HINGE_JOINT_LIMIT_BIAS: m_biasFactor = p_value; break;
- case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS: m_limitSoftness = p_value; break;
- case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION: m_relaxationFactor = p_value; break;
- case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY: m_motorTargetVelocity = p_value; break;
- case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE: m_maxMotorImpulse = p_value; break;
- case PhysicsServer::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::HINGE_JOINT_BIAS: tau = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: m_upperLimit = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: m_lowerLimit = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: m_biasFactor = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: m_limitSoftness = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: m_relaxationFactor = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: m_motorTargetVelocity = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: m_maxMotorImpulse = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
}
}
-real_t HingeJointSW::get_param(PhysicsServer::HingeJointParam p_param) const {
+real_t HingeJoint3DSW::get_param(PhysicsServer3D::HingeJointParam p_param) const {
switch (p_param) {
- case PhysicsServer::HINGE_JOINT_BIAS: return tau;
- case PhysicsServer::HINGE_JOINT_LIMIT_UPPER: return m_upperLimit;
- case PhysicsServer::HINGE_JOINT_LIMIT_LOWER: return m_lowerLimit;
- case PhysicsServer::HINGE_JOINT_LIMIT_BIAS: return m_biasFactor;
- case PhysicsServer::HINGE_JOINT_LIMIT_SOFTNESS: return m_limitSoftness;
- case PhysicsServer::HINGE_JOINT_LIMIT_RELAXATION: return m_relaxationFactor;
- case PhysicsServer::HINGE_JOINT_MOTOR_TARGET_VELOCITY: return m_motorTargetVelocity;
- case PhysicsServer::HINGE_JOINT_MOTOR_MAX_IMPULSE: return m_maxMotorImpulse;
- case PhysicsServer::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::HINGE_JOINT_BIAS: return tau;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER: return m_upperLimit;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_LOWER: return m_lowerLimit;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_BIAS: return m_biasFactor;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_SOFTNESS: return m_limitSoftness;
+ case PhysicsServer3D::HINGE_JOINT_LIMIT_RELAXATION: return m_relaxationFactor;
+ case PhysicsServer3D::HINGE_JOINT_MOTOR_TARGET_VELOCITY: return m_motorTargetVelocity;
+ case PhysicsServer3D::HINGE_JOINT_MOTOR_MAX_IMPULSE: return m_maxMotorImpulse;
+ case PhysicsServer3D::HINGE_JOINT_MAX: break; // Can't happen, but silences warning
}
return 0;
}
-void HingeJointSW::set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value) {
+void HingeJoint3DSW::set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value) {
switch (p_flag) {
- case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT: m_useLimit = p_value; break;
- case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR: m_enableAngularMotor = p_value; break;
- case PhysicsServer::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: m_useLimit = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: m_enableAngularMotor = p_value; break;
+ case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
}
}
-bool HingeJointSW::get_flag(PhysicsServer::HingeJointFlag p_flag) const {
+bool HingeJoint3DSW::get_flag(PhysicsServer3D::HingeJointFlag p_flag) const {
switch (p_flag) {
- case PhysicsServer::HINGE_JOINT_FLAG_USE_LIMIT: return m_useLimit;
- case PhysicsServer::HINGE_JOINT_FLAG_ENABLE_MOTOR: return m_enableAngularMotor;
- case PhysicsServer::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::HINGE_JOINT_FLAG_USE_LIMIT: return m_useLimit;
+ case PhysicsServer3D::HINGE_JOINT_FLAG_ENABLE_MOTOR: return m_enableAngularMotor;
+ case PhysicsServer3D::HINGE_JOINT_FLAG_MAX: break; // Can't happen, but silences warning
}
return false;
diff --git a/servers/physics/joints/hinge_joint_sw.h b/servers/physics_3d/joints/hinge_joint_3d_sw.h
index 1c160cfc09..8da32885bc 100644
--- a/servers/physics/joints/hinge_joint_sw.h
+++ b/servers/physics_3d/joints/hinge_joint_3d_sw.h
@@ -35,8 +35,8 @@ Adapted to Godot from the Bullet library.
#ifndef HINGE_JOINT_SW_H
#define HINGE_JOINT_SW_H
-#include "servers/physics/joints/jacobian_entry_sw.h"
-#include "servers/physics/joints_sw.h"
+#include "servers/physics_3d/joints/jacobian_entry_3d_sw.h"
+#include "servers/physics_3d/joints_3d_sw.h"
/*
Bullet Continuous Collision Detection and Physics Library
@@ -53,19 +53,19 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-class HingeJointSW : public JointSW {
+class HingeJoint3DSW : public Joint3DSW {
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
- JacobianEntrySW m_jac[3]; //3 orthogonal linear constraints
- JacobianEntrySW m_jacAng[3]; //2 orthogonal angular constraints+ 1 for limit/motor
+ JacobianEntry3DSW m_jac[3]; //3 orthogonal linear constraints
+ JacobianEntry3DSW m_jacAng[3]; //2 orthogonal angular constraints+ 1 for limit/motor
Transform m_rbAFrame; // constraint axii. Assumes z is hinge axis.
Transform m_rbBFrame;
@@ -97,21 +97,21 @@ class HingeJointSW : public JointSW {
real_t m_appliedImpulse;
public:
- virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; }
+ virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_HINGE; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
real_t get_hinge_angle();
- void set_param(PhysicsServer::HingeJointParam p_param, real_t p_value);
- real_t get_param(PhysicsServer::HingeJointParam p_param) const;
+ void set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer3D::HingeJointParam p_param) const;
- void set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value);
- bool get_flag(PhysicsServer::HingeJointFlag p_flag) const;
+ void set_flag(PhysicsServer3D::HingeJointFlag p_flag, bool p_value);
+ bool get_flag(PhysicsServer3D::HingeJointFlag p_flag) const;
- HingeJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameA, const Transform &frameB);
- HingeJointSW(BodySW *rbA, BodySW *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB);
+ HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameA, const Transform &frameB);
+ HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB);
};
#endif // HINGE_JOINT_SW_H
diff --git a/servers/physics/joints/jacobian_entry_sw.h b/servers/physics_3d/joints/jacobian_entry_3d_sw.h
index a17175e6de..e298d40d8d 100644
--- a/servers/physics/joints/jacobian_entry_sw.h
+++ b/servers/physics_3d/joints/jacobian_entry_3d_sw.h
@@ -52,11 +52,11 @@ subject to the following restrictions:
#include "core/math/transform.h"
-class JacobianEntrySW {
+class JacobianEntry3DSW {
public:
- JacobianEntrySW(){};
+ JacobianEntry3DSW(){};
//constraint between two different rigidbodies
- JacobianEntrySW(
+ JacobianEntry3DSW(
const Basis &world2A,
const Basis &world2B,
const Vector3 &rel_pos1, const Vector3 &rel_pos2,
@@ -76,7 +76,7 @@ public:
}
//angular constraint between two different rigidbodies
- JacobianEntrySW(const Vector3 &jointAxis,
+ JacobianEntry3DSW(const Vector3 &jointAxis,
const Basis &world2A,
const Basis &world2B,
const Vector3 &inertiaInvA,
@@ -92,7 +92,7 @@ public:
}
//angular constraint between two different rigidbodies
- JacobianEntrySW(const Vector3 &axisInA,
+ JacobianEntry3DSW(const Vector3 &axisInA,
const Vector3 &axisInB,
const Vector3 &inertiaInvA,
const Vector3 &inertiaInvB) :
@@ -107,7 +107,7 @@ public:
}
//constraint on one rigidbody
- JacobianEntrySW(
+ JacobianEntry3DSW(
const Basis &world2A,
const Vector3 &rel_pos1, const Vector3 &rel_pos2,
const Vector3 &jointAxis,
@@ -126,16 +126,16 @@ public:
real_t getDiagonal() const { return m_Adiag; }
// for two constraints on the same rigidbody (for example vehicle friction)
- real_t getNonDiagonal(const JacobianEntrySW &jacB, const real_t massInvA) const {
- const JacobianEntrySW &jacA = *this;
+ real_t getNonDiagonal(const JacobianEntry3DSW &jacB, const real_t massInvA) const {
+ const JacobianEntry3DSW &jacA = *this;
real_t lin = massInvA * jacA.m_linearJointAxis.dot(jacB.m_linearJointAxis);
real_t ang = jacA.m_0MinvJt.dot(jacB.m_aJ);
return lin + ang;
}
// for two constraints on sharing two same rigidbodies (for example two contact points between two rigidbodies)
- real_t getNonDiagonal(const JacobianEntrySW &jacB, const real_t massInvA, const real_t massInvB) const {
- const JacobianEntrySW &jacA = *this;
+ real_t getNonDiagonal(const JacobianEntry3DSW &jacB, const real_t massInvA, const real_t massInvB) const {
+ const JacobianEntry3DSW &jacA = *this;
Vector3 lin = jacA.m_linearJointAxis * jacB.m_linearJointAxis;
Vector3 ang0 = jacA.m_0MinvJt * jacB.m_aJ;
Vector3 ang1 = jacA.m_1MinvJt * jacB.m_bJ;
diff --git a/servers/physics/joints/pin_joint_sw.cpp b/servers/physics_3d/joints/pin_joint_3d_sw.cpp
index fe994aa172..67f2d78d54 100644
--- a/servers/physics/joints/pin_joint_sw.cpp
+++ b/servers/physics_3d/joints/pin_joint_3d_sw.cpp
@@ -47,9 +47,9 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-#include "pin_joint_sw.h"
+#include "pin_joint_3d_sw.h"
-bool PinJointSW::setup(real_t p_step) {
+bool PinJoint3DSW::setup(real_t p_step) {
m_appliedImpulse = real_t(0.);
@@ -57,7 +57,7 @@ bool PinJointSW::setup(real_t p_step) {
for (int i = 0; i < 3; i++) {
normal[i] = 1;
- memnew_placement(&m_jac[i], JacobianEntrySW(
+ memnew_placement(&m_jac[i], JacobianEntry3DSW(
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(),
@@ -73,7 +73,7 @@ bool PinJointSW::setup(real_t p_step) {
return true;
}
-void PinJointSW::solve(real_t p_step) {
+void PinJoint3DSW::solve(real_t p_step) {
Vector3 pivotAInW = A->get_transform().xform(m_pivotInA);
Vector3 pivotBInW = B->get_transform().xform(m_pivotInB);
@@ -126,28 +126,28 @@ void PinJointSW::solve(real_t p_step) {
}
}
-void PinJointSW::set_param(PhysicsServer::PinJointParam p_param, real_t p_value) {
+void PinJoint3DSW::set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::PIN_JOINT_BIAS: m_tau = p_value; break;
- case PhysicsServer::PIN_JOINT_DAMPING: m_damping = p_value; break;
- case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP: m_impulseClamp = p_value; break;
+ case PhysicsServer3D::PIN_JOINT_BIAS: m_tau = p_value; break;
+ case PhysicsServer3D::PIN_JOINT_DAMPING: m_damping = p_value; break;
+ case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: m_impulseClamp = p_value; break;
}
}
-real_t PinJointSW::get_param(PhysicsServer::PinJointParam p_param) const {
+real_t PinJoint3DSW::get_param(PhysicsServer3D::PinJointParam p_param) const {
switch (p_param) {
- case PhysicsServer::PIN_JOINT_BIAS: return m_tau;
- case PhysicsServer::PIN_JOINT_DAMPING: return m_damping;
- case PhysicsServer::PIN_JOINT_IMPULSE_CLAMP: return m_impulseClamp;
+ case PhysicsServer3D::PIN_JOINT_BIAS: return m_tau;
+ case PhysicsServer3D::PIN_JOINT_DAMPING: return m_damping;
+ case PhysicsServer3D::PIN_JOINT_IMPULSE_CLAMP: return m_impulseClamp;
}
return 0;
}
-PinJointSW::PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_b, const Vector3 &p_pos_b) :
- JointSW(_arr, 2) {
+PinJoint3DSW::PinJoint3DSW(Body3DSW *p_body_a, const Vector3 &p_pos_a, Body3DSW *p_body_b, const Vector3 &p_pos_b) :
+ Joint3DSW(_arr, 2) {
A = p_body_a;
B = p_body_b;
@@ -163,5 +163,5 @@ PinJointSW::PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_
B->add_constraint(this, 1);
}
-PinJointSW::~PinJointSW() {
+PinJoint3DSW::~PinJoint3DSW() {
}
diff --git a/servers/physics/joints/pin_joint_sw.h b/servers/physics_3d/joints/pin_joint_3d_sw.h
index 42884e4940..25876327a3 100644
--- a/servers/physics/joints/pin_joint_sw.h
+++ b/servers/physics_3d/joints/pin_joint_3d_sw.h
@@ -35,8 +35,8 @@ Adapted to Godot from the Bullet library.
#ifndef PIN_JOINT_SW_H
#define PIN_JOINT_SW_H
-#include "servers/physics/joints/jacobian_entry_sw.h"
-#include "servers/physics/joints_sw.h"
+#include "servers/physics_3d/joints/jacobian_entry_3d_sw.h"
+#include "servers/physics_3d/joints_3d_sw.h"
/*
Bullet Continuous Collision Detection and Physics Library
@@ -53,15 +53,15 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
-class PinJointSW : public JointSW {
+class PinJoint3DSW : public Joint3DSW {
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
real_t m_tau; //bias
@@ -69,19 +69,19 @@ class PinJointSW : public JointSW {
real_t m_impulseClamp;
real_t m_appliedImpulse;
- JacobianEntrySW m_jac[3]; //3 orthogonal linear constraints
+ JacobianEntry3DSW m_jac[3]; //3 orthogonal linear constraints
Vector3 m_pivotInA;
Vector3 m_pivotInB;
public:
- virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_PIN; }
+ virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_PIN; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
- void set_param(PhysicsServer::PinJointParam p_param, real_t p_value);
- real_t get_param(PhysicsServer::PinJointParam p_param) const;
+ void set_param(PhysicsServer3D::PinJointParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer3D::PinJointParam p_param) const;
void set_pos_a(const Vector3 &p_pos) { m_pivotInA = p_pos; }
void set_pos_b(const Vector3 &p_pos) { m_pivotInB = p_pos; }
@@ -89,8 +89,8 @@ public:
Vector3 get_position_a() { return m_pivotInA; }
Vector3 get_position_b() { return m_pivotInB; }
- PinJointSW(BodySW *p_body_a, const Vector3 &p_pos_a, BodySW *p_body_b, const Vector3 &p_pos_b);
- ~PinJointSW();
+ PinJoint3DSW(Body3DSW *p_body_a, const Vector3 &p_pos_a, Body3DSW *p_body_b, const Vector3 &p_pos_b);
+ ~PinJoint3DSW();
};
#endif // PIN_JOINT_SW_H
diff --git a/servers/physics/joints/slider_joint_sw.cpp b/servers/physics_3d/joints/slider_joint_3d_sw.cpp
index 9963c7ae89..01336e2d7c 100644
--- a/servers/physics/joints/slider_joint_sw.cpp
+++ b/servers/physics_3d/joints/slider_joint_3d_sw.cpp
@@ -53,7 +53,7 @@ April 04, 2008
*/
-#include "slider_joint_sw.h"
+#include "slider_joint_3d_sw.h"
//-----------------------------------------------------------------------------
@@ -72,7 +72,7 @@ static _FORCE_INLINE_ real_t atan2fast(real_t y, real_t x) {
return (y < 0.0f) ? -angle : angle;
}
-void SliderJointSW::initParams() {
+void SliderJoint3DSW::initParams() {
m_lowerLinLimit = real_t(1.0);
m_upperLinLimit = real_t(-1.0);
m_lowerAngLimit = real_t(0.);
@@ -112,8 +112,8 @@ void SliderJointSW::initParams() {
//-----------------------------------------------------------------------------
-SliderJointSW::SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB) :
- JointSW(_arr, 2),
+SliderJoint3DSW::SliderJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameInA, const Transform &frameInB) :
+ Joint3DSW(_arr, 2),
m_frameInA(frameInA),
m_frameInB(frameInB) {
@@ -128,7 +128,7 @@ SliderJointSW::SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA
//-----------------------------------------------------------------------------
-bool SliderJointSW::setup(real_t p_step) {
+bool SliderJoint3DSW::setup(real_t p_step) {
//calculate transforms
m_calculatedTransformA = A->get_transform() * m_frameInA;
@@ -145,7 +145,7 @@ bool SliderJointSW::setup(real_t p_step) {
//linear part
for (i = 0; i < 3; i++) {
normalWorld = m_calculatedTransformA.basis.get_axis(i);
- memnew_placement(&m_jacLin[i], JacobianEntrySW(
+ memnew_placement(&m_jacLin[i], JacobianEntry3DSW(
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
m_relPosA - A->get_center_of_mass(),
@@ -162,7 +162,7 @@ bool SliderJointSW::setup(real_t p_step) {
// angular part
for (i = 0; i < 3; i++) {
normalWorld = m_calculatedTransformA.basis.get_axis(i);
- memnew_placement(&m_jacAng[i], JacobianEntrySW(
+ memnew_placement(&m_jacAng[i], JacobianEntry3DSW(
normalWorld,
A->get_principal_inertia_axes().transposed(),
B->get_principal_inertia_axes().transposed(),
@@ -181,7 +181,7 @@ bool SliderJointSW::setup(real_t p_step) {
//-----------------------------------------------------------------------------
-void SliderJointSW::solve(real_t p_step) {
+void SliderJoint3DSW::solve(real_t p_step) {
int i;
// linear
@@ -304,7 +304,7 @@ void SliderJointSW::solve(real_t p_step) {
//-----------------------------------------------------------------------------
-void SliderJointSW::calculateTransforms(void) {
+void SliderJoint3DSW::calculateTransforms(void) {
m_calculatedTransformA = A->get_transform() * m_frameInA;
m_calculatedTransformB = B->get_transform() * m_frameInB;
m_realPivotAInW = m_calculatedTransformA.origin;
@@ -323,7 +323,7 @@ void SliderJointSW::calculateTransforms(void) {
//-----------------------------------------------------------------------------
-void SliderJointSW::testLinLimits(void) {
+void SliderJoint3DSW::testLinLimits(void) {
m_solveLinLim = false;
m_linPos = m_depth[0];
if (m_lowerLinLimit <= m_upperLinLimit) {
@@ -343,7 +343,7 @@ void SliderJointSW::testLinLimits(void) {
//-----------------------------------------------------------------------------
-void SliderJointSW::testAngLimits(void) {
+void SliderJoint3DSW::testAngLimits(void) {
m_angDepth = real_t(0.);
m_solveAngLim = false;
if (m_lowerAngLimit <= m_upperAngLimit) {
@@ -363,7 +363,7 @@ void SliderJointSW::testAngLimits(void) {
//-----------------------------------------------------------------------------
-Vector3 SliderJointSW::getAncorInA(void) {
+Vector3 SliderJoint3DSW::getAncorInA(void) {
Vector3 ancorInA;
ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * real_t(0.5) * m_sliderAxis;
ancorInA = A->get_transform().inverse().xform(ancorInA);
@@ -372,71 +372,71 @@ Vector3 SliderJointSW::getAncorInA(void) {
//-----------------------------------------------------------------------------
-Vector3 SliderJointSW::getAncorInB(void) {
+Vector3 SliderJoint3DSW::getAncorInB(void) {
Vector3 ancorInB;
ancorInB = m_frameInB.origin;
return ancorInB;
} // SliderJointSW::getAncorInB();
-void SliderJointSW::set_param(PhysicsServer::SliderJointParam p_param, real_t p_value) {
+void SliderJoint3DSW::set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: m_upperLinLimit = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: m_lowerLinLimit = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: m_softnessLimLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: m_restitutionLimLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: m_dampingLimLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: m_softnessDirLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: m_restitutionDirLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: m_dampingDirLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoLin = p_value; break;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: m_dampingOrthoLin = p_value; break;
-
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: m_upperAngLimit = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: m_lowerAngLimit = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: m_softnessLimAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: m_restitutionLimAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: m_dampingLimAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: m_softnessDirAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: m_restitutionDirAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: m_dampingDirAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoAng = p_value; break;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: m_dampingOrthoAng = p_value; break;
-
- case PhysicsServer::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: m_upperLinLimit = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: m_lowerLinLimit = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: m_softnessLimLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: m_restitutionLimLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: m_dampingLimLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: m_softnessDirLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: m_restitutionDirLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: m_dampingDirLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoLin = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: m_dampingOrthoLin = p_value; break;
+
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: m_upperAngLimit = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: m_lowerAngLimit = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: m_softnessLimAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: m_restitutionLimAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: m_dampingLimAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: m_softnessDirAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: m_restitutionDirAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: m_dampingDirAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: m_softnessOrthoAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: m_restitutionOrthoAng = p_value; break;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: m_dampingOrthoAng = p_value; break;
+
+ case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
}
}
-real_t SliderJointSW::get_param(PhysicsServer::SliderJointParam p_param) const {
+real_t SliderJoint3DSW::get_param(PhysicsServer3D::SliderJointParam p_param) const {
switch (p_param) {
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return m_upperLinLimit;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return m_lowerLinLimit;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return m_softnessLimLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return m_restitutionLimLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return m_dampingLimLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return m_softnessDirLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return m_restitutionDirLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return m_dampingDirLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoLin;
- case PhysicsServer::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return m_dampingOrthoLin;
-
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return m_upperAngLimit;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return m_lowerAngLimit;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return m_softnessLimAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return m_restitutionLimAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return m_dampingLimAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return m_softnessDirAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return m_restitutionDirAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return m_dampingDirAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoAng;
- case PhysicsServer::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return m_dampingOrthoAng;
-
- case PhysicsServer::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_UPPER: return m_upperLinLimit;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_LOWER: return m_lowerLinLimit;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS: return m_softnessLimLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION: return m_restitutionLimLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_LIMIT_DAMPING: return m_dampingLimLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_SOFTNESS: return m_softnessDirLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_RESTITUTION: return m_restitutionDirLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_MOTION_DAMPING: return m_dampingDirLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoLin;
+ case PhysicsServer3D::SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING: return m_dampingOrthoLin;
+
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_UPPER: return m_upperAngLimit;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_LOWER: return m_lowerAngLimit;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS: return m_softnessLimAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION: return m_restitutionLimAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_LIMIT_DAMPING: return m_dampingLimAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS: return m_softnessDirAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION: return m_restitutionDirAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_MOTION_DAMPING: return m_dampingDirAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS: return m_softnessOrthoAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION: return m_restitutionOrthoAng;
+ case PhysicsServer3D::SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING: return m_dampingOrthoAng;
+
+ case PhysicsServer3D::SLIDER_JOINT_MAX: break; // Can't happen, but silences warning
}
return 0;
diff --git a/servers/physics/joints/slider_joint_sw.h b/servers/physics_3d/joints/slider_joint_3d_sw.h
index 8b416eafc9..a70ba2597d 100644
--- a/servers/physics/joints/slider_joint_sw.h
+++ b/servers/physics_3d/joints/slider_joint_3d_sw.h
@@ -35,8 +35,8 @@ Adapted to Godot from the Bullet library.
#ifndef SLIDER_JOINT_SW_H
#define SLIDER_JOINT_SW_H
-#include "servers/physics/joints/jacobian_entry_sw.h"
-#include "servers/physics/joints_sw.h"
+#include "servers/physics_3d/joints/jacobian_entry_3d_sw.h"
+#include "servers/physics_3d/joints_3d_sw.h"
/*
Bullet Continuous Collision Detection and Physics Library
@@ -65,15 +65,15 @@ April 04, 2008
//-----------------------------------------------------------------------------
-class SliderJointSW : public JointSW {
+class SliderJoint3DSW : public Joint3DSW {
protected:
union {
struct {
- BodySW *A;
- BodySW *B;
+ Body3DSW *A;
+ Body3DSW *B;
};
- BodySW *_arr[2];
+ Body3DSW *_arr[2];
};
Transform m_frameInA;
@@ -114,10 +114,10 @@ protected:
bool m_solveLinLim;
bool m_solveAngLim;
- JacobianEntrySW m_jacLin[3];
+ JacobianEntry3DSW m_jacLin[3];
real_t m_jacLinDiagABInv[3];
- JacobianEntrySW m_jacAng[3];
+ JacobianEntry3DSW m_jacAng[3];
real_t m_timeStep;
Transform m_calculatedTransformA;
@@ -152,13 +152,13 @@ protected:
public:
// constructors
- SliderJointSW(BodySW *rbA, BodySW *rbB, const Transform &frameInA, const Transform &frameInB);
+ SliderJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Transform &frameInA, const Transform &frameInB);
//SliderJointSW();
// overrides
// access
- const BodySW *getRigidBodyA() const { return A; }
- const BodySW *getRigidBodyB() const { return B; }
+ const Body3DSW *getRigidBodyA() const { return A; }
+ const Body3DSW *getRigidBodyB() const { return B; }
const Transform &getCalculatedTransformA() const { return m_calculatedTransformA; }
const Transform &getCalculatedTransformB() const { return m_calculatedTransformB; }
const Transform &getFrameOffsetA() const { return m_frameInA; }
@@ -237,13 +237,13 @@ public:
Vector3 getAncorInA(void);
Vector3 getAncorInB(void);
- void set_param(PhysicsServer::SliderJointParam p_param, real_t p_value);
- real_t get_param(PhysicsServer::SliderJointParam p_param) const;
+ void set_param(PhysicsServer3D::SliderJointParam p_param, real_t p_value);
+ real_t get_param(PhysicsServer3D::SliderJointParam p_param) const;
bool setup(real_t p_step);
void solve(real_t p_step);
- virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_SLIDER; }
+ virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_SLIDER; }
};
#endif // SLIDER_JOINT_SW_H
diff --git a/servers/physics/joints_sw.h b/servers/physics_3d/joints_3d_sw.h
index c284d541e3..097aeb22b9 100644
--- a/servers/physics/joints_sw.h
+++ b/servers/physics_3d/joints_3d_sw.h
@@ -31,15 +31,15 @@
#ifndef JOINTS_SW_H
#define JOINTS_SW_H
-#include "body_sw.h"
-#include "constraint_sw.h"
+#include "body_3d_sw.h"
+#include "constraint_3d_sw.h"
-class JointSW : public ConstraintSW {
+class Joint3DSW : public Constraint3DSW {
public:
- virtual PhysicsServer::JointType get_type() const = 0;
- _FORCE_INLINE_ JointSW(BodySW **p_body_ptr = NULL, int p_body_count = 0) :
- ConstraintSW(p_body_ptr, p_body_count) {
+ virtual PhysicsServer3D::JointType get_type() const = 0;
+ _FORCE_INLINE_ Joint3DSW(Body3DSW **p_body_ptr = NULL, int p_body_count = 0) :
+ Constraint3DSW(p_body_ptr, p_body_count) {
}
};
diff --git a/servers/physics_3d/physics_server_3d_sw.cpp b/servers/physics_3d/physics_server_3d_sw.cpp
new file mode 100644
index 0000000000..27fcedc45f
--- /dev/null
+++ b/servers/physics_3d/physics_server_3d_sw.cpp
@@ -0,0 +1,1589 @@
+/*************************************************************************/
+/* physics_server_sw.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "physics_server_3d_sw.h"
+
+#include "broad_phase_3d_basic.h"
+#include "broad_phase_octree.h"
+#include "core/debugger/engine_debugger.h"
+#include "core/os/os.h"
+#include "joints/cone_twist_joint_3d_sw.h"
+#include "joints/generic_6dof_joint_3d_sw.h"
+#include "joints/hinge_joint_3d_sw.h"
+#include "joints/pin_joint_3d_sw.h"
+#include "joints/slider_joint_3d_sw.h"
+
+#define FLUSH_QUERY_CHECK(m_object) \
+ ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
+
+RID PhysicsServer3DSW::shape_create(ShapeType p_shape) {
+
+ Shape3DSW *shape = NULL;
+ switch (p_shape) {
+
+ case SHAPE_PLANE: {
+
+ shape = memnew(PlaneShape3DSW);
+ } break;
+ case SHAPE_RAY: {
+
+ shape = memnew(RayShape3DSW);
+ } break;
+ case SHAPE_SPHERE: {
+
+ shape = memnew(SphereShape3DSW);
+ } break;
+ case SHAPE_BOX: {
+
+ shape = memnew(BoxShape3DSW);
+ } break;
+ case SHAPE_CAPSULE: {
+
+ shape = memnew(CapsuleShape3DSW);
+ } break;
+ case SHAPE_CYLINDER: {
+
+ ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
+ } break;
+ case SHAPE_CONVEX_POLYGON: {
+
+ shape = memnew(ConvexPolygonShape3DSW);
+ } break;
+ case SHAPE_CONCAVE_POLYGON: {
+
+ shape = memnew(ConcavePolygonShape3DSW);
+ } break;
+ case SHAPE_HEIGHTMAP: {
+
+ shape = memnew(HeightMapShape3DSW);
+ } break;
+ case SHAPE_CUSTOM: {
+
+ ERR_FAIL_V(RID());
+
+ } break;
+ }
+
+ RID id = shape_owner.make_rid(shape);
+ shape->set_self(id);
+
+ return id;
+};
+
+void PhysicsServer3DSW::shape_set_data(RID p_shape, const Variant &p_data) {
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+ shape->set_data(p_data);
+};
+
+void PhysicsServer3DSW::shape_set_custom_solver_bias(RID p_shape, real_t p_bias) {
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+ shape->set_custom_bias(p_bias);
+}
+
+PhysicsServer3D::ShapeType PhysicsServer3DSW::shape_get_type(RID p_shape) const {
+
+ const Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, SHAPE_CUSTOM);
+ return shape->get_type();
+};
+
+Variant PhysicsServer3DSW::shape_get_data(RID p_shape) const {
+
+ const Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, Variant());
+ ERR_FAIL_COND_V(!shape->is_configured(), Variant());
+ return shape->get_data();
+};
+
+void PhysicsServer3DSW::shape_set_margin(RID p_shape, real_t p_margin) {
+}
+
+real_t PhysicsServer3DSW::shape_get_margin(RID p_shape) const {
+ return 0.0;
+}
+
+real_t PhysicsServer3DSW::shape_get_custom_solver_bias(RID p_shape) const {
+
+ const Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND_V(!shape, 0);
+ return shape->get_custom_bias();
+}
+
+RID PhysicsServer3DSW::space_create() {
+
+ Space3DSW *space = memnew(Space3DSW);
+ RID id = space_owner.make_rid(space);
+ space->set_self(id);
+ RID area_id = area_create();
+ Area3DSW *area = area_owner.getornull(area_id);
+ ERR_FAIL_COND_V(!area, RID());
+ space->set_default_area(area);
+ area->set_space(space);
+ area->set_priority(-1);
+ RID sgb = body_create();
+ body_set_space(sgb, id);
+ body_set_mode(sgb, BODY_MODE_STATIC);
+ space->set_static_global_body(sgb);
+
+ return id;
+};
+
+void PhysicsServer3DSW::space_set_active(RID p_space, bool p_active) {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND(!space);
+ if (p_active)
+ active_spaces.insert(space);
+ else
+ active_spaces.erase(space);
+}
+
+bool PhysicsServer3DSW::space_is_active(RID p_space) const {
+
+ const Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND_V(!space, false);
+
+ return active_spaces.has(space);
+}
+
+void PhysicsServer3DSW::space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND(!space);
+
+ space->set_param(p_param, p_value);
+}
+
+real_t PhysicsServer3DSW::space_get_param(RID p_space, SpaceParameter p_param) const {
+
+ const Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND_V(!space, 0);
+ return space->get_param(p_param);
+}
+
+PhysicsDirectSpaceState3D *PhysicsServer3DSW::space_get_direct_state(RID p_space) {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND_V(!space, NULL);
+ ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
+
+ return space->get_direct_state();
+}
+
+void PhysicsServer3DSW::space_set_debug_contacts(RID p_space, int p_max_contacts) {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND(!space);
+ space->set_debug_contacts(p_max_contacts);
+}
+
+Vector<Vector3> PhysicsServer3DSW::space_get_contacts(RID p_space) const {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND_V(!space, Vector<Vector3>());
+ return space->get_debug_contacts();
+}
+
+int PhysicsServer3DSW::space_get_contact_count(RID p_space) const {
+
+ Space3DSW *space = space_owner.getornull(p_space);
+ ERR_FAIL_COND_V(!space, 0);
+ return space->get_debug_contact_count();
+}
+
+RID PhysicsServer3DSW::area_create() {
+
+ Area3DSW *area = memnew(Area3DSW);
+ RID rid = area_owner.make_rid(area);
+ area->set_self(rid);
+ return rid;
+};
+
+void PhysicsServer3DSW::area_set_space(RID p_area, RID p_space) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ Space3DSW *space = NULL;
+ if (p_space.is_valid()) {
+ space = space_owner.getornull(p_space);
+ ERR_FAIL_COND(!space);
+ }
+
+ if (area->get_space() == space)
+ return; //pointless
+
+ area->clear_constraints();
+ area->set_space(space);
+};
+
+RID PhysicsServer3DSW::area_get_space(RID p_area) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, RID());
+
+ Space3DSW *space = area->get_space();
+ if (!space)
+ return RID();
+ return space->get_self();
+};
+
+void PhysicsServer3DSW::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_space_override_mode(p_mode);
+}
+
+PhysicsServer3D::AreaSpaceOverrideMode PhysicsServer3DSW::area_get_space_override_mode(RID p_area) const {
+
+ const Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, AREA_SPACE_OVERRIDE_DISABLED);
+
+ return area->get_space_override_mode();
+}
+
+void PhysicsServer3DSW::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+
+ area->add_shape(shape, p_transform, p_disabled);
+}
+
+void PhysicsServer3DSW::area_set_shape(RID p_area, int p_shape_idx, RID p_shape) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+ ERR_FAIL_COND(!shape->is_configured());
+
+ area->set_shape(p_shape_idx, shape);
+}
+
+void PhysicsServer3DSW::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_shape_transform(p_shape_idx, p_transform);
+}
+
+int PhysicsServer3DSW::area_get_shape_count(RID p_area) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, -1);
+
+ return area->get_shape_count();
+}
+RID PhysicsServer3DSW::area_get_shape(RID p_area, int p_shape_idx) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, RID());
+
+ Shape3DSW *shape = area->get_shape(p_shape_idx);
+ ERR_FAIL_COND_V(!shape, RID());
+
+ return shape->get_self();
+}
+Transform PhysicsServer3DSW::area_get_shape_transform(RID p_area, int p_shape_idx) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, Transform());
+
+ return area->get_shape_transform(p_shape_idx);
+}
+
+void PhysicsServer3DSW::area_remove_shape(RID p_area, int p_shape_idx) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->remove_shape(p_shape_idx);
+}
+
+void PhysicsServer3DSW::area_clear_shapes(RID p_area) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ while (area->get_shape_count())
+ area->remove_shape(0);
+}
+
+void PhysicsServer3DSW::area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+ ERR_FAIL_INDEX(p_shape_idx, area->get_shape_count());
+ FLUSH_QUERY_CHECK(area);
+ area->set_shape_as_disabled(p_shape_idx, p_disabled);
+}
+
+void PhysicsServer3DSW::area_attach_object_instance_id(RID p_area, ObjectID p_id) {
+
+ if (space_owner.owns(p_area)) {
+ Space3DSW *space = space_owner.getornull(p_area);
+ p_area = space->get_default_area()->get_self();
+ }
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+ area->set_instance_id(p_id);
+}
+ObjectID PhysicsServer3DSW::area_get_object_instance_id(RID p_area) const {
+
+ if (space_owner.owns(p_area)) {
+ Space3DSW *space = space_owner.getornull(p_area);
+ p_area = space->get_default_area()->get_self();
+ }
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, ObjectID());
+ return area->get_instance_id();
+}
+
+void PhysicsServer3DSW::area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) {
+
+ if (space_owner.owns(p_area)) {
+ Space3DSW *space = space_owner.getornull(p_area);
+ p_area = space->get_default_area()->get_self();
+ }
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+ area->set_param(p_param, p_value);
+};
+
+void PhysicsServer3DSW::area_set_transform(RID p_area, const Transform &p_transform) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+ area->set_transform(p_transform);
+};
+
+Variant PhysicsServer3DSW::area_get_param(RID p_area, AreaParameter p_param) const {
+
+ if (space_owner.owns(p_area)) {
+ Space3DSW *space = space_owner.getornull(p_area);
+ p_area = space->get_default_area()->get_self();
+ }
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, Variant());
+
+ return area->get_param(p_param);
+};
+
+Transform PhysicsServer3DSW::area_get_transform(RID p_area) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, Transform());
+
+ return area->get_transform();
+};
+
+void PhysicsServer3DSW::area_set_collision_layer(RID p_area, uint32_t p_layer) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_collision_layer(p_layer);
+}
+
+void PhysicsServer3DSW::area_set_collision_mask(RID p_area, uint32_t p_mask) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_collision_mask(p_mask);
+}
+
+void PhysicsServer3DSW::area_set_monitorable(RID p_area, bool p_monitorable) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+ FLUSH_QUERY_CHECK(area);
+
+ area->set_monitorable(p_monitorable);
+}
+
+void PhysicsServer3DSW::area_set_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
+}
+
+void PhysicsServer3DSW::area_set_ray_pickable(RID p_area, bool p_enable) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_ray_pickable(p_enable);
+}
+
+bool PhysicsServer3DSW::area_is_ray_pickable(RID p_area) const {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND_V(!area, false);
+
+ return area->is_ray_pickable();
+}
+
+void PhysicsServer3DSW::area_set_area_monitor_callback(RID p_area, Object *p_receiver, const StringName &p_method) {
+
+ Area3DSW *area = area_owner.getornull(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_area_monitor_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method);
+}
+
+/* BODY API */
+
+RID PhysicsServer3DSW::body_create(BodyMode p_mode, bool p_init_sleeping) {
+
+ Body3DSW *body = memnew(Body3DSW);
+ if (p_mode != BODY_MODE_RIGID)
+ body->set_mode(p_mode);
+ if (p_init_sleeping)
+ body->set_state(BODY_STATE_SLEEPING, p_init_sleeping);
+ RID rid = body_owner.make_rid(body);
+ body->set_self(rid);
+ return rid;
+};
+
+void PhysicsServer3DSW::body_set_space(RID p_body, RID p_space) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ Space3DSW *space = NULL;
+ if (p_space.is_valid()) {
+ space = space_owner.getornull(p_space);
+ ERR_FAIL_COND(!space);
+ }
+
+ if (body->get_space() == space)
+ return; //pointless
+
+ body->clear_constraint_map();
+ body->set_space(space);
+};
+
+RID PhysicsServer3DSW::body_get_space(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, RID());
+
+ Space3DSW *space = body->get_space();
+ if (!space)
+ return RID();
+ return space->get_self();
+};
+
+void PhysicsServer3DSW::body_set_mode(RID p_body, BodyMode p_mode) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_mode(p_mode);
+};
+
+PhysicsServer3D::BodyMode PhysicsServer3DSW::body_get_mode(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, BODY_MODE_STATIC);
+
+ return body->get_mode();
+};
+
+void PhysicsServer3DSW::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+
+ body->add_shape(shape, p_transform, p_disabled);
+}
+
+void PhysicsServer3DSW::body_set_shape(RID p_body, int p_shape_idx, RID p_shape) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ Shape3DSW *shape = shape_owner.getornull(p_shape);
+ ERR_FAIL_COND(!shape);
+ ERR_FAIL_COND(!shape->is_configured());
+
+ body->set_shape(p_shape_idx, shape);
+}
+void PhysicsServer3DSW::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_shape_transform(p_shape_idx, p_transform);
+}
+
+int PhysicsServer3DSW::body_get_shape_count(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, -1);
+
+ return body->get_shape_count();
+}
+RID PhysicsServer3DSW::body_get_shape(RID p_body, int p_shape_idx) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, RID());
+
+ Shape3DSW *shape = body->get_shape(p_shape_idx);
+ ERR_FAIL_COND_V(!shape, RID());
+
+ return shape->get_self();
+}
+
+void PhysicsServer3DSW::body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+ ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count());
+ FLUSH_QUERY_CHECK(body);
+
+ body->set_shape_as_disabled(p_shape_idx, p_disabled);
+}
+
+Transform PhysicsServer3DSW::body_get_shape_transform(RID p_body, int p_shape_idx) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, Transform());
+
+ return body->get_shape_transform(p_shape_idx);
+}
+
+void PhysicsServer3DSW::body_remove_shape(RID p_body, int p_shape_idx) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->remove_shape(p_shape_idx);
+}
+
+void PhysicsServer3DSW::body_clear_shapes(RID p_body) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ while (body->get_shape_count())
+ body->remove_shape(0);
+}
+
+void PhysicsServer3DSW::body_set_enable_continuous_collision_detection(RID p_body, bool p_enable) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_continuous_collision_detection(p_enable);
+}
+
+bool PhysicsServer3DSW::body_is_continuous_collision_detection_enabled(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, false);
+
+ return body->is_continuous_collision_detection_enabled();
+}
+
+void PhysicsServer3DSW::body_set_collision_layer(RID p_body, uint32_t p_layer) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_collision_layer(p_layer);
+ body->wakeup();
+}
+
+uint32_t PhysicsServer3DSW::body_get_collision_layer(RID p_body) const {
+
+ const Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return body->get_collision_layer();
+}
+
+void PhysicsServer3DSW::body_set_collision_mask(RID p_body, uint32_t p_mask) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_collision_mask(p_mask);
+ body->wakeup();
+}
+
+uint32_t PhysicsServer3DSW::body_get_collision_mask(RID p_body) const {
+
+ const Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return body->get_collision_mask();
+}
+
+void PhysicsServer3DSW::body_attach_object_instance_id(RID p_body, ObjectID p_id) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_instance_id(p_id);
+};
+
+ObjectID PhysicsServer3DSW::body_get_object_instance_id(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, ObjectID());
+
+ return body->get_instance_id();
+};
+
+void PhysicsServer3DSW::body_set_user_flags(RID p_body, uint32_t p_flags) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+};
+
+uint32_t PhysicsServer3DSW::body_get_user_flags(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return 0;
+};
+
+void PhysicsServer3DSW::body_set_param(RID p_body, BodyParameter p_param, real_t p_value) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_param(p_param, p_value);
+};
+
+real_t PhysicsServer3DSW::body_get_param(RID p_body, BodyParameter p_param) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return body->get_param(p_param);
+};
+
+void PhysicsServer3DSW::body_set_kinematic_safe_margin(RID p_body, real_t p_margin) {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_kinematic_margin(p_margin);
+}
+
+real_t PhysicsServer3DSW::body_get_kinematic_safe_margin(RID p_body) const {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+
+ return body->get_kinematic_margin();
+}
+
+void PhysicsServer3DSW::body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_state(p_state, p_variant);
+};
+
+Variant PhysicsServer3DSW::body_get_state(RID p_body, BodyState p_state) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, Variant());
+
+ return body->get_state(p_state);
+};
+
+void PhysicsServer3DSW::body_set_applied_force(RID p_body, const Vector3 &p_force) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_applied_force(p_force);
+ body->wakeup();
+};
+
+Vector3 PhysicsServer3DSW::body_get_applied_force(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, Vector3());
+ return body->get_applied_force();
+};
+
+void PhysicsServer3DSW::body_set_applied_torque(RID p_body, const Vector3 &p_torque) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_applied_torque(p_torque);
+ body->wakeup();
+};
+
+Vector3 PhysicsServer3DSW::body_get_applied_torque(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, Vector3());
+
+ return body->get_applied_torque();
+};
+
+void PhysicsServer3DSW::body_add_central_force(RID p_body, const Vector3 &p_force) {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->add_central_force(p_force);
+ body->wakeup();
+}
+
+void PhysicsServer3DSW::body_add_force(RID p_body, const Vector3 &p_force, const Vector3 &p_pos) {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->add_force(p_force, p_pos);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_add_torque(RID p_body, const Vector3 &p_torque) {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->add_torque(p_torque);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_apply_central_impulse(RID p_body, const Vector3 &p_impulse) {
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ _update_shapes();
+
+ body->apply_central_impulse(p_impulse);
+ body->wakeup();
+}
+
+void PhysicsServer3DSW::body_apply_impulse(RID p_body, const Vector3 &p_pos, const Vector3 &p_impulse) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ _update_shapes();
+
+ body->apply_impulse(p_pos, p_impulse);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ _update_shapes();
+
+ body->apply_torque_impulse(p_impulse);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ _update_shapes();
+
+ Vector3 v = body->get_linear_velocity();
+ Vector3 axis = p_axis_velocity.normalized();
+ v -= axis * axis.dot(v);
+ v += p_axis_velocity;
+ body->set_linear_velocity(v);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_axis_lock(p_axis, p_lock);
+ body->wakeup();
+}
+
+bool PhysicsServer3DSW::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
+
+ const Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+ return body->is_axis_locked(p_axis);
+}
+
+void PhysicsServer3DSW::body_add_collision_exception(RID p_body, RID p_body_b) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->add_exception(p_body_b);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_remove_collision_exception(RID p_body, RID p_body_b) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->remove_exception(p_body_b);
+ body->wakeup();
+};
+
+void PhysicsServer3DSW::body_get_collision_exceptions(RID p_body, List<RID> *p_exceptions) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ for (int i = 0; i < body->get_exceptions().size(); i++) {
+ p_exceptions->push_back(body->get_exceptions()[i]);
+ }
+};
+
+void PhysicsServer3DSW::body_set_contacts_reported_depth_threshold(RID p_body, real_t p_threshold) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+};
+
+real_t PhysicsServer3DSW::body_get_contacts_reported_depth_threshold(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, 0);
+ return 0;
+};
+
+void PhysicsServer3DSW::body_set_omit_force_integration(RID p_body, bool p_omit) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+
+ body->set_omit_force_integration(p_omit);
+};
+
+bool PhysicsServer3DSW::body_is_omitting_force_integration(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, false);
+ return body->get_omit_force_integration();
+};
+
+void PhysicsServer3DSW::body_set_max_contacts_reported(RID p_body, int p_contacts) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_max_contacts_reported(p_contacts);
+}
+
+int PhysicsServer3DSW::body_get_max_contacts_reported(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, -1);
+ return body->get_max_contacts_reported();
+}
+
+void PhysicsServer3DSW::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(), p_method, p_udata);
+}
+
+void PhysicsServer3DSW::body_set_ray_pickable(RID p_body, bool p_enable) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_ray_pickable(p_enable);
+}
+
+bool PhysicsServer3DSW::body_is_ray_pickable(RID p_body) const {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, false);
+ return body->is_ray_pickable();
+}
+
+bool PhysicsServer3DSW::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, false);
+ ERR_FAIL_COND_V(!body->get_space(), false);
+ ERR_FAIL_COND_V(body->get_space()->is_locked(), false);
+
+ _update_shapes();
+
+ return body->get_space()->test_body_motion(body, p_from, p_motion, p_infinite_inertia, body->get_kinematic_margin(), r_result, p_exclude_raycast_shapes);
+}
+
+int PhysicsServer3DSW::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, false);
+ ERR_FAIL_COND_V(!body->get_space(), false);
+ ERR_FAIL_COND_V(body->get_space()->is_locked(), false);
+
+ _update_shapes();
+
+ return body->get_space()->test_body_ray_separation(body, p_transform, p_infinite_inertia, r_recover_motion, r_results, p_result_max, p_margin);
+}
+
+PhysicsDirectBodyState3D *PhysicsServer3DSW::body_get_direct_state(RID p_body) {
+
+ Body3DSW *body = body_owner.getornull(p_body);
+ ERR_FAIL_COND_V(!body, NULL);
+ ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+
+ direct_state->body = body;
+ return direct_state;
+}
+
+/* JOINT API */
+
+RID PhysicsServer3DSW::joint_create_pin(RID p_body_A, const Vector3 &p_local_A, RID p_body_B, const Vector3 &p_local_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(PinJoint3DSW(body_A, p_local_A, body_B, p_local_B));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+void PhysicsServer3DSW::pin_joint_set_param(RID p_joint, PinJointParam p_param, real_t p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ pin_joint->set_param(p_param, p_value);
+}
+real_t PhysicsServer3DSW::pin_joint_get_param(RID p_joint, PinJointParam p_param) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, 0);
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ return pin_joint->get_param(p_param);
+}
+
+void PhysicsServer3DSW::pin_joint_set_local_a(RID p_joint, const Vector3 &p_A) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ pin_joint->set_pos_a(p_A);
+}
+Vector3 PhysicsServer3DSW::pin_joint_get_local_a(RID p_joint) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, Vector3());
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ return pin_joint->get_position_a();
+}
+
+void PhysicsServer3DSW::pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_PIN);
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ pin_joint->set_pos_b(p_B);
+}
+Vector3 PhysicsServer3DSW::pin_joint_get_local_b(RID p_joint) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, Vector3());
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_PIN, Vector3());
+ PinJoint3DSW *pin_joint = static_cast<PinJoint3DSW *>(joint);
+ return pin_joint->get_position_b();
+}
+
+RID PhysicsServer3DSW::joint_create_hinge(RID p_body_A, const Transform &p_frame_A, RID p_body_B, const Transform &p_frame_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(HingeJoint3DSW(body_A, body_B, p_frame_A, p_frame_B));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+RID PhysicsServer3DSW::joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(HingeJoint3DSW(body_A, body_B, p_pivot_A, p_pivot_B, p_axis_A, p_axis_B));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+void PhysicsServer3DSW::hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_HINGE);
+ HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint);
+ hinge_joint->set_param(p_param, p_value);
+}
+real_t PhysicsServer3DSW::hinge_joint_get_param(RID p_joint, HingeJointParam p_param) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, 0);
+ HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint);
+ return hinge_joint->get_param(p_param);
+}
+
+void PhysicsServer3DSW::hinge_joint_set_flag(RID p_joint, HingeJointFlag p_flag, bool p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_HINGE);
+ HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint);
+ hinge_joint->set_flag(p_flag, p_value);
+}
+bool PhysicsServer3DSW::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, false);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_HINGE, false);
+ HingeJoint3DSW *hinge_joint = static_cast<HingeJoint3DSW *>(joint);
+ return hinge_joint->get_flag(p_flag);
+}
+
+void PhysicsServer3DSW::joint_set_solver_priority(RID p_joint, int p_priority) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ joint->set_priority(p_priority);
+}
+
+int PhysicsServer3DSW::joint_get_solver_priority(RID p_joint) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ return joint->get_priority();
+}
+
+void PhysicsServer3DSW::joint_disable_collisions_between_bodies(RID p_joint, const bool p_disable) {
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+
+ joint->disable_collisions_between_bodies(p_disable);
+
+ if (2 == joint->get_body_count()) {
+ Body3DSW *body_a = *joint->get_body_ptr();
+ Body3DSW *body_b = *(joint->get_body_ptr() + 1);
+
+ if (p_disable) {
+ body_add_collision_exception(body_a->get_self(), body_b->get_self());
+ body_add_collision_exception(body_b->get_self(), body_a->get_self());
+ } else {
+ body_remove_collision_exception(body_a->get_self(), body_b->get_self());
+ body_remove_collision_exception(body_b->get_self(), body_a->get_self());
+ }
+ }
+}
+
+bool PhysicsServer3DSW::joint_is_disabled_collisions_between_bodies(RID p_joint) const {
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, true);
+
+ return joint->is_disabled_collisions_between_bodies();
+}
+
+PhysicsServer3DSW::JointType PhysicsServer3DSW::joint_get_type(RID p_joint) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, JOINT_PIN);
+ return joint->get_type();
+}
+
+RID PhysicsServer3DSW::joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(SliderJoint3DSW(body_A, body_B, p_local_frame_A, p_local_frame_B));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+void PhysicsServer3DSW::slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_SLIDER);
+ SliderJoint3DSW *slider_joint = static_cast<SliderJoint3DSW *>(joint);
+ slider_joint->set_param(p_param, p_value);
+}
+real_t PhysicsServer3DSW::slider_joint_get_param(RID p_joint, SliderJointParam p_param) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_CONE_TWIST, 0);
+ SliderJoint3DSW *slider_joint = static_cast<SliderJoint3DSW *>(joint);
+ return slider_joint->get_param(p_param);
+}
+
+RID PhysicsServer3DSW::joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(ConeTwistJoint3DSW(body_A, body_B, p_local_frame_A, p_local_frame_B));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+void PhysicsServer3DSW::cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_CONE_TWIST);
+ ConeTwistJoint3DSW *cone_twist_joint = static_cast<ConeTwistJoint3DSW *>(joint);
+ cone_twist_joint->set_param(p_param, p_value);
+}
+real_t PhysicsServer3DSW::cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_CONE_TWIST, 0);
+ ConeTwistJoint3DSW *cone_twist_joint = static_cast<ConeTwistJoint3DSW *>(joint);
+ return cone_twist_joint->get_param(p_param);
+}
+
+RID PhysicsServer3DSW::joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) {
+
+ Body3DSW *body_A = body_owner.getornull(p_body_A);
+ ERR_FAIL_COND_V(!body_A, RID());
+
+ if (!p_body_B.is_valid()) {
+ ERR_FAIL_COND_V(!body_A->get_space(), RID());
+ p_body_B = body_A->get_space()->get_static_global_body();
+ }
+
+ Body3DSW *body_B = body_owner.getornull(p_body_B);
+ ERR_FAIL_COND_V(!body_B, RID());
+
+ ERR_FAIL_COND_V(body_A == body_B, RID());
+
+ Joint3DSW *joint = memnew(Generic6DOFJoint3DSW(body_A, body_B, p_local_frame_A, p_local_frame_B, true));
+ RID rid = joint_owner.make_rid(joint);
+ joint->set_self(rid);
+ return rid;
+}
+
+void PhysicsServer3DSW::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
+ Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint);
+ generic_6dof_joint->set_param(p_axis, p_param, p_value);
+}
+real_t PhysicsServer3DSW::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, 0);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0);
+ Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint);
+ return generic_6dof_joint->get_param(p_axis, p_param);
+}
+
+void PhysicsServer3DSW::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND(!joint);
+ ERR_FAIL_COND(joint->get_type() != JOINT_6DOF);
+ Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint);
+ generic_6dof_joint->set_flag(p_axis, p_flag, p_enable);
+}
+bool PhysicsServer3DSW::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_joint);
+ ERR_FAIL_COND_V(!joint, false);
+ ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, false);
+ Generic6DOFJoint3DSW *generic_6dof_joint = static_cast<Generic6DOFJoint3DSW *>(joint);
+ return generic_6dof_joint->get_flag(p_axis, p_flag);
+}
+
+void PhysicsServer3DSW::free(RID p_rid) {
+
+ _update_shapes(); //just in case
+
+ if (shape_owner.owns(p_rid)) {
+
+ Shape3DSW *shape = shape_owner.getornull(p_rid);
+
+ while (shape->get_owners().size()) {
+ ShapeOwner3DSW *so = shape->get_owners().front()->key();
+ so->remove_shape(shape);
+ }
+
+ shape_owner.free(p_rid);
+ memdelete(shape);
+ } else if (body_owner.owns(p_rid)) {
+
+ Body3DSW *body = body_owner.getornull(p_rid);
+
+ /*
+ if (body->get_state_query())
+ _clear_query(body->get_state_query());
+
+ if (body->get_direct_state_query())
+ _clear_query(body->get_direct_state_query());
+ */
+
+ body->set_space(NULL);
+
+ while (body->get_shape_count()) {
+
+ body->remove_shape(0);
+ }
+
+ body_owner.free(p_rid);
+ memdelete(body);
+
+ } else if (area_owner.owns(p_rid)) {
+
+ Area3DSW *area = area_owner.getornull(p_rid);
+
+ /*
+ if (area->get_monitor_query())
+ _clear_query(area->get_monitor_query());
+ */
+
+ area->set_space(NULL);
+
+ while (area->get_shape_count()) {
+
+ area->remove_shape(0);
+ }
+
+ area_owner.free(p_rid);
+ memdelete(area);
+ } else if (space_owner.owns(p_rid)) {
+
+ Space3DSW *space = space_owner.getornull(p_rid);
+
+ while (space->get_objects().size()) {
+ CollisionObject3DSW *co = (CollisionObject3DSW *)space->get_objects().front()->get();
+ co->set_space(NULL);
+ }
+
+ active_spaces.erase(space);
+ free(space->get_default_area()->get_self());
+ free(space->get_static_global_body());
+
+ space_owner.free(p_rid);
+ memdelete(space);
+ } else if (joint_owner.owns(p_rid)) {
+
+ Joint3DSW *joint = joint_owner.getornull(p_rid);
+
+ for (int i = 0; i < joint->get_body_count(); i++) {
+
+ joint->get_body_ptr()[i]->remove_constraint(joint);
+ }
+ joint_owner.free(p_rid);
+ memdelete(joint);
+
+ } else {
+
+ ERR_FAIL_MSG("Invalid ID.");
+ }
+};
+
+void PhysicsServer3DSW::set_active(bool p_active) {
+
+ active = p_active;
+};
+
+void PhysicsServer3DSW::init() {
+
+ doing_sync = true;
+ last_step = 0.001;
+ iterations = 8; // 8?
+ stepper = memnew(Step3DSW);
+ direct_state = memnew(PhysicsDirectBodyState3DSW);
+};
+
+void PhysicsServer3DSW::step(real_t p_step) {
+
+#ifndef _3D_DISABLED
+
+ if (!active)
+ return;
+
+ _update_shapes();
+
+ doing_sync = false;
+
+ last_step = p_step;
+ PhysicsDirectBodyState3DSW::singleton->step = p_step;
+
+ island_count = 0;
+ active_objects = 0;
+ collision_pairs = 0;
+ for (Set<const Space3DSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
+
+ stepper->step((Space3DSW *)E->get(), p_step, iterations);
+ island_count += E->get()->get_island_count();
+ active_objects += E->get()->get_active_objects();
+ collision_pairs += E->get()->get_collision_pairs();
+ }
+#endif
+}
+
+void PhysicsServer3DSW::sync(){
+
+};
+
+void PhysicsServer3DSW::flush_queries() {
+
+#ifndef _3D_DISABLED
+
+ if (!active)
+ return;
+
+ doing_sync = true;
+
+ flushing_queries = true;
+
+ uint64_t time_beg = OS::get_singleton()->get_ticks_usec();
+
+ for (Set<const Space3DSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
+
+ Space3DSW *space = (Space3DSW *)E->get();
+ space->call_queries();
+ }
+
+ flushing_queries = false;
+
+ if (EngineDebugger::is_profiling("servers")) {
+
+ uint64_t total_time[Space3DSW::ELAPSED_TIME_MAX];
+ static const char *time_name[Space3DSW::ELAPSED_TIME_MAX] = {
+ "integrate_forces",
+ "generate_islands",
+ "setup_constraints",
+ "solve_constraints",
+ "integrate_velocities"
+ };
+
+ for (int i = 0; i < Space3DSW::ELAPSED_TIME_MAX; i++) {
+ total_time[i] = 0;
+ }
+
+ for (Set<const Space3DSW *>::Element *E = active_spaces.front(); E; E = E->next()) {
+
+ for (int i = 0; i < Space3DSW::ELAPSED_TIME_MAX; i++) {
+ total_time[i] += E->get()->get_elapsed_time(Space3DSW::ElapsedTime(i));
+ }
+ }
+
+ Array values;
+ values.resize(Space3DSW::ELAPSED_TIME_MAX * 2);
+ for (int i = 0; i < Space3DSW::ELAPSED_TIME_MAX; i++) {
+ values[i * 2 + 0] = time_name[i];
+ values[i * 2 + 1] = USEC_TO_SEC(total_time[i]);
+ }
+ values.push_back("flush_queries");
+ values.push_back(USEC_TO_SEC(OS::get_singleton()->get_ticks_usec() - time_beg));
+
+ values.push_front("physics");
+ EngineDebugger::profiler_add_frame_data("server", values);
+ }
+#endif
+};
+
+void PhysicsServer3DSW::finish() {
+
+ memdelete(stepper);
+ memdelete(direct_state);
+};
+
+int PhysicsServer3DSW::get_process_info(ProcessInfo p_info) {
+
+ switch (p_info) {
+
+ case INFO_ACTIVE_OBJECTS: {
+
+ return active_objects;
+ } break;
+ case INFO_COLLISION_PAIRS: {
+ return collision_pairs;
+ } break;
+ case INFO_ISLAND_COUNT: {
+
+ return island_count;
+ } break;
+ }
+
+ return 0;
+}
+
+void PhysicsServer3DSW::_update_shapes() {
+
+ while (pending_shape_update_list.first()) {
+ pending_shape_update_list.first()->self()->_shape_changed();
+ pending_shape_update_list.remove(pending_shape_update_list.first());
+ }
+}
+
+void PhysicsServer3DSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_point_B, void *p_userdata) {
+
+ CollCbkData *cbk = (CollCbkData *)p_userdata;
+
+ if (cbk->max == 0)
+ return;
+
+ if (cbk->amount == cbk->max) {
+ //find least deep
+ real_t min_depth = 1e20;
+ int min_depth_idx = 0;
+ for (int i = 0; i < cbk->amount; i++) {
+
+ real_t d = cbk->ptr[i * 2 + 0].distance_squared_to(cbk->ptr[i * 2 + 1]);
+ if (d < min_depth) {
+ min_depth = d;
+ min_depth_idx = i;
+ }
+ }
+
+ real_t d = p_point_A.distance_squared_to(p_point_B);
+ if (d < min_depth)
+ return;
+ cbk->ptr[min_depth_idx * 2 + 0] = p_point_A;
+ cbk->ptr[min_depth_idx * 2 + 1] = p_point_B;
+
+ } else {
+
+ cbk->ptr[cbk->amount * 2 + 0] = p_point_A;
+ cbk->ptr[cbk->amount * 2 + 1] = p_point_B;
+ cbk->amount++;
+ }
+}
+
+PhysicsServer3DSW *PhysicsServer3DSW::singleton = NULL;
+PhysicsServer3DSW::PhysicsServer3DSW() {
+ singleton = this;
+ BroadPhase3DSW::create_func = BroadPhaseOctree::_create;
+ island_count = 0;
+ active_objects = 0;
+ collision_pairs = 0;
+
+ active = true;
+ flushing_queries = false;
+};
+
+PhysicsServer3DSW::~PhysicsServer3DSW(){
+
+};
diff --git a/servers/physics/physics_server_sw.h b/servers/physics_3d/physics_server_3d_sw.h
index 459c7688f0..7f0cd0ba9f 100644
--- a/servers/physics/physics_server_sw.h
+++ b/servers/physics_3d/physics_server_3d_sw.h
@@ -32,17 +32,17 @@
#define PHYSICS_SERVER_SW
#include "core/rid_owner.h"
-#include "joints_sw.h"
-#include "servers/physics_server.h"
-#include "shape_sw.h"
-#include "space_sw.h"
-#include "step_sw.h"
+#include "joints_3d_sw.h"
+#include "servers/physics_server_3d.h"
+#include "shape_3d_sw.h"
+#include "space_3d_sw.h"
+#include "step_3d_sw.h"
-class PhysicsServerSW : public PhysicsServer {
+class PhysicsServer3DSW : public PhysicsServer3D {
- GDCLASS(PhysicsServerSW, PhysicsServer);
+ GDCLASS(PhysicsServer3DSW, PhysicsServer3D);
- friend class PhysicsDirectSpaceStateSW;
+ friend class PhysicsDirectSpaceState3DSW;
bool active;
int iterations;
bool doing_sync;
@@ -54,24 +54,24 @@ class PhysicsServerSW : public PhysicsServer {
bool flushing_queries;
- StepSW *stepper;
- Set<const SpaceSW *> active_spaces;
+ Step3DSW *stepper;
+ Set<const Space3DSW *> active_spaces;
- PhysicsDirectBodyStateSW *direct_state;
+ PhysicsDirectBodyState3DSW *direct_state;
- mutable RID_PtrOwner<ShapeSW> shape_owner;
- mutable RID_PtrOwner<SpaceSW> space_owner;
- mutable RID_PtrOwner<AreaSW> area_owner;
- mutable RID_PtrOwner<BodySW> body_owner;
- mutable RID_PtrOwner<JointSW> joint_owner;
+ mutable RID_PtrOwner<Shape3DSW> shape_owner;
+ mutable RID_PtrOwner<Space3DSW> space_owner;
+ mutable RID_PtrOwner<Area3DSW> area_owner;
+ mutable RID_PtrOwner<Body3DSW> body_owner;
+ mutable RID_PtrOwner<Joint3DSW> joint_owner;
//void _clear_query(QuerySW *p_query);
- friend class CollisionObjectSW;
- SelfList<CollisionObjectSW>::List pending_shape_update_list;
+ friend class CollisionObject3DSW;
+ SelfList<CollisionObject3DSW>::List pending_shape_update_list;
void _update_shapes();
public:
- static PhysicsServerSW *singleton;
+ static PhysicsServer3DSW *singleton;
struct CollCbkData {
@@ -104,7 +104,7 @@ public:
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const;
// this function only works on physics process, errors and returns null otherwise
- virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space);
+ virtual PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space);
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts);
virtual Vector<Vector3> space_get_contacts(RID p_space) const;
@@ -241,13 +241,13 @@ public:
virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
// this function only works on physics process, errors and returns null otherwise
- virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body);
+ virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body);
/* SOFT BODY */
virtual RID soft_body_create(bool p_init_sleeping = false) { return RID(); }
- virtual void soft_body_update_visual_server(RID p_body, class SoftBodyVisualServerHandler *p_visual_server_handler) {}
+ virtual void soft_body_update_rendering_server(RID p_body, class SoftBodyRenderingServerHandler *p_rendering_server_handler) {}
virtual void soft_body_set_space(RID p_body, RID p_space) {}
virtual RID soft_body_get_space(RID p_body) const { return RID(); }
@@ -375,8 +375,8 @@ public:
int get_process_info(ProcessInfo p_info);
- PhysicsServerSW();
- ~PhysicsServerSW();
+ PhysicsServer3DSW();
+ ~PhysicsServer3DSW();
};
#endif
diff --git a/servers/physics/shape_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp
index 4a6ed6be58..53b162636e 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics_3d/shape_3d_sw.cpp
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "shape_sw.h"
+#include "shape_3d_sw.h"
#include "core/math/geometry.h"
#include "core/math/quick_hull.h"
@@ -38,16 +38,16 @@
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.0002
#define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.9998
-void ShapeSW::configure(const AABB &p_aabb) {
+void Shape3DSW::configure(const AABB &p_aabb) {
aabb = p_aabb;
configured = true;
- for (Map<ShapeOwnerSW *, int>::Element *E = owners.front(); E; E = E->next()) {
- ShapeOwnerSW *co = (ShapeOwnerSW *)E->key();
+ for (Map<ShapeOwner3DSW *, int>::Element *E = owners.front(); E; E = E->next()) {
+ ShapeOwner3DSW *co = (ShapeOwner3DSW *)E->key();
co->_shape_changed();
}
}
-Vector3 ShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 Shape3DSW::get_support(const Vector3 &p_normal) const {
Vector3 res;
int amnt;
@@ -55,9 +55,9 @@ Vector3 ShapeSW::get_support(const Vector3 &p_normal) const {
return res;
}
-void ShapeSW::add_owner(ShapeOwnerSW *p_owner) {
+void Shape3DSW::add_owner(ShapeOwner3DSW *p_owner) {
- Map<ShapeOwnerSW *, int>::Element *E = owners.find(p_owner);
+ Map<ShapeOwner3DSW *, int>::Element *E = owners.find(p_owner);
if (E) {
E->get()++;
} else {
@@ -65,9 +65,9 @@ void ShapeSW::add_owner(ShapeOwnerSW *p_owner) {
}
}
-void ShapeSW::remove_owner(ShapeOwnerSW *p_owner) {
+void Shape3DSW::remove_owner(ShapeOwner3DSW *p_owner) {
- Map<ShapeOwnerSW *, int>::Element *E = owners.find(p_owner);
+ Map<ShapeOwner3DSW *, int>::Element *E = owners.find(p_owner);
ERR_FAIL_COND(!E);
E->get()--;
if (E->get() == 0) {
@@ -75,44 +75,44 @@ void ShapeSW::remove_owner(ShapeOwnerSW *p_owner) {
}
}
-bool ShapeSW::is_owner(ShapeOwnerSW *p_owner) const {
+bool Shape3DSW::is_owner(ShapeOwner3DSW *p_owner) const {
return owners.has(p_owner);
}
-const Map<ShapeOwnerSW *, int> &ShapeSW::get_owners() const {
+const Map<ShapeOwner3DSW *, int> &Shape3DSW::get_owners() const {
return owners;
}
-ShapeSW::ShapeSW() {
+Shape3DSW::Shape3DSW() {
custom_bias = 0;
configured = false;
}
-ShapeSW::~ShapeSW() {
+Shape3DSW::~Shape3DSW() {
ERR_FAIL_COND(owners.size());
}
-Plane PlaneShapeSW::get_plane() const {
+Plane PlaneShape3DSW::get_plane() const {
return plane;
}
-void PlaneShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void PlaneShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
// gibberish, a plane is infinity
r_min = -1e7;
r_max = 1e7;
}
-Vector3 PlaneShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 PlaneShape3DSW::get_support(const Vector3 &p_normal) const {
return p_normal * 1e15;
}
-bool PlaneShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool PlaneShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
bool inters = plane.intersects_segment(p_begin, p_end, &r_result);
if (inters)
@@ -120,12 +120,12 @@ bool PlaneShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_en
return inters;
}
-bool PlaneShapeSW::intersect_point(const Vector3 &p_point) const {
+bool PlaneShape3DSW::intersect_point(const Vector3 &p_point) const {
return plane.distance_to(p_point) < 0;
}
-Vector3 PlaneShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 PlaneShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
if (plane.is_point_over(p_point)) {
return plane.project(p_point);
@@ -134,49 +134,49 @@ Vector3 PlaneShapeSW::get_closest_point_to(const Vector3 &p_point) const {
}
}
-Vector3 PlaneShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 PlaneShape3DSW::get_moment_of_inertia(real_t p_mass) const {
return Vector3(); //wtf
}
-void PlaneShapeSW::_setup(const Plane &p_plane) {
+void PlaneShape3DSW::_setup(const Plane &p_plane) {
plane = p_plane;
configure(AABB(Vector3(-1e4, -1e4, -1e4), Vector3(1e4 * 2, 1e4 * 2, 1e4 * 2)));
}
-void PlaneShapeSW::set_data(const Variant &p_data) {
+void PlaneShape3DSW::set_data(const Variant &p_data) {
_setup(p_data);
}
-Variant PlaneShapeSW::get_data() const {
+Variant PlaneShape3DSW::get_data() const {
return plane;
}
-PlaneShapeSW::PlaneShapeSW() {
+PlaneShape3DSW::PlaneShape3DSW() {
}
//
-real_t RayShapeSW::get_length() const {
+real_t RayShape3DSW::get_length() const {
return length;
}
-bool RayShapeSW::get_slips_on_slope() const {
+bool RayShape3DSW::get_slips_on_slope() const {
return slips_on_slope;
}
-void RayShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void RayShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
// don't think this will be even used
r_min = 0;
r_max = 1;
}
-Vector3 RayShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 RayShape3DSW::get_support(const Vector3 &p_normal) const {
if (p_normal.z > 0)
return Vector3(0, 0, length);
@@ -184,7 +184,7 @@ Vector3 RayShapeSW::get_support(const Vector3 &p_normal) const {
return Vector3(0, 0, 0);
}
-void RayShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void RayShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
if (Math::abs(p_normal.z) < _EDGE_IS_VALID_SUPPORT_THRESHOLD) {
@@ -200,17 +200,17 @@ void RayShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup
}
}
-bool RayShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool RayShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
return false; //simply not possible
}
-bool RayShapeSW::intersect_point(const Vector3 &p_point) const {
+bool RayShape3DSW::intersect_point(const Vector3 &p_point) const {
return false; //simply not possible
}
-Vector3 RayShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 RayShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
Vector3 s[2] = {
Vector3(0, 0, 0),
@@ -220,25 +220,25 @@ Vector3 RayShapeSW::get_closest_point_to(const Vector3 &p_point) const {
return Geometry::get_closest_point_to_segment(p_point, s);
}
-Vector3 RayShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 RayShape3DSW::get_moment_of_inertia(real_t p_mass) const {
return Vector3();
}
-void RayShapeSW::_setup(real_t p_length, bool p_slips_on_slope) {
+void RayShape3DSW::_setup(real_t p_length, bool p_slips_on_slope) {
length = p_length;
slips_on_slope = p_slips_on_slope;
configure(AABB(Vector3(0, 0, 0), Vector3(0.1, 0.1, length)));
}
-void RayShapeSW::set_data(const Variant &p_data) {
+void RayShape3DSW::set_data(const Variant &p_data) {
Dictionary d = p_data;
_setup(d["length"], d["slips_on_slope"]);
}
-Variant RayShapeSW::get_data() const {
+Variant RayShape3DSW::get_data() const {
Dictionary d;
d["length"] = length;
@@ -246,7 +246,7 @@ Variant RayShapeSW::get_data() const {
return d;
}
-RayShapeSW::RayShapeSW() {
+RayShape3DSW::RayShape3DSW() {
length = 1;
slips_on_slope = false;
@@ -254,12 +254,12 @@ RayShapeSW::RayShapeSW() {
/********** SPHERE *************/
-real_t SphereShapeSW::get_radius() const {
+real_t SphereShape3DSW::get_radius() const {
return radius;
}
-void SphereShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void SphereShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
real_t d = p_normal.dot(p_transform.origin);
@@ -271,28 +271,28 @@ void SphereShapeSW::project_range(const Vector3 &p_normal, const Transform &p_tr
r_max = d + (radius)*scale;
}
-Vector3 SphereShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 SphereShape3DSW::get_support(const Vector3 &p_normal) const {
return p_normal * radius;
}
-void SphereShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void SphereShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
*r_supports = p_normal * radius;
r_amount = 1;
}
-bool SphereShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool SphereShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
return Geometry::segment_intersects_sphere(p_begin, p_end, Vector3(), radius, &r_result, &r_normal);
}
-bool SphereShapeSW::intersect_point(const Vector3 &p_point) const {
+bool SphereShape3DSW::intersect_point(const Vector3 &p_point) const {
return p_point.length() < radius;
}
-Vector3 SphereShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 SphereShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
Vector3 p = p_point;
float l = p.length();
@@ -301,36 +301,36 @@ Vector3 SphereShapeSW::get_closest_point_to(const Vector3 &p_point) const {
return (p / l) * radius;
}
-Vector3 SphereShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 SphereShape3DSW::get_moment_of_inertia(real_t p_mass) const {
real_t s = 0.4 * p_mass * radius * radius;
return Vector3(s, s, s);
}
-void SphereShapeSW::_setup(real_t p_radius) {
+void SphereShape3DSW::_setup(real_t p_radius) {
radius = p_radius;
configure(AABB(Vector3(-radius, -radius, -radius), Vector3(radius * 2.0, radius * 2.0, radius * 2.0)));
}
-void SphereShapeSW::set_data(const Variant &p_data) {
+void SphereShape3DSW::set_data(const Variant &p_data) {
_setup(p_data);
}
-Variant SphereShapeSW::get_data() const {
+Variant SphereShape3DSW::get_data() const {
return radius;
}
-SphereShapeSW::SphereShapeSW() {
+SphereShape3DSW::SphereShape3DSW() {
radius = 0;
}
/********** BOX *************/
-void BoxShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void BoxShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
// no matter the angle, the box is mirrored anyway
Vector3 local_normal = p_transform.basis.xform_inv(p_normal);
@@ -342,7 +342,7 @@ void BoxShapeSW::project_range(const Vector3 &p_normal, const Transform &p_trans
r_max = distance + length;
}
-Vector3 BoxShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 BoxShape3DSW::get_support(const Vector3 &p_normal) const {
Vector3 point(
(p_normal.x < 0) ? -half_extents.x : half_extents.x,
@@ -352,7 +352,7 @@ Vector3 BoxShapeSW::get_support(const Vector3 &p_normal) const {
return point;
}
-void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void BoxShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
static const int next[3] = { 1, 2, 0 };
static const int next2[3] = { 2, 0, 1 };
@@ -439,19 +439,19 @@ void BoxShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_sup
r_supports[0] = point;
}
-bool BoxShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool BoxShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
AABB aabb(-half_extents, half_extents * 2.0);
return aabb.intersects_segment(p_begin, p_end, &r_result, &r_normal);
}
-bool BoxShapeSW::intersect_point(const Vector3 &p_point) const {
+bool BoxShape3DSW::intersect_point(const Vector3 &p_point) const {
return (Math::abs(p_point.x) < half_extents.x && Math::abs(p_point.y) < half_extents.y && Math::abs(p_point.z) < half_extents.z);
}
-Vector3 BoxShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 BoxShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
int outside = 0;
Vector3 min_point;
@@ -502,7 +502,7 @@ Vector3 BoxShapeSW::get_closest_point_to(const Vector3 &p_point) const {
return min_point;
}
-Vector3 BoxShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 BoxShape3DSW::get_moment_of_inertia(real_t p_mass) const {
real_t lx = half_extents.x;
real_t ly = half_extents.y;
@@ -511,29 +511,29 @@ Vector3 BoxShapeSW::get_moment_of_inertia(real_t p_mass) const {
return Vector3((p_mass / 3.0) * (ly * ly + lz * lz), (p_mass / 3.0) * (lx * lx + lz * lz), (p_mass / 3.0) * (lx * lx + ly * ly));
}
-void BoxShapeSW::_setup(const Vector3 &p_half_extents) {
+void BoxShape3DSW::_setup(const Vector3 &p_half_extents) {
half_extents = p_half_extents.abs();
configure(AABB(-half_extents, half_extents * 2));
}
-void BoxShapeSW::set_data(const Variant &p_data) {
+void BoxShape3DSW::set_data(const Variant &p_data) {
_setup(p_data);
}
-Variant BoxShapeSW::get_data() const {
+Variant BoxShape3DSW::get_data() const {
return half_extents;
}
-BoxShapeSW::BoxShapeSW() {
+BoxShape3DSW::BoxShape3DSW() {
}
/********** CAPSULE *************/
-void CapsuleShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void CapsuleShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
Vector3 n = p_transform.basis.xform_inv(p_normal).normalized();
real_t h = (n.z > 0) ? height : -height;
@@ -545,7 +545,7 @@ void CapsuleShapeSW::project_range(const Vector3 &p_normal, const Transform &p_t
r_min = p_normal.dot(p_transform.xform(-n));
}
-Vector3 CapsuleShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 CapsuleShape3DSW::get_support(const Vector3 &p_normal) const {
Vector3 n = p_normal;
@@ -556,7 +556,7 @@ Vector3 CapsuleShapeSW::get_support(const Vector3 &p_normal) const {
return n;
}
-void CapsuleShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void CapsuleShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
Vector3 n = p_normal;
@@ -586,7 +586,7 @@ void CapsuleShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r
}
}
-bool CapsuleShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool CapsuleShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
Vector3 norm = (p_end - p_begin).normalized();
real_t min_d = 1e20;
@@ -644,7 +644,7 @@ bool CapsuleShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_
return collision;
}
-bool CapsuleShapeSW::intersect_point(const Vector3 &p_point) const {
+bool CapsuleShape3DSW::intersect_point(const Vector3 &p_point) const {
if (Math::abs(p_point.z) < height * 0.5) {
return Vector3(p_point.x, p_point.y, 0).length() < radius;
@@ -655,7 +655,7 @@ bool CapsuleShapeSW::intersect_point(const Vector3 &p_point) const {
}
}
-Vector3 CapsuleShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 CapsuleShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
Vector3 s[2] = {
Vector3(0, 0, -height * 0.5),
@@ -670,7 +670,7 @@ Vector3 CapsuleShapeSW::get_closest_point_to(const Vector3 &p_point) const {
return p + (p_point - p).normalized() * radius;
}
-Vector3 CapsuleShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 CapsuleShape3DSW::get_moment_of_inertia(real_t p_mass) const {
// use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
@@ -681,14 +681,14 @@ Vector3 CapsuleShapeSW::get_moment_of_inertia(real_t p_mass) const {
(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y));
}
-void CapsuleShapeSW::_setup(real_t p_height, real_t p_radius) {
+void CapsuleShape3DSW::_setup(real_t p_height, real_t p_radius) {
height = p_height;
radius = p_radius;
configure(AABB(Vector3(-radius, -radius, -height * 0.5 - radius), Vector3(radius * 2, radius * 2, height + radius * 2.0)));
}
-void CapsuleShapeSW::set_data(const Variant &p_data) {
+void CapsuleShape3DSW::set_data(const Variant &p_data) {
Dictionary d = p_data;
ERR_FAIL_COND(!d.has("radius"));
@@ -696,7 +696,7 @@ void CapsuleShapeSW::set_data(const Variant &p_data) {
_setup(d["height"], d["radius"]);
}
-Variant CapsuleShapeSW::get_data() const {
+Variant CapsuleShape3DSW::get_data() const {
Dictionary d;
d["radius"] = radius;
@@ -704,14 +704,14 @@ Variant CapsuleShapeSW::get_data() const {
return d;
}
-CapsuleShapeSW::CapsuleShapeSW() {
+CapsuleShape3DSW::CapsuleShape3DSW() {
height = radius = 0;
}
/********** CONVEX POLYGON *************/
-void ConvexPolygonShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void ConvexPolygonShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
int vertex_count = mesh.vertices.size();
if (vertex_count == 0)
@@ -730,7 +730,7 @@ void ConvexPolygonShapeSW::project_range(const Vector3 &p_normal, const Transfor
}
}
-Vector3 ConvexPolygonShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 ConvexPolygonShape3DSW::get_support(const Vector3 &p_normal) const {
Vector3 n = p_normal;
@@ -756,7 +756,7 @@ Vector3 ConvexPolygonShapeSW::get_support(const Vector3 &p_normal) const {
return vrts[vert_support_idx];
}
-void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void ConvexPolygonShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
const Geometry::MeshData::Face *faces = mesh.faces.ptr();
int fc = mesh.faces.size();
@@ -826,7 +826,7 @@ void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vect
r_amount = 1;
}
-bool ConvexPolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool ConvexPolygonShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
const Geometry::MeshData::Face *faces = mesh.faces.ptr();
int fc = mesh.faces.size();
@@ -866,7 +866,7 @@ bool ConvexPolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vecto
return col;
}
-bool ConvexPolygonShapeSW::intersect_point(const Vector3 &p_point) const {
+bool ConvexPolygonShape3DSW::intersect_point(const Vector3 &p_point) const {
const Geometry::MeshData::Face *faces = mesh.faces.ptr();
int fc = mesh.faces.size();
@@ -880,7 +880,7 @@ bool ConvexPolygonShapeSW::intersect_point(const Vector3 &p_point) const {
return true;
}
-Vector3 ConvexPolygonShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 ConvexPolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
const Geometry::MeshData::Face *faces = mesh.faces.ptr();
int fc = mesh.faces.size();
@@ -941,7 +941,7 @@ Vector3 ConvexPolygonShapeSW::get_closest_point_to(const Vector3 &p_point) const
return min_point;
}
-Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 ConvexPolygonShape3DSW::get_moment_of_inertia(real_t p_mass) const {
// use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
@@ -952,7 +952,7 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y));
}
-void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
+void ConvexPolygonShape3DSW::_setup(const Vector<Vector3> &p_vertices) {
Error err = QuickHull::build(p_vertices, mesh);
if (err != OK)
@@ -971,22 +971,22 @@ void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
configure(_aabb);
}
-void ConvexPolygonShapeSW::set_data(const Variant &p_data) {
+void ConvexPolygonShape3DSW::set_data(const Variant &p_data) {
_setup(p_data);
}
-Variant ConvexPolygonShapeSW::get_data() const {
+Variant ConvexPolygonShape3DSW::get_data() const {
return mesh.vertices;
}
-ConvexPolygonShapeSW::ConvexPolygonShapeSW() {
+ConvexPolygonShape3DSW::ConvexPolygonShape3DSW() {
}
/********** FACE POLYGON *************/
-void FaceShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void FaceShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
for (int i = 0; i < 3; i++) {
@@ -1001,7 +1001,7 @@ void FaceShapeSW::project_range(const Vector3 &p_normal, const Transform &p_tran
}
}
-Vector3 FaceShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 FaceShape3DSW::get_support(const Vector3 &p_normal) const {
int vert_support_idx = -1;
real_t support_max = 0;
@@ -1019,7 +1019,7 @@ Vector3 FaceShapeSW::get_support(const Vector3 &p_normal) const {
return vertex[vert_support_idx];
}
-void FaceShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
+void FaceShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const {
Vector3 n = p_normal;
@@ -1073,7 +1073,7 @@ void FaceShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_su
r_supports[0] = vertex[vert_support_idx];
}
-bool FaceShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool FaceShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
bool c = Geometry::segment_intersects_triangle(p_begin, p_end, vertex[0], vertex[1], vertex[2], &r_result);
if (c) {
@@ -1086,27 +1086,27 @@ bool FaceShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end
return c;
}
-bool FaceShapeSW::intersect_point(const Vector3 &p_point) const {
+bool FaceShape3DSW::intersect_point(const Vector3 &p_point) const {
return false; //face is flat
}
-Vector3 FaceShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 FaceShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
return Face3(vertex[0], vertex[1], vertex[2]).get_closest_point_to(p_point);
}
-Vector3 FaceShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 FaceShape3DSW::get_moment_of_inertia(real_t p_mass) const {
return Vector3(); // Sorry, but i don't think anyone cares, FaceShape!
}
-FaceShapeSW::FaceShapeSW() {
+FaceShape3DSW::FaceShape3DSW() {
configure(AABB());
}
-Vector<Vector3> ConcavePolygonShapeSW::get_faces() const {
+Vector<Vector3> ConcavePolygonShape3DSW::get_faces() const {
Vector<Vector3> rfaces;
rfaces.resize(faces.size() * 3);
@@ -1124,7 +1124,7 @@ Vector<Vector3> ConcavePolygonShapeSW::get_faces() const {
return rfaces;
}
-void ConcavePolygonShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void ConcavePolygonShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
int count = vertices.size();
if (count == 0) {
@@ -1145,7 +1145,7 @@ void ConcavePolygonShapeSW::project_range(const Vector3 &p_normal, const Transfo
}
}
-Vector3 ConcavePolygonShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 ConcavePolygonShape3DSW::get_support(const Vector3 &p_normal) const {
int count = vertices.size();
if (count == 0)
@@ -1171,7 +1171,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3 &p_normal) const {
return vptr[vert_support_idx];
}
-void ConcavePolygonShapeSW::_cull_segment(int p_idx, _SegmentCullParams *p_params) const {
+void ConcavePolygonShape3DSW::_cull_segment(int p_idx, _SegmentCullParams *p_params) const {
const BVH *bvh = &p_params->bvh[p_idx];
@@ -1223,7 +1223,7 @@ void ConcavePolygonShapeSW::_cull_segment(int p_idx, _SegmentCullParams *p_param
}
}
-bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
+bool ConcavePolygonShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_result, Vector3 &r_normal) const {
if (faces.size() == 0)
return false;
@@ -1258,17 +1258,17 @@ bool ConcavePolygonShapeSW::intersect_segment(const Vector3 &p_begin, const Vect
}
}
-bool ConcavePolygonShapeSW::intersect_point(const Vector3 &p_point) const {
+bool ConcavePolygonShape3DSW::intersect_point(const Vector3 &p_point) const {
return false; //face is flat
}
-Vector3 ConcavePolygonShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 ConcavePolygonShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
return Vector3();
}
-void ConcavePolygonShapeSW::_cull(int p_idx, _CullParams *p_params) const {
+void ConcavePolygonShape3DSW::_cull(int p_idx, _CullParams *p_params) const {
const BVH *bvh = &p_params->bvh[p_idx];
@@ -1278,7 +1278,7 @@ void ConcavePolygonShapeSW::_cull(int p_idx, _CullParams *p_params) const {
if (bvh->face_index >= 0) {
const Face *f = &p_params->faces[bvh->face_index];
- FaceShapeSW *face = p_params->face;
+ FaceShape3DSW *face = p_params->face;
face->normal = f->normal;
face->vertex[0] = p_params->vertices[f->indices[0]];
face->vertex[1] = p_params->vertices[f->indices[1]];
@@ -1299,7 +1299,7 @@ void ConcavePolygonShapeSW::_cull(int p_idx, _CullParams *p_params) const {
}
}
-void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
+void ConcavePolygonShape3DSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
// make matrix local to concave
if (faces.size() == 0)
@@ -1312,7 +1312,7 @@ void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback,
const Vector3 *vr = vertices.ptr();
const BVH *br = bvh.ptr();
- FaceShapeSW face; // use this to send in the callback
+ FaceShape3DSW face; // use this to send in the callback
_CullParams params;
params.aabb = local_aabb;
@@ -1327,7 +1327,7 @@ void ConcavePolygonShapeSW::cull(const AABB &p_local_aabb, Callback p_callback,
_cull(0, &params);
}
-Vector3 ConcavePolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 ConcavePolygonShape3DSW::get_moment_of_inertia(real_t p_mass) const {
// use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
@@ -1433,7 +1433,7 @@ _VolumeSW_BVH *_volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements, int p_siz
return bvh;
}
-void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_array, int &p_idx) {
+void ConcavePolygonShape3DSW::_fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_array, int &p_idx) {
int idx = p_idx;
@@ -1462,7 +1462,7 @@ void ConcavePolygonShapeSW::_fill_bvh(_VolumeSW_BVH *p_bvh_tree, BVH *p_bvh_arra
memdelete(p_bvh_tree);
}
-void ConcavePolygonShapeSW::_setup(Vector<Vector3> p_faces) {
+void ConcavePolygonShape3DSW::_setup(Vector<Vector3> p_faces) {
int src_face_count = p_faces.size();
if (src_face_count == 0) {
@@ -1521,68 +1521,68 @@ void ConcavePolygonShapeSW::_setup(Vector<Vector3> p_faces) {
configure(_aabb); // this type of shape has no margin
}
-void ConcavePolygonShapeSW::set_data(const Variant &p_data) {
+void ConcavePolygonShape3DSW::set_data(const Variant &p_data) {
_setup(p_data);
}
-Variant ConcavePolygonShapeSW::get_data() const {
+Variant ConcavePolygonShape3DSW::get_data() const {
return get_faces();
}
-ConcavePolygonShapeSW::ConcavePolygonShapeSW() {
+ConcavePolygonShape3DSW::ConcavePolygonShape3DSW() {
}
/* HEIGHT MAP SHAPE */
-Vector<real_t> HeightMapShapeSW::get_heights() const {
+Vector<real_t> HeightMapShape3DSW::get_heights() const {
return heights;
}
-int HeightMapShapeSW::get_width() const {
+int HeightMapShape3DSW::get_width() const {
return width;
}
-int HeightMapShapeSW::get_depth() const {
+int HeightMapShape3DSW::get_depth() const {
return depth;
}
-real_t HeightMapShapeSW::get_cell_size() const {
+real_t HeightMapShape3DSW::get_cell_size() const {
return cell_size;
}
-void HeightMapShapeSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
+void HeightMapShape3DSW::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
//not very useful, but not very used either
p_transform.xform(get_aabb()).project_range_in_plane(Plane(p_normal, 0), r_min, r_max);
}
-Vector3 HeightMapShapeSW::get_support(const Vector3 &p_normal) const {
+Vector3 HeightMapShape3DSW::get_support(const Vector3 &p_normal) const {
//not very useful, but not very used either
return get_aabb().get_support(p_normal);
}
-bool HeightMapShapeSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const {
+bool HeightMapShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 &r_point, Vector3 &r_normal) const {
return false;
}
-bool HeightMapShapeSW::intersect_point(const Vector3 &p_point) const {
+bool HeightMapShape3DSW::intersect_point(const Vector3 &p_point) const {
return false;
}
-Vector3 HeightMapShapeSW::get_closest_point_to(const Vector3 &p_point) const {
+Vector3 HeightMapShape3DSW::get_closest_point_to(const Vector3 &p_point) const {
return Vector3();
}
-void HeightMapShapeSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
+void HeightMapShape3DSW::cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const {
}
-Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const {
+Vector3 HeightMapShape3DSW::get_moment_of_inertia(real_t p_mass) const {
// use bad AABB approximation
Vector3 extents = get_aabb().size * 0.5;
@@ -1593,7 +1593,7 @@ Vector3 HeightMapShapeSW::get_moment_of_inertia(real_t p_mass) const {
(p_mass / 3.0) * (extents.y * extents.y + extents.y * extents.y));
}
-void HeightMapShapeSW::_setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) {
+void HeightMapShape3DSW::_setup(Vector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) {
heights = p_heights;
width = p_width;
@@ -1621,7 +1621,7 @@ void HeightMapShapeSW::_setup(Vector<real_t> p_heights, int p_width, int p_depth
configure(aabb);
}
-void HeightMapShapeSW::set_data(const Variant &p_data) {
+void HeightMapShape3DSW::set_data(const Variant &p_data) {
ERR_FAIL_COND(p_data.get_type() != Variant::DICTIONARY);
Dictionary d = p_data;
@@ -1642,12 +1642,12 @@ void HeightMapShapeSW::set_data(const Variant &p_data) {
_setup(heights, width, depth, cell_size);
}
-Variant HeightMapShapeSW::get_data() const {
+Variant HeightMapShape3DSW::get_data() const {
ERR_FAIL_V(Variant());
}
-HeightMapShapeSW::HeightMapShapeSW() {
+HeightMapShape3DSW::HeightMapShape3DSW() {
width = 0;
depth = 0;
diff --git a/servers/physics/shape_sw.h b/servers/physics_3d/shape_3d_sw.h
index eaae64be66..f10bd0771b 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics_3d/shape_3d_sw.h
@@ -32,7 +32,7 @@
#define SHAPE_SW_H
#include "core/math/geometry.h"
-#include "servers/physics_server.h"
+#include "servers/physics_server_3d.h"
/*
SHAPE_LINE, ///< plane:"plane"
@@ -45,24 +45,24 @@ SHAPE_CUSTOM, ///< Server-Implementation based custom shape, calling shape_creat
*/
-class ShapeSW;
+class Shape3DSW;
-class ShapeOwnerSW {
+class ShapeOwner3DSW {
public:
virtual void _shape_changed() = 0;
- virtual void remove_shape(ShapeSW *p_shape) = 0;
+ virtual void remove_shape(Shape3DSW *p_shape) = 0;
- virtual ~ShapeOwnerSW() {}
+ virtual ~ShapeOwner3DSW() {}
};
-class ShapeSW {
+class Shape3DSW {
RID self;
AABB aabb;
bool configured;
real_t custom_bias;
- Map<ShapeOwnerSW *, int> owners;
+ Map<ShapeOwner3DSW *, int> owners;
protected:
void configure(const AABB &p_aabb);
@@ -77,7 +77,7 @@ public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
_FORCE_INLINE_ RID get_self() const { return self; }
- virtual PhysicsServer::ShapeType get_type() const = 0;
+ virtual PhysicsServer3D::ShapeType get_type() const = 0;
_FORCE_INLINE_ AABB get_aabb() const { return aabb; }
_FORCE_INLINE_ bool is_configured() const { return configured; }
@@ -98,28 +98,28 @@ public:
_FORCE_INLINE_ void set_custom_bias(real_t p_bias) { custom_bias = p_bias; }
_FORCE_INLINE_ real_t get_custom_bias() const { return custom_bias; }
- void add_owner(ShapeOwnerSW *p_owner);
- void remove_owner(ShapeOwnerSW *p_owner);
- bool is_owner(ShapeOwnerSW *p_owner) const;
- const Map<ShapeOwnerSW *, int> &get_owners() const;
+ void add_owner(ShapeOwner3DSW *p_owner);
+ void remove_owner(ShapeOwner3DSW *p_owner);
+ bool is_owner(ShapeOwner3DSW *p_owner) const;
+ const Map<ShapeOwner3DSW *, int> &get_owners() const;
- ShapeSW();
- virtual ~ShapeSW();
+ Shape3DSW();
+ virtual ~Shape3DSW();
};
-class ConcaveShapeSW : public ShapeSW {
+class ConcaveShape3DSW : public Shape3DSW {
public:
virtual bool is_concave() const { return true; }
- typedef void (*Callback)(void *p_userdata, ShapeSW *p_convex);
+ typedef void (*Callback)(void *p_userdata, Shape3DSW *p_convex);
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const { r_amount = 0; }
virtual void cull(const AABB &p_local_aabb, Callback p_callback, void *p_userdata) const = 0;
- ConcaveShapeSW() {}
+ ConcaveShape3DSW() {}
};
-class PlaneShapeSW : public ShapeSW {
+class PlaneShape3DSW : public Shape3DSW {
Plane plane;
@@ -129,7 +129,7 @@ public:
Plane get_plane() const;
virtual real_t get_area() const { return Math_INF; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_PLANE; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_PLANE; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const { r_amount = 0; }
@@ -142,10 +142,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- PlaneShapeSW();
+ PlaneShape3DSW();
};
-class RayShapeSW : public ShapeSW {
+class RayShape3DSW : public Shape3DSW {
real_t length;
bool slips_on_slope;
@@ -157,7 +157,7 @@ public:
bool get_slips_on_slope() const;
virtual real_t get_area() const { return 0.0; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_RAY; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_RAY; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
virtual void get_supports(const Vector3 &p_normal, int p_max, Vector3 *r_supports, int &r_amount) const;
@@ -171,10 +171,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- RayShapeSW();
+ RayShape3DSW();
};
-class SphereShapeSW : public ShapeSW {
+class SphereShape3DSW : public Shape3DSW {
real_t radius;
@@ -185,7 +185,7 @@ public:
virtual real_t get_area() const { return 4.0 / 3.0 * Math_PI * radius * radius * radius; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_SPHERE; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_SPHERE; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -199,10 +199,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- SphereShapeSW();
+ SphereShape3DSW();
};
-class BoxShapeSW : public ShapeSW {
+class BoxShape3DSW : public Shape3DSW {
Vector3 half_extents;
void _setup(const Vector3 &p_half_extents);
@@ -211,7 +211,7 @@ public:
_FORCE_INLINE_ Vector3 get_half_extents() const { return half_extents; }
virtual real_t get_area() const { return 8 * half_extents.x * half_extents.y * half_extents.z; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_BOX; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_BOX; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -225,10 +225,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- BoxShapeSW();
+ BoxShape3DSW();
};
-class CapsuleShapeSW : public ShapeSW {
+class CapsuleShape3DSW : public Shape3DSW {
real_t height;
real_t radius;
@@ -241,7 +241,7 @@ public:
virtual real_t get_area() const { return 4.0 / 3.0 * Math_PI * radius * radius * radius + height * Math_PI * radius * radius; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CAPSULE; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CAPSULE; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -255,10 +255,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- CapsuleShapeSW();
+ CapsuleShape3DSW();
};
-struct ConvexPolygonShapeSW : public ShapeSW {
+struct ConvexPolygonShape3DSW : public Shape3DSW {
Geometry::MeshData mesh;
@@ -267,7 +267,7 @@ struct ConvexPolygonShapeSW : public ShapeSW {
public:
const Geometry::MeshData &get_mesh() const { return mesh; }
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONVEX_POLYGON; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CONVEX_POLYGON; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -281,13 +281,13 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- ConvexPolygonShapeSW();
+ ConvexPolygonShape3DSW();
};
struct _VolumeSW_BVH;
-struct FaceShapeSW;
+struct FaceShape3DSW;
-struct ConcavePolygonShapeSW : public ConcaveShapeSW {
+struct ConcavePolygonShape3DSW : public ConcaveShape3DSW {
// always a trimesh
struct Face {
@@ -318,7 +318,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
const Face *faces;
const Vector3 *vertices;
const BVH *bvh;
- FaceShapeSW *face;
+ FaceShape3DSW *face;
};
struct _SegmentCullParams {
@@ -346,7 +346,7 @@ struct ConcavePolygonShapeSW : public ConcaveShapeSW {
public:
Vector<Vector3> get_faces() const;
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CONCAVE_POLYGON; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -362,10 +362,10 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- ConcavePolygonShapeSW();
+ ConcavePolygonShape3DSW();
};
-struct HeightMapShapeSW : public ConcaveShapeSW {
+struct HeightMapShape3DSW : public ConcaveShape3DSW {
Vector<real_t> heights;
int width;
@@ -383,7 +383,7 @@ public:
int get_depth() const;
real_t get_cell_size() const;
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_HEIGHTMAP; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_HEIGHTMAP; }
virtual void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
virtual Vector3 get_support(const Vector3 &p_normal) const;
@@ -398,16 +398,16 @@ public:
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;
- HeightMapShapeSW();
+ HeightMapShape3DSW();
};
//used internally
-struct FaceShapeSW : public ShapeSW {
+struct FaceShape3DSW : public Shape3DSW {
Vector3 normal; //cache
Vector3 vertex[3];
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONCAVE_POLYGON; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CONCAVE_POLYGON; }
const Vector3 &get_vertex(int p_idx) const { return vertex[p_idx]; }
@@ -423,15 +423,15 @@ struct FaceShapeSW : public ShapeSW {
virtual void set_data(const Variant &p_data) {}
virtual Variant get_data() const { return Variant(); }
- FaceShapeSW();
+ FaceShape3DSW();
};
-struct MotionShapeSW : public ShapeSW {
+struct MotionShape3DSW : public Shape3DSW {
- ShapeSW *shape;
+ Shape3DSW *shape;
Vector3 motion;
- virtual PhysicsServer::ShapeType get_type() const { return PhysicsServer::SHAPE_CONVEX_POLYGON; }
+ virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_CONVEX_POLYGON; }
void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
@@ -464,7 +464,7 @@ struct MotionShapeSW : public ShapeSW {
virtual void set_data(const Variant &p_data) {}
virtual Variant get_data() const { return Variant(); }
- MotionShapeSW() { configure(AABB()); }
+ MotionShape3DSW() { configure(AABB()); }
};
#endif // SHAPE_SW_H
diff --git a/servers/physics/space_sw.cpp b/servers/physics_3d/space_3d_sw.cpp
index 110520db5a..e7b2c7bfd7 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics_3d/space_3d_sw.cpp
@@ -28,31 +28,31 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "space_sw.h"
+#include "space_3d_sw.h"
-#include "collision_solver_sw.h"
+#include "collision_solver_3d_sw.h"
#include "core/project_settings.h"
-#include "physics_server_sw.h"
+#include "physics_server_3d_sw.h"
-_FORCE_INLINE_ static bool _can_collide_with(CollisionObjectSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+_FORCE_INLINE_ static bool _can_collide_with(CollisionObject3DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (!(p_object->get_collision_layer() & p_collision_mask)) {
return false;
}
- if (p_object->get_type() == CollisionObjectSW::TYPE_AREA && !p_collide_with_areas)
+ if (p_object->get_type() == CollisionObject3DSW::TYPE_AREA && !p_collide_with_areas)
return false;
- if (p_object->get_type() == CollisionObjectSW::TYPE_BODY && !p_collide_with_bodies)
+ if (p_object->get_type() == CollisionObject3DSW::TYPE_BODY && !p_collide_with_bodies)
return false;
return true;
}
-int PhysicsDirectSpaceStateSW::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+int PhysicsDirectSpaceState3DSW::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
ERR_FAIL_COND_V(space->locked, false);
- int amount = space->broadphase->cull_point(p_point, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_point(p_point, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
int cc = 0;
//Transform ai = p_xform.affine_inverse();
@@ -70,7 +70,7 @@ int PhysicsDirectSpaceStateSW::intersect_point(const Vector3 &p_point, ShapeResu
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
continue;
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
Transform inv_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
@@ -93,7 +93,7 @@ int PhysicsDirectSpaceStateSW::intersect_point(const Vector3 &p_point, ShapeResu
return cc;
}
-bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_pick_ray) {
+bool PhysicsDirectSpaceState3DSW::intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_pick_ray) {
ERR_FAIL_COND_V(space->locked, false);
@@ -103,14 +103,14 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
end = p_to;
normal = (end - begin).normalized();
- int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
//todo, create another array that references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
bool collided = false;
Vector3 res_point, res_normal;
int res_shape;
- const CollisionObjectSW *res_obj;
+ const CollisionObject3DSW *res_obj;
real_t min_d = 1e10;
for (int i = 0; i < amount; i++) {
@@ -124,7 +124,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
continue;
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
Transform inv_xform = col_obj->get_shape_inv_transform(shape_idx) * col_obj->get_inv_transform();
@@ -132,7 +132,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
Vector3 local_from = inv_xform.xform(begin);
Vector3 local_to = inv_xform.xform(end);
- const ShapeSW *shape = col_obj->get_shape(shape_idx);
+ const Shape3DSW *shape = col_obj->get_shape(shape_idx);
Vector3 shape_point, shape_normal;
@@ -171,17 +171,17 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
return true;
}
-int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+int PhysicsDirectSpaceState3DSW::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (p_result_max <= 0)
return 0;
- ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.getornull(p_shape);
+ Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
AABB aabb = p_xform.xform(shape->get_aabb());
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
int cc = 0;
@@ -200,10 +200,10 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
continue;
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- if (!CollisionSolverSW::solve_static(shape, p_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), NULL, NULL, NULL, p_margin, 0))
+ if (!CollisionSolver3DSW::solve_static(shape, p_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), NULL, NULL, NULL, p_margin, 0))
continue;
if (r_results) {
@@ -222,22 +222,22 @@ int PhysicsDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Transfo
return cc;
}
-bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, ShapeRestInfo *r_info) {
+bool PhysicsDirectSpaceState3DSW::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, ShapeRestInfo *r_info) {
- ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.getornull(p_shape);
+ Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, false);
AABB aabb = p_xform.xform(shape->get_aabb());
aabb = aabb.merge(AABB(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
real_t best_safe = 1;
real_t best_unsafe = 1;
Transform xform_inv = p_xform.affine_inverse();
- MotionShapeSW mshape;
+ MotionShape3DSW mshape;
mshape.shape = shape;
mshape.motion = xform_inv.basis.xform(p_motion);
@@ -253,7 +253,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
if (p_exclude.has(space->intersection_query_results[i]->get_self()))
continue; //ignore excluded
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
Vector3 point_A, point_B;
@@ -261,14 +261,14 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
- if (CollisionSolverSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
+ if (CollisionSolver3DSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
continue;
}
//test initial overlap
sep_axis = p_motion.normalized();
- if (!CollisionSolverSW::solve_distance(shape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
+ if (!CollisionSolver3DSW::solve_distance(shape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, aabb, &sep_axis)) {
return false;
}
@@ -287,7 +287,7 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
Vector3 lA, lB;
- bool collided = !CollisionSolverSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, lA, lB, aabb, &sep);
+ bool collided = !CollisionSolver3DSW::solve_distance(&mshape, p_xform, col_obj->get_shape(shape_idx), col_obj_xform, lA, lB, aabb, &sep);
if (collided) {
@@ -315,8 +315,8 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
r_info->point = closest_B;
r_info->normal = (closest_A - closest_B).normalized();
best_first = false;
- if (col_obj->get_type() == CollisionObjectSW::TYPE_BODY) {
- const BodySW *body = static_cast<const BodySW *>(col_obj);
+ if (col_obj->get_type() == CollisionObject3DSW::TYPE_BODY) {
+ const Body3DSW *body = static_cast<const Body3DSW *>(col_obj);
r_info->linear_velocity = body->get_linear_velocity() + (body->get_angular_velocity()).cross(body->get_transform().origin - closest_B);
}
}
@@ -328,43 +328,43 @@ bool PhysicsDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transform
return true;
}
-bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+bool PhysicsDirectSpaceState3DSW::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
if (p_result_max <= 0)
return 0;
- ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.getornull(p_shape);
+ Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
AABB aabb = p_shape_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
bool collided = false;
r_result_count = 0;
- PhysicsServerSW::CollCbkData cbk;
+ PhysicsServer3DSW::CollCbkData cbk;
cbk.max = p_result_max;
cbk.amount = 0;
cbk.ptr = r_results;
- CollisionSolverSW::CallbackResult cbkres = PhysicsServerSW::_shape_col_cbk;
+ CollisionSolver3DSW::CallbackResult cbkres = PhysicsServer3DSW::_shape_col_cbk;
- PhysicsServerSW::CollCbkData *cbkptr = &cbk;
+ PhysicsServer3DSW::CollCbkData *cbkptr = &cbk;
for (int i = 0; i < amount; i++) {
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas))
continue;
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
if (p_exclude.has(col_obj->get_self())) {
continue;
}
- if (CollisionSolverSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
collided = true;
}
}
@@ -376,8 +376,8 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
struct _RestCallbackData {
- const CollisionObjectSW *object;
- const CollisionObjectSW *best_object;
+ const CollisionObject3DSW *object;
+ const CollisionObject3DSW *best_object;
int shape;
int best_shape;
Vector3 best_contact;
@@ -403,15 +403,15 @@ static void _rest_cbk_result(const Vector3 &p_point_A, const Vector3 &p_point_B,
rd->best_object = rd->object;
rd->best_shape = rd->shape;
}
-bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+bool PhysicsDirectSpaceState3DSW::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
- ShapeSW *shape = static_cast<PhysicsServerSW *>(PhysicsServer::get_singleton())->shape_owner.getornull(p_shape);
+ Shape3DSW *shape = static_cast<PhysicsServer3DSW *>(PhysicsServer3D::get_singleton())->shape_owner.getornull(p_shape);
ERR_FAIL_COND_V(!shape, 0);
AABB aabb = p_shape_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space3DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
_RestCallbackData rcd;
rcd.best_len = 0;
@@ -424,7 +424,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas))
continue;
- const CollisionObjectSW *col_obj = space->intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
if (p_exclude.has(col_obj->get_self()))
@@ -432,7 +432,7 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
rcd.object = col_obj;
rcd.shape = shape_idx;
- bool sc = CollisionSolverSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
if (!sc)
continue;
}
@@ -445,9 +445,9 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
r_info->normal = rcd.best_normal;
r_info->point = rcd.best_contact;
r_info->rid = rcd.best_object->get_self();
- if (rcd.best_object->get_type() == CollisionObjectSW::TYPE_BODY) {
+ if (rcd.best_object->get_type() == CollisionObject3DSW::TYPE_BODY) {
- const BodySW *body = static_cast<const BodySW *>(rcd.best_object);
+ const Body3DSW *body = static_cast<const Body3DSW *>(rcd.best_object);
r_info->linear_velocity = body->get_linear_velocity() +
(body->get_angular_velocity()).cross(body->get_transform().origin - rcd.best_contact); // * mPos);
@@ -458,11 +458,11 @@ bool PhysicsDirectSpaceStateSW::rest_info(RID p_shape, const Transform &p_shape_
return true;
}
-Vector3 PhysicsDirectSpaceStateSW::get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const {
+Vector3 PhysicsDirectSpaceState3DSW::get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const {
- CollisionObjectSW *obj = PhysicsServerSW::singleton->area_owner.getornull(p_object);
+ CollisionObject3DSW *obj = PhysicsServer3DSW::singleton->area_owner.getornull(p_object);
if (!obj) {
- obj = PhysicsServerSW::singleton->body_owner.getornull(p_object);
+ obj = PhysicsServer3DSW::singleton->body_owner.getornull(p_object);
}
ERR_FAIL_COND_V(!obj, Vector3());
@@ -479,7 +479,7 @@ Vector3 PhysicsDirectSpaceStateSW::get_closest_point_to_object_volume(RID p_obje
continue;
Transform shape_xform = obj->get_transform() * obj->get_shape_transform(i);
- ShapeSW *shape = obj->get_shape(i);
+ Shape3DSW *shape = obj->get_shape(i);
Vector3 point = shape->get_closest_point_to(shape_xform.affine_inverse().xform(p_point));
point = shape_xform.xform(point);
@@ -499,14 +499,14 @@ Vector3 PhysicsDirectSpaceStateSW::get_closest_point_to_object_volume(RID p_obje
}
}
-PhysicsDirectSpaceStateSW::PhysicsDirectSpaceStateSW() {
+PhysicsDirectSpaceState3DSW::PhysicsDirectSpaceState3DSW() {
space = NULL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
-int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb) {
+int Space3DSW::_cull_aabb_for_body(Body3DSW *p_body, const AABB &p_aabb) {
int amount = broadphase->cull_aabb(p_aabb, intersection_query_results, INTERSECTION_QUERY_MAX, intersection_query_subindex_results);
@@ -516,13 +516,13 @@ int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb) {
if (intersection_query_results[i] == p_body)
keep = false;
- else if (intersection_query_results[i]->get_type() == CollisionObjectSW::TYPE_AREA)
+ else if (intersection_query_results[i]->get_type() == CollisionObject3DSW::TYPE_AREA)
keep = false;
- else if ((static_cast<BodySW *>(intersection_query_results[i])->test_collision_mask(p_body)) == 0)
+ else if ((static_cast<Body3DSW *>(intersection_query_results[i])->test_collision_mask(p_body)) == 0)
keep = false;
- else if (static_cast<BodySW *>(intersection_query_results[i])->has_exception(p_body->get_self()) || p_body->has_exception(intersection_query_results[i]->get_self()))
+ else if (static_cast<Body3DSW *>(intersection_query_results[i])->has_exception(p_body->get_self()) || p_body->has_exception(intersection_query_results[i]->get_self()))
keep = false;
- else if (static_cast<BodySW *>(intersection_query_results[i])->is_shape_set_as_disabled(intersection_query_subindex_results[i]))
+ else if (static_cast<Body3DSW *>(intersection_query_results[i])->is_shape_set_as_disabled(intersection_query_subindex_results[i]))
keep = false;
if (!keep) {
@@ -540,7 +540,7 @@ int SpaceSW::_cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb) {
return amount;
}
-int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, real_t p_margin) {
+int Space3DSW::test_body_ray_separation(Body3DSW *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin) {
AABB body_aabb;
@@ -581,10 +581,10 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
const int max_results = 32;
int recover_attempts = 4;
Vector3 sr[max_results * 2];
- PhysicsServerSW::CollCbkData cbk;
+ PhysicsServer3DSW::CollCbkData cbk;
cbk.max = max_results;
- PhysicsServerSW::CollCbkData *cbkptr = &cbk;
- CollisionSolverSW::CallbackResult cbkres = PhysicsServerSW::_shape_col_cbk;
+ PhysicsServer3DSW::CollCbkData *cbkptr = &cbk;
+ CollisionSolver3DSW::CallbackResult cbkres = PhysicsServer3DSW::_shape_col_cbk;
do {
@@ -598,30 +598,30 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
if (p_body->is_shape_set_as_disabled(j))
continue;
- ShapeSW *body_shape = p_body->get_shape(j);
+ Shape3DSW *body_shape = p_body->get_shape(j);
- if (body_shape->get_type() != PhysicsServer::SHAPE_RAY)
+ if (body_shape->get_type() != PhysicsServer3D::SHAPE_RAY)
continue;
Transform body_shape_xform = body_transform * p_body->get_shape_transform(j);
for (int i = 0; i < amount; i++) {
- const CollisionObjectSW *col_obj = intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = intersection_query_results[i];
int shape_idx = intersection_query_subindex_results[i];
cbk.amount = 0;
cbk.ptr = sr;
- if (CollisionObjectSW::TYPE_BODY == col_obj->get_type()) {
- const BodySW *b = static_cast<const BodySW *>(col_obj);
- if (p_infinite_inertia && PhysicsServer::BODY_MODE_STATIC != b->get_mode() && PhysicsServer::BODY_MODE_KINEMATIC != b->get_mode()) {
+ if (CollisionObject3DSW::TYPE_BODY == col_obj->get_type()) {
+ const Body3DSW *b = static_cast<const Body3DSW *>(col_obj);
+ if (p_infinite_inertia && PhysicsServer3D::BODY_MODE_STATIC != b->get_mode() && PhysicsServer3D::BODY_MODE_KINEMATIC != b->get_mode()) {
continue;
}
}
- ShapeSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolverSW::solve_static(body_shape, body_shape_xform, against_shape, col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ Shape3DSW *against_shape = col_obj->get_shape(shape_idx);
+ if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, against_shape, col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
if (cbk.amount > 0) {
collided = true;
}
@@ -639,7 +639,7 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
}
if (ray_index != -1) {
- PhysicsServer::SeparationResult &result = r_results[ray_index];
+ PhysicsServer3D::SeparationResult &result = r_results[ray_index];
for (int k = 0; k < cbk.amount; k++) {
Vector3 a = sr[k * 2 + 0];
@@ -658,8 +658,8 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
result.collider_id = col_obj->get_instance_id();
result.collider_shape = shape_idx;
//result.collider_metadata = col_obj->get_shape_metadata(shape_idx);
- if (col_obj->get_type() == CollisionObjectSW::TYPE_BODY) {
- BodySW *body = (BodySW *)col_obj;
+ if (col_obj->get_type() == CollisionObject3DSW::TYPE_BODY) {
+ Body3DSW *body = (Body3DSW *)col_obj;
Vector3 rel_vec = b - body->get_transform().get_origin();
//result.collider_velocity = Vector3(-body->get_angular_velocity() * rel_vec.y, body->get_angular_velocity() * rel_vec.x) + body->get_linear_velocity();
@@ -695,7 +695,7 @@ int SpaceSW::test_body_ray_separation(BodySW *p_body, const Transform &p_transfo
return rays_found;
}
-bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes) {
+bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes) {
//give me back regular physics engine logic
//this is madness
@@ -726,7 +726,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
if (!shapes_found) {
if (r_result) {
- *r_result = PhysicsServer::MotionResult();
+ *r_result = PhysicsServer3D::MotionResult();
r_result->motion = p_motion;
}
@@ -748,13 +748,13 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
do {
- PhysicsServerSW::CollCbkData cbk;
+ PhysicsServer3DSW::CollCbkData cbk;
cbk.max = max_results;
cbk.amount = 0;
cbk.ptr = sr;
- PhysicsServerSW::CollCbkData *cbkptr = &cbk;
- CollisionSolverSW::CallbackResult cbkres = PhysicsServerSW::_shape_col_cbk;
+ PhysicsServer3DSW::CollCbkData *cbkptr = &cbk;
+ CollisionSolver3DSW::CallbackResult cbkres = PhysicsServer3DSW::_shape_col_cbk;
bool collided = false;
@@ -765,17 +765,17 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
continue;
Transform body_shape_xform = body_transform * p_body->get_shape_transform(j);
- ShapeSW *body_shape = p_body->get_shape(j);
- if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer::SHAPE_RAY) {
+ Shape3DSW *body_shape = p_body->get_shape(j);
+ if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer3D::SHAPE_RAY) {
continue;
}
for (int i = 0; i < amount; i++) {
- const CollisionObjectSW *col_obj = intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = intersection_query_results[i];
int shape_idx = intersection_query_subindex_results[i];
- if (CollisionSolverSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
collided = cbk.amount > 0;
}
}
@@ -826,14 +826,14 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
continue;
Transform body_shape_xform = body_transform * p_body->get_shape_transform(j);
- ShapeSW *body_shape = p_body->get_shape(j);
+ Shape3DSW *body_shape = p_body->get_shape(j);
- if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer::SHAPE_RAY) {
+ if (p_exclude_raycast_shapes && body_shape->get_type() == PhysicsServer3D::SHAPE_RAY) {
continue;
}
Transform body_shape_xform_inv = body_shape_xform.affine_inverse();
- MotionShapeSW mshape;
+ MotionShape3DSW mshape;
mshape.shape = body_shape;
mshape.motion = body_shape_xform_inv.basis.xform(p_motion);
@@ -844,7 +844,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
for (int i = 0; i < amount; i++) {
- const CollisionObjectSW *col_obj = intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = intersection_query_results[i];
int shape_idx = intersection_query_subindex_results[i];
//test initial overlap, does it collide if going all the way?
@@ -853,12 +853,12 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
Transform col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
- if (CollisionSolverSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
+ if (CollisionSolver3DSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
continue;
}
sep_axis = p_motion.normalized();
- if (!CollisionSolverSW::solve_distance(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
+ if (!CollisionSolver3DSW::solve_distance(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, point_A, point_B, motion_aabb, &sep_axis)) {
stuck = true;
break;
}
@@ -878,7 +878,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
Vector3 lA, lB;
- bool collided = !CollisionSolverSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, lA, lB, motion_aabb, &sep);
+ bool collided = !CollisionSolver3DSW::solve_distance(&mshape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj_xform, lA, lB, motion_aabb, &sep);
if (collided) {
@@ -940,7 +940,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
rcd.min_allowed_depth = test_motion_min_contact_depth;
Transform body_shape_xform = ugt * p_body->get_shape_transform(best_shape);
- ShapeSW *body_shape = p_body->get_shape(best_shape);
+ Shape3DSW *body_shape = p_body->get_shape(best_shape);
body_aabb.position += p_motion * unsafe;
@@ -948,12 +948,12 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
for (int i = 0; i < amount; i++) {
- const CollisionObjectSW *col_obj = intersection_query_results[i];
+ const CollisionObject3DSW *col_obj = intersection_query_results[i];
int shape_idx = intersection_query_subindex_results[i];
rcd.object = col_obj;
rcd.shape = shape_idx;
- bool sc = CollisionSolverSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
if (!sc)
continue;
}
@@ -969,7 +969,7 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
r_result->collision_point = rcd.best_contact;
//r_result->collider_metadata = rcd.best_object->get_shape_metadata(rcd.best_shape);
- const BodySW *body = static_cast<const BodySW *>(rcd.best_object);
+ const Body3DSW *body = static_cast<const Body3DSW *>(rcd.best_object);
//Vector3 rel_vec = r_result->collision_point - body->get_transform().get_origin();
// r_result->collider_velocity = Vector3(-body->get_angular_velocity() * rel_vec.y, body->get_angular_velocity() * rel_vec.x) + body->get_linear_velocity();
r_result->collider_velocity = body->get_linear_velocity() + (body->get_angular_velocity()).cross(body->get_transform().origin - rcd.best_contact); // * mPos);
@@ -995,10 +995,10 @@ bool SpaceSW::test_body_motion(BodySW *p_body, const Transform &p_from, const Ve
return collided;
}
-void *SpaceSW::_broadphase_pair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_self) {
+void *Space3DSW::_broadphase_pair(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_self) {
- CollisionObjectSW::Type type_A = A->get_type();
- CollisionObjectSW::Type type_B = B->get_type();
+ CollisionObject3DSW::Type type_A = A->get_type();
+ CollisionObject3DSW::Type type_B = B->get_type();
if (type_A > type_B) {
SWAP(A, B);
@@ -1006,137 +1006,137 @@ void *SpaceSW::_broadphase_pair(CollisionObjectSW *A, int p_subindex_A, Collisio
SWAP(type_A, type_B);
}
- SpaceSW *self = (SpaceSW *)p_self;
+ Space3DSW *self = (Space3DSW *)p_self;
self->collision_pairs++;
- if (type_A == CollisionObjectSW::TYPE_AREA) {
+ if (type_A == CollisionObject3DSW::TYPE_AREA) {
- AreaSW *area = static_cast<AreaSW *>(A);
- if (type_B == CollisionObjectSW::TYPE_AREA) {
+ Area3DSW *area = static_cast<Area3DSW *>(A);
+ if (type_B == CollisionObject3DSW::TYPE_AREA) {
- AreaSW *area_b = static_cast<AreaSW *>(B);
- Area2PairSW *area2_pair = memnew(Area2PairSW(area_b, p_subindex_B, area, p_subindex_A));
+ Area3DSW *area_b = static_cast<Area3DSW *>(B);
+ Area2Pair3DSW *area2_pair = memnew(Area2Pair3DSW(area_b, p_subindex_B, area, p_subindex_A));
return area2_pair;
} else {
- BodySW *body = static_cast<BodySW *>(B);
- AreaPairSW *area_pair = memnew(AreaPairSW(body, p_subindex_B, area, p_subindex_A));
+ Body3DSW *body = static_cast<Body3DSW *>(B);
+ AreaPair3DSW *area_pair = memnew(AreaPair3DSW(body, p_subindex_B, area, p_subindex_A));
return area_pair;
}
} else {
- BodyPairSW *b = memnew(BodyPairSW((BodySW *)A, p_subindex_A, (BodySW *)B, p_subindex_B));
+ BodyPair3DSW *b = memnew(BodyPair3DSW((Body3DSW *)A, p_subindex_A, (Body3DSW *)B, p_subindex_B));
return b;
}
return NULL;
}
-void SpaceSW::_broadphase_unpair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_data, void *p_self) {
+void Space3DSW::_broadphase_unpair(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_data, void *p_self) {
- SpaceSW *self = (SpaceSW *)p_self;
+ Space3DSW *self = (Space3DSW *)p_self;
self->collision_pairs--;
- ConstraintSW *c = (ConstraintSW *)p_data;
+ Constraint3DSW *c = (Constraint3DSW *)p_data;
memdelete(c);
}
-const SelfList<BodySW>::List &SpaceSW::get_active_body_list() const {
+const SelfList<Body3DSW>::List &Space3DSW::get_active_body_list() const {
return active_list;
}
-void SpaceSW::body_add_to_active_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_add_to_active_list(SelfList<Body3DSW> *p_body) {
active_list.add(p_body);
}
-void SpaceSW::body_remove_from_active_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_remove_from_active_list(SelfList<Body3DSW> *p_body) {
active_list.remove(p_body);
}
-void SpaceSW::body_add_to_inertia_update_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_add_to_inertia_update_list(SelfList<Body3DSW> *p_body) {
inertia_update_list.add(p_body);
}
-void SpaceSW::body_remove_from_inertia_update_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_remove_from_inertia_update_list(SelfList<Body3DSW> *p_body) {
inertia_update_list.remove(p_body);
}
-BroadPhaseSW *SpaceSW::get_broadphase() {
+BroadPhase3DSW *Space3DSW::get_broadphase() {
return broadphase;
}
-void SpaceSW::add_object(CollisionObjectSW *p_object) {
+void Space3DSW::add_object(CollisionObject3DSW *p_object) {
ERR_FAIL_COND(objects.has(p_object));
objects.insert(p_object);
}
-void SpaceSW::remove_object(CollisionObjectSW *p_object) {
+void Space3DSW::remove_object(CollisionObject3DSW *p_object) {
ERR_FAIL_COND(!objects.has(p_object));
objects.erase(p_object);
}
-const Set<CollisionObjectSW *> &SpaceSW::get_objects() const {
+const Set<CollisionObject3DSW *> &Space3DSW::get_objects() const {
return objects;
}
-void SpaceSW::body_add_to_state_query_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_add_to_state_query_list(SelfList<Body3DSW> *p_body) {
state_query_list.add(p_body);
}
-void SpaceSW::body_remove_from_state_query_list(SelfList<BodySW> *p_body) {
+void Space3DSW::body_remove_from_state_query_list(SelfList<Body3DSW> *p_body) {
state_query_list.remove(p_body);
}
-void SpaceSW::area_add_to_monitor_query_list(SelfList<AreaSW> *p_area) {
+void Space3DSW::area_add_to_monitor_query_list(SelfList<Area3DSW> *p_area) {
monitor_query_list.add(p_area);
}
-void SpaceSW::area_remove_from_monitor_query_list(SelfList<AreaSW> *p_area) {
+void Space3DSW::area_remove_from_monitor_query_list(SelfList<Area3DSW> *p_area) {
monitor_query_list.remove(p_area);
}
-void SpaceSW::area_add_to_moved_list(SelfList<AreaSW> *p_area) {
+void Space3DSW::area_add_to_moved_list(SelfList<Area3DSW> *p_area) {
area_moved_list.add(p_area);
}
-void SpaceSW::area_remove_from_moved_list(SelfList<AreaSW> *p_area) {
+void Space3DSW::area_remove_from_moved_list(SelfList<Area3DSW> *p_area) {
area_moved_list.remove(p_area);
}
-const SelfList<AreaSW>::List &SpaceSW::get_moved_area_list() const {
+const SelfList<Area3DSW>::List &Space3DSW::get_moved_area_list() const {
return area_moved_list;
}
-void SpaceSW::call_queries() {
+void Space3DSW::call_queries() {
while (state_query_list.first()) {
- BodySW *b = state_query_list.first()->self();
+ Body3DSW *b = state_query_list.first()->self();
state_query_list.remove(state_query_list.first());
b->call_queries();
}
while (monitor_query_list.first()) {
- AreaSW *a = monitor_query_list.first()->self();
+ Area3DSW *a = monitor_query_list.first()->self();
monitor_query_list.remove(monitor_query_list.first());
a->call_queries();
}
}
-void SpaceSW::setup() {
+void Space3DSW::setup() {
contact_debug_count = 0;
while (inertia_update_list.first()) {
@@ -1145,65 +1145,65 @@ void SpaceSW::setup() {
}
}
-void SpaceSW::update() {
+void Space3DSW::update() {
broadphase->update();
}
-void SpaceSW::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) {
+void Space3DSW::set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value) {
switch (p_param) {
- case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
- case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio = p_value; break;
- case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
- case PhysicsServer::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: body_linear_velocity_sleep_threshold = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: body_angular_velocity_sleep_threshold = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias = p_value; break;
+ case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: test_motion_min_contact_depth = p_value; break;
}
}
-real_t SpaceSW::get_param(PhysicsServer::SpaceParameter p_param) const {
+real_t Space3DSW::get_param(PhysicsServer3D::SpaceParameter p_param) const {
switch (p_param) {
- case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
- case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
- case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
- case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
- case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
- case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
- case PhysicsServer::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
+ case PhysicsServer3D::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
+ case PhysicsServer3D::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
+ case PhysicsServer3D::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
+ case PhysicsServer3D::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD: return body_linear_velocity_sleep_threshold;
+ case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD: return body_angular_velocity_sleep_threshold;
+ case PhysicsServer3D::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
+ case PhysicsServer3D::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
+ case PhysicsServer3D::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
+ case PhysicsServer3D::SPACE_PARAM_TEST_MOTION_MIN_CONTACT_DEPTH: return test_motion_min_contact_depth;
}
return 0;
}
-void SpaceSW::lock() {
+void Space3DSW::lock() {
locked = true;
}
-void SpaceSW::unlock() {
+void Space3DSW::unlock() {
locked = false;
}
-bool SpaceSW::is_locked() const {
+bool Space3DSW::is_locked() const {
return locked;
}
-PhysicsDirectSpaceStateSW *SpaceSW::get_direct_state() {
+PhysicsDirectSpaceState3DSW *Space3DSW::get_direct_state() {
return direct_access;
}
-SpaceSW::SpaceSW() {
+Space3DSW::Space3DSW() {
collision_pairs = 0;
active_objects = 0;
@@ -1223,19 +1223,19 @@ SpaceSW::SpaceSW() {
ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/time_before_sleep", PropertyInfo(Variant::FLOAT, "physics/3d/time_before_sleep", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"));
body_angular_velocity_damp_ratio = 10;
- broadphase = BroadPhaseSW::create_func();
+ broadphase = BroadPhase3DSW::create_func();
broadphase->set_pair_callback(_broadphase_pair, this);
broadphase->set_unpair_callback(_broadphase_unpair, this);
area = NULL;
- direct_access = memnew(PhysicsDirectSpaceStateSW);
+ direct_access = memnew(PhysicsDirectSpaceState3DSW);
direct_access->space = this;
for (int i = 0; i < ELAPSED_TIME_MAX; i++)
elapsed_time[i] = 0;
}
-SpaceSW::~SpaceSW() {
+Space3DSW::~Space3DSW() {
memdelete(broadphase);
memdelete(direct_access);
diff --git a/servers/physics/space_sw.h b/servers/physics_3d/space_3d_sw.h
index 9e82720a75..c32af5c5d4 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics_3d/space_3d_sw.h
@@ -31,22 +31,22 @@
#ifndef SPACE_SW_H
#define SPACE_SW_H
-#include "area_pair_sw.h"
-#include "area_sw.h"
-#include "body_pair_sw.h"
-#include "body_sw.h"
-#include "broad_phase_sw.h"
-#include "collision_object_sw.h"
+#include "area_3d_sw.h"
+#include "area_pair_3d_sw.h"
+#include "body_3d_sw.h"
+#include "body_pair_3d_sw.h"
+#include "broad_phase_3d_sw.h"
+#include "collision_object_3d_sw.h"
#include "core/hash_map.h"
#include "core/project_settings.h"
#include "core/typedefs.h"
-class PhysicsDirectSpaceStateSW : public PhysicsDirectSpaceState {
+class PhysicsDirectSpaceState3DSW : public PhysicsDirectSpaceState3D {
- GDCLASS(PhysicsDirectSpaceStateSW, PhysicsDirectSpaceState);
+ GDCLASS(PhysicsDirectSpaceState3DSW, PhysicsDirectSpaceState3D);
public:
- SpaceSW *space;
+ Space3DSW *space;
virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false);
@@ -56,10 +56,10 @@ public:
virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const;
- PhysicsDirectSpaceStateSW();
+ PhysicsDirectSpaceState3DSW();
};
-class SpaceSW {
+class Space3DSW {
public:
enum ElapsedTime {
@@ -75,22 +75,22 @@ public:
private:
uint64_t elapsed_time[ELAPSED_TIME_MAX];
- PhysicsDirectSpaceStateSW *direct_access;
+ PhysicsDirectSpaceState3DSW *direct_access;
RID self;
- BroadPhaseSW *broadphase;
- SelfList<BodySW>::List active_list;
- SelfList<BodySW>::List inertia_update_list;
- SelfList<BodySW>::List state_query_list;
- SelfList<AreaSW>::List monitor_query_list;
- SelfList<AreaSW>::List area_moved_list;
+ BroadPhase3DSW *broadphase;
+ SelfList<Body3DSW>::List active_list;
+ SelfList<Body3DSW>::List inertia_update_list;
+ SelfList<Body3DSW>::List state_query_list;
+ SelfList<Area3DSW>::List monitor_query_list;
+ SelfList<Area3DSW>::List area_moved_list;
- static void *_broadphase_pair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_self);
- static void _broadphase_unpair(CollisionObjectSW *A, int p_subindex_A, CollisionObjectSW *B, int p_subindex_B, void *p_data, void *p_self);
+ static void *_broadphase_pair(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_self);
+ static void _broadphase_unpair(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_data, void *p_self);
- Set<CollisionObjectSW *> objects;
+ Set<CollisionObject3DSW *> objects;
- AreaSW *area;
+ Area3DSW *area;
real_t contact_recycle_radius;
real_t contact_max_separation;
@@ -103,7 +103,7 @@ private:
INTERSECTION_QUERY_MAX = 2048
};
- CollisionObjectSW *intersection_query_results[INTERSECTION_QUERY_MAX];
+ CollisionObject3DSW *intersection_query_results[INTERSECTION_QUERY_MAX];
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
real_t body_linear_velocity_sleep_threshold;
@@ -122,37 +122,37 @@ private:
Vector<Vector3> contact_debug;
int contact_debug_count;
- friend class PhysicsDirectSpaceStateSW;
+ friend class PhysicsDirectSpaceState3DSW;
- int _cull_aabb_for_body(BodySW *p_body, const AABB &p_aabb);
+ int _cull_aabb_for_body(Body3DSW *p_body, const AABB &p_aabb);
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }
_FORCE_INLINE_ RID get_self() const { return self; }
- void set_default_area(AreaSW *p_area) { area = p_area; }
- AreaSW *get_default_area() const { return area; }
+ void set_default_area(Area3DSW *p_area) { area = p_area; }
+ Area3DSW *get_default_area() const { return area; }
- const SelfList<BodySW>::List &get_active_body_list() const;
- void body_add_to_active_list(SelfList<BodySW> *p_body);
- void body_remove_from_active_list(SelfList<BodySW> *p_body);
- void body_add_to_inertia_update_list(SelfList<BodySW> *p_body);
- void body_remove_from_inertia_update_list(SelfList<BodySW> *p_body);
+ const SelfList<Body3DSW>::List &get_active_body_list() const;
+ void body_add_to_active_list(SelfList<Body3DSW> *p_body);
+ void body_remove_from_active_list(SelfList<Body3DSW> *p_body);
+ void body_add_to_inertia_update_list(SelfList<Body3DSW> *p_body);
+ void body_remove_from_inertia_update_list(SelfList<Body3DSW> *p_body);
- void body_add_to_state_query_list(SelfList<BodySW> *p_body);
- void body_remove_from_state_query_list(SelfList<BodySW> *p_body);
+ void body_add_to_state_query_list(SelfList<Body3DSW> *p_body);
+ void body_remove_from_state_query_list(SelfList<Body3DSW> *p_body);
- void area_add_to_monitor_query_list(SelfList<AreaSW> *p_area);
- void area_remove_from_monitor_query_list(SelfList<AreaSW> *p_area);
- void area_add_to_moved_list(SelfList<AreaSW> *p_area);
- void area_remove_from_moved_list(SelfList<AreaSW> *p_area);
- const SelfList<AreaSW>::List &get_moved_area_list() const;
+ void area_add_to_monitor_query_list(SelfList<Area3DSW> *p_area);
+ void area_remove_from_monitor_query_list(SelfList<Area3DSW> *p_area);
+ void area_add_to_moved_list(SelfList<Area3DSW> *p_area);
+ void area_remove_from_moved_list(SelfList<Area3DSW> *p_area);
+ const SelfList<Area3DSW>::List &get_moved_area_list() const;
- BroadPhaseSW *get_broadphase();
+ BroadPhase3DSW *get_broadphase();
- void add_object(CollisionObjectSW *p_object);
- void remove_object(CollisionObjectSW *p_object);
- const Set<CollisionObjectSW *> &get_objects() const;
+ void add_object(CollisionObject3DSW *p_object);
+ void remove_object(CollisionObject3DSW *p_object);
+ const Set<CollisionObject3DSW *> &get_objects() const;
_FORCE_INLINE_ real_t get_contact_recycle_radius() const { return contact_recycle_radius; }
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
@@ -171,8 +171,8 @@ public:
void lock();
void unlock();
- void set_param(PhysicsServer::SpaceParameter p_param, real_t p_value);
- real_t get_param(PhysicsServer::SpaceParameter p_param) const;
+ void set_param(PhysicsServer3D::SpaceParameter p_param, real_t p_value);
+ real_t get_param(PhysicsServer3D::SpaceParameter p_param) const;
void set_island_count(int p_island_count) { island_count = p_island_count; }
int get_island_count() const { return island_count; }
@@ -182,7 +182,7 @@ public:
int get_collision_pairs() const { return collision_pairs; }
- PhysicsDirectSpaceStateSW *get_direct_state();
+ PhysicsDirectSpaceState3DSW *get_direct_state();
void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
_FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
@@ -198,11 +198,11 @@ public:
void set_elapsed_time(ElapsedTime p_time, uint64_t p_msec) { elapsed_time[p_time] = p_msec; }
uint64_t get_elapsed_time(ElapsedTime p_time) const { return elapsed_time[p_time]; }
- int test_body_ray_separation(BodySW *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer::SeparationResult *r_results, int p_result_max, real_t p_margin);
- bool test_body_motion(BodySW *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer::MotionResult *r_result, bool p_exclude_raycast_shapes);
+ int test_body_ray_separation(Body3DSW *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin);
+ bool test_body_motion(Body3DSW *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, real_t p_margin, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes);
- SpaceSW();
- ~SpaceSW();
+ Space3DSW();
+ ~Space3DSW();
};
#endif // SPACE__SW_H
diff --git a/servers/physics/step_sw.cpp b/servers/physics_3d/step_3d_sw.cpp
index f4055ecff7..ef9015a61c 100644
--- a/servers/physics/step_sw.cpp
+++ b/servers/physics_3d/step_3d_sw.cpp
@@ -28,20 +28,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "step_sw.h"
-#include "joints_sw.h"
+#include "step_3d_sw.h"
+#include "joints_3d_sw.h"
#include "core/os/os.h"
-void StepSW::_populate_island(BodySW *p_body, BodySW **p_island, ConstraintSW **p_constraint_island) {
+void Step3DSW::_populate_island(Body3DSW *p_body, Body3DSW **p_island, Constraint3DSW **p_constraint_island) {
p_body->set_island_step(_step);
p_body->set_island_next(*p_island);
*p_island = p_body;
- for (Map<ConstraintSW *, int>::Element *E = p_body->get_constraint_map().front(); E; E = E->next()) {
+ for (Map<Constraint3DSW *, int>::Element *E = p_body->get_constraint_map().front(); E; E = E->next()) {
- ConstraintSW *c = (ConstraintSW *)E->key();
+ Constraint3DSW *c = (Constraint3DSW *)E->key();
if (c->get_island_step() == _step)
continue; //already processed
c->set_island_step(_step);
@@ -51,17 +51,17 @@ void StepSW::_populate_island(BodySW *p_body, BodySW **p_island, ConstraintSW **
for (int i = 0; i < c->get_body_count(); i++) {
if (i == E->get())
continue;
- BodySW *b = c->get_body_ptr()[i];
- if (b->get_island_step() == _step || b->get_mode() == PhysicsServer::BODY_MODE_STATIC || b->get_mode() == PhysicsServer::BODY_MODE_KINEMATIC)
+ Body3DSW *b = c->get_body_ptr()[i];
+ if (b->get_island_step() == _step || b->get_mode() == PhysicsServer3D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer3D::BODY_MODE_KINEMATIC)
continue; //no go
_populate_island(c->get_body_ptr()[i], p_island, p_constraint_island);
}
}
}
-void StepSW::_setup_island(ConstraintSW *p_island, real_t p_delta) {
+void Step3DSW::_setup_island(Constraint3DSW *p_island, real_t p_delta) {
- ConstraintSW *ci = p_island;
+ Constraint3DSW *ci = p_island;
while (ci) {
ci->setup(p_delta);
//todo remove from island if process fails
@@ -69,7 +69,7 @@ void StepSW::_setup_island(ConstraintSW *p_island, real_t p_delta) {
}
}
-void StepSW::_solve_island(ConstraintSW *p_island, int p_iterations, real_t p_delta) {
+void Step3DSW::_solve_island(Constraint3DSW *p_island, int p_iterations, real_t p_delta) {
int at_priority = 1;
@@ -77,7 +77,7 @@ void StepSW::_solve_island(ConstraintSW *p_island, int p_iterations, real_t p_de
for (int i = 0; i < p_iterations; i++) {
- ConstraintSW *ci = p_island;
+ Constraint3DSW *ci = p_island;
while (ci) {
ci->solve(p_delta);
ci = ci->get_island_next();
@@ -87,8 +87,8 @@ void StepSW::_solve_island(ConstraintSW *p_island, int p_iterations, real_t p_de
at_priority++;
{
- ConstraintSW *ci = p_island;
- ConstraintSW *prev = NULL;
+ Constraint3DSW *ci = p_island;
+ Constraint3DSW *prev = NULL;
while (ci) {
if (ci->get_priority() < at_priority) {
if (prev) {
@@ -107,14 +107,14 @@ void StepSW::_solve_island(ConstraintSW *p_island, int p_iterations, real_t p_de
}
}
-void StepSW::_check_suspend(BodySW *p_island, real_t p_delta) {
+void Step3DSW::_check_suspend(Body3DSW *p_island, real_t p_delta) {
bool can_sleep = true;
- BodySW *b = p_island;
+ Body3DSW *b = p_island;
while (b) {
- if (b->get_mode() == PhysicsServer::BODY_MODE_STATIC || b->get_mode() == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (b->get_mode() == PhysicsServer3D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer3D::BODY_MODE_KINEMATIC) {
b = b->get_island_next();
continue; //ignore for static
}
@@ -130,7 +130,7 @@ void StepSW::_check_suspend(BodySW *p_island, real_t p_delta) {
b = p_island;
while (b) {
- if (b->get_mode() == PhysicsServer::BODY_MODE_STATIC || b->get_mode() == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (b->get_mode() == PhysicsServer3D::BODY_MODE_STATIC || b->get_mode() == PhysicsServer3D::BODY_MODE_KINEMATIC) {
b = b->get_island_next();
continue; //ignore for static
}
@@ -144,13 +144,13 @@ void StepSW::_check_suspend(BodySW *p_island, real_t p_delta) {
}
}
-void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
+void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
p_space->lock(); // can't access space during this
p_space->setup(); //update inertias, etc
- const SelfList<BodySW>::List *body_list = &p_space->get_active_body_list();
+ const SelfList<Body3DSW>::List *body_list = &p_space->get_active_body_list();
/* INTEGRATE FORCES */
@@ -159,7 +159,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
int active_count = 0;
- const SelfList<BodySW> *b = body_list->first();
+ const SelfList<Body3DSW> *b = body_list->first();
while (b) {
b->self()->integrate_forces(p_delta);
@@ -171,25 +171,25 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
- p_space->set_elapsed_time(SpaceSW::ELAPSED_TIME_INTEGRATE_FORCES, profile_endtime - profile_begtime);
+ p_space->set_elapsed_time(Space3DSW::ELAPSED_TIME_INTEGRATE_FORCES, profile_endtime - profile_begtime);
profile_begtime = profile_endtime;
}
/* GENERATE CONSTRAINT ISLANDS */
- BodySW *island_list = NULL;
- ConstraintSW *constraint_island_list = NULL;
+ Body3DSW *island_list = NULL;
+ Constraint3DSW *constraint_island_list = NULL;
b = body_list->first();
int island_count = 0;
while (b) {
- BodySW *body = b->self();
+ Body3DSW *body = b->self();
if (body->get_island_step() != _step) {
- BodySW *island = NULL;
- ConstraintSW *constraint_island = NULL;
+ Body3DSW *island = NULL;
+ Constraint3DSW *constraint_island = NULL;
_populate_island(body, &island, &constraint_island);
island->set_island_list_next(island_list);
@@ -206,12 +206,12 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
p_space->set_island_count(island_count);
- const SelfList<AreaSW>::List &aml = p_space->get_moved_area_list();
+ const SelfList<Area3DSW>::List &aml = p_space->get_moved_area_list();
while (aml.first()) {
- for (const Set<ConstraintSW *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) {
+ for (const Set<Constraint3DSW *>::Element *E = aml.first()->self()->get_constraints().front(); E; E = E->next()) {
- ConstraintSW *c = E->get();
+ Constraint3DSW *c = E->get();
if (c->get_island_step() == _step)
continue;
c->set_island_step(_step);
@@ -219,19 +219,19 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
c->set_island_list_next(constraint_island_list);
constraint_island_list = c;
}
- p_space->area_remove_from_moved_list((SelfList<AreaSW> *)aml.first()); //faster to remove here
+ p_space->area_remove_from_moved_list((SelfList<Area3DSW> *)aml.first()); //faster to remove here
}
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
- p_space->set_elapsed_time(SpaceSW::ELAPSED_TIME_GENERATE_ISLANDS, profile_endtime - profile_begtime);
+ p_space->set_elapsed_time(Space3DSW::ELAPSED_TIME_GENERATE_ISLANDS, profile_endtime - profile_begtime);
profile_begtime = profile_endtime;
}
/* SETUP CONSTRAINT ISLANDS */
{
- ConstraintSW *ci = constraint_island_list;
+ Constraint3DSW *ci = constraint_island_list;
while (ci) {
_setup_island(ci, p_delta);
@@ -241,14 +241,14 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
- p_space->set_elapsed_time(SpaceSW::ELAPSED_TIME_SETUP_CONSTRAINTS, profile_endtime - profile_begtime);
+ p_space->set_elapsed_time(Space3DSW::ELAPSED_TIME_SETUP_CONSTRAINTS, profile_endtime - profile_begtime);
profile_begtime = profile_endtime;
}
/* SOLVE CONSTRAINT ISLANDS */
{
- ConstraintSW *ci = constraint_island_list;
+ Constraint3DSW *ci = constraint_island_list;
while (ci) {
//iterating each island separatedly improves cache efficiency
_solve_island(ci, p_iterations, p_delta);
@@ -258,7 +258,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
- p_space->set_elapsed_time(SpaceSW::ELAPSED_TIME_SOLVE_CONSTRAINTS, profile_endtime - profile_begtime);
+ p_space->set_elapsed_time(Space3DSW::ELAPSED_TIME_SOLVE_CONSTRAINTS, profile_endtime - profile_begtime);
profile_begtime = profile_endtime;
}
@@ -266,7 +266,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
b = body_list->first();
while (b) {
- const SelfList<BodySW> *n = b->next();
+ const SelfList<Body3DSW> *n = b->next();
b->self()->integrate_velocities(p_delta);
b = n;
}
@@ -274,7 +274,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
/* SLEEP / WAKE UP ISLANDS */
{
- BodySW *bi = island_list;
+ Body3DSW *bi = island_list;
while (bi) {
_check_suspend(bi, p_delta);
@@ -284,7 +284,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
- p_space->set_elapsed_time(SpaceSW::ELAPSED_TIME_INTEGRATE_VELOCITIES, profile_endtime - profile_begtime);
+ p_space->set_elapsed_time(Space3DSW::ELAPSED_TIME_INTEGRATE_VELOCITIES, profile_endtime - profile_begtime);
profile_begtime = profile_endtime;
}
@@ -293,7 +293,7 @@ void StepSW::step(SpaceSW *p_space, real_t p_delta, int p_iterations) {
_step++;
}
-StepSW::StepSW() {
+Step3DSW::Step3DSW() {
_step = 1;
}
diff --git a/servers/physics/step_sw.h b/servers/physics_3d/step_3d_sw.h
index 40022ef8b9..dcd67fa122 100644
--- a/servers/physics/step_sw.h
+++ b/servers/physics_3d/step_3d_sw.h
@@ -31,20 +31,20 @@
#ifndef STEP_SW_H
#define STEP_SW_H
-#include "space_sw.h"
+#include "space_3d_sw.h"
-class StepSW {
+class Step3DSW {
uint64_t _step;
- void _populate_island(BodySW *p_body, BodySW **p_island, ConstraintSW **p_constraint_island);
- void _setup_island(ConstraintSW *p_island, real_t p_delta);
- void _solve_island(ConstraintSW *p_island, int p_iterations, real_t p_delta);
- void _check_suspend(BodySW *p_island, real_t p_delta);
+ void _populate_island(Body3DSW *p_body, Body3DSW **p_island, Constraint3DSW **p_constraint_island);
+ void _setup_island(Constraint3DSW *p_island, real_t p_delta);
+ void _solve_island(Constraint3DSW *p_island, int p_iterations, real_t p_delta);
+ void _check_suspend(Body3DSW *p_island, real_t p_delta);
public:
- void step(SpaceSW *p_space, real_t p_delta, int p_iterations);
- StepSW();
+ void step(Space3DSW *p_space, real_t p_delta, int p_iterations);
+ Step3DSW();
};
#endif // STEP__SW_H
diff --git a/servers/physics_2d_server.cpp b/servers/physics_server_2d.cpp
index 1f92d6e419..d80a51ca36 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_server_2d.cpp
@@ -28,15 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "physics_2d_server.h"
+#include "physics_server_2d.h"
#include "core/method_bind_ext.gen.inc"
#include "core/print_string.h"
#include "core/project_settings.h"
-Physics2DServer *Physics2DServer::singleton = NULL;
+PhysicsServer2D *PhysicsServer2D::singleton = NULL;
-void Physics2DDirectBodyState::integrate_forces() {
+void PhysicsDirectBodyState2D::integrate_forces() {
real_t step = get_step();
Vector2 lv = get_linear_velocity();
@@ -62,61 +62,61 @@ void Physics2DDirectBodyState::integrate_forces() {
set_angular_velocity(av);
}
-Object *Physics2DDirectBodyState::get_contact_collider_object(int p_contact_idx) const {
+Object *PhysicsDirectBodyState2D::get_contact_collider_object(int p_contact_idx) const {
ObjectID objid = get_contact_collider_id(p_contact_idx);
Object *obj = ObjectDB::get_instance(objid);
return obj;
}
-Physics2DServer *Physics2DServer::get_singleton() {
+PhysicsServer2D *PhysicsServer2D::get_singleton() {
return singleton;
}
-void Physics2DDirectBodyState::_bind_methods() {
+void PhysicsDirectBodyState2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_total_gravity"), &Physics2DDirectBodyState::get_total_gravity);
- ClassDB::bind_method(D_METHOD("get_total_linear_damp"), &Physics2DDirectBodyState::get_total_linear_damp);
- ClassDB::bind_method(D_METHOD("get_total_angular_damp"), &Physics2DDirectBodyState::get_total_angular_damp);
+ ClassDB::bind_method(D_METHOD("get_total_gravity"), &PhysicsDirectBodyState2D::get_total_gravity);
+ ClassDB::bind_method(D_METHOD("get_total_linear_damp"), &PhysicsDirectBodyState2D::get_total_linear_damp);
+ ClassDB::bind_method(D_METHOD("get_total_angular_damp"), &PhysicsDirectBodyState2D::get_total_angular_damp);
- ClassDB::bind_method(D_METHOD("get_inverse_mass"), &Physics2DDirectBodyState::get_inverse_mass);
- ClassDB::bind_method(D_METHOD("get_inverse_inertia"), &Physics2DDirectBodyState::get_inverse_inertia);
+ ClassDB::bind_method(D_METHOD("get_inverse_mass"), &PhysicsDirectBodyState2D::get_inverse_mass);
+ ClassDB::bind_method(D_METHOD("get_inverse_inertia"), &PhysicsDirectBodyState2D::get_inverse_inertia);
- ClassDB::bind_method(D_METHOD("set_linear_velocity", "velocity"), &Physics2DDirectBodyState::set_linear_velocity);
- ClassDB::bind_method(D_METHOD("get_linear_velocity"), &Physics2DDirectBodyState::get_linear_velocity);
+ ClassDB::bind_method(D_METHOD("set_linear_velocity", "velocity"), &PhysicsDirectBodyState2D::set_linear_velocity);
+ ClassDB::bind_method(D_METHOD("get_linear_velocity"), &PhysicsDirectBodyState2D::get_linear_velocity);
- ClassDB::bind_method(D_METHOD("set_angular_velocity", "velocity"), &Physics2DDirectBodyState::set_angular_velocity);
- ClassDB::bind_method(D_METHOD("get_angular_velocity"), &Physics2DDirectBodyState::get_angular_velocity);
+ ClassDB::bind_method(D_METHOD("set_angular_velocity", "velocity"), &PhysicsDirectBodyState2D::set_angular_velocity);
+ ClassDB::bind_method(D_METHOD("get_angular_velocity"), &PhysicsDirectBodyState2D::get_angular_velocity);
- ClassDB::bind_method(D_METHOD("set_transform", "transform"), &Physics2DDirectBodyState::set_transform);
- ClassDB::bind_method(D_METHOD("get_transform"), &Physics2DDirectBodyState::get_transform);
+ ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsDirectBodyState2D::set_transform);
+ ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsDirectBodyState2D::get_transform);
- ClassDB::bind_method(D_METHOD("add_central_force", "force"), &Physics2DDirectBodyState::add_central_force);
- ClassDB::bind_method(D_METHOD("add_force", "offset", "force"), &Physics2DDirectBodyState::add_force);
- ClassDB::bind_method(D_METHOD("add_torque", "torque"), &Physics2DDirectBodyState::add_torque);
- ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &Physics2DDirectBodyState::apply_central_impulse);
- ClassDB::bind_method(D_METHOD("apply_torque_impulse", "impulse"), &Physics2DDirectBodyState::apply_torque_impulse);
- ClassDB::bind_method(D_METHOD("apply_impulse", "offset", "impulse"), &Physics2DDirectBodyState::apply_impulse);
+ ClassDB::bind_method(D_METHOD("add_central_force", "force"), &PhysicsDirectBodyState2D::add_central_force);
+ ClassDB::bind_method(D_METHOD("add_force", "offset", "force"), &PhysicsDirectBodyState2D::add_force);
+ ClassDB::bind_method(D_METHOD("add_torque", "torque"), &PhysicsDirectBodyState2D::add_torque);
+ ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &PhysicsDirectBodyState2D::apply_central_impulse);
+ ClassDB::bind_method(D_METHOD("apply_torque_impulse", "impulse"), &PhysicsDirectBodyState2D::apply_torque_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "offset", "impulse"), &PhysicsDirectBodyState2D::apply_impulse);
- ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &Physics2DDirectBodyState::set_sleep_state);
- ClassDB::bind_method(D_METHOD("is_sleeping"), &Physics2DDirectBodyState::is_sleeping);
+ ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &PhysicsDirectBodyState2D::set_sleep_state);
+ ClassDB::bind_method(D_METHOD("is_sleeping"), &PhysicsDirectBodyState2D::is_sleeping);
- ClassDB::bind_method(D_METHOD("get_contact_count"), &Physics2DDirectBodyState::get_contact_count);
+ ClassDB::bind_method(D_METHOD("get_contact_count"), &PhysicsDirectBodyState2D::get_contact_count);
- ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_position);
- ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_normal);
- ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &Physics2DDirectBodyState::get_contact_local_shape);
- ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider);
- ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_position);
- ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_id);
- ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_object);
- ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape);
- ClassDB::bind_method(D_METHOD("get_contact_collider_shape_metadata", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_shape_metadata);
- ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &Physics2DDirectBodyState::get_contact_collider_velocity_at_position);
- ClassDB::bind_method(D_METHOD("get_step"), &Physics2DDirectBodyState::get_step);
- ClassDB::bind_method(D_METHOD("integrate_forces"), &Physics2DDirectBodyState::integrate_forces);
- ClassDB::bind_method(D_METHOD("get_space_state"), &Physics2DDirectBodyState::get_space_state);
+ ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_local_position);
+ ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_local_normal);
+ ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_local_shape);
+ ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_position);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_id);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_object);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_shape);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_shape_metadata", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_shape_metadata);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &PhysicsDirectBodyState2D::get_contact_collider_velocity_at_position);
+ ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState2D::get_step);
+ ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState2D::integrate_forces);
+ ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState2D::get_space_state);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "step"), "", "get_step");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inverse_mass"), "", "get_inverse_mass");
@@ -130,70 +130,70 @@ void Physics2DDirectBodyState::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform");
}
-Physics2DDirectBodyState::Physics2DDirectBodyState() {}
+PhysicsDirectBodyState2D::PhysicsDirectBodyState2D() {}
///////////////////////////////////////////////////////
-void Physics2DShapeQueryParameters::set_shape(const RES &p_shape) {
+void PhysicsShapeQueryParameters2D::set_shape(const RES &p_shape) {
ERR_FAIL_COND(p_shape.is_null());
shape = p_shape->get_rid();
}
-void Physics2DShapeQueryParameters::set_shape_rid(const RID &p_shape) {
+void PhysicsShapeQueryParameters2D::set_shape_rid(const RID &p_shape) {
shape = p_shape;
}
-RID Physics2DShapeQueryParameters::get_shape_rid() const {
+RID PhysicsShapeQueryParameters2D::get_shape_rid() const {
return shape;
}
-void Physics2DShapeQueryParameters::set_transform(const Transform2D &p_transform) {
+void PhysicsShapeQueryParameters2D::set_transform(const Transform2D &p_transform) {
transform = p_transform;
}
-Transform2D Physics2DShapeQueryParameters::get_transform() const {
+Transform2D PhysicsShapeQueryParameters2D::get_transform() const {
return transform;
}
-void Physics2DShapeQueryParameters::set_motion(const Vector2 &p_motion) {
+void PhysicsShapeQueryParameters2D::set_motion(const Vector2 &p_motion) {
motion = p_motion;
}
-Vector2 Physics2DShapeQueryParameters::get_motion() const {
+Vector2 PhysicsShapeQueryParameters2D::get_motion() const {
return motion;
}
-void Physics2DShapeQueryParameters::set_margin(float p_margin) {
+void PhysicsShapeQueryParameters2D::set_margin(float p_margin) {
margin = p_margin;
}
-float Physics2DShapeQueryParameters::get_margin() const {
+float PhysicsShapeQueryParameters2D::get_margin() const {
return margin;
}
-void Physics2DShapeQueryParameters::set_collision_mask(int p_collision_mask) {
+void PhysicsShapeQueryParameters2D::set_collision_mask(int p_collision_mask) {
collision_mask = p_collision_mask;
}
-int Physics2DShapeQueryParameters::get_collision_mask() const {
+int PhysicsShapeQueryParameters2D::get_collision_mask() const {
return collision_mask;
}
-void Physics2DShapeQueryParameters::set_exclude(const Vector<RID> &p_exclude) {
+void PhysicsShapeQueryParameters2D::set_exclude(const Vector<RID> &p_exclude) {
exclude.clear();
for (int i = 0; i < p_exclude.size(); i++)
exclude.insert(p_exclude[i]);
}
-Vector<RID> Physics2DShapeQueryParameters::get_exclude() const {
+Vector<RID> PhysicsShapeQueryParameters2D::get_exclude() const {
Vector<RID> ret;
ret.resize(exclude.size());
@@ -204,48 +204,48 @@ Vector<RID> Physics2DShapeQueryParameters::get_exclude() const {
return ret;
}
-void Physics2DShapeQueryParameters::set_collide_with_bodies(bool p_enable) {
+void PhysicsShapeQueryParameters2D::set_collide_with_bodies(bool p_enable) {
collide_with_bodies = p_enable;
}
-bool Physics2DShapeQueryParameters::is_collide_with_bodies_enabled() const {
+bool PhysicsShapeQueryParameters2D::is_collide_with_bodies_enabled() const {
return collide_with_bodies;
}
-void Physics2DShapeQueryParameters::set_collide_with_areas(bool p_enable) {
+void PhysicsShapeQueryParameters2D::set_collide_with_areas(bool p_enable) {
collide_with_areas = p_enable;
}
-bool Physics2DShapeQueryParameters::is_collide_with_areas_enabled() const {
+bool PhysicsShapeQueryParameters2D::is_collide_with_areas_enabled() const {
return collide_with_areas;
}
-void Physics2DShapeQueryParameters::_bind_methods() {
+void PhysicsShapeQueryParameters2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_shape", "shape"), &Physics2DShapeQueryParameters::set_shape);
- ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &Physics2DShapeQueryParameters::set_shape_rid);
- ClassDB::bind_method(D_METHOD("get_shape_rid"), &Physics2DShapeQueryParameters::get_shape_rid);
+ ClassDB::bind_method(D_METHOD("set_shape", "shape"), &PhysicsShapeQueryParameters2D::set_shape);
+ ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &PhysicsShapeQueryParameters2D::set_shape_rid);
+ ClassDB::bind_method(D_METHOD("get_shape_rid"), &PhysicsShapeQueryParameters2D::get_shape_rid);
- ClassDB::bind_method(D_METHOD("set_transform", "transform"), &Physics2DShapeQueryParameters::set_transform);
- ClassDB::bind_method(D_METHOD("get_transform"), &Physics2DShapeQueryParameters::get_transform);
+ ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsShapeQueryParameters2D::set_transform);
+ ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsShapeQueryParameters2D::get_transform);
- ClassDB::bind_method(D_METHOD("set_motion", "motion"), &Physics2DShapeQueryParameters::set_motion);
- ClassDB::bind_method(D_METHOD("get_motion"), &Physics2DShapeQueryParameters::get_motion);
+ ClassDB::bind_method(D_METHOD("set_motion", "motion"), &PhysicsShapeQueryParameters2D::set_motion);
+ ClassDB::bind_method(D_METHOD("get_motion"), &PhysicsShapeQueryParameters2D::get_motion);
- ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Physics2DShapeQueryParameters::set_margin);
- ClassDB::bind_method(D_METHOD("get_margin"), &Physics2DShapeQueryParameters::get_margin);
+ ClassDB::bind_method(D_METHOD("set_margin", "margin"), &PhysicsShapeQueryParameters2D::set_margin);
+ ClassDB::bind_method(D_METHOD("get_margin"), &PhysicsShapeQueryParameters2D::get_margin);
- ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &Physics2DShapeQueryParameters::set_collision_mask);
- ClassDB::bind_method(D_METHOD("get_collision_layer"), &Physics2DShapeQueryParameters::get_collision_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_layer", "collision_layer"), &PhysicsShapeQueryParameters2D::set_collision_mask);
+ ClassDB::bind_method(D_METHOD("get_collision_layer"), &PhysicsShapeQueryParameters2D::get_collision_mask);
- ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &Physics2DShapeQueryParameters::set_exclude);
- ClassDB::bind_method(D_METHOD("get_exclude"), &Physics2DShapeQueryParameters::get_exclude);
+ ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters2D::set_exclude);
+ ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters2D::get_exclude);
- ClassDB::bind_method(D_METHOD("set_collide_with_bodies", "enable"), &Physics2DShapeQueryParameters::set_collide_with_bodies);
- ClassDB::bind_method(D_METHOD("is_collide_with_bodies_enabled"), &Physics2DShapeQueryParameters::is_collide_with_bodies_enabled);
+ ClassDB::bind_method(D_METHOD("set_collide_with_bodies", "enable"), &PhysicsShapeQueryParameters2D::set_collide_with_bodies);
+ ClassDB::bind_method(D_METHOD("is_collide_with_bodies_enabled"), &PhysicsShapeQueryParameters2D::is_collide_with_bodies_enabled);
- ClassDB::bind_method(D_METHOD("set_collide_with_areas", "enable"), &Physics2DShapeQueryParameters::set_collide_with_areas);
- ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &Physics2DShapeQueryParameters::is_collide_with_areas_enabled);
+ ClassDB::bind_method(D_METHOD("set_collide_with_areas", "enable"), &PhysicsShapeQueryParameters2D::set_collide_with_areas);
+ ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters2D::is_collide_with_areas_enabled);
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_collision_layer", "get_collision_layer");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude");
@@ -258,7 +258,7 @@ void Physics2DShapeQueryParameters::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled");
}
-Physics2DShapeQueryParameters::Physics2DShapeQueryParameters() {
+PhysicsShapeQueryParameters2D::PhysicsShapeQueryParameters2D() {
margin = 0;
collision_mask = 0x7FFFFFFF;
@@ -266,7 +266,7 @@ Physics2DShapeQueryParameters::Physics2DShapeQueryParameters() {
collide_with_areas = false;
}
-Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2 &p_from, const Vector2 &p_to, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
+Dictionary PhysicsDirectSpaceState2D::_intersect_ray(const Vector2 &p_from, const Vector2 &p_to, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
RayResult inters;
Set<RID> exclude;
@@ -290,7 +290,7 @@ Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2 &p_from, cons
return d;
}
-Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
+Array PhysicsDirectSpaceState2D::_intersect_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -313,7 +313,7 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
return ret;
}
-Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
+Array PhysicsDirectSpaceState2D::_cast_motion(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -328,7 +328,7 @@ Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParam
return ret;
}
-Array Physics2DDirectSpaceState::_intersect_point_impl(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_filter_by_canvas, ObjectID p_canvas_instance_id) {
+Array PhysicsDirectSpaceState2D::_intersect_point_impl(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_filter_by_canvas, ObjectID p_canvas_instance_id) {
Set<RID> exclude;
for (int i = 0; i < p_exclude.size(); i++)
@@ -361,17 +361,17 @@ Array Physics2DDirectSpaceState::_intersect_point_impl(const Vector2 &p_point, i
return r;
}
-Array Physics2DDirectSpaceState::_intersect_point(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
+Array PhysicsDirectSpaceState2D::_intersect_point(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
return _intersect_point_impl(p_point, p_max_results, p_exclude, p_layers, p_collide_with_bodies, p_collide_with_areas);
}
-Array Physics2DDirectSpaceState::_intersect_point_on_canvas(const Vector2 &p_point, ObjectID p_canvas_intance_id, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
+Array PhysicsDirectSpaceState2D::_intersect_point_on_canvas(const Vector2 &p_point, ObjectID p_canvas_intance_id, int p_max_results, const Vector<RID> &p_exclude, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas) {
return _intersect_point_impl(p_point, p_max_results, p_exclude, p_layers, p_collide_with_bodies, p_collide_with_areas, true, p_canvas_intance_id);
}
-Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results) {
+Array PhysicsDirectSpaceState2D::_collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -387,7 +387,7 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar
r[i] = ret[i];
return r;
}
-Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query) {
+Dictionary PhysicsDirectSpaceState2D::_get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
@@ -409,51 +409,51 @@ Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQue
return r;
}
-Physics2DDirectSpaceState::Physics2DDirectSpaceState() {
+PhysicsDirectSpaceState2D::PhysicsDirectSpaceState2D() {
}
-void Physics2DDirectSpaceState::_bind_methods() {
+void PhysicsDirectSpaceState2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("intersect_point", "point", "max_results", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &Physics2DDirectSpaceState::_intersect_point, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("intersect_point_on_canvas", "point", "canvas_instance_id", "max_results", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &Physics2DDirectSpaceState::_intersect_point_on_canvas, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &Physics2DDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &Physics2DDirectSpaceState::_intersect_shape, DEFVAL(32));
- ClassDB::bind_method(D_METHOD("cast_motion", "shape"), &Physics2DDirectSpaceState::_cast_motion);
- ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &Physics2DDirectSpaceState::_collide_shape, DEFVAL(32));
- ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &Physics2DDirectSpaceState::_get_rest_info);
+ ClassDB::bind_method(D_METHOD("intersect_point", "point", "max_results", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState2D::_intersect_point, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("intersect_point_on_canvas", "point", "canvas_instance_id", "max_results", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState2D::_intersect_point_on_canvas, DEFVAL(32), DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_layer", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState2D::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState2D::_intersect_shape, DEFVAL(32));
+ ClassDB::bind_method(D_METHOD("cast_motion", "shape"), &PhysicsDirectSpaceState2D::_cast_motion);
+ ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState2D::_collide_shape, DEFVAL(32));
+ ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState2D::_get_rest_info);
}
-int Physics2DShapeQueryResult::get_result_count() const {
+int PhysicsShapeQueryResult2D::get_result_count() const {
return result.size();
}
-RID Physics2DShapeQueryResult::get_result_rid(int p_idx) const {
+RID PhysicsShapeQueryResult2D::get_result_rid(int p_idx) const {
return result[p_idx].rid;
}
-ObjectID Physics2DShapeQueryResult::get_result_object_id(int p_idx) const {
+ObjectID PhysicsShapeQueryResult2D::get_result_object_id(int p_idx) const {
return result[p_idx].collider_id;
}
-Object *Physics2DShapeQueryResult::get_result_object(int p_idx) const {
+Object *PhysicsShapeQueryResult2D::get_result_object(int p_idx) const {
return result[p_idx].collider;
}
-int Physics2DShapeQueryResult::get_result_object_shape(int p_idx) const {
+int PhysicsShapeQueryResult2D::get_result_object_shape(int p_idx) const {
return result[p_idx].shape;
}
-Physics2DShapeQueryResult::Physics2DShapeQueryResult() {
+PhysicsShapeQueryResult2D::PhysicsShapeQueryResult2D() {
}
-void Physics2DShapeQueryResult::_bind_methods() {
+void PhysicsShapeQueryResult2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_result_count"), &Physics2DShapeQueryResult::get_result_count);
- ClassDB::bind_method(D_METHOD("get_result_rid", "idx"), &Physics2DShapeQueryResult::get_result_rid);
- ClassDB::bind_method(D_METHOD("get_result_object_id", "idx"), &Physics2DShapeQueryResult::get_result_object_id);
- ClassDB::bind_method(D_METHOD("get_result_object", "idx"), &Physics2DShapeQueryResult::get_result_object);
- ClassDB::bind_method(D_METHOD("get_result_object_shape", "idx"), &Physics2DShapeQueryResult::get_result_object_shape);
+ ClassDB::bind_method(D_METHOD("get_result_count"), &PhysicsShapeQueryResult2D::get_result_count);
+ ClassDB::bind_method(D_METHOD("get_result_rid", "idx"), &PhysicsShapeQueryResult2D::get_result_rid);
+ ClassDB::bind_method(D_METHOD("get_result_object_id", "idx"), &PhysicsShapeQueryResult2D::get_result_object_id);
+ ClassDB::bind_method(D_METHOD("get_result_object", "idx"), &PhysicsShapeQueryResult2D::get_result_object);
+ ClassDB::bind_method(D_METHOD("get_result_object_shape", "idx"), &PhysicsShapeQueryResult2D::get_result_object_shape);
}
///////////////////////////////
@@ -529,7 +529,7 @@ Physics2DTestMotionResult::Physics2DTestMotionResult() {
///////////////////////////////////////
-bool Physics2DServer::_body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<Physics2DTestMotionResult> &p_result) {
+bool PhysicsServer2D::_body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<Physics2DTestMotionResult> &p_result) {
MotionResult *r = NULL;
if (p_result.is_valid())
@@ -537,154 +537,154 @@ bool Physics2DServer::_body_test_motion(RID p_body, const Transform2D &p_from, c
return body_test_motion(p_body, p_from, p_motion, p_infinite_inertia, p_margin, r);
}
-void Physics2DServer::_bind_methods() {
+void PhysicsServer2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("line_shape_create"), &Physics2DServer::line_shape_create);
- ClassDB::bind_method(D_METHOD("ray_shape_create"), &Physics2DServer::ray_shape_create);
- ClassDB::bind_method(D_METHOD("segment_shape_create"), &Physics2DServer::segment_shape_create);
- ClassDB::bind_method(D_METHOD("circle_shape_create"), &Physics2DServer::circle_shape_create);
- ClassDB::bind_method(D_METHOD("rectangle_shape_create"), &Physics2DServer::rectangle_shape_create);
- ClassDB::bind_method(D_METHOD("capsule_shape_create"), &Physics2DServer::capsule_shape_create);
- ClassDB::bind_method(D_METHOD("convex_polygon_shape_create"), &Physics2DServer::convex_polygon_shape_create);
- ClassDB::bind_method(D_METHOD("concave_polygon_shape_create"), &Physics2DServer::concave_polygon_shape_create);
+ ClassDB::bind_method(D_METHOD("line_shape_create"), &PhysicsServer2D::line_shape_create);
+ ClassDB::bind_method(D_METHOD("ray_shape_create"), &PhysicsServer2D::ray_shape_create);
+ ClassDB::bind_method(D_METHOD("segment_shape_create"), &PhysicsServer2D::segment_shape_create);
+ ClassDB::bind_method(D_METHOD("circle_shape_create"), &PhysicsServer2D::circle_shape_create);
+ ClassDB::bind_method(D_METHOD("rectangle_shape_create"), &PhysicsServer2D::rectangle_shape_create);
+ ClassDB::bind_method(D_METHOD("capsule_shape_create"), &PhysicsServer2D::capsule_shape_create);
+ ClassDB::bind_method(D_METHOD("convex_polygon_shape_create"), &PhysicsServer2D::convex_polygon_shape_create);
+ ClassDB::bind_method(D_METHOD("concave_polygon_shape_create"), &PhysicsServer2D::concave_polygon_shape_create);
- ClassDB::bind_method(D_METHOD("shape_set_data", "shape", "data"), &Physics2DServer::shape_set_data);
+ ClassDB::bind_method(D_METHOD("shape_set_data", "shape", "data"), &PhysicsServer2D::shape_set_data);
- ClassDB::bind_method(D_METHOD("shape_get_type", "shape"), &Physics2DServer::shape_get_type);
- ClassDB::bind_method(D_METHOD("shape_get_data", "shape"), &Physics2DServer::shape_get_data);
+ ClassDB::bind_method(D_METHOD("shape_get_type", "shape"), &PhysicsServer2D::shape_get_type);
+ ClassDB::bind_method(D_METHOD("shape_get_data", "shape"), &PhysicsServer2D::shape_get_data);
- ClassDB::bind_method(D_METHOD("space_create"), &Physics2DServer::space_create);
- ClassDB::bind_method(D_METHOD("space_set_active", "space", "active"), &Physics2DServer::space_set_active);
- ClassDB::bind_method(D_METHOD("space_is_active", "space"), &Physics2DServer::space_is_active);
- ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &Physics2DServer::space_set_param);
- ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &Physics2DServer::space_get_param);
- ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &Physics2DServer::space_get_direct_state);
+ ClassDB::bind_method(D_METHOD("space_create"), &PhysicsServer2D::space_create);
+ ClassDB::bind_method(D_METHOD("space_set_active", "space", "active"), &PhysicsServer2D::space_set_active);
+ ClassDB::bind_method(D_METHOD("space_is_active", "space"), &PhysicsServer2D::space_is_active);
+ ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &PhysicsServer2D::space_set_param);
+ ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &PhysicsServer2D::space_get_param);
+ ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &PhysicsServer2D::space_get_direct_state);
- ClassDB::bind_method(D_METHOD("area_create"), &Physics2DServer::area_create);
- ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &Physics2DServer::area_set_space);
- ClassDB::bind_method(D_METHOD("area_get_space", "area"), &Physics2DServer::area_get_space);
+ ClassDB::bind_method(D_METHOD("area_create"), &PhysicsServer2D::area_create);
+ ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &PhysicsServer2D::area_set_space);
+ ClassDB::bind_method(D_METHOD("area_get_space", "area"), &PhysicsServer2D::area_get_space);
- ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &Physics2DServer::area_set_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &Physics2DServer::area_get_space_override_mode);
+ ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &PhysicsServer2D::area_set_space_override_mode);
+ ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &PhysicsServer2D::area_get_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &Physics2DServer::area_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &Physics2DServer::area_set_shape);
- ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &Physics2DServer::area_set_shape_transform);
- ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &Physics2DServer::area_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &PhysicsServer2D::area_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &PhysicsServer2D::area_set_shape);
+ ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &PhysicsServer2D::area_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &PhysicsServer2D::area_set_shape_disabled);
- ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &Physics2DServer::area_get_shape_count);
- ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &Physics2DServer::area_get_shape);
- ClassDB::bind_method(D_METHOD("area_get_shape_transform", "area", "shape_idx"), &Physics2DServer::area_get_shape_transform);
+ ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &PhysicsServer2D::area_get_shape_count);
+ ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &PhysicsServer2D::area_get_shape);
+ ClassDB::bind_method(D_METHOD("area_get_shape_transform", "area", "shape_idx"), &PhysicsServer2D::area_get_shape_transform);
- ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &Physics2DServer::area_remove_shape);
- ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &Physics2DServer::area_clear_shapes);
+ ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &PhysicsServer2D::area_remove_shape);
+ ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &PhysicsServer2D::area_clear_shapes);
- ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &Physics2DServer::area_set_collision_layer);
- ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &Physics2DServer::area_set_collision_mask);
+ ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &PhysicsServer2D::area_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &PhysicsServer2D::area_set_collision_mask);
- ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &Physics2DServer::area_set_param);
- ClassDB::bind_method(D_METHOD("area_set_transform", "area", "transform"), &Physics2DServer::area_set_transform);
+ ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &PhysicsServer2D::area_set_param);
+ ClassDB::bind_method(D_METHOD("area_set_transform", "area", "transform"), &PhysicsServer2D::area_set_transform);
- ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &Physics2DServer::area_get_param);
- ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &Physics2DServer::area_get_transform);
+ ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &PhysicsServer2D::area_get_param);
+ ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &PhysicsServer2D::area_get_transform);
- ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &Physics2DServer::area_attach_object_instance_id);
- ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &Physics2DServer::area_get_object_instance_id);
+ ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &PhysicsServer2D::area_attach_object_instance_id);
+ ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer2D::area_get_object_instance_id);
- ClassDB::bind_method(D_METHOD("area_attach_canvas_instance_id", "area", "id"), &Physics2DServer::area_attach_canvas_instance_id);
- ClassDB::bind_method(D_METHOD("area_get_canvas_instance_id", "area"), &Physics2DServer::area_get_canvas_instance_id);
+ ClassDB::bind_method(D_METHOD("area_attach_canvas_instance_id", "area", "id"), &PhysicsServer2D::area_attach_canvas_instance_id);
+ ClassDB::bind_method(D_METHOD("area_get_canvas_instance_id", "area"), &PhysicsServer2D::area_get_canvas_instance_id);
- ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_monitor_callback);
- ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &Physics2DServer::area_set_area_monitor_callback);
- ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &Physics2DServer::area_set_monitorable);
+ ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer2D::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &PhysicsServer2D::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &PhysicsServer2D::area_set_monitorable);
- ClassDB::bind_method(D_METHOD("body_create"), &Physics2DServer::body_create);
+ ClassDB::bind_method(D_METHOD("body_create"), &PhysicsServer2D::body_create);
- ClassDB::bind_method(D_METHOD("body_set_space", "body", "space"), &Physics2DServer::body_set_space);
- ClassDB::bind_method(D_METHOD("body_get_space", "body"), &Physics2DServer::body_get_space);
+ ClassDB::bind_method(D_METHOD("body_set_space", "body", "space"), &PhysicsServer2D::body_set_space);
+ ClassDB::bind_method(D_METHOD("body_get_space", "body"), &PhysicsServer2D::body_get_space);
- ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &Physics2DServer::body_set_mode);
- ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &Physics2DServer::body_get_mode);
+ ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &PhysicsServer2D::body_set_mode);
+ ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &PhysicsServer2D::body_get_mode);
- ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &Physics2DServer::body_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &Physics2DServer::body_set_shape);
- ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &Physics2DServer::body_set_shape_transform);
- ClassDB::bind_method(D_METHOD("body_set_shape_metadata", "body", "shape_idx", "metadata"), &Physics2DServer::body_set_shape_metadata);
+ ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &PhysicsServer2D::body_add_shape, DEFVAL(Transform2D()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &PhysicsServer2D::body_set_shape);
+ ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &PhysicsServer2D::body_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("body_set_shape_metadata", "body", "shape_idx", "metadata"), &PhysicsServer2D::body_set_shape_metadata);
- ClassDB::bind_method(D_METHOD("body_get_shape_count", "body"), &Physics2DServer::body_get_shape_count);
- ClassDB::bind_method(D_METHOD("body_get_shape", "body", "shape_idx"), &Physics2DServer::body_get_shape);
- ClassDB::bind_method(D_METHOD("body_get_shape_transform", "body", "shape_idx"), &Physics2DServer::body_get_shape_transform);
- ClassDB::bind_method(D_METHOD("body_get_shape_metadata", "body", "shape_idx"), &Physics2DServer::body_get_shape_metadata);
+ ClassDB::bind_method(D_METHOD("body_get_shape_count", "body"), &PhysicsServer2D::body_get_shape_count);
+ ClassDB::bind_method(D_METHOD("body_get_shape", "body", "shape_idx"), &PhysicsServer2D::body_get_shape);
+ ClassDB::bind_method(D_METHOD("body_get_shape_transform", "body", "shape_idx"), &PhysicsServer2D::body_get_shape_transform);
+ ClassDB::bind_method(D_METHOD("body_get_shape_metadata", "body", "shape_idx"), &PhysicsServer2D::body_get_shape_metadata);
- ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &Physics2DServer::body_remove_shape);
- ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &Physics2DServer::body_clear_shapes);
+ ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &PhysicsServer2D::body_remove_shape);
+ ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &PhysicsServer2D::body_clear_shapes);
- ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &Physics2DServer::body_set_shape_disabled);
- ClassDB::bind_method(D_METHOD("body_set_shape_as_one_way_collision", "body", "shape_idx", "enable", "margin"), &Physics2DServer::body_set_shape_as_one_way_collision);
+ ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &PhysicsServer2D::body_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("body_set_shape_as_one_way_collision", "body", "shape_idx", "enable", "margin"), &PhysicsServer2D::body_set_shape_as_one_way_collision);
- ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &Physics2DServer::body_attach_object_instance_id);
- ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &Physics2DServer::body_get_object_instance_id);
+ ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &PhysicsServer2D::body_attach_object_instance_id);
+ ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &PhysicsServer2D::body_get_object_instance_id);
- ClassDB::bind_method(D_METHOD("body_attach_canvas_instance_id", "body", "id"), &Physics2DServer::body_attach_canvas_instance_id);
- ClassDB::bind_method(D_METHOD("body_get_canvas_instance_id", "body"), &Physics2DServer::body_get_canvas_instance_id);
+ ClassDB::bind_method(D_METHOD("body_attach_canvas_instance_id", "body", "id"), &PhysicsServer2D::body_attach_canvas_instance_id);
+ ClassDB::bind_method(D_METHOD("body_get_canvas_instance_id", "body"), &PhysicsServer2D::body_get_canvas_instance_id);
- ClassDB::bind_method(D_METHOD("body_set_continuous_collision_detection_mode", "body", "mode"), &Physics2DServer::body_set_continuous_collision_detection_mode);
- ClassDB::bind_method(D_METHOD("body_get_continuous_collision_detection_mode", "body"), &Physics2DServer::body_get_continuous_collision_detection_mode);
+ ClassDB::bind_method(D_METHOD("body_set_continuous_collision_detection_mode", "body", "mode"), &PhysicsServer2D::body_set_continuous_collision_detection_mode);
+ ClassDB::bind_method(D_METHOD("body_get_continuous_collision_detection_mode", "body"), &PhysicsServer2D::body_get_continuous_collision_detection_mode);
- ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &Physics2DServer::body_set_collision_layer);
- ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &Physics2DServer::body_get_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &PhysicsServer2D::body_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &PhysicsServer2D::body_get_collision_layer);
- ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &Physics2DServer::body_set_collision_mask);
- ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &Physics2DServer::body_get_collision_mask);
+ ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &PhysicsServer2D::body_set_collision_mask);
+ ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &PhysicsServer2D::body_get_collision_mask);
- ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &Physics2DServer::body_set_param);
- ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &Physics2DServer::body_get_param);
+ ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &PhysicsServer2D::body_set_param);
+ ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &PhysicsServer2D::body_get_param);
- ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &Physics2DServer::body_set_state);
- ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &Physics2DServer::body_get_state);
+ ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &PhysicsServer2D::body_set_state);
+ ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &PhysicsServer2D::body_get_state);
- ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &Physics2DServer::body_apply_central_impulse);
- ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &Physics2DServer::body_apply_torque_impulse);
- ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &Physics2DServer::body_apply_impulse);
- ClassDB::bind_method(D_METHOD("body_add_central_force", "body", "force"), &Physics2DServer::body_add_central_force);
- ClassDB::bind_method(D_METHOD("body_add_force", "body", "offset", "force"), &Physics2DServer::body_add_force);
- ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &Physics2DServer::body_add_torque);
- ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &Physics2DServer::body_set_axis_velocity);
+ ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &PhysicsServer2D::body_apply_central_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &PhysicsServer2D::body_apply_torque_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &PhysicsServer2D::body_apply_impulse);
+ ClassDB::bind_method(D_METHOD("body_add_central_force", "body", "force"), &PhysicsServer2D::body_add_central_force);
+ ClassDB::bind_method(D_METHOD("body_add_force", "body", "offset", "force"), &PhysicsServer2D::body_add_force);
+ ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &PhysicsServer2D::body_add_torque);
+ ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &PhysicsServer2D::body_set_axis_velocity);
- ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &Physics2DServer::body_add_collision_exception);
- ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &Physics2DServer::body_remove_collision_exception);
+ ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &PhysicsServer2D::body_add_collision_exception);
+ ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &PhysicsServer2D::body_remove_collision_exception);
- ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &Physics2DServer::body_set_max_contacts_reported);
- ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &Physics2DServer::body_get_max_contacts_reported);
+ ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &PhysicsServer2D::body_set_max_contacts_reported);
+ ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &PhysicsServer2D::body_get_max_contacts_reported);
- ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &Physics2DServer::body_set_omit_force_integration);
- ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &Physics2DServer::body_is_omitting_force_integration);
+ ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &PhysicsServer2D::body_set_omit_force_integration);
+ ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &PhysicsServer2D::body_is_omitting_force_integration);
- ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "receiver", "method", "userdata"), &Physics2DServer::body_set_force_integration_callback, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "receiver", "method", "userdata"), &PhysicsServer2D::body_set_force_integration_callback, DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "infinite_inertia", "margin", "result"), &Physics2DServer::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("body_test_motion", "body", "from", "motion", "infinite_inertia", "margin", "result"), &PhysicsServer2D::_body_test_motion, DEFVAL(0.08), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &Physics2DServer::body_get_direct_state);
+ ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &PhysicsServer2D::body_get_direct_state);
/* JOINT API */
- ClassDB::bind_method(D_METHOD("joint_set_param", "joint", "param", "value"), &Physics2DServer::joint_set_param);
- ClassDB::bind_method(D_METHOD("joint_get_param", "joint", "param"), &Physics2DServer::joint_get_param);
+ ClassDB::bind_method(D_METHOD("joint_set_param", "joint", "param", "value"), &PhysicsServer2D::joint_set_param);
+ ClassDB::bind_method(D_METHOD("joint_get_param", "joint", "param"), &PhysicsServer2D::joint_get_param);
- ClassDB::bind_method(D_METHOD("pin_joint_create", "anchor", "body_a", "body_b"), &Physics2DServer::pin_joint_create, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("groove_joint_create", "groove1_a", "groove2_a", "anchor_b", "body_a", "body_b"), &Physics2DServer::groove_joint_create, DEFVAL(RID()), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("damped_spring_joint_create", "anchor_a", "anchor_b", "body_a", "body_b"), &Physics2DServer::damped_spring_joint_create, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("pin_joint_create", "anchor", "body_a", "body_b"), &PhysicsServer2D::pin_joint_create, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("groove_joint_create", "groove1_a", "groove2_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::groove_joint_create, DEFVAL(RID()), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("damped_spring_joint_create", "anchor_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::damped_spring_joint_create, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("damped_string_joint_set_param", "joint", "param", "value"), &Physics2DServer::damped_string_joint_set_param);
- ClassDB::bind_method(D_METHOD("damped_string_joint_get_param", "joint", "param"), &Physics2DServer::damped_string_joint_get_param);
+ ClassDB::bind_method(D_METHOD("damped_string_joint_set_param", "joint", "param", "value"), &PhysicsServer2D::damped_string_joint_set_param);
+ ClassDB::bind_method(D_METHOD("damped_string_joint_get_param", "joint", "param"), &PhysicsServer2D::damped_string_joint_get_param);
- ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &Physics2DServer::joint_get_type);
+ ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer2D::joint_get_type);
- ClassDB::bind_method(D_METHOD("free_rid", "rid"), &Physics2DServer::free);
+ ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer2D::free);
- ClassDB::bind_method(D_METHOD("set_active", "active"), &Physics2DServer::set_active);
+ ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer2D::set_active);
- ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &Physics2DServer::get_process_info);
+ ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer2D::get_process_info);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS);
BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION);
@@ -764,22 +764,22 @@ void Physics2DServer::_bind_methods() {
BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT);
}
-Physics2DServer::Physics2DServer() {
+PhysicsServer2D::PhysicsServer2D() {
singleton = this;
}
-Physics2DServer::~Physics2DServer() {
+PhysicsServer2D::~PhysicsServer2D() {
singleton = NULL;
}
-Vector<Physics2DServerManager::ClassInfo> Physics2DServerManager::physics_2d_servers;
-int Physics2DServerManager::default_server_id = -1;
-int Physics2DServerManager::default_server_priority = -1;
-const String Physics2DServerManager::setting_property_name("physics/2d/physics_engine");
+Vector<PhysicsServer2DManager::ClassInfo> PhysicsServer2DManager::physics_2d_servers;
+int PhysicsServer2DManager::default_server_id = -1;
+int PhysicsServer2DManager::default_server_priority = -1;
+const String PhysicsServer2DManager::setting_property_name("physics/2d/physics_engine");
-void Physics2DServerManager::on_servers_changed() {
+void PhysicsServer2DManager::on_servers_changed() {
String physics_servers("DEFAULT");
for (int i = get_servers_count() - 1; 0 <= i; --i) {
@@ -788,7 +788,7 @@ void Physics2DServerManager::on_servers_changed() {
ProjectSettings::get_singleton()->set_custom_property_info(setting_property_name, PropertyInfo(Variant::STRING, setting_property_name, PROPERTY_HINT_ENUM, physics_servers));
}
-void Physics2DServerManager::register_server(const String &p_name, CreatePhysics2DServerCallback p_creat_callback) {
+void PhysicsServer2DManager::register_server(const String &p_name, CreatePhysicsServer2DCallback p_creat_callback) {
ERR_FAIL_COND(!p_creat_callback);
ERR_FAIL_COND(find_server_id(p_name) != -1);
@@ -796,7 +796,7 @@ void Physics2DServerManager::register_server(const String &p_name, CreatePhysics
on_servers_changed();
}
-void Physics2DServerManager::set_default_server(const String &p_name, int p_priority) {
+void PhysicsServer2DManager::set_default_server(const String &p_name, int p_priority) {
const int id = find_server_id(p_name);
ERR_FAIL_COND(id == -1); // Not found
@@ -806,7 +806,7 @@ void Physics2DServerManager::set_default_server(const String &p_name, int p_prio
}
}
-int Physics2DServerManager::find_server_id(const String &p_name) {
+int PhysicsServer2DManager::find_server_id(const String &p_name) {
for (int i = physics_2d_servers.size() - 1; 0 <= i; --i) {
if (p_name == physics_2d_servers[i].name) {
@@ -816,21 +816,21 @@ int Physics2DServerManager::find_server_id(const String &p_name) {
return -1;
}
-int Physics2DServerManager::get_servers_count() {
+int PhysicsServer2DManager::get_servers_count() {
return physics_2d_servers.size();
}
-String Physics2DServerManager::get_server_name(int p_id) {
+String PhysicsServer2DManager::get_server_name(int p_id) {
ERR_FAIL_INDEX_V(p_id, get_servers_count(), "");
return physics_2d_servers[p_id].name;
}
-Physics2DServer *Physics2DServerManager::new_default_server() {
+PhysicsServer2D *PhysicsServer2DManager::new_default_server() {
ERR_FAIL_COND_V(default_server_id == -1, NULL);
return physics_2d_servers[default_server_id].create_callback();
}
-Physics2DServer *Physics2DServerManager::new_server(const String &p_name) {
+PhysicsServer2D *PhysicsServer2DManager::new_server(const String &p_name) {
int id = find_server_id(p_name);
if (id == -1) {
return NULL;
diff --git a/servers/physics_2d_server.h b/servers/physics_server_2d.h
index c923ef16b7..9fa3a7b71a 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_server_2d.h
@@ -35,11 +35,11 @@
#include "core/reference.h"
#include "core/resource.h"
-class Physics2DDirectSpaceState;
+class PhysicsDirectSpaceState2D;
-class Physics2DDirectBodyState : public Object {
+class PhysicsDirectBodyState2D : public Object {
- GDCLASS(Physics2DDirectBodyState, Object);
+ GDCLASS(PhysicsDirectBodyState2D, Object);
protected:
static void _bind_methods();
@@ -88,18 +88,18 @@ public:
virtual real_t get_step() const = 0;
virtual void integrate_forces();
- virtual Physics2DDirectSpaceState *get_space_state() = 0;
+ virtual PhysicsDirectSpaceState2D *get_space_state() = 0;
- Physics2DDirectBodyState();
+ PhysicsDirectBodyState2D();
};
-class Physics2DShapeQueryResult;
+class PhysicsShapeQueryResult2D;
//used for script
-class Physics2DShapeQueryParameters : public Reference {
+class PhysicsShapeQueryParameters2D : public Reference {
- GDCLASS(Physics2DShapeQueryParameters, Reference);
- friend class Physics2DDirectSpaceState;
+ GDCLASS(PhysicsShapeQueryParameters2D, Reference);
+ friend class PhysicsDirectSpaceState2D;
RID shape;
Transform2D transform;
Vector2 motion;
@@ -139,21 +139,21 @@ public:
void set_exclude(const Vector<RID> &p_exclude);
Vector<RID> get_exclude() const;
- Physics2DShapeQueryParameters();
+ PhysicsShapeQueryParameters2D();
};
-class Physics2DDirectSpaceState : public Object {
+class PhysicsDirectSpaceState2D : public Object {
- GDCLASS(Physics2DDirectSpaceState, Object);
+ GDCLASS(PhysicsDirectSpaceState2D, Object);
Dictionary _intersect_ray(const Vector2 &p_from, const Vector2 &p_to, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
Array _intersect_point(const Vector2 &p_point, int p_max_results = 32, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
Array _intersect_point_on_canvas(const Vector2 &p_point, ObjectID p_canvas_intance_id, int p_max_results = 32, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_layers = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
Array _intersect_point_impl(const Vector2 &p_point, int p_max_results, const Vector<RID> &p_exclud, uint32_t p_layers, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_filter_by_canvas = false, ObjectID p_canvas_instance_id = ObjectID());
- Array _intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results = 32);
- Array _cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query);
- Array _collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query, int p_max_results = 32);
- Dictionary _get_rest_info(const Ref<Physics2DShapeQueryParameters> &p_shape_query);
+ Array _intersect_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results = 32);
+ Array _cast_motion(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query);
+ Array _collide_shape(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query, int p_max_results = 32);
+ Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters2D> &p_shape_query);
protected:
static void _bind_methods();
@@ -203,16 +203,16 @@ public:
virtual bool rest_info(RID p_shape, const Transform2D &p_shape_xform, const Vector2 &p_motion, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_layer = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) = 0;
- Physics2DDirectSpaceState();
+ PhysicsDirectSpaceState2D();
};
-class Physics2DShapeQueryResult : public Reference {
+class PhysicsShapeQueryResult2D : public Reference {
- GDCLASS(Physics2DShapeQueryResult, Reference);
+ GDCLASS(PhysicsShapeQueryResult2D, Reference);
- Vector<Physics2DDirectSpaceState::ShapeResult> result;
+ Vector<PhysicsDirectSpaceState2D::ShapeResult> result;
- friend class Physics2DDirectSpaceState;
+ friend class PhysicsDirectSpaceState2D;
protected:
static void _bind_methods();
@@ -224,16 +224,16 @@ public:
Object *get_result_object(int p_idx) const;
int get_result_object_shape(int p_idx) const;
- Physics2DShapeQueryResult();
+ PhysicsShapeQueryResult2D();
};
class Physics2DTestMotionResult;
-class Physics2DServer : public Object {
+class PhysicsServer2D : public Object {
- GDCLASS(Physics2DServer, Object);
+ GDCLASS(PhysicsServer2D, Object);
- static Physics2DServer *singleton;
+ static PhysicsServer2D *singleton;
virtual bool _body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin = 0.08, const Ref<Physics2DTestMotionResult> &p_result = Ref<Physics2DTestMotionResult>());
@@ -241,7 +241,7 @@ protected:
static void _bind_methods();
public:
- static Physics2DServer *get_singleton();
+ static PhysicsServer2D *get_singleton();
enum ShapeType {
SHAPE_LINE, ///< plane:"plane"
@@ -296,7 +296,7 @@ public:
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const = 0;
// this function only works on physics process, errors and returns null otherwise
- virtual Physics2DDirectSpaceState *space_get_direct_state(RID p_space) = 0;
+ virtual PhysicsDirectSpaceState2D *space_get_direct_state(RID p_space) = 0;
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts) = 0;
virtual Vector<Vector2> space_get_contacts(RID p_space) const = 0;
@@ -490,7 +490,7 @@ public:
virtual void body_set_pickable(RID p_body, bool p_pickable) = 0;
// this function only works on physics process, errors and returns null otherwise
- virtual Physics2DDirectBodyState *body_get_direct_state(RID p_body) = 0;
+ virtual PhysicsDirectBodyState2D *body_get_direct_state(RID p_body) = 0;
struct MotionResult {
@@ -602,23 +602,23 @@ public:
virtual int get_process_info(ProcessInfo p_info) = 0;
- Physics2DServer();
- ~Physics2DServer();
+ PhysicsServer2D();
+ ~PhysicsServer2D();
};
class Physics2DTestMotionResult : public Reference {
GDCLASS(Physics2DTestMotionResult, Reference);
- Physics2DServer::MotionResult result;
+ PhysicsServer2D::MotionResult result;
bool colliding;
- friend class Physics2DServer;
+ friend class PhysicsServer2D;
protected:
static void _bind_methods();
public:
- Physics2DServer::MotionResult *get_result_ptr() const { return const_cast<Physics2DServer::MotionResult *>(&result); }
+ PhysicsServer2D::MotionResult *get_result_ptr() const { return const_cast<PhysicsServer2D::MotionResult *>(&result); }
//bool is_colliding() const;
Vector2 get_motion() const;
@@ -635,18 +635,18 @@ public:
Physics2DTestMotionResult();
};
-typedef Physics2DServer *(*CreatePhysics2DServerCallback)();
+typedef PhysicsServer2D *(*CreatePhysicsServer2DCallback)();
-class Physics2DServerManager {
+class PhysicsServer2DManager {
struct ClassInfo {
String name;
- CreatePhysics2DServerCallback create_callback;
+ CreatePhysicsServer2DCallback create_callback;
ClassInfo() :
name(""),
create_callback(NULL) {}
- ClassInfo(String p_name, CreatePhysics2DServerCallback p_create_callback) :
+ ClassInfo(String p_name, CreatePhysicsServer2DCallback p_create_callback) :
name(p_name),
create_callback(p_create_callback) {}
@@ -672,28 +672,28 @@ private:
static void on_servers_changed();
public:
- static void register_server(const String &p_name, CreatePhysics2DServerCallback p_creat_callback);
+ static void register_server(const String &p_name, CreatePhysicsServer2DCallback p_creat_callback);
static void set_default_server(const String &p_name, int p_priority = 0);
static int find_server_id(const String &p_name);
static int get_servers_count();
static String get_server_name(int p_id);
- static Physics2DServer *new_default_server();
- static Physics2DServer *new_server(const String &p_name);
+ static PhysicsServer2D *new_default_server();
+ static PhysicsServer2D *new_server(const String &p_name);
};
-VARIANT_ENUM_CAST(Physics2DServer::ShapeType);
-VARIANT_ENUM_CAST(Physics2DServer::SpaceParameter);
-VARIANT_ENUM_CAST(Physics2DServer::AreaParameter);
-VARIANT_ENUM_CAST(Physics2DServer::AreaSpaceOverrideMode);
-VARIANT_ENUM_CAST(Physics2DServer::BodyMode);
-VARIANT_ENUM_CAST(Physics2DServer::BodyParameter);
-VARIANT_ENUM_CAST(Physics2DServer::BodyState);
-VARIANT_ENUM_CAST(Physics2DServer::CCDMode);
-VARIANT_ENUM_CAST(Physics2DServer::JointParam);
-VARIANT_ENUM_CAST(Physics2DServer::JointType);
-VARIANT_ENUM_CAST(Physics2DServer::DampedStringParam);
-//VARIANT_ENUM_CAST( Physics2DServer::ObjectType );
-VARIANT_ENUM_CAST(Physics2DServer::AreaBodyStatus);
-VARIANT_ENUM_CAST(Physics2DServer::ProcessInfo);
+VARIANT_ENUM_CAST(PhysicsServer2D::ShapeType);
+VARIANT_ENUM_CAST(PhysicsServer2D::SpaceParameter);
+VARIANT_ENUM_CAST(PhysicsServer2D::AreaParameter);
+VARIANT_ENUM_CAST(PhysicsServer2D::AreaSpaceOverrideMode);
+VARIANT_ENUM_CAST(PhysicsServer2D::BodyMode);
+VARIANT_ENUM_CAST(PhysicsServer2D::BodyParameter);
+VARIANT_ENUM_CAST(PhysicsServer2D::BodyState);
+VARIANT_ENUM_CAST(PhysicsServer2D::CCDMode);
+VARIANT_ENUM_CAST(PhysicsServer2D::JointParam);
+VARIANT_ENUM_CAST(PhysicsServer2D::JointType);
+VARIANT_ENUM_CAST(PhysicsServer2D::DampedStringParam);
+//VARIANT_ENUM_CAST( PhysicsServer2D::ObjectType );
+VARIANT_ENUM_CAST(PhysicsServer2D::AreaBodyStatus);
+VARIANT_ENUM_CAST(PhysicsServer2D::ProcessInfo);
#endif
diff --git a/servers/physics_server.cpp b/servers/physics_server_3d.cpp
index 57f3a7979e..ddc96d2722 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server_3d.cpp
@@ -28,15 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "physics_server.h"
+#include "physics_server_3d.h"
#include "core/method_bind_ext.gen.inc"
#include "core/print_string.h"
#include "core/project_settings.h"
-PhysicsServer *PhysicsServer::singleton = NULL;
+PhysicsServer3D *PhysicsServer3D::singleton = NULL;
-void PhysicsDirectBodyState::integrate_forces() {
+void PhysicsDirectBodyState3D::integrate_forces() {
real_t step = get_step();
Vector3 lv = get_linear_velocity();
@@ -61,64 +61,64 @@ void PhysicsDirectBodyState::integrate_forces() {
set_angular_velocity(av);
}
-Object *PhysicsDirectBodyState::get_contact_collider_object(int p_contact_idx) const {
+Object *PhysicsDirectBodyState3D::get_contact_collider_object(int p_contact_idx) const {
ObjectID objid = get_contact_collider_id(p_contact_idx);
Object *obj = ObjectDB::get_instance(objid);
return obj;
}
-PhysicsServer *PhysicsServer::get_singleton() {
+PhysicsServer3D *PhysicsServer3D::get_singleton() {
return singleton;
}
-void PhysicsDirectBodyState::_bind_methods() {
+void PhysicsDirectBodyState3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_total_gravity"), &PhysicsDirectBodyState::get_total_gravity);
- ClassDB::bind_method(D_METHOD("get_total_linear_damp"), &PhysicsDirectBodyState::get_total_linear_damp);
- ClassDB::bind_method(D_METHOD("get_total_angular_damp"), &PhysicsDirectBodyState::get_total_angular_damp);
+ ClassDB::bind_method(D_METHOD("get_total_gravity"), &PhysicsDirectBodyState3D::get_total_gravity);
+ ClassDB::bind_method(D_METHOD("get_total_linear_damp"), &PhysicsDirectBodyState3D::get_total_linear_damp);
+ ClassDB::bind_method(D_METHOD("get_total_angular_damp"), &PhysicsDirectBodyState3D::get_total_angular_damp);
- ClassDB::bind_method(D_METHOD("get_center_of_mass"), &PhysicsDirectBodyState::get_center_of_mass);
- ClassDB::bind_method(D_METHOD("get_principal_inertia_axes"), &PhysicsDirectBodyState::get_principal_inertia_axes);
+ ClassDB::bind_method(D_METHOD("get_center_of_mass"), &PhysicsDirectBodyState3D::get_center_of_mass);
+ ClassDB::bind_method(D_METHOD("get_principal_inertia_axes"), &PhysicsDirectBodyState3D::get_principal_inertia_axes);
- ClassDB::bind_method(D_METHOD("get_inverse_mass"), &PhysicsDirectBodyState::get_inverse_mass);
- ClassDB::bind_method(D_METHOD("get_inverse_inertia"), &PhysicsDirectBodyState::get_inverse_inertia);
+ ClassDB::bind_method(D_METHOD("get_inverse_mass"), &PhysicsDirectBodyState3D::get_inverse_mass);
+ ClassDB::bind_method(D_METHOD("get_inverse_inertia"), &PhysicsDirectBodyState3D::get_inverse_inertia);
- ClassDB::bind_method(D_METHOD("set_linear_velocity", "velocity"), &PhysicsDirectBodyState::set_linear_velocity);
- ClassDB::bind_method(D_METHOD("get_linear_velocity"), &PhysicsDirectBodyState::get_linear_velocity);
+ ClassDB::bind_method(D_METHOD("set_linear_velocity", "velocity"), &PhysicsDirectBodyState3D::set_linear_velocity);
+ ClassDB::bind_method(D_METHOD("get_linear_velocity"), &PhysicsDirectBodyState3D::get_linear_velocity);
- ClassDB::bind_method(D_METHOD("set_angular_velocity", "velocity"), &PhysicsDirectBodyState::set_angular_velocity);
- ClassDB::bind_method(D_METHOD("get_angular_velocity"), &PhysicsDirectBodyState::get_angular_velocity);
+ ClassDB::bind_method(D_METHOD("set_angular_velocity", "velocity"), &PhysicsDirectBodyState3D::set_angular_velocity);
+ ClassDB::bind_method(D_METHOD("get_angular_velocity"), &PhysicsDirectBodyState3D::get_angular_velocity);
- ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsDirectBodyState::set_transform);
- ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsDirectBodyState::get_transform);
+ ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsDirectBodyState3D::set_transform);
+ ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsDirectBodyState3D::get_transform);
- ClassDB::bind_method(D_METHOD("add_central_force", "force"), &PhysicsDirectBodyState::add_central_force);
- ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &PhysicsDirectBodyState::add_force);
- ClassDB::bind_method(D_METHOD("add_torque", "torque"), &PhysicsDirectBodyState::add_torque);
- ClassDB::bind_method(D_METHOD("apply_central_impulse", "j"), &PhysicsDirectBodyState::apply_central_impulse);
- ClassDB::bind_method(D_METHOD("apply_impulse", "position", "j"), &PhysicsDirectBodyState::apply_impulse);
- ClassDB::bind_method(D_METHOD("apply_torque_impulse", "j"), &PhysicsDirectBodyState::apply_torque_impulse);
+ ClassDB::bind_method(D_METHOD("add_central_force", "force"), &PhysicsDirectBodyState3D::add_central_force);
+ ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &PhysicsDirectBodyState3D::add_force);
+ ClassDB::bind_method(D_METHOD("add_torque", "torque"), &PhysicsDirectBodyState3D::add_torque);
+ ClassDB::bind_method(D_METHOD("apply_central_impulse", "j"), &PhysicsDirectBodyState3D::apply_central_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "position", "j"), &PhysicsDirectBodyState3D::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_torque_impulse", "j"), &PhysicsDirectBodyState3D::apply_torque_impulse);
- ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &PhysicsDirectBodyState::set_sleep_state);
- ClassDB::bind_method(D_METHOD("is_sleeping"), &PhysicsDirectBodyState::is_sleeping);
+ ClassDB::bind_method(D_METHOD("set_sleep_state", "enabled"), &PhysicsDirectBodyState3D::set_sleep_state);
+ ClassDB::bind_method(D_METHOD("is_sleeping"), &PhysicsDirectBodyState3D::is_sleeping);
- ClassDB::bind_method(D_METHOD("get_contact_count"), &PhysicsDirectBodyState::get_contact_count);
+ ClassDB::bind_method(D_METHOD("get_contact_count"), &PhysicsDirectBodyState3D::get_contact_count);
- ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_position);
- ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_normal);
- ClassDB::bind_method(D_METHOD("get_contact_impulse", "contact_idx"), &PhysicsDirectBodyState::get_contact_impulse);
- ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &PhysicsDirectBodyState::get_contact_local_shape);
- ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider);
- ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_position);
- ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_id);
- ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_object);
- ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_shape);
- ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &PhysicsDirectBodyState::get_contact_collider_velocity_at_position);
- ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState::get_step);
- ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState::integrate_forces);
- ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState::get_space_state);
+ ClassDB::bind_method(D_METHOD("get_contact_local_position", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_local_position);
+ ClassDB::bind_method(D_METHOD("get_contact_local_normal", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_local_normal);
+ ClassDB::bind_method(D_METHOD("get_contact_impulse", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_impulse);
+ ClassDB::bind_method(D_METHOD("get_contact_local_shape", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_local_shape);
+ ClassDB::bind_method(D_METHOD("get_contact_collider", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_position", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider_position);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_id", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider_id);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_object", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider_object);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_shape", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider_shape);
+ ClassDB::bind_method(D_METHOD("get_contact_collider_velocity_at_position", "contact_idx"), &PhysicsDirectBodyState3D::get_contact_collider_velocity_at_position);
+ ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState3D::get_step);
+ ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState3D::integrate_forces);
+ ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState3D::get_space_state);
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "step"), "", "get_step");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inverse_mass"), "", "get_inverse_mass");
@@ -134,62 +134,62 @@ void PhysicsDirectBodyState::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform");
}
-PhysicsDirectBodyState::PhysicsDirectBodyState() {}
+PhysicsDirectBodyState3D::PhysicsDirectBodyState3D() {}
///////////////////////////////////////////////////////
-void PhysicsShapeQueryParameters::set_shape(const RES &p_shape) {
+void PhysicsShapeQueryParameters3D::set_shape(const RES &p_shape) {
ERR_FAIL_COND(p_shape.is_null());
shape = p_shape->get_rid();
}
-void PhysicsShapeQueryParameters::set_shape_rid(const RID &p_shape) {
+void PhysicsShapeQueryParameters3D::set_shape_rid(const RID &p_shape) {
shape = p_shape;
}
-RID PhysicsShapeQueryParameters::get_shape_rid() const {
+RID PhysicsShapeQueryParameters3D::get_shape_rid() const {
return shape;
}
-void PhysicsShapeQueryParameters::set_transform(const Transform &p_transform) {
+void PhysicsShapeQueryParameters3D::set_transform(const Transform &p_transform) {
transform = p_transform;
}
-Transform PhysicsShapeQueryParameters::get_transform() const {
+Transform PhysicsShapeQueryParameters3D::get_transform() const {
return transform;
}
-void PhysicsShapeQueryParameters::set_margin(float p_margin) {
+void PhysicsShapeQueryParameters3D::set_margin(float p_margin) {
margin = p_margin;
}
-float PhysicsShapeQueryParameters::get_margin() const {
+float PhysicsShapeQueryParameters3D::get_margin() const {
return margin;
}
-void PhysicsShapeQueryParameters::set_collision_mask(int p_collision_mask) {
+void PhysicsShapeQueryParameters3D::set_collision_mask(int p_collision_mask) {
collision_mask = p_collision_mask;
}
-int PhysicsShapeQueryParameters::get_collision_mask() const {
+int PhysicsShapeQueryParameters3D::get_collision_mask() const {
return collision_mask;
}
-void PhysicsShapeQueryParameters::set_exclude(const Vector<RID> &p_exclude) {
+void PhysicsShapeQueryParameters3D::set_exclude(const Vector<RID> &p_exclude) {
exclude.clear();
for (int i = 0; i < p_exclude.size(); i++)
exclude.insert(p_exclude[i]);
}
-Vector<RID> PhysicsShapeQueryParameters::get_exclude() const {
+Vector<RID> PhysicsShapeQueryParameters3D::get_exclude() const {
Vector<RID> ret;
ret.resize(exclude.size());
@@ -200,45 +200,45 @@ Vector<RID> PhysicsShapeQueryParameters::get_exclude() const {
return ret;
}
-void PhysicsShapeQueryParameters::set_collide_with_bodies(bool p_enable) {
+void PhysicsShapeQueryParameters3D::set_collide_with_bodies(bool p_enable) {
collide_with_bodies = p_enable;
}
-bool PhysicsShapeQueryParameters::is_collide_with_bodies_enabled() const {
+bool PhysicsShapeQueryParameters3D::is_collide_with_bodies_enabled() const {
return collide_with_bodies;
}
-void PhysicsShapeQueryParameters::set_collide_with_areas(bool p_enable) {
+void PhysicsShapeQueryParameters3D::set_collide_with_areas(bool p_enable) {
collide_with_areas = p_enable;
}
-bool PhysicsShapeQueryParameters::is_collide_with_areas_enabled() const {
+bool PhysicsShapeQueryParameters3D::is_collide_with_areas_enabled() const {
return collide_with_areas;
}
-void PhysicsShapeQueryParameters::_bind_methods() {
+void PhysicsShapeQueryParameters3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_shape", "shape"), &PhysicsShapeQueryParameters::set_shape);
- ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &PhysicsShapeQueryParameters::set_shape_rid);
- ClassDB::bind_method(D_METHOD("get_shape_rid"), &PhysicsShapeQueryParameters::get_shape_rid);
+ ClassDB::bind_method(D_METHOD("set_shape", "shape"), &PhysicsShapeQueryParameters3D::set_shape);
+ ClassDB::bind_method(D_METHOD("set_shape_rid", "shape"), &PhysicsShapeQueryParameters3D::set_shape_rid);
+ ClassDB::bind_method(D_METHOD("get_shape_rid"), &PhysicsShapeQueryParameters3D::get_shape_rid);
- ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsShapeQueryParameters::set_transform);
- ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsShapeQueryParameters::get_transform);
+ ClassDB::bind_method(D_METHOD("set_transform", "transform"), &PhysicsShapeQueryParameters3D::set_transform);
+ ClassDB::bind_method(D_METHOD("get_transform"), &PhysicsShapeQueryParameters3D::get_transform);
- ClassDB::bind_method(D_METHOD("set_margin", "margin"), &PhysicsShapeQueryParameters::set_margin);
- ClassDB::bind_method(D_METHOD("get_margin"), &PhysicsShapeQueryParameters::get_margin);
+ ClassDB::bind_method(D_METHOD("set_margin", "margin"), &PhysicsShapeQueryParameters3D::set_margin);
+ ClassDB::bind_method(D_METHOD("get_margin"), &PhysicsShapeQueryParameters3D::get_margin);
- ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &PhysicsShapeQueryParameters::set_collision_mask);
- ClassDB::bind_method(D_METHOD("get_collision_mask"), &PhysicsShapeQueryParameters::get_collision_mask);
+ ClassDB::bind_method(D_METHOD("set_collision_mask", "collision_mask"), &PhysicsShapeQueryParameters3D::set_collision_mask);
+ ClassDB::bind_method(D_METHOD("get_collision_mask"), &PhysicsShapeQueryParameters3D::get_collision_mask);
- ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters::set_exclude);
- ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters::get_exclude);
+ ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters3D::set_exclude);
+ ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters3D::get_exclude);
- ClassDB::bind_method(D_METHOD("set_collide_with_bodies", "enable"), &PhysicsShapeQueryParameters::set_collide_with_bodies);
- ClassDB::bind_method(D_METHOD("is_collide_with_bodies_enabled"), &PhysicsShapeQueryParameters::is_collide_with_bodies_enabled);
+ ClassDB::bind_method(D_METHOD("set_collide_with_bodies", "enable"), &PhysicsShapeQueryParameters3D::set_collide_with_bodies);
+ ClassDB::bind_method(D_METHOD("is_collide_with_bodies_enabled"), &PhysicsShapeQueryParameters3D::is_collide_with_bodies_enabled);
- ClassDB::bind_method(D_METHOD("set_collide_with_areas", "enable"), &PhysicsShapeQueryParameters::set_collide_with_areas);
- ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters::is_collide_with_areas_enabled);
+ ClassDB::bind_method(D_METHOD("set_collide_with_areas", "enable"), &PhysicsShapeQueryParameters3D::set_collide_with_areas);
+ ClassDB::bind_method(D_METHOD("is_collide_with_areas_enabled"), &PhysicsShapeQueryParameters3D::is_collide_with_areas_enabled);
ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude");
@@ -250,7 +250,7 @@ void PhysicsShapeQueryParameters::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled");
}
-PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
+PhysicsShapeQueryParameters3D::PhysicsShapeQueryParameters3D() {
margin = 0;
collision_mask = 0x7FFFFFFF;
@@ -260,7 +260,7 @@ PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {
/////////////////////////////////////
-Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
+Dictionary PhysicsDirectSpaceState3D::_intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) {
RayResult inters;
Set<RID> exclude;
@@ -283,7 +283,7 @@ Dictionary PhysicsDirectSpaceState::_intersect_ray(const Vector3 &p_from, const
return d;
}
-Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
+Array PhysicsDirectSpaceState3D::_intersect_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -305,7 +305,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
return ret;
}
-Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion) {
+Array PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, const Vector3 &p_motion) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -319,7 +319,7 @@ Array PhysicsDirectSpaceState::_cast_motion(const Ref<PhysicsShapeQueryParameter
ret[1] = closest_unsafe;
return ret;
}
-Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results) {
+Array PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array());
@@ -335,7 +335,7 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
r[i] = ret[i];
return r;
}
-Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query) {
+Dictionary PhysicsDirectSpaceState3D::_get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query) {
ERR_FAIL_COND_V(!p_shape_query.is_valid(), Dictionary());
@@ -356,176 +356,176 @@ Dictionary PhysicsDirectSpaceState::_get_rest_info(const Ref<PhysicsShapeQueryPa
return r;
}
-PhysicsDirectSpaceState::PhysicsDirectSpaceState() {
+PhysicsDirectSpaceState3D::PhysicsDirectSpaceState3D() {
}
-void PhysicsDirectSpaceState::_bind_methods() {
+void PhysicsDirectSpaceState3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_mask", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_intersect_shape, DEFVAL(32));
- ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState::_cast_motion);
- ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32));
- ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState::_get_rest_info);
+ ClassDB::bind_method(D_METHOD("intersect_ray", "from", "to", "exclude", "collision_mask", "collide_with_bodies", "collide_with_areas"), &PhysicsDirectSpaceState3D::_intersect_ray, DEFVAL(Array()), DEFVAL(0x7FFFFFFF), DEFVAL(true), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("intersect_shape", "shape", "max_results"), &PhysicsDirectSpaceState3D::_intersect_shape, DEFVAL(32));
+ ClassDB::bind_method(D_METHOD("cast_motion", "shape", "motion"), &PhysicsDirectSpaceState3D::_cast_motion);
+ ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState3D::_collide_shape, DEFVAL(32));
+ ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState3D::_get_rest_info);
}
-int PhysicsShapeQueryResult::get_result_count() const {
+int PhysicsShapeQueryResult3D::get_result_count() const {
return result.size();
}
-RID PhysicsShapeQueryResult::get_result_rid(int p_idx) const {
+RID PhysicsShapeQueryResult3D::get_result_rid(int p_idx) const {
return result[p_idx].rid;
}
-ObjectID PhysicsShapeQueryResult::get_result_object_id(int p_idx) const {
+ObjectID PhysicsShapeQueryResult3D::get_result_object_id(int p_idx) const {
return result[p_idx].collider_id;
}
-Object *PhysicsShapeQueryResult::get_result_object(int p_idx) const {
+Object *PhysicsShapeQueryResult3D::get_result_object(int p_idx) const {
return result[p_idx].collider;
}
-int PhysicsShapeQueryResult::get_result_object_shape(int p_idx) const {
+int PhysicsShapeQueryResult3D::get_result_object_shape(int p_idx) const {
return result[p_idx].shape;
}
-PhysicsShapeQueryResult::PhysicsShapeQueryResult() {
+PhysicsShapeQueryResult3D::PhysicsShapeQueryResult3D() {
}
-void PhysicsShapeQueryResult::_bind_methods() {
+void PhysicsShapeQueryResult3D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_result_count"), &PhysicsShapeQueryResult::get_result_count);
- ClassDB::bind_method(D_METHOD("get_result_rid", "idx"), &PhysicsShapeQueryResult::get_result_rid);
- ClassDB::bind_method(D_METHOD("get_result_object_id", "idx"), &PhysicsShapeQueryResult::get_result_object_id);
- ClassDB::bind_method(D_METHOD("get_result_object", "idx"), &PhysicsShapeQueryResult::get_result_object);
- ClassDB::bind_method(D_METHOD("get_result_object_shape", "idx"), &PhysicsShapeQueryResult::get_result_object_shape);
+ ClassDB::bind_method(D_METHOD("get_result_count"), &PhysicsShapeQueryResult3D::get_result_count);
+ ClassDB::bind_method(D_METHOD("get_result_rid", "idx"), &PhysicsShapeQueryResult3D::get_result_rid);
+ ClassDB::bind_method(D_METHOD("get_result_object_id", "idx"), &PhysicsShapeQueryResult3D::get_result_object_id);
+ ClassDB::bind_method(D_METHOD("get_result_object", "idx"), &PhysicsShapeQueryResult3D::get_result_object);
+ ClassDB::bind_method(D_METHOD("get_result_object_shape", "idx"), &PhysicsShapeQueryResult3D::get_result_object_shape);
}
///////////////////////////////////////
-void PhysicsServer::_bind_methods() {
+void PhysicsServer3D::_bind_methods() {
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("shape_create", "type"), &PhysicsServer::shape_create);
- ClassDB::bind_method(D_METHOD("shape_set_data", "shape", "data"), &PhysicsServer::shape_set_data);
+ ClassDB::bind_method(D_METHOD("shape_create", "type"), &PhysicsServer3D::shape_create);
+ ClassDB::bind_method(D_METHOD("shape_set_data", "shape", "data"), &PhysicsServer3D::shape_set_data);
- ClassDB::bind_method(D_METHOD("shape_get_type", "shape"), &PhysicsServer::shape_get_type);
- ClassDB::bind_method(D_METHOD("shape_get_data", "shape"), &PhysicsServer::shape_get_data);
+ ClassDB::bind_method(D_METHOD("shape_get_type", "shape"), &PhysicsServer3D::shape_get_type);
+ ClassDB::bind_method(D_METHOD("shape_get_data", "shape"), &PhysicsServer3D::shape_get_data);
- ClassDB::bind_method(D_METHOD("space_create"), &PhysicsServer::space_create);
- ClassDB::bind_method(D_METHOD("space_set_active", "space", "active"), &PhysicsServer::space_set_active);
- ClassDB::bind_method(D_METHOD("space_is_active", "space"), &PhysicsServer::space_is_active);
- ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &PhysicsServer::space_set_param);
- ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &PhysicsServer::space_get_param);
- ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &PhysicsServer::space_get_direct_state);
+ ClassDB::bind_method(D_METHOD("space_create"), &PhysicsServer3D::space_create);
+ ClassDB::bind_method(D_METHOD("space_set_active", "space", "active"), &PhysicsServer3D::space_set_active);
+ ClassDB::bind_method(D_METHOD("space_is_active", "space"), &PhysicsServer3D::space_is_active);
+ ClassDB::bind_method(D_METHOD("space_set_param", "space", "param", "value"), &PhysicsServer3D::space_set_param);
+ ClassDB::bind_method(D_METHOD("space_get_param", "space", "param"), &PhysicsServer3D::space_get_param);
+ ClassDB::bind_method(D_METHOD("space_get_direct_state", "space"), &PhysicsServer3D::space_get_direct_state);
- ClassDB::bind_method(D_METHOD("area_create"), &PhysicsServer::area_create);
- ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &PhysicsServer::area_set_space);
- ClassDB::bind_method(D_METHOD("area_get_space", "area"), &PhysicsServer::area_get_space);
+ ClassDB::bind_method(D_METHOD("area_create"), &PhysicsServer3D::area_create);
+ ClassDB::bind_method(D_METHOD("area_set_space", "area", "space"), &PhysicsServer3D::area_set_space);
+ ClassDB::bind_method(D_METHOD("area_get_space", "area"), &PhysicsServer3D::area_get_space);
- ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &PhysicsServer::area_set_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &PhysicsServer::area_get_space_override_mode);
+ ClassDB::bind_method(D_METHOD("area_set_space_override_mode", "area", "mode"), &PhysicsServer3D::area_set_space_override_mode);
+ ClassDB::bind_method(D_METHOD("area_get_space_override_mode", "area"), &PhysicsServer3D::area_get_space_override_mode);
- ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &PhysicsServer::area_add_shape, DEFVAL(Transform()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &PhysicsServer::area_set_shape);
- ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &PhysicsServer::area_set_shape_transform);
- ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &PhysicsServer::area_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("area_add_shape", "area", "shape", "transform", "disabled"), &PhysicsServer3D::area_add_shape, DEFVAL(Transform()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("area_set_shape", "area", "shape_idx", "shape"), &PhysicsServer3D::area_set_shape);
+ ClassDB::bind_method(D_METHOD("area_set_shape_transform", "area", "shape_idx", "transform"), &PhysicsServer3D::area_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("area_set_shape_disabled", "area", "shape_idx", "disabled"), &PhysicsServer3D::area_set_shape_disabled);
- ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &PhysicsServer::area_get_shape_count);
- ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &PhysicsServer::area_get_shape);
- ClassDB::bind_method(D_METHOD("area_get_shape_transform", "area", "shape_idx"), &PhysicsServer::area_get_shape_transform);
+ ClassDB::bind_method(D_METHOD("area_get_shape_count", "area"), &PhysicsServer3D::area_get_shape_count);
+ ClassDB::bind_method(D_METHOD("area_get_shape", "area", "shape_idx"), &PhysicsServer3D::area_get_shape);
+ ClassDB::bind_method(D_METHOD("area_get_shape_transform", "area", "shape_idx"), &PhysicsServer3D::area_get_shape_transform);
- ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &PhysicsServer::area_remove_shape);
- ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &PhysicsServer::area_clear_shapes);
+ ClassDB::bind_method(D_METHOD("area_remove_shape", "area", "shape_idx"), &PhysicsServer3D::area_remove_shape);
+ ClassDB::bind_method(D_METHOD("area_clear_shapes", "area"), &PhysicsServer3D::area_clear_shapes);
- ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &PhysicsServer::area_set_collision_layer);
- ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &PhysicsServer::area_set_collision_mask);
+ ClassDB::bind_method(D_METHOD("area_set_collision_layer", "area", "layer"), &PhysicsServer3D::area_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("area_set_collision_mask", "area", "mask"), &PhysicsServer3D::area_set_collision_mask);
- ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &PhysicsServer::area_set_param);
- ClassDB::bind_method(D_METHOD("area_set_transform", "area", "transform"), &PhysicsServer::area_set_transform);
+ ClassDB::bind_method(D_METHOD("area_set_param", "area", "param", "value"), &PhysicsServer3D::area_set_param);
+ ClassDB::bind_method(D_METHOD("area_set_transform", "area", "transform"), &PhysicsServer3D::area_set_transform);
- ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &PhysicsServer::area_get_param);
- ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &PhysicsServer::area_get_transform);
+ ClassDB::bind_method(D_METHOD("area_get_param", "area", "param"), &PhysicsServer3D::area_get_param);
+ ClassDB::bind_method(D_METHOD("area_get_transform", "area"), &PhysicsServer3D::area_get_transform);
- ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &PhysicsServer::area_attach_object_instance_id);
- ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer::area_get_object_instance_id);
+ ClassDB::bind_method(D_METHOD("area_attach_object_instance_id", "area", "id"), &PhysicsServer3D::area_attach_object_instance_id);
+ ClassDB::bind_method(D_METHOD("area_get_object_instance_id", "area"), &PhysicsServer3D::area_get_object_instance_id);
- ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_monitor_callback);
- ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &PhysicsServer::area_set_area_monitor_callback);
- ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &PhysicsServer::area_set_monitorable);
+ ClassDB::bind_method(D_METHOD("area_set_monitor_callback", "area", "receiver", "method"), &PhysicsServer3D::area_set_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_area_monitor_callback", "area", "receiver", "method"), &PhysicsServer3D::area_set_area_monitor_callback);
+ ClassDB::bind_method(D_METHOD("area_set_monitorable", "area", "monitorable"), &PhysicsServer3D::area_set_monitorable);
- ClassDB::bind_method(D_METHOD("area_set_ray_pickable", "area", "enable"), &PhysicsServer::area_set_ray_pickable);
- ClassDB::bind_method(D_METHOD("area_is_ray_pickable", "area"), &PhysicsServer::area_is_ray_pickable);
+ ClassDB::bind_method(D_METHOD("area_set_ray_pickable", "area", "enable"), &PhysicsServer3D::area_set_ray_pickable);
+ ClassDB::bind_method(D_METHOD("area_is_ray_pickable", "area"), &PhysicsServer3D::area_is_ray_pickable);
- ClassDB::bind_method(D_METHOD("body_create", "mode", "init_sleeping"), &PhysicsServer::body_create, DEFVAL(BODY_MODE_RIGID), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("body_create", "mode", "init_sleeping"), &PhysicsServer3D::body_create, DEFVAL(BODY_MODE_RIGID), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("body_set_space", "body", "space"), &PhysicsServer::body_set_space);
- ClassDB::bind_method(D_METHOD("body_get_space", "body"), &PhysicsServer::body_get_space);
+ ClassDB::bind_method(D_METHOD("body_set_space", "body", "space"), &PhysicsServer3D::body_set_space);
+ ClassDB::bind_method(D_METHOD("body_get_space", "body"), &PhysicsServer3D::body_get_space);
- ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &PhysicsServer::body_set_mode);
- ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &PhysicsServer::body_get_mode);
+ ClassDB::bind_method(D_METHOD("body_set_mode", "body", "mode"), &PhysicsServer3D::body_set_mode);
+ ClassDB::bind_method(D_METHOD("body_get_mode", "body"), &PhysicsServer3D::body_get_mode);
- ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &PhysicsServer::body_set_collision_layer);
- ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &PhysicsServer::body_get_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_set_collision_layer", "body", "layer"), &PhysicsServer3D::body_set_collision_layer);
+ ClassDB::bind_method(D_METHOD("body_get_collision_layer", "body"), &PhysicsServer3D::body_get_collision_layer);
- ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &PhysicsServer::body_set_collision_mask);
- ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &PhysicsServer::body_get_collision_mask);
+ ClassDB::bind_method(D_METHOD("body_set_collision_mask", "body", "mask"), &PhysicsServer3D::body_set_collision_mask);
+ ClassDB::bind_method(D_METHOD("body_get_collision_mask", "body"), &PhysicsServer3D::body_get_collision_mask);
- ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &PhysicsServer::body_add_shape, DEFVAL(Transform()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &PhysicsServer::body_set_shape);
- ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &PhysicsServer::body_set_shape_transform);
- ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &PhysicsServer::body_set_shape_disabled);
+ ClassDB::bind_method(D_METHOD("body_add_shape", "body", "shape", "transform", "disabled"), &PhysicsServer3D::body_add_shape, DEFVAL(Transform()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("body_set_shape", "body", "shape_idx", "shape"), &PhysicsServer3D::body_set_shape);
+ ClassDB::bind_method(D_METHOD("body_set_shape_transform", "body", "shape_idx", "transform"), &PhysicsServer3D::body_set_shape_transform);
+ ClassDB::bind_method(D_METHOD("body_set_shape_disabled", "body", "shape_idx", "disabled"), &PhysicsServer3D::body_set_shape_disabled);
- ClassDB::bind_method(D_METHOD("body_get_shape_count", "body"), &PhysicsServer::body_get_shape_count);
- ClassDB::bind_method(D_METHOD("body_get_shape", "body", "shape_idx"), &PhysicsServer::body_get_shape);
- ClassDB::bind_method(D_METHOD("body_get_shape_transform", "body", "shape_idx"), &PhysicsServer::body_get_shape_transform);
+ ClassDB::bind_method(D_METHOD("body_get_shape_count", "body"), &PhysicsServer3D::body_get_shape_count);
+ ClassDB::bind_method(D_METHOD("body_get_shape", "body", "shape_idx"), &PhysicsServer3D::body_get_shape);
+ ClassDB::bind_method(D_METHOD("body_get_shape_transform", "body", "shape_idx"), &PhysicsServer3D::body_get_shape_transform);
- ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &PhysicsServer::body_remove_shape);
- ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &PhysicsServer::body_clear_shapes);
+ ClassDB::bind_method(D_METHOD("body_remove_shape", "body", "shape_idx"), &PhysicsServer3D::body_remove_shape);
+ ClassDB::bind_method(D_METHOD("body_clear_shapes", "body"), &PhysicsServer3D::body_clear_shapes);
- ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &PhysicsServer::body_attach_object_instance_id);
- ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &PhysicsServer::body_get_object_instance_id);
+ ClassDB::bind_method(D_METHOD("body_attach_object_instance_id", "body", "id"), &PhysicsServer3D::body_attach_object_instance_id);
+ ClassDB::bind_method(D_METHOD("body_get_object_instance_id", "body"), &PhysicsServer3D::body_get_object_instance_id);
- ClassDB::bind_method(D_METHOD("body_set_enable_continuous_collision_detection", "body", "enable"), &PhysicsServer::body_set_enable_continuous_collision_detection);
- ClassDB::bind_method(D_METHOD("body_is_continuous_collision_detection_enabled", "body"), &PhysicsServer::body_is_continuous_collision_detection_enabled);
+ ClassDB::bind_method(D_METHOD("body_set_enable_continuous_collision_detection", "body", "enable"), &PhysicsServer3D::body_set_enable_continuous_collision_detection);
+ ClassDB::bind_method(D_METHOD("body_is_continuous_collision_detection_enabled", "body"), &PhysicsServer3D::body_is_continuous_collision_detection_enabled);
- ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &PhysicsServer::body_set_param);
- ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &PhysicsServer::body_get_param);
+ ClassDB::bind_method(D_METHOD("body_set_param", "body", "param", "value"), &PhysicsServer3D::body_set_param);
+ ClassDB::bind_method(D_METHOD("body_get_param", "body", "param"), &PhysicsServer3D::body_get_param);
- ClassDB::bind_method(D_METHOD("body_set_kinematic_safe_margin", "body", "margin"), &PhysicsServer::body_set_kinematic_safe_margin);
- ClassDB::bind_method(D_METHOD("body_get_kinematic_safe_margin", "body"), &PhysicsServer::body_get_kinematic_safe_margin);
+ ClassDB::bind_method(D_METHOD("body_set_kinematic_safe_margin", "body", "margin"), &PhysicsServer3D::body_set_kinematic_safe_margin);
+ ClassDB::bind_method(D_METHOD("body_get_kinematic_safe_margin", "body"), &PhysicsServer3D::body_get_kinematic_safe_margin);
- ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &PhysicsServer::body_set_state);
- ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &PhysicsServer::body_get_state);
+ ClassDB::bind_method(D_METHOD("body_set_state", "body", "state", "value"), &PhysicsServer3D::body_set_state);
+ ClassDB::bind_method(D_METHOD("body_get_state", "body", "state"), &PhysicsServer3D::body_get_state);
- ClassDB::bind_method(D_METHOD("body_add_central_force", "body", "force"), &PhysicsServer::body_add_central_force);
- ClassDB::bind_method(D_METHOD("body_add_force", "body", "force", "position"), &PhysicsServer::body_add_force);
- ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &PhysicsServer::body_add_torque);
+ ClassDB::bind_method(D_METHOD("body_add_central_force", "body", "force"), &PhysicsServer3D::body_add_central_force);
+ ClassDB::bind_method(D_METHOD("body_add_force", "body", "force", "position"), &PhysicsServer3D::body_add_force);
+ ClassDB::bind_method(D_METHOD("body_add_torque", "body", "torque"), &PhysicsServer3D::body_add_torque);
- ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &PhysicsServer::body_apply_central_impulse);
- ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &PhysicsServer::body_apply_impulse);
- ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &PhysicsServer::body_apply_torque_impulse);
- ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &PhysicsServer::body_set_axis_velocity);
+ ClassDB::bind_method(D_METHOD("body_apply_central_impulse", "body", "impulse"), &PhysicsServer3D::body_apply_central_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_impulse", "body", "position", "impulse"), &PhysicsServer3D::body_apply_impulse);
+ ClassDB::bind_method(D_METHOD("body_apply_torque_impulse", "body", "impulse"), &PhysicsServer3D::body_apply_torque_impulse);
+ ClassDB::bind_method(D_METHOD("body_set_axis_velocity", "body", "axis_velocity"), &PhysicsServer3D::body_set_axis_velocity);
- ClassDB::bind_method(D_METHOD("body_set_axis_lock", "body", "axis", "lock"), &PhysicsServer::body_set_axis_lock);
- ClassDB::bind_method(D_METHOD("body_is_axis_locked", "body", "axis"), &PhysicsServer::body_is_axis_locked);
+ ClassDB::bind_method(D_METHOD("body_set_axis_lock", "body", "axis", "lock"), &PhysicsServer3D::body_set_axis_lock);
+ ClassDB::bind_method(D_METHOD("body_is_axis_locked", "body", "axis"), &PhysicsServer3D::body_is_axis_locked);
- ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &PhysicsServer::body_add_collision_exception);
- ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &PhysicsServer::body_remove_collision_exception);
+ ClassDB::bind_method(D_METHOD("body_add_collision_exception", "body", "excepted_body"), &PhysicsServer3D::body_add_collision_exception);
+ ClassDB::bind_method(D_METHOD("body_remove_collision_exception", "body", "excepted_body"), &PhysicsServer3D::body_remove_collision_exception);
- ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &PhysicsServer::body_set_max_contacts_reported);
- ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &PhysicsServer::body_get_max_contacts_reported);
+ ClassDB::bind_method(D_METHOD("body_set_max_contacts_reported", "body", "amount"), &PhysicsServer3D::body_set_max_contacts_reported);
+ ClassDB::bind_method(D_METHOD("body_get_max_contacts_reported", "body"), &PhysicsServer3D::body_get_max_contacts_reported);
- ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &PhysicsServer::body_set_omit_force_integration);
- ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &PhysicsServer::body_is_omitting_force_integration);
+ ClassDB::bind_method(D_METHOD("body_set_omit_force_integration", "body", "enable"), &PhysicsServer3D::body_set_omit_force_integration);
+ ClassDB::bind_method(D_METHOD("body_is_omitting_force_integration", "body"), &PhysicsServer3D::body_is_omitting_force_integration);
- ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "receiver", "method", "userdata"), &PhysicsServer::body_set_force_integration_callback, DEFVAL(Variant()));
+ ClassDB::bind_method(D_METHOD("body_set_force_integration_callback", "body", "receiver", "method", "userdata"), &PhysicsServer3D::body_set_force_integration_callback, DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("body_set_ray_pickable", "body", "enable"), &PhysicsServer::body_set_ray_pickable);
- ClassDB::bind_method(D_METHOD("body_is_ray_pickable", "body"), &PhysicsServer::body_is_ray_pickable);
+ ClassDB::bind_method(D_METHOD("body_set_ray_pickable", "body", "enable"), &PhysicsServer3D::body_set_ray_pickable);
+ ClassDB::bind_method(D_METHOD("body_is_ray_pickable", "body"), &PhysicsServer3D::body_is_ray_pickable);
- ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &PhysicsServer::body_get_direct_state);
+ ClassDB::bind_method(D_METHOD("body_get_direct_state", "body"), &PhysicsServer3D::body_get_direct_state);
/* JOINT API */
@@ -535,15 +535,15 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(JOINT_CONE_TWIST);
BIND_ENUM_CONSTANT(JOINT_6DOF);
- ClassDB::bind_method(D_METHOD("joint_create_pin", "body_A", "local_A", "body_B", "local_B"), &PhysicsServer::joint_create_pin);
- ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer::pin_joint_set_param);
- ClassDB::bind_method(D_METHOD("pin_joint_get_param", "joint", "param"), &PhysicsServer::pin_joint_get_param);
+ ClassDB::bind_method(D_METHOD("joint_create_pin", "body_A", "local_A", "body_B", "local_B"), &PhysicsServer3D::joint_create_pin);
+ ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer3D::pin_joint_set_param);
+ ClassDB::bind_method(D_METHOD("pin_joint_get_param", "joint", "param"), &PhysicsServer3D::pin_joint_get_param);
- ClassDB::bind_method(D_METHOD("pin_joint_set_local_a", "joint", "local_A"), &PhysicsServer::pin_joint_set_local_a);
- ClassDB::bind_method(D_METHOD("pin_joint_get_local_a", "joint"), &PhysicsServer::pin_joint_get_local_a);
+ ClassDB::bind_method(D_METHOD("pin_joint_set_local_a", "joint", "local_A"), &PhysicsServer3D::pin_joint_set_local_a);
+ ClassDB::bind_method(D_METHOD("pin_joint_get_local_a", "joint"), &PhysicsServer3D::pin_joint_get_local_a);
- ClassDB::bind_method(D_METHOD("pin_joint_set_local_b", "joint", "local_B"), &PhysicsServer::pin_joint_set_local_b);
- ClassDB::bind_method(D_METHOD("pin_joint_get_local_b", "joint"), &PhysicsServer::pin_joint_get_local_b);
+ ClassDB::bind_method(D_METHOD("pin_joint_set_local_b", "joint", "local_B"), &PhysicsServer3D::pin_joint_set_local_b);
+ ClassDB::bind_method(D_METHOD("pin_joint_get_local_b", "joint"), &PhysicsServer3D::pin_joint_get_local_b);
BIND_ENUM_CONSTANT(PIN_JOINT_BIAS);
BIND_ENUM_CONSTANT(PIN_JOINT_DAMPING);
@@ -561,18 +561,18 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_USE_LIMIT);
BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_ENABLE_MOTOR);
- ClassDB::bind_method(D_METHOD("joint_create_hinge", "body_A", "hinge_A", "body_B", "hinge_B"), &PhysicsServer::joint_create_hinge);
+ ClassDB::bind_method(D_METHOD("joint_create_hinge", "body_A", "hinge_A", "body_B", "hinge_B"), &PhysicsServer3D::joint_create_hinge);
- ClassDB::bind_method(D_METHOD("hinge_joint_set_param", "joint", "param", "value"), &PhysicsServer::hinge_joint_set_param);
- ClassDB::bind_method(D_METHOD("hinge_joint_get_param", "joint", "param"), &PhysicsServer::hinge_joint_get_param);
+ ClassDB::bind_method(D_METHOD("hinge_joint_set_param", "joint", "param", "value"), &PhysicsServer3D::hinge_joint_set_param);
+ ClassDB::bind_method(D_METHOD("hinge_joint_get_param", "joint", "param"), &PhysicsServer3D::hinge_joint_get_param);
- ClassDB::bind_method(D_METHOD("hinge_joint_set_flag", "joint", "flag", "enabled"), &PhysicsServer::hinge_joint_set_flag);
- ClassDB::bind_method(D_METHOD("hinge_joint_get_flag", "joint", "flag"), &PhysicsServer::hinge_joint_get_flag);
+ ClassDB::bind_method(D_METHOD("hinge_joint_set_flag", "joint", "flag", "enabled"), &PhysicsServer3D::hinge_joint_set_flag);
+ ClassDB::bind_method(D_METHOD("hinge_joint_get_flag", "joint", "flag"), &PhysicsServer3D::hinge_joint_get_flag);
- ClassDB::bind_method(D_METHOD("joint_create_slider", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer::joint_create_slider);
+ ClassDB::bind_method(D_METHOD("joint_create_slider", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer3D::joint_create_slider);
- ClassDB::bind_method(D_METHOD("slider_joint_set_param", "joint", "param", "value"), &PhysicsServer::slider_joint_set_param);
- ClassDB::bind_method(D_METHOD("slider_joint_get_param", "joint", "param"), &PhysicsServer::slider_joint_get_param);
+ ClassDB::bind_method(D_METHOD("slider_joint_set_param", "joint", "param", "value"), &PhysicsServer3D::slider_joint_set_param);
+ ClassDB::bind_method(D_METHOD("slider_joint_get_param", "joint", "param"), &PhysicsServer3D::slider_joint_get_param);
BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_UPPER);
BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_LOWER);
@@ -599,10 +599,10 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING);
BIND_ENUM_CONSTANT(SLIDER_JOINT_MAX);
- ClassDB::bind_method(D_METHOD("joint_create_cone_twist", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer::joint_create_cone_twist);
+ ClassDB::bind_method(D_METHOD("joint_create_cone_twist", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer3D::joint_create_cone_twist);
- ClassDB::bind_method(D_METHOD("cone_twist_joint_set_param", "joint", "param", "value"), &PhysicsServer::cone_twist_joint_set_param);
- ClassDB::bind_method(D_METHOD("cone_twist_joint_get_param", "joint", "param"), &PhysicsServer::cone_twist_joint_get_param);
+ ClassDB::bind_method(D_METHOD("cone_twist_joint_set_param", "joint", "param", "value"), &PhysicsServer3D::cone_twist_joint_set_param);
+ ClassDB::bind_method(D_METHOD("cone_twist_joint_get_param", "joint", "param"), &PhysicsServer3D::cone_twist_joint_get_param);
BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_SWING_SPAN);
BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_TWIST_SPAN);
@@ -632,24 +632,24 @@ void PhysicsServer::_bind_methods() {
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR);
- ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer::joint_get_type);
+ ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer3D::joint_get_type);
- ClassDB::bind_method(D_METHOD("joint_set_solver_priority", "joint", "priority"), &PhysicsServer::joint_set_solver_priority);
- ClassDB::bind_method(D_METHOD("joint_get_solver_priority", "joint"), &PhysicsServer::joint_get_solver_priority);
+ ClassDB::bind_method(D_METHOD("joint_set_solver_priority", "joint", "priority"), &PhysicsServer3D::joint_set_solver_priority);
+ ClassDB::bind_method(D_METHOD("joint_get_solver_priority", "joint"), &PhysicsServer3D::joint_get_solver_priority);
- ClassDB::bind_method(D_METHOD("joint_create_generic_6dof", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer::joint_create_generic_6dof);
+ ClassDB::bind_method(D_METHOD("joint_create_generic_6dof", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer3D::joint_create_generic_6dof);
- ClassDB::bind_method(D_METHOD("generic_6dof_joint_set_param", "joint", "axis", "param", "value"), &PhysicsServer::generic_6dof_joint_set_param);
- ClassDB::bind_method(D_METHOD("generic_6dof_joint_get_param", "joint", "axis", "param"), &PhysicsServer::generic_6dof_joint_get_param);
+ ClassDB::bind_method(D_METHOD("generic_6dof_joint_set_param", "joint", "axis", "param", "value"), &PhysicsServer3D::generic_6dof_joint_set_param);
+ ClassDB::bind_method(D_METHOD("generic_6dof_joint_get_param", "joint", "axis", "param"), &PhysicsServer3D::generic_6dof_joint_get_param);
- ClassDB::bind_method(D_METHOD("generic_6dof_joint_set_flag", "joint", "axis", "flag", "enable"), &PhysicsServer::generic_6dof_joint_set_flag);
- ClassDB::bind_method(D_METHOD("generic_6dof_joint_get_flag", "joint", "axis", "flag"), &PhysicsServer::generic_6dof_joint_get_flag);
+ ClassDB::bind_method(D_METHOD("generic_6dof_joint_set_flag", "joint", "axis", "flag", "enable"), &PhysicsServer3D::generic_6dof_joint_set_flag);
+ ClassDB::bind_method(D_METHOD("generic_6dof_joint_get_flag", "joint", "axis", "flag"), &PhysicsServer3D::generic_6dof_joint_get_flag);
- ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer::free);
+ ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer3D::free);
- ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer::set_active);
+ ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer3D::set_active);
- ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer::get_process_info);
+ ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer3D::get_process_info);
BIND_ENUM_CONSTANT(SHAPE_PLANE);
BIND_ENUM_CONSTANT(SHAPE_RAY);
@@ -723,23 +723,23 @@ void PhysicsServer::_bind_methods() {
#endif
}
-PhysicsServer::PhysicsServer() {
+PhysicsServer3D::PhysicsServer3D() {
ERR_FAIL_COND(singleton != NULL);
singleton = this;
}
-PhysicsServer::~PhysicsServer() {
+PhysicsServer3D::~PhysicsServer3D() {
singleton = NULL;
}
-Vector<PhysicsServerManager::ClassInfo> PhysicsServerManager::physics_servers;
-int PhysicsServerManager::default_server_id = -1;
-int PhysicsServerManager::default_server_priority = -1;
-const String PhysicsServerManager::setting_property_name("physics/3d/physics_engine");
+Vector<PhysicsServer3DManager::ClassInfo> PhysicsServer3DManager::physics_servers;
+int PhysicsServer3DManager::default_server_id = -1;
+int PhysicsServer3DManager::default_server_priority = -1;
+const String PhysicsServer3DManager::setting_property_name("physics/3d/physics_engine");
-void PhysicsServerManager::on_servers_changed() {
+void PhysicsServer3DManager::on_servers_changed() {
String physics_servers2("DEFAULT");
for (int i = get_servers_count() - 1; 0 <= i; --i) {
@@ -748,7 +748,7 @@ void PhysicsServerManager::on_servers_changed() {
ProjectSettings::get_singleton()->set_custom_property_info(setting_property_name, PropertyInfo(Variant::STRING, setting_property_name, PROPERTY_HINT_ENUM, physics_servers2));
}
-void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback) {
+void PhysicsServer3DManager::register_server(const String &p_name, CreatePhysicsServer3DCallback p_creat_callback) {
ERR_FAIL_COND(!p_creat_callback);
ERR_FAIL_COND(find_server_id(p_name) != -1);
@@ -756,7 +756,7 @@ void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsSe
on_servers_changed();
}
-void PhysicsServerManager::set_default_server(const String &p_name, int p_priority) {
+void PhysicsServer3DManager::set_default_server(const String &p_name, int p_priority) {
const int id = find_server_id(p_name);
ERR_FAIL_COND(id == -1); // Not found
@@ -766,7 +766,7 @@ void PhysicsServerManager::set_default_server(const String &p_name, int p_priori
}
}
-int PhysicsServerManager::find_server_id(const String &p_name) {
+int PhysicsServer3DManager::find_server_id(const String &p_name) {
for (int i = physics_servers.size() - 1; 0 <= i; --i) {
if (p_name == physics_servers[i].name) {
@@ -776,21 +776,21 @@ int PhysicsServerManager::find_server_id(const String &p_name) {
return -1;
}
-int PhysicsServerManager::get_servers_count() {
+int PhysicsServer3DManager::get_servers_count() {
return physics_servers.size();
}
-String PhysicsServerManager::get_server_name(int p_id) {
+String PhysicsServer3DManager::get_server_name(int p_id) {
ERR_FAIL_INDEX_V(p_id, get_servers_count(), "");
return physics_servers[p_id].name;
}
-PhysicsServer *PhysicsServerManager::new_default_server() {
+PhysicsServer3D *PhysicsServer3DManager::new_default_server() {
ERR_FAIL_COND_V(default_server_id == -1, NULL);
return physics_servers[default_server_id].create_callback();
}
-PhysicsServer *PhysicsServerManager::new_server(const String &p_name) {
+PhysicsServer3D *PhysicsServer3DManager::new_server(const String &p_name) {
int id = find_server_id(p_name);
if (id == -1) {
return NULL;
diff --git a/servers/physics_server.h b/servers/physics_server_3d.h
index f1388c8758..9bb7bfe3f4 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server_3d.h
@@ -34,11 +34,11 @@
#include "core/object.h"
#include "core/resource.h"
-class PhysicsDirectSpaceState;
+class PhysicsDirectSpaceState3D;
-class PhysicsDirectBodyState : public Object {
+class PhysicsDirectBodyState3D : public Object {
- GDCLASS(PhysicsDirectBodyState, Object);
+ GDCLASS(PhysicsDirectBodyState3D, Object);
protected:
static void _bind_methods();
@@ -90,17 +90,17 @@ public:
virtual real_t get_step() const = 0;
virtual void integrate_forces();
- virtual PhysicsDirectSpaceState *get_space_state() = 0;
+ virtual PhysicsDirectSpaceState3D *get_space_state() = 0;
- PhysicsDirectBodyState();
+ PhysicsDirectBodyState3D();
};
-class PhysicsShapeQueryResult;
+class PhysicsShapeQueryResult3D;
-class PhysicsShapeQueryParameters : public Reference {
+class PhysicsShapeQueryParameters3D : public Reference {
- GDCLASS(PhysicsShapeQueryParameters, Reference);
- friend class PhysicsDirectSpaceState;
+ GDCLASS(PhysicsShapeQueryParameters3D, Reference);
+ friend class PhysicsDirectSpaceState3D;
RID shape;
Transform transform;
@@ -137,19 +137,19 @@ public:
void set_collide_with_areas(bool p_enable);
bool is_collide_with_areas_enabled() const;
- PhysicsShapeQueryParameters();
+ PhysicsShapeQueryParameters3D();
};
-class PhysicsDirectSpaceState : public Object {
+class PhysicsDirectSpaceState3D : public Object {
- GDCLASS(PhysicsDirectSpaceState, Object);
+ GDCLASS(PhysicsDirectSpaceState3D, Object);
private:
Dictionary _intersect_ray(const Vector3 &p_from, const Vector3 &p_to, const Vector<RID> &p_exclude = Vector<RID>(), uint32_t p_collision_mask = 0, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
- Array _intersect_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results = 32);
- Array _cast_motion(const Ref<PhysicsShapeQueryParameters> &p_shape_query, const Vector3 &p_motion);
- Array _collide_shape(const Ref<PhysicsShapeQueryParameters> &p_shape_query, int p_max_results = 32);
- Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters> &p_shape_query);
+ Array _intersect_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32);
+ Array _cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, const Vector3 &p_motion);
+ Array _collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32);
+ Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query);
protected:
static void _bind_methods();
@@ -197,16 +197,16 @@ public:
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const = 0;
- PhysicsDirectSpaceState();
+ PhysicsDirectSpaceState3D();
};
-class PhysicsShapeQueryResult : public Reference {
+class PhysicsShapeQueryResult3D : public Reference {
- GDCLASS(PhysicsShapeQueryResult, Reference);
+ GDCLASS(PhysicsShapeQueryResult3D, Reference);
- Vector<PhysicsDirectSpaceState::ShapeResult> result;
+ Vector<PhysicsDirectSpaceState3D::ShapeResult> result;
- friend class PhysicsDirectSpaceState;
+ friend class PhysicsDirectSpaceState3D;
protected:
static void _bind_methods();
@@ -218,20 +218,20 @@ public:
Object *get_result_object(int p_idx) const;
int get_result_object_shape(int p_idx) const;
- PhysicsShapeQueryResult();
+ PhysicsShapeQueryResult3D();
};
-class PhysicsServer : public Object {
+class PhysicsServer3D : public Object {
- GDCLASS(PhysicsServer, Object);
+ GDCLASS(PhysicsServer3D, Object);
- static PhysicsServer *singleton;
+ static PhysicsServer3D *singleton;
protected:
static void _bind_methods();
public:
- static PhysicsServer *get_singleton();
+ static PhysicsServer3D *get_singleton();
enum ShapeType {
SHAPE_PLANE, ///< plane:"plane"
@@ -281,7 +281,7 @@ public:
virtual real_t space_get_param(RID p_space, SpaceParameter p_param) const = 0;
// this function only works on physics process, errors and returns null otherwise
- virtual PhysicsDirectSpaceState *space_get_direct_state(RID p_space) = 0;
+ virtual PhysicsDirectSpaceState3D *space_get_direct_state(RID p_space) = 0;
virtual void space_set_debug_contacts(RID p_space, int p_max_contacts) = 0;
virtual Vector<Vector3> space_get_contacts(RID p_space) const = 0;
@@ -478,7 +478,7 @@ public:
virtual bool body_is_ray_pickable(RID p_body) const = 0;
// this function only works on physics process, errors and returns null otherwise
- virtual PhysicsDirectBodyState *body_get_direct_state(RID p_body) = 0;
+ virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body) = 0;
struct MotionResult {
@@ -521,7 +521,7 @@ public:
virtual RID soft_body_create(bool p_init_sleeping = false) = 0;
- virtual void soft_body_update_visual_server(RID p_body, class SoftBodyVisualServerHandler *p_visual_server_handler) = 0;
+ virtual void soft_body_update_rendering_server(RID p_body, class SoftBodyRenderingServerHandler *p_rendering_server_handler) = 0;
virtual void soft_body_set_space(RID p_body, RID p_space) = 0;
virtual RID soft_body_get_space(RID p_body) const = 0;
@@ -772,22 +772,22 @@ public:
virtual int get_process_info(ProcessInfo p_info) = 0;
- PhysicsServer();
- ~PhysicsServer();
+ PhysicsServer3D();
+ ~PhysicsServer3D();
};
-typedef PhysicsServer *(*CreatePhysicsServerCallback)();
+typedef PhysicsServer3D *(*CreatePhysicsServer3DCallback)();
-class PhysicsServerManager {
+class PhysicsServer3DManager {
struct ClassInfo {
String name;
- CreatePhysicsServerCallback create_callback;
+ CreatePhysicsServer3DCallback create_callback;
ClassInfo() :
name(""),
create_callback(NULL) {}
- ClassInfo(String p_name, CreatePhysicsServerCallback p_create_callback) :
+ ClassInfo(String p_name, CreatePhysicsServer3DCallback p_create_callback) :
name(p_name),
create_callback(p_create_callback) {}
@@ -813,32 +813,32 @@ private:
static void on_servers_changed();
public:
- static void register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback);
+ static void register_server(const String &p_name, CreatePhysicsServer3DCallback p_creat_callback);
static void set_default_server(const String &p_name, int p_priority = 0);
static int find_server_id(const String &p_name);
static int get_servers_count();
static String get_server_name(int p_id);
- static PhysicsServer *new_default_server();
- static PhysicsServer *new_server(const String &p_name);
+ static PhysicsServer3D *new_default_server();
+ static PhysicsServer3D *new_server(const String &p_name);
};
-VARIANT_ENUM_CAST(PhysicsServer::ShapeType);
-VARIANT_ENUM_CAST(PhysicsServer::SpaceParameter);
-VARIANT_ENUM_CAST(PhysicsServer::AreaParameter);
-VARIANT_ENUM_CAST(PhysicsServer::AreaSpaceOverrideMode);
-VARIANT_ENUM_CAST(PhysicsServer::BodyMode);
-VARIANT_ENUM_CAST(PhysicsServer::BodyParameter);
-VARIANT_ENUM_CAST(PhysicsServer::BodyState);
-VARIANT_ENUM_CAST(PhysicsServer::BodyAxis);
-VARIANT_ENUM_CAST(PhysicsServer::PinJointParam);
-VARIANT_ENUM_CAST(PhysicsServer::JointType);
-VARIANT_ENUM_CAST(PhysicsServer::HingeJointParam);
-VARIANT_ENUM_CAST(PhysicsServer::HingeJointFlag);
-VARIANT_ENUM_CAST(PhysicsServer::SliderJointParam);
-VARIANT_ENUM_CAST(PhysicsServer::ConeTwistJointParam);
-VARIANT_ENUM_CAST(PhysicsServer::G6DOFJointAxisParam);
-VARIANT_ENUM_CAST(PhysicsServer::G6DOFJointAxisFlag);
-VARIANT_ENUM_CAST(PhysicsServer::AreaBodyStatus);
-VARIANT_ENUM_CAST(PhysicsServer::ProcessInfo);
+VARIANT_ENUM_CAST(PhysicsServer3D::ShapeType);
+VARIANT_ENUM_CAST(PhysicsServer3D::SpaceParameter);
+VARIANT_ENUM_CAST(PhysicsServer3D::AreaParameter);
+VARIANT_ENUM_CAST(PhysicsServer3D::AreaSpaceOverrideMode);
+VARIANT_ENUM_CAST(PhysicsServer3D::BodyMode);
+VARIANT_ENUM_CAST(PhysicsServer3D::BodyParameter);
+VARIANT_ENUM_CAST(PhysicsServer3D::BodyState);
+VARIANT_ENUM_CAST(PhysicsServer3D::BodyAxis);
+VARIANT_ENUM_CAST(PhysicsServer3D::PinJointParam);
+VARIANT_ENUM_CAST(PhysicsServer3D::JointType);
+VARIANT_ENUM_CAST(PhysicsServer3D::HingeJointParam);
+VARIANT_ENUM_CAST(PhysicsServer3D::HingeJointFlag);
+VARIANT_ENUM_CAST(PhysicsServer3D::SliderJointParam);
+VARIANT_ENUM_CAST(PhysicsServer3D::ConeTwistJointParam);
+VARIANT_ENUM_CAST(PhysicsServer3D::G6DOFJointAxisParam);
+VARIANT_ENUM_CAST(PhysicsServer3D::G6DOFJointAxisFlag);
+VARIANT_ENUM_CAST(PhysicsServer3D::AreaBodyStatus);
+VARIANT_ENUM_CAST(PhysicsServer3D::ProcessInfo);
#endif
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 574b373c30..fa2a5f23dd 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -58,30 +58,30 @@
#include "camera/camera_feed.h"
#include "camera_server.h"
#include "display_server.h"
-#include "navigation_2d_server.h"
-#include "navigation_server.h"
-#include "physics/physics_server_sw.h"
-#include "physics_2d/physics_2d_server_sw.h"
-#include "physics_2d/physics_2d_server_wrap_mt.h"
-#include "physics_2d_server.h"
-#include "physics_server.h"
-#include "visual/shader_types.h"
-#include "visual_server.h"
+#include "navigation_server_2d.h"
+#include "navigation_server_3d.h"
+#include "physics_2d/physics_server_2d_sw.h"
+#include "physics_2d/physics_server_2d_wrap_mt.h"
+#include "physics_3d/physics_server_3d_sw.h"
+#include "physics_server_2d.h"
+#include "physics_server_3d.h"
+#include "rendering_server.h"
+#include "servers/rendering/shader_types.h"
ShaderTypes *shader_types = NULL;
-PhysicsServer *_createGodotPhysicsCallback() {
- return memnew(PhysicsServerSW);
+PhysicsServer3D *_createGodotPhysicsCallback() {
+ return memnew(PhysicsServer3DSW);
}
-Physics2DServer *_createGodotPhysics2DCallback() {
- return Physics2DServerWrapMT::init_server<Physics2DServerSW>();
+PhysicsServer2D *_createGodotPhysics2DCallback() {
+ return PhysicsServer2DWrapMT::init_server<PhysicsServer2DSW>();
}
static bool has_server_feature_callback(const String &p_feature) {
- if (VisualServer::get_singleton()) {
- if (VisualServer::get_singleton()->has_os_feature(p_feature)) {
+ if (RenderingServer::get_singleton()) {
+ if (RenderingServer::get_singleton()->has_os_feature(p_feature)) {
return true;
}
}
@@ -98,10 +98,10 @@ void register_server_types() {
OS::get_singleton()->set_has_server_feature_callback(has_server_feature_callback);
ClassDB::register_virtual_class<DisplayServer>();
- ClassDB::register_virtual_class<VisualServer>();
+ ClassDB::register_virtual_class<RenderingServer>();
ClassDB::register_class<AudioServer>();
- ClassDB::register_virtual_class<PhysicsServer>();
- ClassDB::register_virtual_class<Physics2DServer>();
+ ClassDB::register_virtual_class<PhysicsServer3D>();
+ ClassDB::register_virtual_class<PhysicsServer2D>();
ClassDB::register_class<ARVRServer>();
ClassDB::register_class<CameraServer>();
@@ -159,30 +159,30 @@ void register_server_types() {
ClassDB::register_class<CameraFeed>();
- ClassDB::register_virtual_class<Physics2DDirectBodyState>();
- ClassDB::register_virtual_class<Physics2DDirectSpaceState>();
- ClassDB::register_virtual_class<Physics2DShapeQueryResult>();
+ ClassDB::register_virtual_class<PhysicsDirectBodyState2D>();
+ ClassDB::register_virtual_class<PhysicsDirectSpaceState2D>();
+ ClassDB::register_virtual_class<PhysicsShapeQueryResult2D>();
ClassDB::register_class<Physics2DTestMotionResult>();
- ClassDB::register_class<Physics2DShapeQueryParameters>();
+ ClassDB::register_class<PhysicsShapeQueryParameters2D>();
- ClassDB::register_class<PhysicsShapeQueryParameters>();
- ClassDB::register_virtual_class<PhysicsDirectBodyState>();
- ClassDB::register_virtual_class<PhysicsDirectSpaceState>();
- ClassDB::register_virtual_class<PhysicsShapeQueryResult>();
+ ClassDB::register_class<PhysicsShapeQueryParameters3D>();
+ ClassDB::register_virtual_class<PhysicsDirectBodyState3D>();
+ ClassDB::register_virtual_class<PhysicsDirectSpaceState3D>();
+ ClassDB::register_virtual_class<PhysicsShapeQueryResult3D>();
// Physics 2D
- GLOBAL_DEF(Physics2DServerManager::setting_property_name, "DEFAULT");
- ProjectSettings::get_singleton()->set_custom_property_info(Physics2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Physics2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
+ GLOBAL_DEF(PhysicsServer2DManager::setting_property_name, "DEFAULT");
+ ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServer2DManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServer2DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
- Physics2DServerManager::register_server("GodotPhysics", &_createGodotPhysics2DCallback);
- Physics2DServerManager::set_default_server("GodotPhysics");
+ PhysicsServer2DManager::register_server("GodotPhysics", &_createGodotPhysics2DCallback);
+ PhysicsServer2DManager::set_default_server("GodotPhysics");
// Physics 3D
- GLOBAL_DEF(PhysicsServerManager::setting_property_name, "DEFAULT");
- ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServerManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
+ GLOBAL_DEF(PhysicsServer3DManager::setting_property_name, "DEFAULT");
+ ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServer3DManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServer3DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
- PhysicsServerManager::register_server("GodotPhysics", &_createGodotPhysicsCallback);
- PhysicsServerManager::set_default_server("GodotPhysics");
+ PhysicsServer3DManager::register_server("GodotPhysics", &_createGodotPhysicsCallback);
+ PhysicsServer3DManager::set_default_server("GodotPhysics");
}
void unregister_server_types() {
@@ -192,12 +192,12 @@ void unregister_server_types() {
void register_server_singletons() {
- Engine::get_singleton()->add_singleton(Engine::Singleton("VisualServer", VisualServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("Physics2DServer", Physics2DServer::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer", NavigationServer::get_singleton_mut()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("Navigation2DServer", Navigation2DServer::get_singleton_mut()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer", NavigationServer3D::get_singleton_mut()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2D", NavigationServer2D::get_singleton_mut()));
Engine::get_singleton()->add_singleton(Engine::Singleton("ARVRServer", ARVRServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("CameraServer", CameraServer::get_singleton()));
}
diff --git a/servers/visual/SCsub b/servers/rendering/SCsub
index fca18bfea0..fca18bfea0 100644
--- a/servers/visual/SCsub
+++ b/servers/rendering/SCsub
diff --git a/servers/visual/rasterizer.cpp b/servers/rendering/rasterizer.cpp
index a3f93a3f8c..a3f93a3f8c 100644
--- a/servers/visual/rasterizer.cpp
+++ b/servers/rendering/rasterizer.cpp
diff --git a/servers/visual/rasterizer.h b/servers/rendering/rasterizer.h
index d5d32c8d47..f63d1077bb 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/rendering/rasterizer.h
@@ -32,7 +32,7 @@
#define RASTERIZER_H
#include "core/math/camera_matrix.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
#include "core/pair.h"
#include "core/self_list.h"
@@ -55,35 +55,35 @@ public:
virtual RID sky_create() = 0;
virtual void sky_set_radiance_size(RID p_sky, int p_radiance_size) = 0;
- virtual void sky_set_mode(RID p_sky, VS::SkyMode p_samples) = 0;
+ virtual void sky_set_mode(RID p_sky, RS::SkyMode p_samples) = 0;
virtual void sky_set_material(RID p_sky, RID p_material) = 0;
/* ENVIRONMENT API */
virtual RID environment_create() = 0;
- virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg) = 0;
+ virtual void environment_set_background(RID p_env, RS::EnvironmentBG p_bg) = 0;
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale) = 0;
virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation) = 0;
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
- virtual void environment_set_ambient_light(RID p_env, const Color &p_color, VS::EnvironmentAmbientSource p_ambient = VS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, VS::EnvironmentReflectionSource p_reflection_source = VS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) = 0;
+ virtual void environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient = RS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, RS::EnvironmentReflectionSource p_reflection_source = RS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) = 0;
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) = 0;
#endif
- virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0;
+ virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0;
virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) = 0;
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0;
- virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
+ virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) = 0;
- virtual void environment_set_ssao_quality(VS::EnvironmentSSAOQuality p_quality, bool p_half_size) = 0;
+ virtual void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size) = 0;
- virtual void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0;
+ virtual void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) = 0;
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0;
@@ -92,13 +92,13 @@ public:
virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) = 0;
virtual bool is_environment(RID p_env) const = 0;
- virtual VS::EnvironmentBG environment_get_background(RID p_env) const = 0;
+ virtual RS::EnvironmentBG environment_get_background(RID p_env) const = 0;
virtual int environment_get_canvas_max_layer(RID p_env) const = 0;
virtual RID camera_effects_create() = 0;
- virtual void camera_effects_set_dof_blur_quality(VS::DOFBlurQuality p_quality, bool p_use_jitter) = 0;
- virtual void camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape p_shape) = 0;
+ virtual void camera_effects_set_dof_blur_quality(RS::DOFBlurQuality p_quality, bool p_use_jitter) = 0;
+ virtual void camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape p_shape) = 0;
virtual void camera_effects_set_dof_blur(RID p_camera_effects, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) = 0;
virtual void camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure) = 0;
@@ -119,7 +119,7 @@ public:
struct InstanceBase {
- VS::InstanceType base_type;
+ RS::InstanceType base_type;
RID base;
RID skeleton;
@@ -142,7 +142,7 @@ public:
Vector<float> blend_values;
- VS::ShadowCastingSetting cast_shadows;
+ RS::ShadowCastingSetting cast_shadows;
//fit in 32 bits
bool mirror : 8;
@@ -208,8 +208,8 @@ public:
InstanceBase() :
dependency_item(this) {
- base_type = VS::INSTANCE_NONE;
- cast_shadows = VS::SHADOW_CASTING_SETTING_ON;
+ base_type = RS::INSTANCE_NONE;
+ cast_shadows = RS::SHADOW_CASTING_SETTING_ON;
receive_shadows = true;
visible = true;
depth_layer = 0;
@@ -255,10 +255,10 @@ public:
virtual void set_scene_pass(uint64_t p_pass) = 0;
virtual void set_time(double p_time, double p_step) = 0;
- virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) = 0;
+ virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) = 0;
virtual RID render_buffers_create() = 0;
- virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, VS::ViewportMSAA p_msaa) = 0;
+ virtual void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa) = 0;
virtual void screen_space_roughness_limiter_set_active(bool p_enable, float p_curve) = 0;
virtual bool screen_space_roughness_limiter_is_active() const = 0;
@@ -277,7 +277,7 @@ public:
/* TEXTURE API */
virtual RID texture_2d_create(const Ref<Image> &p_image) = 0;
- virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, VS::TextureLayeredType p_layered_type) = 0;
+ virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) = 0;
virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices) = 0; //all slices, then all the mipmaps, must be coherent
virtual RID texture_proxy_create(RID p_base) = 0; //all slices, then all the mipmaps, must be coherent
@@ -305,11 +305,11 @@ public:
virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
virtual String texture_get_path(RID p_texture) const = 0;
- virtual void texture_set_detect_3d_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) = 0;
- virtual void texture_set_detect_normal_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) = 0;
- virtual void texture_set_detect_roughness_callback(RID p_texture, VS::TextureDetectRoughnessCallback p_callback, void *p_userdata) = 0;
+ virtual void texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) = 0;
+ virtual void texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) = 0;
+ virtual void texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) = 0;
- virtual void texture_debug_usage(List<VS::TextureInfo> *r_info) = 0;
+ virtual void texture_debug_usage(List<RS::TextureInfo> *r_info) = 0;
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) = 0;
@@ -349,19 +349,19 @@ public:
virtual RID mesh_create() = 0;
/// Returns stride
- virtual void mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_surface) = 0;
+ virtual void mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) = 0;
virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0;
- virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) = 0;
- virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
+ virtual void mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) = 0;
+ virtual RS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data) = 0;
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;
- virtual VS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const = 0;
+ virtual RS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const = 0;
virtual int mesh_get_surface_count(RID p_mesh) const = 0;
@@ -376,7 +376,7 @@ public:
virtual RID multimesh_create() = 0;
- virtual void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false) = 0;
+ virtual void multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false) = 0;
virtual int multimesh_get_instance_count(RID p_multimesh) const = 0;
@@ -404,7 +404,7 @@ public:
/* IMMEDIATE API */
virtual RID immediate_create() = 0;
- virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID()) = 0;
+ virtual void immediate_begin(RID p_immediate, RS::PrimitiveType p_rimitive, RID p_texture = RID()) = 0;
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) = 0;
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal) = 0;
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent) = 0;
@@ -430,14 +430,14 @@ public:
/* Light API */
- virtual RID light_create(VS::LightType p_type) = 0;
+ virtual RID light_create(RS::LightType p_type) = 0;
- RID directional_light_create() { return light_create(VS::LIGHT_DIRECTIONAL); }
- RID omni_light_create() { return light_create(VS::LIGHT_OMNI); }
- RID spot_light_create() { return light_create(VS::LIGHT_SPOT); }
+ RID directional_light_create() { return light_create(RS::LIGHT_DIRECTIONAL); }
+ RID omni_light_create() { return light_create(RS::LIGHT_OMNI); }
+ RID spot_light_create() { return light_create(RS::LIGHT_SPOT); }
virtual void light_set_color(RID p_light, const Color &p_color) = 0;
- virtual void light_set_param(RID p_light, VS::LightParam p_param, float p_value) = 0;
+ virtual void light_set_param(RID p_light, RS::LightParam p_param, float p_value) = 0;
virtual void light_set_shadow(RID p_light, bool p_enabled) = 0;
virtual void light_set_shadow_color(RID p_light, const Color &p_color) = 0;
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
@@ -446,22 +446,22 @@ public:
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0;
virtual void light_set_use_gi(RID p_light, bool p_enable) = 0;
- virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0;
+ virtual void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) = 0;
- virtual void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) = 0;
+ virtual void light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) = 0;
virtual void light_directional_set_blend_splits(RID p_light, bool p_enable) = 0;
virtual bool light_directional_get_blend_splits(RID p_light) const = 0;
- virtual void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) = 0;
- virtual VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const = 0;
+ virtual void light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode) = 0;
+ virtual RS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const = 0;
- virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) = 0;
- virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) = 0;
+ virtual RS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) = 0;
+ virtual RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) = 0;
virtual bool light_has_shadow(RID p_light) const = 0;
- virtual VS::LightType light_get_type(RID p_light) const = 0;
+ virtual RS::LightType light_get_type(RID p_light) const = 0;
virtual AABB light_get_aabb(RID p_light) const = 0;
- virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0;
+ virtual float light_get_param(RID p_light, RS::LightParam p_param) = 0;
virtual Color light_get_color(RID p_light) = 0;
virtual bool light_get_use_gi(RID p_light) = 0;
virtual uint64_t light_get_version(RID p_light) const = 0;
@@ -470,7 +470,7 @@ public:
virtual RID reflection_probe_create() = 0;
- virtual void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) = 0;
+ virtual void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) = 0;
virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution) = 0;
virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity) = 0;
virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient) = 0;
@@ -485,7 +485,7 @@ public:
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
virtual AABB reflection_probe_get_aabb(RID p_probe) const = 0;
- virtual VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0;
+ virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0;
virtual uint32_t reflection_probe_get_cull_mask(RID p_probe) const = 0;
virtual Vector3 reflection_probe_get_extents(RID p_probe) const = 0;
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const = 0;
@@ -591,7 +591,7 @@ public:
virtual bool particles_is_inactive(RID p_particles) const = 0;
- virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) = 0;
+ virtual void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) = 0;
virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0;
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0;
@@ -628,7 +628,7 @@ public:
virtual void render_target_disable_clear_request(RID p_render_target) = 0;
virtual void render_target_do_clear_request(RID p_render_target) = 0;
- virtual VS::InstanceType get_base_type(RID p_rid) const = 0;
+ virtual RS::InstanceType get_base_type(RID p_rid) const = 0;
virtual bool free(RID p_rid) = 0;
virtual bool has_os_feature(const String &p_feature) const = 0;
@@ -639,9 +639,9 @@ public:
virtual void render_info_begin_capture() = 0;
virtual void render_info_end_capture() = 0;
- virtual int get_captured_render_info(VS::RenderInfo p_info) = 0;
+ virtual int get_captured_render_info(RS::RenderInfo p_info) = 0;
- virtual int get_render_info(VS::RenderInfo p_info) = 0;
+ virtual int get_render_info(RS::RenderInfo p_info) = 0;
virtual String get_video_adapter_name() const = 0;
virtual String get_video_adapter_vendor() const = 0;
@@ -656,12 +656,12 @@ public:
}
#define TIMESTAMP_BEGIN() \
{ \
- if (VSG::storage->capturing_timestamps) VSG::storage->capture_timestamps_begin(); \
+ if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamps_begin(); \
}
#define RENDER_TIMESTAMP(m_text) \
{ \
- if (VSG::storage->capturing_timestamps) VSG::storage->capture_timestamp(m_text); \
+ if (RSG::storage->capturing_timestamps) RSG::storage->capture_timestamp(m_text); \
}
bool capturing_timestamps = false;
@@ -706,13 +706,13 @@ public:
int layer_max;
int item_mask;
int item_shadow_mask;
- VS::CanvasLightMode mode;
+ RS::CanvasLightMode mode;
RID texture;
Vector2 texture_offset;
RID canvas;
bool use_shadow;
int shadow_buffer_size;
- VS::CanvasLightShadowFilter shadow_filter;
+ RS::CanvasLightShadowFilter shadow_filter;
Color shadow_color;
float shadow_smooth;
@@ -749,14 +749,14 @@ public:
scale = 1.0;
energy = 1.0;
item_shadow_mask = -1;
- mode = VS::CANVAS_LIGHT_MODE_ADD;
+ mode = RS::CANVAS_LIGHT_MODE_ADD;
// texture_cache = NULL;
next_ptr = NULL;
mask_next_ptr = NULL;
filter_next_ptr = NULL;
use_shadow = false;
shadow_buffer_size = 2048;
- shadow_filter = VS::CANVAS_LIGHT_FILTER_NONE;
+ shadow_filter = RS::CANVAS_LIGHT_FILTER_NONE;
shadow_smooth = 0.0;
render_index_cache = -1;
}
@@ -764,7 +764,7 @@ public:
typedef uint64_t TextureBindingID;
- virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) = 0;
+ virtual TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) = 0;
virtual void free_texture_binding(TextureBindingID p_binding) = 0;
//easier wrap to avoid mistakes
@@ -775,14 +775,14 @@ public:
TextureBindingID binding_id;
- _FORCE_INLINE_ void create(VS::CanvasItemTextureFilter p_item_filter, VS::CanvasItemTextureRepeat p_item_repeat, RID p_texture, RID p_normalmap, RID p_specular, VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
- if (p_filter == VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
+ _FORCE_INLINE_ void create(RS::CanvasItemTextureFilter p_item_filter, RS::CanvasItemTextureRepeat p_item_repeat, RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
+ if (p_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
p_filter = p_item_filter;
}
- if (p_repeat == VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
+ if (p_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
p_repeat = p_item_repeat;
}
- if (p_texture != RID() || p_normalmap != RID() || p_specular != RID() || p_filter != VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT || p_repeat != VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT || p_multimesh.is_valid()) {
+ if (p_texture != RID() || p_normalmap != RID() || p_specular != RID() || p_filter != RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT || p_repeat != RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT || p_multimesh.is_valid()) {
ERR_FAIL_COND(binding_id != 0);
binding_id = singleton->request_texture_binding(p_texture, p_normalmap, p_specular, p_filter, p_repeat, p_multimesh);
}
@@ -882,8 +882,8 @@ public:
float margin[4];
bool draw_center;
Color color;
- VS::NinePatchAxisMode axis_x;
- VS::NinePatchAxisMode axis_y;
+ RS::NinePatchAxisMode axis_x;
+ RS::NinePatchAxisMode axis_y;
Color specular_shininess;
TextureBinding texture_binding;
CommandNinePatch() {
@@ -894,7 +894,7 @@ public:
struct CommandPolygon : public Command {
- VS::PrimitiveType primitive;
+ RS::PrimitiveType primitive;
Polygon polygon;
Color specular_shininess;
TextureBinding texture_binding;
@@ -958,7 +958,7 @@ public:
};
struct ViewportRender {
- VisualServer *owner;
+ RenderingServer *owner;
void *udata;
Rect2 rect;
};
@@ -968,7 +968,7 @@ public:
bool visible;
bool behind;
bool update_when_visible;
- //VS::MaterialBlendMode blend_mode;
+ //RS::MaterialBlendMode blend_mode;
int light_mask;
int z_final;
@@ -1241,7 +1241,7 @@ public:
Transform2D xform;
Transform2D xform_cache;
int light_mask;
- VS::CanvasOccluderPolygonCullMode cull_cache;
+ RS::CanvasOccluderPolygonCullMode cull_cache;
LightOccluderInstance *next;
@@ -1249,7 +1249,7 @@ public:
enabled = true;
next = NULL;
light_mask = 1;
- cull_cache = VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
+ cull_cache = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
}
};
@@ -1260,7 +1260,7 @@ public:
virtual RID occluder_polygon_create() = 0;
virtual void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines) = 0;
- virtual void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) = 0;
+ virtual void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) = 0;
virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0;
diff --git a/servers/visual/rasterizer_rd/SCsub b/servers/rendering/rasterizer_rd/SCsub
index cc17feeb05..cc17feeb05 100644
--- a/servers/visual/rasterizer_rd/SCsub
+++ b/servers/rendering/rasterizer_rd/SCsub
diff --git a/servers/visual/rasterizer_rd/cubemap_coeffs.h b/servers/rendering/rasterizer_rd/cubemap_coeffs.h
index 1db03ce7c4..1db03ce7c4 100644
--- a/servers/visual/rasterizer_rd/cubemap_coeffs.h
+++ b/servers/rendering/rasterizer_rd/cubemap_coeffs.h
diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.cpp b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp
index 943ef1c7fa..943ef1c7fa 100644
--- a/servers/visual/rasterizer_rd/light_cluster_builder.cpp
+++ b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp
diff --git a/servers/visual/rasterizer_rd/light_cluster_builder.h b/servers/rendering/rasterizer_rd/light_cluster_builder.h
index 83014a7dd0..3411ed07a0 100644
--- a/servers/visual/rasterizer_rd/light_cluster_builder.h
+++ b/servers/rendering/rasterizer_rd/light_cluster_builder.h
@@ -31,7 +31,7 @@
#ifndef LIGHT_CLUSTER_BUILDER_H
#define LIGHT_CLUSTER_BUILDER_H
-#include "servers/visual/rasterizer_rd/rasterizer_storage_rd.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
class LightClusterBuilder {
public:
diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
index 38b1e3b3a6..8d52ffd7b9 100644
--- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
@@ -104,7 +104,7 @@ void RasterizerCanvasRD::_update_specular_shininess(const Color &p_transform, ui
*r_ss |= uint32_t(CLAMP(p_transform.r * 255.0, 0, 255));
}
-RID RasterizerCanvasRD::_create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
+RID RasterizerCanvasRD::_create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
Vector<RD::Uniform> uniform_set;
@@ -168,13 +168,13 @@ RID RasterizerCanvasRD::_create_texture_binding(RID p_texture, RID p_normalmap,
return RD::get_singleton()->uniform_set_create(uniform_set, shader.default_version_rd_shader, 0);
}
-RasterizerCanvas::TextureBindingID RasterizerCanvasRD::request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
+RasterizerCanvas::TextureBindingID RasterizerCanvasRD::request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh) {
- if (p_filter == VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
+ if (p_filter == RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT) {
p_filter = default_samplers.default_filter;
}
- if (p_repeat == VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
+ if (p_repeat == RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT) {
p_repeat = default_samplers.default_repeat;
}
@@ -287,7 +287,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
vd.offset = base_offset * sizeof(float);
- vd.location = VS::ARRAY_VERTEX;
+ vd.location = RS::ARRAY_VERTEX;
vd.stride = stride * sizeof(float);
descriptions.write[0] = vd;
@@ -307,7 +307,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32B32A32_SFLOAT;
vd.offset = base_offset * sizeof(float);
- vd.location = VS::ARRAY_COLOR;
+ vd.location = RS::ARRAY_COLOR;
vd.stride = stride * sizeof(float);
descriptions.write[1] = vd;
@@ -335,7 +335,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32B32A32_SFLOAT;
vd.offset = 0;
- vd.location = VS::ARRAY_COLOR;
+ vd.location = RS::ARRAY_COLOR;
vd.stride = 0;
descriptions.write[1] = vd;
@@ -347,7 +347,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
vd.offset = base_offset * sizeof(float);
- vd.location = VS::ARRAY_TEX_UV;
+ vd.location = RS::ARRAY_TEX_UV;
vd.stride = stride * sizeof(float);
descriptions.write[2] = vd;
@@ -363,7 +363,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
vd.offset = 0;
- vd.location = VS::ARRAY_TEX_UV;
+ vd.location = RS::ARRAY_TEX_UV;
vd.stride = 0;
descriptions.write[2] = vd;
@@ -375,7 +375,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32B32A32_UINT;
vd.offset = base_offset * sizeof(float);
- vd.location = VS::ARRAY_BONES;
+ vd.location = RS::ARRAY_BONES;
vd.stride = stride * sizeof(float);
descriptions.write[3] = vd;
@@ -404,7 +404,7 @@ RasterizerCanvas::PolygonID RasterizerCanvasRD::request_polygon(const Vector<int
RD::VertexDescription vd;
vd.format = RD::DATA_FORMAT_R32G32B32A32_UINT;
vd.offset = 0;
- vd.location = VS::ARRAY_BONES;
+ vd.location = RS::ARRAY_BONES;
vd.stride = 0;
descriptions.write[3] = vd;
@@ -558,7 +558,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
light_cache[light_count] = light;
light_count++;
- if (light->mode == VS::CANVAS_LIGHT_MODE_MASK) {
+ if (light->mode == RS::CANVAS_LIGHT_MODE_MASK) {
base_flags |= FLAGS_USING_LIGHT_MASK;
}
if (light_count == state.max_lights_per_item) {
@@ -888,13 +888,13 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
ERR_CONTINUE(!pb);
//bind pipeline
{
- static const PipelineVariant variant[VS::PRIMITIVE_MAX] = { PIPELINE_VARIANT_ATTRIBUTE_POINTS, PIPELINE_VARIANT_ATTRIBUTE_LINES, PIPELINE_VARIANT_ATTRIBUTE_LINES_STRIP, PIPELINE_VARIANT_ATTRIBUTE_TRIANGLES, PIPELINE_VARIANT_ATTRIBUTE_TRIANGLE_STRIP };
- ERR_CONTINUE(polygon->primitive < 0 || polygon->primitive >= VS::PRIMITIVE_MAX);
+ static const PipelineVariant variant[RS::PRIMITIVE_MAX] = { PIPELINE_VARIANT_ATTRIBUTE_POINTS, PIPELINE_VARIANT_ATTRIBUTE_LINES, PIPELINE_VARIANT_ATTRIBUTE_LINES_STRIP, PIPELINE_VARIANT_ATTRIBUTE_TRIANGLES, PIPELINE_VARIANT_ATTRIBUTE_TRIANGLE_STRIP };
+ ERR_CONTINUE(polygon->primitive < 0 || polygon->primitive >= RS::PRIMITIVE_MAX);
RID pipeline = pipeline_variants->variants[light_mode][variant[polygon->primitive]].get_render_pipeline(pb->vertex_format_id, p_framebuffer_format);
RD::get_singleton()->draw_list_bind_render_pipeline(p_draw_list, pipeline);
}
- if (polygon->primitive == VS::PRIMITIVE_LINES) {
+ if (polygon->primitive == RS::PRIMITIVE_LINES) {
//not supported in most hardware, so pointless
//RD::get_singleton()->draw_list_set_line_width(p_draw_list, polygon->line_width);
}
@@ -1024,7 +1024,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
// materials are ignored in 2D meshes, could be added but many things (ie, lighting mode, reading from screen, etc) would break as they are not meant be set up at this point of drawing
glBindVertexArray(s->array_id);
- glVertexAttrib4f(VS::ARRAY_COLOR, mesh->modulate.r, mesh->modulate.g, mesh->modulate.b, mesh->modulate.a);
+ glVertexAttrib4f(RS::ARRAY_COLOR, mesh->modulate.r, mesh->modulate.g, mesh->modulate.b, mesh->modulate.a);
if (s->index_array_len) {
glDrawElements(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0);
@@ -1054,7 +1054,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
RasterizerStorageGLES3::Texture *texture = _bind_canvas_texture(mmesh->texture, mmesh->normal_map);
- state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != VS::MULTIMESH_CUSTOM_DATA_NONE);
+ state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCE_CUSTOM, multi_mesh->custom_data_format != RS::MULTIMESH_CUSTOM_DATA_NONE);
state.canvas_shader.set_conditional(CanvasShaderGLES3::USE_INSTANCING, true);
//reset shader and force rebind
state.using_texture_rect = true;
@@ -1088,7 +1088,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
int color_ofs;
- if (multi_mesh->transform_format == VS::MULTIMESH_TRANSFORM_3D) {
+ if (multi_mesh->transform_format == RS::MULTIMESH_TRANSFORM_3D) {
glEnableVertexAttribArray(10);
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(8 * 4));
glVertexAttribDivisor(10, 1);
@@ -1103,18 +1103,18 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
switch (multi_mesh->color_format) {
- case VS::MULTIMESH_COLOR_NONE: {
+ case RS::MULTIMESH_COLOR_NONE: {
glDisableVertexAttribArray(11);
glVertexAttrib4f(11, 1, 1, 1, 1);
} break;
- case VS::MULTIMESH_COLOR_8BIT: {
+ case RS::MULTIMESH_COLOR_8BIT: {
glEnableVertexAttribArray(11);
glVertexAttribPointer(11, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(color_ofs));
glVertexAttribDivisor(11, 1);
custom_data_ofs += 4;
} break;
- case VS::MULTIMESH_COLOR_FLOAT: {
+ case RS::MULTIMESH_COLOR_FLOAT: {
glEnableVertexAttribArray(11);
glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(color_ofs));
glVertexAttribDivisor(11, 1);
@@ -1124,17 +1124,17 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
switch (multi_mesh->custom_data_format) {
- case VS::MULTIMESH_CUSTOM_DATA_NONE: {
+ case RS::MULTIMESH_CUSTOM_DATA_NONE: {
glDisableVertexAttribArray(12);
glVertexAttrib4f(12, 1, 1, 1, 1);
} break;
- case VS::MULTIMESH_CUSTOM_DATA_8BIT: {
+ case RS::MULTIMESH_CUSTOM_DATA_8BIT: {
glEnableVertexAttribArray(12);
glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, CAST_INT_TO_UCHAR_PTR(custom_data_ofs));
glVertexAttribDivisor(12, 1);
} break;
- case VS::MULTIMESH_CUSTOM_DATA_FLOAT: {
+ case RS::MULTIMESH_CUSTOM_DATA_FLOAT: {
glEnableVertexAttribArray(12);
glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(custom_data_ofs));
glVertexAttribDivisor(12, 1);
@@ -1167,9 +1167,9 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
if (particles->inactive && !particles->emitting)
break;
- glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1); //not used, so keep white
+ glVertexAttrib4f(RS::ARRAY_COLOR, 1, 1, 1, 1); //not used, so keep white
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
storage->particles_request_process(particles_cmd->particles);
//enable instancing
@@ -1208,7 +1208,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
int amount = particles->amount;
- if (particles->draw_order != VS::PARTICLES_DRAW_ORDER_LIFETIME) {
+ if (particles->draw_order != RS::PARTICLES_DRAW_ORDER_LIFETIME) {
glEnableVertexAttribArray(8); //xform x
glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(sizeof(float) * 4 * 3));
@@ -1712,7 +1712,7 @@ RID RasterizerCanvasRD::occluder_polygon_create() {
OccluderPolygon occluder;
occluder.point_count = 0;
- occluder.cull_mode = VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
+ occluder.cull_mode = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
return occluder_polygon_owner.make_rid(occluder);
}
@@ -1805,7 +1805,7 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con
}
}
}
-void RasterizerCanvasRD::occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode) {
+void RasterizerCanvasRD::occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) {
OccluderPolygon *oc = occluder_polygon_owner.getornull(p_occluder);
ERR_FAIL_COND(!oc);
oc->cull_mode = p_mode;
@@ -1849,7 +1849,7 @@ void RasterizerCanvasRD::ShaderData::set_code(const String &p_code) {
RasterizerCanvasRD *canvas_singleton = (RasterizerCanvasRD *)RasterizerCanvas::singleton;
- Error err = canvas_singleton->shader.compiler.compile(VS::SHADER_CANVAS_ITEM, code, &actions, path, gen_code);
+ Error err = canvas_singleton->shader.compiler.compile(RS::SHADER_CANVAS_ITEM, code, &actions, path, gen_code);
ERR_FAIL_COND(err != OK);
@@ -2138,18 +2138,18 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V
u.binding = 0;
u.ids.resize(12);
RID *ids_ptr = u.ids.ptrw();
- ids_ptr[0] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[1] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[2] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[3] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[4] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[5] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[6] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[7] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[8] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[9] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[10] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[11] = canvas_singleton->storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[0] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[1] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[2] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[3] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[4] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[5] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[6] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[7] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[8] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[9] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[10] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[11] = canvas_singleton->storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
uniforms.push_back(u);
}
@@ -2204,8 +2204,8 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
{ //create default samplers
- default_samplers.default_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
- default_samplers.default_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
+ default_samplers.default_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
+ default_samplers.default_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
}
{ //shader variants
@@ -2418,7 +2418,7 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
{ //bindings
bindings.id_generator = 0;
//generate for 0
- bindings.default_empty = request_texture_binding(RID(), RID(), RID(), VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, RID());
+ bindings.default_empty = request_texture_binding(RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT, RID());
{ //state allocate
state.canvas_state_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(State::Buffer));
diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
index 894a00a436..0c151975bc 100644
--- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
@@ -31,13 +31,13 @@
#ifndef RASTERIZER_CANVAS_RD_H
#define RASTERIZER_CANVAS_RD_H
-#include "servers/visual/rasterizer.h"
-#include "servers/visual/rasterizer_rd/rasterizer_storage_rd.h"
-#include "servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
-#include "servers/visual/rasterizer_rd/shader_compiler_rd.h"
-#include "servers/visual/rasterizer_rd/shaders/canvas.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/canvas_occlusion.glsl.gen.h"
-#include "servers/visual/rendering_device.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
+#include "servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
+#include "servers/rendering/rasterizer_rd/shader_compiler_rd.h"
+#include "servers/rendering/rasterizer_rd/shaders/canvas.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl.gen.h"
+#include "servers/rendering/rendering_device.h"
class RasterizerCanvasRD : public RasterizerCanvas {
@@ -229,8 +229,8 @@ class RasterizerCanvasRD : public RasterizerCanvas {
RID normalmap;
RID specular;
RID multimesh;
- VS::CanvasItemTextureFilter texture_filter;
- VS::CanvasItemTextureRepeat texture_repeat;
+ RS::CanvasItemTextureFilter texture_filter;
+ RS::CanvasItemTextureRepeat texture_repeat;
bool operator==(const TextureBindingKey &p_key) const {
return texture == p_key.texture && normalmap == p_key.normalmap && specular == p_key.specular && multimesh == p_key.specular && texture_filter == p_key.texture_filter && texture_repeat == p_key.texture_repeat;
}
@@ -269,12 +269,12 @@ class RasterizerCanvasRD : public RasterizerCanvas {
TextureBindingID default_empty;
} bindings;
- RID _create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
+ RID _create_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
void _dispose_bindings();
struct {
- VS::CanvasItemTextureFilter default_filter;
- VS::CanvasItemTextureRepeat default_repeat;
+ RS::CanvasItemTextureFilter default_filter;
+ RS::CanvasItemTextureRepeat default_repeat;
} default_samplers;
/******************/
@@ -332,7 +332,7 @@ class RasterizerCanvasRD : public RasterizerCanvas {
struct OccluderPolygon {
- VS::CanvasOccluderPolygonCullMode cull_mode;
+ RS::CanvasOccluderPolygonCullMode cull_mode;
int point_count;
RID vertex_buffer;
RID vertex_array;
@@ -470,7 +470,7 @@ class RasterizerCanvasRD : public RasterizerCanvas {
_FORCE_INLINE_ void _update_specular_shininess(const Color &p_transform, uint32_t *r_ss);
public:
- TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
+ TextureBindingID request_texture_binding(RID p_texture, RID p_normalmap, RID p_specular, RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat, RID p_multimesh);
void free_texture_binding(TextureBindingID p_binding);
PolygonID request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>());
@@ -483,7 +483,7 @@ public:
RID occluder_polygon_create();
void occluder_polygon_set_shape_as_lines(RID p_occluder, const Vector<Vector2> &p_lines);
- void occluder_polygon_set_cull_mode(RID p_occluder, VS::CanvasOccluderPolygonCullMode p_mode);
+ void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode);
void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, const Transform2D &p_canvas_transform);
diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
index 355ebfa409..cc94815152 100644
--- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
@@ -365,7 +365,7 @@ void RasterizerEffectsRD::luminance_reduction(RID p_source_texture, const Size2i
RD::get_singleton()->compute_list_end();
}
-void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_halfsize_texture1, RID p_halfsize_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, VisualServer::DOFBokehShape p_bokeh_shape, VS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal) {
+void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_halfsize_texture1, RID p_halfsize_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, RenderingServer::DOFBokehShape p_bokeh_shape, RS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal) {
bokeh.push_constant.blur_far_active = p_dof_far;
bokeh.push_constant.blur_far_begin = p_dof_far_begin;
@@ -408,16 +408,16 @@ void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, con
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
RD::get_singleton()->compute_list_add_barrier(compute_list);
- if (p_bokeh_shape == VS::DOF_BOKEH_BOX || p_bokeh_shape == VS::DOF_BOKEH_HEXAGON) {
+ if (p_bokeh_shape == RS::DOF_BOKEH_BOX || p_bokeh_shape == RS::DOF_BOKEH_HEXAGON) {
//second pass
- RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, bokeh.pipelines[p_bokeh_shape == VS::DOF_BOKEH_BOX ? BOKEH_GEN_BOKEH_BOX : BOKEH_GEN_BOKEH_HEXAGONAL]);
+ RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, bokeh.pipelines[p_bokeh_shape == RS::DOF_BOKEH_BOX ? BOKEH_GEN_BOKEH_BOX : BOKEH_GEN_BOKEH_HEXAGONAL]);
static const int quality_samples[4] = { 6, 12, 12, 24 };
bokeh.push_constant.steps = quality_samples[p_quality];
- if (p_quality == VS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == VS::DOF_BLUR_QUALITY_LOW) {
+ if (p_quality == RS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == RS::DOF_BLUR_QUALITY_LOW) {
//box and hexagon are more or less the same, and they can work in either half (very low and low quality) or full (medium and high quality_ sizes)
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_halfsize_texture1), 0);
@@ -444,7 +444,7 @@ void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, con
//third pass
bokeh.push_constant.second_pass = true;
- if (p_quality == VS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == VS::DOF_BLUR_QUALITY_LOW) {
+ if (p_quality == RS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == RS::DOF_BLUR_QUALITY_LOW) {
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_halfsize_texture2), 0);
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_halfsize_texture1), 1);
@@ -458,7 +458,7 @@ void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, con
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, 1);
RD::get_singleton()->compute_list_add_barrier(compute_list);
- if (p_quality == VS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == VS::DOF_BLUR_QUALITY_LOW) {
+ if (p_quality == RS::DOF_BLUR_QUALITY_VERY_LOW || p_quality == RS::DOF_BLUR_QUALITY_LOW) {
//forth pass, upscale for low quality
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, bokeh.pipelines[BOKEH_COMPOSITE]);
@@ -528,7 +528,7 @@ void RasterizerEffectsRD::bokeh_dof(RID p_base_texture, RID p_depth_texture, con
RD::get_singleton()->compute_list_end();
}
-void RasterizerEffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness) {
+void RasterizerEffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness) {
//minify first
ssao.minify_push_constant.orthogonal = p_projection.is_orthogonal();
@@ -628,7 +628,7 @@ void RasterizerEffectsRD::generate_ssao(RID p_depth_buffer, RID p_normal_buffer,
ssao.blur_push_constant.axis[0] = 1;
ssao.blur_push_constant.axis[1] = 0;
- if (p_blur != VS::ENV_SSAO_BLUR_DISABLED) {
+ if (p_blur != RS::ENV_SSAO_BLUR_DISABLED) {
RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[p_half_size ? SSAO_BLUR_PASS_HALF : SSAO_BLUR_PASS]);
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_ao1), 0);
diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.h b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.h
index 562a7b674b..69da5dc6d4 100644
--- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.h
@@ -32,21 +32,21 @@
#define RASTERIZER_EFFECTS_RD_H
#include "core/math/camera_matrix.h"
-#include "servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
-#include "servers/visual/rasterizer_rd/shaders/blur.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/bokeh_dof.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/copy.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/cubemap_downsampler.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/cubemap_roughness.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/luminance_reduce.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/ssao.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/ssao_blur.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/ssao_minify.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/tonemap.glsl.gen.h"
-
-#include "servers/visual_server.h"
+#include "servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
+#include "servers/rendering/rasterizer_rd/shaders/blur.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/copy.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/ssao.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/tonemap.glsl.gen.h"
+
+#include "servers/rendering_server.h"
class RasterizerEffectsRD {
@@ -404,7 +404,7 @@ public:
void make_mipmap(RID p_source_rd_texture, RID p_framebuffer_half, const Vector2 &p_pixel_size);
void copy_cubemap_to_dp(RID p_source_rd_texture, RID p_dest_framebuffer, const Rect2 &p_rect, float p_z_near, float p_z_far, float p_bias, bool p_dp_flip);
void luminance_reduction(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);
- void bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_bokeh_texture1, RID p_bokeh_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, VS::DOFBokehShape p_bokeh_shape, VS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal);
+ void bokeh_dof(RID p_base_texture, RID p_depth_texture, const Size2i &p_base_texture_size, RID p_secondary_texture, RID p_bokeh_texture1, RID p_bokeh_texture2, bool p_dof_far, float p_dof_far_begin, float p_dof_far_size, bool p_dof_near, float p_dof_near_begin, float p_dof_near_size, float p_bokeh_size, RS::DOFBokehShape p_bokeh_shape, RS::DOFBlurQuality p_quality, bool p_use_jitter, float p_cam_znear, float p_cam_zfar, bool p_cam_orthogonal);
struct TonemapSettings {
@@ -424,7 +424,7 @@ public:
bool glow_use_bicubic_upscale = false;
RID glow_texture;
- VS::EnvironmentToneMapper tonemap_mode = VS::ENV_TONE_MAPPER_LINEAR;
+ RS::EnvironmentToneMapper tonemap_mode = RS::ENV_TONE_MAPPER_LINEAR;
float exposure = 1.0;
float white = 1.0;
@@ -443,7 +443,7 @@ public:
void tonemapper(RID p_source_color, RID p_dst_framebuffer, const TonemapSettings &p_settings);
- void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, VS::EnvironmentSSAOQuality p_quality, VS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness);
+ void generate_ssao(RID p_depth_buffer, RID p_normal_buffer, const Size2i &p_depth_buffer_size, RID p_depth_mipmaps_texture, const Vector<RID> &depth_mipmaps, RID p_ao1, bool p_half_size, RID p_ao2, RID p_upscale_buffer, float p_intensity, float p_radius, float p_bias, const CameraMatrix &p_projection, RS::EnvironmentSSAOQuality p_quality, RS::EnvironmentSSAOBlur p_blur, float p_edge_sharpness);
void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
void cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, const Size2i &p_size);
diff --git a/servers/visual/rasterizer_rd/rasterizer_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_rd.cpp
index 9c54f0caae..9c54f0caae 100644
--- a/servers/visual/rasterizer_rd/rasterizer_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_rd.cpp
diff --git a/servers/visual/rasterizer_rd/rasterizer_rd.h b/servers/rendering/rasterizer_rd/rasterizer_rd.h
index bbcf9bfefe..756b9499ca 100644
--- a/servers/visual/rasterizer_rd/rasterizer_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_rd.h
@@ -33,10 +33,10 @@
#include "core/os/os.h"
#include "core/thread_work_pool.h"
-#include "servers/visual/rasterizer.h"
-#include "servers/visual/rasterizer_rd/rasterizer_canvas_rd.h"
-#include "servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.h"
-#include "servers/visual/rasterizer_rd/rasterizer_storage_rd.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
class RasterizerRD : public Rasterizer {
protected:
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index 70219a3981..bf3cd045f1 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -30,8 +30,8 @@
#include "rasterizer_scene_high_end_rd.h"
#include "core/project_settings.h"
-#include "servers/visual/rendering_device.h"
-#include "servers/visual/visual_server_raster.h"
+#include "servers/rendering/rendering_device.h"
+#include "servers/rendering/rendering_server_raster.h"
static _FORCE_INLINE_ void store_transform(const Transform &p_mtx, float *p_array) {
p_array[0] = p_mtx.basis.elements[0][0];
@@ -163,7 +163,7 @@ void RasterizerSceneHighEndRD::ShaderData::set_code(const String &p_code) {
RasterizerSceneHighEndRD *scene_singleton = (RasterizerSceneHighEndRD *)RasterizerSceneHighEndRD::singleton;
- Error err = scene_singleton->shader.compiler.compile(VS::SHADER_SPATIAL, code, &actions, path, gen_code);
+ Error err = scene_singleton->shader.compiler.compile(RS::SHADER_SPATIAL, code, &actions, path, gen_code);
ERR_FAIL_COND(err != OK);
@@ -273,9 +273,9 @@ void RasterizerSceneHighEndRD::ShaderData::set_code(const String &p_code) {
RD::PolygonCullMode cull_mode_rd = cull_mode_rd_table[i][cull];
- for (int j = 0; j < VS::PRIMITIVE_MAX; j++) {
+ for (int j = 0; j < RS::PRIMITIVE_MAX; j++) {
- RD::RenderPrimitive primitive_rd_table[VS::PRIMITIVE_MAX] = {
+ RD::RenderPrimitive primitive_rd_table[RS::PRIMITIVE_MAX] = {
RD::RENDER_PRIMITIVE_POINTS,
RD::RENDER_PRIMITIVE_LINES,
RD::RENDER_PRIMITIVE_LINESTRIPS,
@@ -413,7 +413,7 @@ RasterizerStorageRD::ShaderData *RasterizerSceneHighEndRD::_create_shader_func()
}
void RasterizerSceneHighEndRD::MaterialData::set_render_priority(int p_priority) {
- priority = p_priority - VS::MATERIAL_RENDER_PRIORITY_MIN; //8 bits
+ priority = p_priority - RS::MATERIAL_RENDER_PRIORITY_MIN; //8 bits
}
void RasterizerSceneHighEndRD::MaterialData::set_next_pass(RID p_pass) {
@@ -569,7 +569,7 @@ void RasterizerSceneHighEndRD::RenderBufferDataHighEnd::clear() {
}
}
-void RasterizerSceneHighEndRD::RenderBufferDataHighEnd::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, VS::ViewportMSAA p_msaa) {
+void RasterizerSceneHighEndRD::RenderBufferDataHighEnd::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) {
clear();
width = p_width;
@@ -659,10 +659,10 @@ void RasterizerSceneHighEndRD::_fill_instances(RenderList::Element **p_elements,
id.flags = 0;
id.mask = e->instance->layer_mask;
- if (e->instance->base_type == VS::INSTANCE_MULTIMESH) {
+ if (e->instance->base_type == RS::INSTANCE_MULTIMESH) {
id.flags |= INSTANCE_DATA_FLAG_MULTIMESH;
uint32_t stride;
- if (storage->multimesh_get_transform_format(e->instance->base) == VS::MULTIMESH_TRANSFORM_2D) {
+ if (storage->multimesh_get_transform_format(e->instance->base) == RS::MULTIMESH_TRANSFORM_2D) {
id.flags |= INSTANCE_DATA_FLAG_MULTIMESH_FORMAT_2D;
stride = 2;
} else {
@@ -678,7 +678,7 @@ void RasterizerSceneHighEndRD::_fill_instances(RenderList::Element **p_elements,
}
id.flags |= (stride << INSTANCE_DATA_FLAGS_MULTIMESH_STRIDE_SHIFT);
- } else if (e->instance->base_type == VS::INSTANCE_MESH) {
+ } else if (e->instance->base_type == RS::INSTANCE_MESH) {
if (e->instance->skeleton.is_valid()) {
id.flags |= INSTANCE_DATA_FLAG_SKELETON;
}
@@ -769,7 +769,7 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
//find cull variant
ShaderData::CullVariant cull_variant;
- if ((p_pass_mode == PASS_MODE_SHADOW || p_pass_mode == PASS_MODE_SHADOW_DP) && e->instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
+ if ((p_pass_mode == PASS_MODE_SHADOW || p_pass_mode == PASS_MODE_SHADOW_DP) && e->instance->cast_shadows == RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) {
cull_variant = ShaderData::CULL_VARIANT_DOUBLE_SIDED;
} else {
bool mirror = e->instance->mirror;
@@ -780,16 +780,16 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
}
//find primitive and vertex format
- VS::PrimitiveType primitive;
+ RS::PrimitiveType primitive;
switch (e->instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
primitive = storage->mesh_surface_get_primitive(e->instance->base, e->surface_index);
if (e->instance->skeleton.is_valid()) {
xforms_uniform_set = storage->skeleton_get_3d_uniform_set(e->instance->skeleton, default_shader_rd, TRANSFORMS_UNIFORM_SET);
}
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
RID mesh = storage->multimesh_get_mesh(e->instance->base);
ERR_CONTINUE(!mesh.is_valid()); //should be a bug
primitive = storage->mesh_surface_get_primitive(mesh, e->surface_index);
@@ -797,10 +797,10 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
xforms_uniform_set = storage->multimesh_get_3d_uniform_set(e->instance->base, default_shader_rd, TRANSFORMS_UNIFORM_SET);
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
ERR_CONTINUE(true); //should be a bug
} break;
- case VS::INSTANCE_PARTICLES: {
+ case RS::INSTANCE_PARTICLES: {
ERR_CONTINUE(true); //should be a bug
} break;
default: {
@@ -857,18 +857,18 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
RID index_array_rd;
switch (e->instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
storage->mesh_surface_get_arrays_and_format(e->instance->base, e->surface_index, pipeline->get_vertex_input_mask(), vertex_array_rd, index_array_rd, vertex_format);
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
RID mesh = storage->multimesh_get_mesh(e->instance->base);
ERR_CONTINUE(!mesh.is_valid()); //should be a bug
storage->mesh_surface_get_arrays_and_format(mesh, e->surface_index, pipeline->get_vertex_input_mask(), vertex_array_rd, index_array_rd, vertex_format);
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
ERR_CONTINUE(true); //should be a bug
} break;
- case VS::INSTANCE_PARTICLES: {
+ case RS::INSTANCE_PARTICLES: {
ERR_CONTINUE(true); //should be a bug
} break;
default: {
@@ -915,17 +915,17 @@ void RasterizerSceneHighEndRD::_render_list(RenderingDevice::DrawListID p_draw_l
RD::get_singleton()->draw_list_set_push_constant(draw_list, &push_constant, sizeof(PushConstant));
switch (e->instance->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
RD::get_singleton()->draw_list_draw(draw_list, index_array_rd.is_valid());
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
uint32_t instances = storage->multimesh_get_instances_to_draw(e->instance->base);
RD::get_singleton()->draw_list_draw(draw_list, index_array_rd.is_valid(), instances);
} break;
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
} break;
- case VS::INSTANCE_PARTICLES: {
+ case RS::INSTANCE_PARTICLES: {
} break;
default: {
@@ -968,7 +968,7 @@ void RasterizerSceneHighEndRD::_setup_environment(RID p_environment, const Camer
//time global variables
scene_state.ubo.time = time;
- if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
+ if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
scene_state.ubo.use_ambient_light = true;
scene_state.ubo.ambient_light_color_energy[0] = 1;
@@ -981,8 +981,8 @@ void RasterizerSceneHighEndRD::_setup_environment(RID p_environment, const Camer
} else if (is_environment(p_environment)) {
- VS::EnvironmentBG env_bg = environment_get_background(p_environment);
- VS::EnvironmentAmbientSource ambient_src = environment_get_ambient_light_ambient_source(p_environment);
+ RS::EnvironmentBG env_bg = environment_get_background(p_environment);
+ RS::EnvironmentAmbientSource ambient_src = environment_get_ambient_light_ambient_source(p_environment);
float bg_energy = environment_get_bg_energy(p_environment);
scene_state.ubo.ambient_light_color_energy[3] = bg_energy;
@@ -990,9 +990,9 @@ void RasterizerSceneHighEndRD::_setup_environment(RID p_environment, const Camer
scene_state.ubo.ambient_color_sky_mix = environment_get_ambient_sky_contribution(p_environment);
//ambient
- if (ambient_src == VS::ENV_AMBIENT_SOURCE_BG && (env_bg == VS::ENV_BG_CLEAR_COLOR || env_bg == VS::ENV_BG_COLOR)) {
+ if (ambient_src == RS::ENV_AMBIENT_SOURCE_BG && (env_bg == RS::ENV_BG_CLEAR_COLOR || env_bg == RS::ENV_BG_COLOR)) {
- Color color = env_bg == VS::ENV_BG_CLEAR_COLOR ? p_default_bg_color : environment_get_bg_color(p_environment);
+ Color color = env_bg == RS::ENV_BG_CLEAR_COLOR ? p_default_bg_color : environment_get_bg_color(p_environment);
color = color.to_linear();
scene_state.ubo.ambient_light_color_energy[0] = color.r * bg_energy;
@@ -1013,13 +1013,13 @@ void RasterizerSceneHighEndRD::_setup_environment(RID p_environment, const Camer
sky_transform = sky_transform.inverse() * p_cam_transform.basis;
store_transform_3x3(sky_transform, scene_state.ubo.radiance_inverse_xform);
- scene_state.ubo.use_ambient_cubemap = (ambient_src == VS::ENV_AMBIENT_SOURCE_BG && env_bg == VS::ENV_BG_SKY) || ambient_src == VS::ENV_AMBIENT_SOURCE_SKY;
- scene_state.ubo.use_ambient_light = scene_state.ubo.use_ambient_cubemap || ambient_src == VS::ENV_AMBIENT_SOURCE_COLOR;
+ scene_state.ubo.use_ambient_cubemap = (ambient_src == RS::ENV_AMBIENT_SOURCE_BG && env_bg == RS::ENV_BG_SKY) || ambient_src == RS::ENV_AMBIENT_SOURCE_SKY;
+ scene_state.ubo.use_ambient_light = scene_state.ubo.use_ambient_cubemap || ambient_src == RS::ENV_AMBIENT_SOURCE_COLOR;
}
//specular
- VS::EnvironmentReflectionSource ref_src = environment_get_reflection_source(p_environment);
- if ((ref_src == VS::ENV_REFLECTION_SOURCE_BG && env_bg == VS::ENV_BG_SKY) || ref_src == VS::ENV_REFLECTION_SOURCE_SKY) {
+ RS::EnvironmentReflectionSource ref_src = environment_get_reflection_source(p_environment);
+ if ((ref_src == RS::ENV_REFLECTION_SOURCE_BG && env_bg == RS::ENV_BG_SKY) || ref_src == RS::ENV_REFLECTION_SOURCE_SKY) {
scene_state.ubo.use_reflection_cubemap = true;
} else {
scene_state.ubo.use_reflection_cubemap = false;
@@ -1064,12 +1064,12 @@ void RasterizerSceneHighEndRD::_add_geometry(InstanceBase *p_instance, uint32_t
m_src = p_instance->material_override.is_valid() ? p_instance->material_override : p_material;
- if (unlikely(get_debug_draw_mode() != VS::VIEWPORT_DEBUG_DRAW_DISABLED)) {
- if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) {
+ if (unlikely(get_debug_draw_mode() != RS::VIEWPORT_DEBUG_DRAW_DISABLED)) {
+ if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_OVERDRAW) {
m_src = overdraw_material;
- } else if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_WIREFRAME) {
+ } else if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME) {
m_src = wireframe_material;
- } else if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_LIGHTING) {
+ } else if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_LIGHTING) {
m_src = default_material;
}
}
@@ -1126,7 +1126,7 @@ void RasterizerSceneHighEndRD::_add_geometry_with_material(InstanceBase *p_insta
if (p_pass_mode != PASS_MODE_COLOR && p_pass_mode != PASS_MODE_COLOR_SPECULAR) {
- if (has_blend_alpha || has_read_screen_alpha || (has_base_alpha && !p_material->shader_data->uses_depth_pre_pass) || p_material->shader_data->depth_draw == ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == ShaderData::DEPTH_TEST_DISABLED || p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_OFF) {
+ if (has_blend_alpha || has_read_screen_alpha || (has_base_alpha && !p_material->shader_data->uses_depth_pre_pass) || p_material->shader_data->depth_draw == ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == ShaderData::DEPTH_TEST_DISABLED || p_instance->cast_shadows == RS::SHADOW_CASTING_SETTING_OFF) {
//conditions in which no depth pass should be processed
return;
}
@@ -1169,7 +1169,7 @@ void RasterizerSceneHighEndRD::_add_geometry_with_material(InstanceBase *p_insta
}
e->geometry_index = p_geometry_index;
e->material_index = e->material->index;
- e->uses_instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH;
+ e->uses_instancing = e->instance->base_type == RS::INSTANCE_MULTIMESH;
e->uses_lightmap = e->instance->lightmap.is_valid();
e->uses_vct = e->instance->gi_probe_instances.size();
e->shader_index = e->shader_index;
@@ -1177,7 +1177,7 @@ void RasterizerSceneHighEndRD::_add_geometry_with_material(InstanceBase *p_insta
e->priority = p_material->priority;
if (p_material->shader_data->uses_time) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
}
@@ -1201,7 +1201,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
//add geometry for drawing
switch (inst->base_type) {
- case VS::INSTANCE_MESH: {
+ case RS::INSTANCE_MESH: {
const RID *materials = NULL;
uint32_t surface_count;
@@ -1225,7 +1225,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
} break;
- case VS::INSTANCE_MULTIMESH: {
+ case RS::INSTANCE_MULTIMESH: {
if (storage->multimesh_get_instances_to_draw(inst->base) == 0) {
//not visible, 0 instances
@@ -1253,7 +1253,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
} break;
#if 0
- case VS::INSTANCE_IMMEDIATE: {
+ case RS::INSTANCE_IMMEDIATE: {
RasterizerStorageGLES3::Immediate *immediate = storage->immediate_owner.getornull(inst->base);
ERR_CONTINUE(!immediate);
@@ -1261,7 +1261,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
_add_geometry(immediate, inst, NULL, -1, p_depth_pass, p_shadow_pass);
} break;
- case VS::INSTANCE_PARTICLES: {
+ case RS::INSTANCE_PARTICLES: {
RasterizerStorageGLES3::Particles *particles = storage->particles_owner.getornull(inst->base);
ERR_CONTINUE(!particles);
@@ -1439,10 +1439,10 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
ERR_CONTINUE(base.is_null());
- VS::LightType type = storage->light_get_type(base);
+ RS::LightType type = storage->light_get_type(base);
switch (type) {
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
if (scene_state.ubo.directional_light_count >= scene_state.max_directional_lights) {
continue;
@@ -1460,14 +1460,14 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
float sign = storage->light_is_negative(base) ? -1 : 1;
- light_data.energy = sign * storage->light_get_param(base, VS::LIGHT_PARAM_ENERGY) * Math_PI;
+ light_data.energy = sign * storage->light_get_param(base, RS::LIGHT_PARAM_ENERGY) * Math_PI;
Color linear_col = storage->light_get_color(base).to_linear();
light_data.color[0] = linear_col.r;
light_data.color[1] = linear_col.g;
light_data.color[2] = linear_col.b;
- light_data.specular = storage->light_get_param(base, VS::LIGHT_PARAM_SPECULAR);
+ light_data.specular = storage->light_get_param(base, RS::LIGHT_PARAM_SPECULAR);
light_data.mask = storage->light_get_cull_mask(base);
Color shadow_col = storage->light_get_shadow_color(base).to_linear();
@@ -1480,9 +1480,9 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
if (light_data.shadow_enabled) {
- VS::LightDirectionalShadowMode smode = storage->light_directional_get_shadow_mode(base);
+ RS::LightDirectionalShadowMode smode = storage->light_directional_get_shadow_mode(base);
- int limit = smode == VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL ? 0 : (smode == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS ? 1 : 3);
+ int limit = smode == RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL ? 0 : (smode == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS ? 1 : 3);
light_data.blend_splits = storage->light_directional_get_blend_splits(base);
for (int j = 0; j < 4; j++) {
Rect2 atlas_rect = light_instance_get_directional_shadow_atlas_rect(li, j);
@@ -1501,7 +1501,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
store_camera(shadow_mtx, light_data.shadow_matrices[j]);
}
- float fade_start = storage->light_get_param(base, VS::LIGHT_PARAM_SHADOW_FADE_START);
+ float fade_start = storage->light_get_param(base, RS::LIGHT_PARAM_SHADOW_FADE_START);
light_data.fade_from = -light_data.shadow_split_offsets[3] * MIN(fade_start, 0.999); //using 1.0 would break smoothstep
light_data.fade_to = -light_data.shadow_split_offsets[3];
}
@@ -1529,8 +1529,8 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
scene_state.ubo.directional_light_count++;
} break;
- case VS::LIGHT_SPOT:
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_SPOT:
+ case RS::LIGHT_OMNI: {
if (light_count >= scene_state.max_lights) {
continue;
@@ -1543,15 +1543,15 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
float sign = storage->light_is_negative(base) ? -1 : 1;
Color linear_col = storage->light_get_color(base).to_linear();
- light_data.attenuation_energy[0] = Math::make_half_float(storage->light_get_param(base, VS::LIGHT_PARAM_ATTENUATION));
- light_data.attenuation_energy[1] = Math::make_half_float(sign * storage->light_get_param(base, VS::LIGHT_PARAM_ENERGY) * Math_PI);
+ light_data.attenuation_energy[0] = Math::make_half_float(storage->light_get_param(base, RS::LIGHT_PARAM_ATTENUATION));
+ light_data.attenuation_energy[1] = Math::make_half_float(sign * storage->light_get_param(base, RS::LIGHT_PARAM_ENERGY) * Math_PI);
light_data.color_specular[0] = MIN(uint32_t(linear_col.r * 255), 255);
light_data.color_specular[1] = MIN(uint32_t(linear_col.g * 255), 255);
light_data.color_specular[2] = MIN(uint32_t(linear_col.b * 255), 255);
- light_data.color_specular[3] = MIN(uint32_t(storage->light_get_param(base, VS::LIGHT_PARAM_SPECULAR) * 255), 255);
+ light_data.color_specular[3] = MIN(uint32_t(storage->light_get_param(base, RS::LIGHT_PARAM_SPECULAR) * 255), 255);
- float radius = MAX(0.001, storage->light_get_param(base, VS::LIGHT_PARAM_RANGE));
+ float radius = MAX(0.001, storage->light_get_param(base, RS::LIGHT_PARAM_RANGE));
light_data.inv_radius = 1.0 / radius;
Vector3 pos = p_camera_inverse_transform.xform(light_transform.origin);
@@ -1566,8 +1566,8 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
light_data.direction[1] = direction.y;
light_data.direction[2] = direction.z;
- light_data.cone_attenuation_angle[0] = Math::make_half_float(storage->light_get_param(base, VS::LIGHT_PARAM_SPOT_ATTENUATION));
- float spot_angle = storage->light_get_param(base, VS::LIGHT_PARAM_SPOT_ANGLE);
+ light_data.cone_attenuation_angle[0] = Math::make_half_float(storage->light_get_param(base, RS::LIGHT_PARAM_SPOT_ATTENUATION));
+ float spot_angle = storage->light_get_param(base, RS::LIGHT_PARAM_SPOT_ANGLE);
light_data.cone_attenuation_angle[1] = Math::make_half_float(Math::cos(Math::deg2rad(spot_angle)));
light_data.mask = storage->light_get_cull_mask(base);
@@ -1590,7 +1590,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
Rect2 rect = light_instance_get_shadow_atlas_rect(li, p_shadow_atlas);
- if (type == VS::LIGHT_OMNI) {
+ if (type == RS::LIGHT_OMNI) {
light_data.atlas_rect[0] = rect.position.x;
light_data.atlas_rect[1] = rect.position.y;
@@ -1600,7 +1600,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
Transform proj = (p_camera_inverse_transform * light_transform).inverse();
store_transform(proj, light_data.shadow_matrix);
- } else if (type == VS::LIGHT_SPOT) {
+ } else if (type == RS::LIGHT_SPOT) {
Transform modelview = (p_camera_inverse_transform * light_transform).inverse();
CameraMatrix bias;
@@ -1615,7 +1615,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
light_instance_set_index(li, light_count);
- cluster_builder.add_light(type == VS::LIGHT_SPOT ? LightClusterBuilder::LIGHT_TYPE_SPOT : LightClusterBuilder::LIGHT_TYPE_OMNI, light_transform, radius, spot_angle);
+ cluster_builder.add_light(type == RS::LIGHT_SPOT ? LightClusterBuilder::LIGHT_TYPE_SPOT : LightClusterBuilder::LIGHT_TYPE_OMNI, light_transform, radius, spot_angle);
light_count++;
} break;
@@ -1670,7 +1670,7 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
RENDER_TIMESTAMP("Setup 3D Scene");
- if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
+ if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
p_light_cull_count = 0;
p_reflection_probe_cull_count = 0;
p_gi_probe_cull_count = 0;
@@ -1720,7 +1720,7 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
//we need to allocate both these, if not allocated
_allocate_normal_texture(render_buffer);
_allocate_roughness_texture(render_buffer);
- } else if (p_environment.is_valid() && (environment_is_ssao_enabled(p_environment) || get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER)) {
+ } else if (p_environment.is_valid() && (environment_is_ssao_enabled(p_environment) || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER)) {
depth_pass_mode = PASS_MODE_DEPTH_NORMAL;
}
@@ -1785,25 +1785,25 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
Color clear_color;
bool keep_color = false;
- if (get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) {
+ if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_OVERDRAW) {
clear_color = Color(0, 0, 0, 1); //in overdraw mode, BG should always be black
} else if (is_environment(p_environment)) {
- VS::EnvironmentBG bg_mode = environment_get_background(p_environment);
+ RS::EnvironmentBG bg_mode = environment_get_background(p_environment);
float bg_energy = environment_get_bg_energy(p_environment);
switch (bg_mode) {
- case VS::ENV_BG_CLEAR_COLOR: {
+ case RS::ENV_BG_CLEAR_COLOR: {
clear_color = p_default_bg_color;
clear_color.r *= bg_energy;
clear_color.g *= bg_energy;
clear_color.b *= bg_energy;
} break;
- case VS::ENV_BG_COLOR: {
+ case RS::ENV_BG_COLOR: {
clear_color = environment_get_bg_color(p_environment);
clear_color.r *= bg_energy;
clear_color.g *= bg_energy;
clear_color.b *= bg_energy;
} break;
- case VS::ENV_BG_SKY: {
+ case RS::ENV_BG_SKY: {
RID sky = environment_get_sky(p_environment);
if (sky.is_valid()) {
@@ -1822,13 +1822,13 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
draw_sky = true;
}
} break;
- case VS::ENV_BG_CANVAS: {
+ case RS::ENV_BG_CANVAS: {
keep_color = true;
} break;
- case VS::ENV_BG_KEEP: {
+ case RS::ENV_BG_KEEP: {
keep_color = true;
} break;
- case VS::ENV_BG_CAMERA_FEED: {
+ case RS::ENV_BG_CAMERA_FEED: {
} break;
default: {
@@ -1846,7 +1846,7 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
_fill_instances(render_list.elements, render_list.element_count, false);
bool can_continue = true; //unless the middle buffers are needed
- bool debug_giprobes = get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_GI_PROBE_ALBEDO || get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING || get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION;
+ bool debug_giprobes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_ALBEDO || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION;
bool using_separate_specular = false;
bool depth_pre_pass = depth_framebuffer.is_valid();
@@ -1896,7 +1896,7 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
CameraMatrix cm = (dc * p_cam_projection) * CameraMatrix(p_cam_transform.affine_inverse());
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(opaque_framebuffer, RD::INITIAL_ACTION_CONTINUE, will_continue ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_CONTINUE, will_continue ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ);
for (int i = 0; i < p_gi_probe_cull_count; i++) {
- _debug_giprobe(p_gi_probe_cull_result[i], draw_list, opaque_framebuffer, cm, get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING, get_debug_draw_mode() == VS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION, 1.0);
+ _debug_giprobe(p_gi_probe_cull_result[i], draw_list, opaque_framebuffer, cm, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION, 1.0);
}
RD::get_singleton()->draw_list_end();
}
@@ -2105,18 +2105,18 @@ void RasterizerSceneHighEndRD::_update_render_base_uniform_set() {
u.binding = 1;
u.ids.resize(12);
RID *ids_ptr = u.ids.ptrw();
- ids_ptr[0] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[1] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[2] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[3] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[4] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[5] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[6] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[7] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[8] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[9] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[10] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[11] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[0] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[1] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[2] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[3] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[4] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[5] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[6] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[7] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[8] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[9] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[10] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[11] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
uniforms.push_back(u);
}
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h
index 960b95ee86..4c3422cedb 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h
@@ -31,11 +31,11 @@
#ifndef RASTERIZER_SCENE_HIGHEND_RD_H
#define RASTERIZER_SCENE_HIGHEND_RD_H
-#include "servers/visual/rasterizer_rd/light_cluster_builder.h"
-#include "servers/visual/rasterizer_rd/rasterizer_scene_rd.h"
-#include "servers/visual/rasterizer_rd/rasterizer_storage_rd.h"
-#include "servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
-#include "servers/visual/rasterizer_rd/shaders/scene_high_end.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/light_cluster_builder.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_scene_rd.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
+#include "servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h"
+#include "servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl.gen.h"
class RasterizerSceneHighEndRD : public RasterizerSceneRD {
@@ -111,7 +111,7 @@ class RasterizerSceneHighEndRD : public RasterizerSceneRD {
bool valid;
RID version;
uint32_t vertex_input_mask;
- RenderPipelineVertexFormatCacheRD pipelines[CULL_VARIANT_MAX][VS::PRIMITIVE_MAX][SHADER_VERSION_MAX];
+ RenderPipelineVertexFormatCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][SHADER_VERSION_MAX];
String path;
@@ -211,7 +211,7 @@ class RasterizerSceneHighEndRD : public RasterizerSceneRD {
void ensure_specular();
void clear();
- virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, VS::ViewportMSAA p_msaa);
+ virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa);
RID uniform_set;
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index 395b73ca9b..842f7046c9 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -32,7 +32,7 @@
#include "core/os/os.h"
#include "core/project_settings.h"
-#include "servers/visual/visual_server_raster.h"
+#include "servers/rendering/rendering_server_raster.h"
uint64_t RasterizerSceneRD::auto_exposure_counter = 2;
@@ -212,7 +212,7 @@ void RasterizerSceneRD::sky_set_radiance_size(RID p_sky, int p_radiance_size) {
}
sky->radiance_size = p_radiance_size;
- if (sky->mode == VS::SKY_MODE_REALTIME && sky->radiance_size != 256) {
+ if (sky->mode == RS::SKY_MODE_REALTIME && sky->radiance_size != 256) {
WARN_PRINT("Realtime Skies can only use a radiance size of 256. Radiance size will be set to 256 internally.");
sky->radiance_size = 256;
}
@@ -225,7 +225,7 @@ void RasterizerSceneRD::sky_set_radiance_size(RID p_sky, int p_radiance_size) {
_clear_reflection_data(sky->reflection);
}
-void RasterizerSceneRD::sky_set_mode(RID p_sky, VS::SkyMode p_mode) {
+void RasterizerSceneRD::sky_set_mode(RID p_sky, RS::SkyMode p_mode) {
Sky *sky = sky_owner.getornull(p_sky);
ERR_FAIL_COND(!sky);
@@ -235,7 +235,7 @@ void RasterizerSceneRD::sky_set_mode(RID p_sky, VS::SkyMode p_mode) {
sky->mode = p_mode;
- if (sky->mode == VS::SKY_MODE_REALTIME && sky->radiance_size != 256) {
+ if (sky->mode == RS::SKY_MODE_REALTIME && sky->radiance_size != 256) {
WARN_PRINT("Realtime Skies can only use a radiance size of 256. Radiance size will be set to 256 internally.");
sky_set_radiance_size(p_sky, 256);
}
@@ -267,7 +267,7 @@ void RasterizerSceneRD::_update_dirty_skys() {
uint32_t w = sky->radiance_size, h = sky->radiance_size;
int layers = roughness_layers;
- if (sky->mode == VS::SKY_MODE_REALTIME) {
+ if (sky->mode == RS::SKY_MODE_REALTIME) {
layers = 8;
if (roughness_layers != 8) {
WARN_PRINT("When using REALTIME skies, roughness_layers should be set to 8 in the project settings for best quality reflections");
@@ -287,7 +287,7 @@ void RasterizerSceneRD::_update_dirty_skys() {
sky->radiance = RD::get_singleton()->texture_create(tf, RD::TextureView());
- _update_reflection_data(sky->reflection, sky->radiance_size, mipmaps, true, sky->radiance, 0, sky->mode == VS::SKY_MODE_REALTIME);
+ _update_reflection_data(sky->reflection, sky->radiance_size, mipmaps, true, sky->radiance, 0, sky->mode == RS::SKY_MODE_REALTIME);
} else {
//regular cubemap, lower quality (aliasing, less memory)
@@ -302,7 +302,7 @@ void RasterizerSceneRD::_update_dirty_skys() {
sky->radiance = RD::get_singleton()->texture_create(tf, RD::TextureView());
- _update_reflection_data(sky->reflection, sky->radiance_size, MIN(mipmaps, layers), false, sky->radiance, 0, sky->mode == VS::SKY_MODE_REALTIME);
+ _update_reflection_data(sky->reflection, sky->radiance_size, MIN(mipmaps, layers), false, sky->radiance, 0, sky->mode == RS::SKY_MODE_REALTIME);
}
texture_set_dirty = true;
}
@@ -604,7 +604,7 @@ void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position,
sky->prev_time = time;
sky->reflection.dirty = true;
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
if (material != sky->prev_material) {
@@ -785,7 +785,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
RD::get_singleton()->draw_list_end();
}
if (sky_use_cubemap_array) {
- if (sky->mode == VS::SKY_MODE_QUALITY) {
+ if (sky->mode == RS::SKY_MODE_QUALITY) {
for (int i = 1; i < sky->reflection.layers.size(); i++) {
_create_reflection_importance_sample(sky->reflection, sky_use_cubemap_array, 10, i);
}
@@ -795,7 +795,7 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
_update_reflection_mipmaps(sky->reflection);
} else {
- if (sky->mode == VS::SKY_MODE_QUALITY) {
+ if (sky->mode == RS::SKY_MODE_QUALITY) {
for (int i = 1; i < sky->reflection.layers[0].mipmaps.size(); i++) {
_create_reflection_importance_sample(sky->reflection, sky_use_cubemap_array, 10, i);
}
@@ -857,7 +857,7 @@ void RasterizerSceneRD::SkyShaderData::set_code(const String &p_code) {
RasterizerSceneRD *scene_singleton = (RasterizerSceneRD *)RasterizerSceneRD::singleton;
- Error err = scene_singleton->sky_shader.compiler.compile(VS::SHADER_SKY, code, &actions, path, gen_code);
+ Error err = scene_singleton->sky_shader.compiler.compile(RS::SHADER_SKY, code, &actions, path, gen_code);
ERR_FAIL_COND(err != OK);
@@ -1082,7 +1082,7 @@ RID RasterizerSceneRD::environment_create() {
return environment_owner.make_rid(Environent());
}
-void RasterizerSceneRD::environment_set_background(RID p_env, VS::EnvironmentBG p_bg) {
+void RasterizerSceneRD::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
env->background = p_bg;
@@ -1117,7 +1117,7 @@ void RasterizerSceneRD::environment_set_canvas_max_layer(RID p_env, int p_max_la
ERR_FAIL_COND(!env);
env->canvas_max_layer = p_max_layer;
}
-void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_color, VS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, VS::EnvironmentReflectionSource p_reflection_source, const Color &p_ao_color) {
+void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source, const Color &p_ao_color) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
env->ambient_light = p_color;
@@ -1128,9 +1128,9 @@ void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_
env->ao_color = p_ao_color;
}
-VS::EnvironmentBG RasterizerSceneRD::environment_get_background(RID p_env) const {
+RS::EnvironmentBG RasterizerSceneRD::environment_get_background(RID p_env) const {
Environent *env = environment_owner.getornull(p_env);
- ERR_FAIL_COND_V(!env, VS::ENV_BG_MAX);
+ ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX);
return env->background;
}
RID RasterizerSceneRD::environment_get_sky(RID p_env) const {
@@ -1168,9 +1168,9 @@ Color RasterizerSceneRD::environment_get_ambient_light_color(RID p_env) const {
ERR_FAIL_COND_V(!env, Color());
return env->ambient_light;
}
-VS::EnvironmentAmbientSource RasterizerSceneRD::environment_get_ambient_light_ambient_source(RID p_env) const {
+RS::EnvironmentAmbientSource RasterizerSceneRD::environment_get_ambient_light_ambient_source(RID p_env) const {
Environent *env = environment_owner.getornull(p_env);
- ERR_FAIL_COND_V(!env, VS::ENV_AMBIENT_SOURCE_BG);
+ ERR_FAIL_COND_V(!env, RS::ENV_AMBIENT_SOURCE_BG);
return env->ambient_source;
}
float RasterizerSceneRD::environment_get_ambient_light_ambient_energy(RID p_env) const {
@@ -1183,9 +1183,9 @@ float RasterizerSceneRD::environment_get_ambient_sky_contribution(RID p_env) con
ERR_FAIL_COND_V(!env, 0);
return env->ambient_sky_contribution;
}
-VS::EnvironmentReflectionSource RasterizerSceneRD::environment_get_reflection_source(RID p_env) const {
+RS::EnvironmentReflectionSource RasterizerSceneRD::environment_get_reflection_source(RID p_env) const {
Environent *env = environment_owner.getornull(p_env);
- ERR_FAIL_COND_V(!env, VS::ENV_REFLECTION_SOURCE_DISABLED);
+ ERR_FAIL_COND_V(!env, RS::ENV_REFLECTION_SOURCE_DISABLED);
return env->reflection_source;
}
@@ -1195,7 +1195,7 @@ Color RasterizerSceneRD::environment_get_ao_color(RID p_env) const {
return env->ao_color;
}
-void RasterizerSceneRD::environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
+void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
env->exposure = p_exposure;
@@ -1211,7 +1211,7 @@ void RasterizerSceneRD::environment_set_tonemap(RID p_env, VS::EnvironmentToneMa
env->auto_exp_scale = p_auto_exp_scale;
}
-void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
+void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -1228,7 +1228,7 @@ void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_lev
env->glow_bicubic_upscale = p_bicubic_upscale;
}
-void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
+void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -1242,7 +1242,7 @@ void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_r
env->ssao_blur = p_blur;
}
-void RasterizerSceneRD::environment_set_ssao_quality(VS::EnvironmentSSAOQuality p_quality, bool p_half_size) {
+void RasterizerSceneRD::environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size) {
ssao_quality = p_quality;
ssao_half_size = p_half_size;
}
@@ -1363,7 +1363,7 @@ bool RasterizerSceneRD::reflection_probe_instance_needs_redraw(RID p_instance) {
return true;
}
- if (storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS) {
+ if (storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS) {
return true;
}
@@ -1387,12 +1387,12 @@ bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, R
ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(p_instance);
ERR_FAIL_COND_V(!rpi, false);
- if (storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS && atlas->reflection.is_valid() && atlas->size != 256) {
+ if (storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS && atlas->reflection.is_valid() && atlas->size != 256) {
WARN_PRINT("ReflectionProbes set to UPDATE_ALWAYS must have an atlas size of 256. Please update the atlas size in the ProjectSettings.");
reflection_atlas_set_size(p_reflection_atlas, 256, atlas->count);
}
- if (storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS && atlas->reflection.is_valid() && atlas->reflections[0].data.layers[0].mipmaps.size() != 8) {
+ if (storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS && atlas->reflection.is_valid() && atlas->reflections[0].data.layers[0].mipmaps.size() != 8) {
// Invalidate reflection atlas, need to regenerate
RD::get_singleton()->free(atlas->reflection);
atlas->reflection = RID();
@@ -1409,7 +1409,7 @@ bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, R
if (atlas->reflection.is_null()) {
int mipmaps = MIN(roughness_layers, Image::get_image_required_mipmaps(atlas->size, atlas->size, Image::FORMAT_RGBAH) + 1);
- mipmaps = storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS ? 8 : mipmaps; // always use 8 mipmaps with real time filtering
+ mipmaps = storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS ? 8 : mipmaps; // always use 8 mipmaps with real time filtering
{
//reflection atlas was unused, create:
RD::TextureFormat tf;
@@ -1434,7 +1434,7 @@ bool RasterizerSceneRD::reflection_probe_instance_begin_render(RID p_instance, R
}
atlas->reflections.resize(atlas->count);
for (int i = 0; i < atlas->count; i++) {
- _update_reflection_data(atlas->reflections.write[i].data, atlas->size, mipmaps, false, atlas->reflection, i * 6, storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS);
+ _update_reflection_data(atlas->reflections.write[i].data, atlas->size, mipmaps, false, atlas->reflection, i * 6, storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS);
for (int j = 0; j < 6; j++) {
Vector<RID> fb;
fb.push_back(atlas->reflections.write[i].data.layers[0].mipmaps[0].views[j]);
@@ -1493,7 +1493,7 @@ bool RasterizerSceneRD::reflection_probe_instance_postprocess_step(RID p_instanc
return false;
}
- if (storage->reflection_probe_get_update_mode(rpi->probe) == VS::REFLECTION_PROBE_UPDATE_ALWAYS) {
+ if (storage->reflection_probe_get_update_mode(rpi->probe) == RS::REFLECTION_PROBE_UPDATE_ALWAYS) {
// Using real time reflections, all roughness is done in one step
_create_reflection_fast_filter(atlas->reflections.write[rpi->atlas_index].data, false);
rpi->rendering = false;
@@ -1937,10 +1937,10 @@ int RasterizerSceneRD::get_directional_light_shadow_size(RID p_light_intance) {
ERR_FAIL_COND_V(!light_instance, 0);
switch (storage->light_directional_get_shadow_mode(light_instance->light)) {
- case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
+ case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL:
break; //none
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: r.size.height /= 2; break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: r.size /= 2; break;
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: r.size.height /= 2; break;
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: r.size /= 2; break;
}
return MAX(r.size.width, r.size.height);
@@ -1953,13 +1953,13 @@ RID RasterizerSceneRD::camera_effects_create() {
return camera_effects_owner.make_rid(CameraEffects());
}
-void RasterizerSceneRD::camera_effects_set_dof_blur_quality(VS::DOFBlurQuality p_quality, bool p_use_jitter) {
+void RasterizerSceneRD::camera_effects_set_dof_blur_quality(RS::DOFBlurQuality p_quality, bool p_use_jitter) {
dof_blur_quality = p_quality;
dof_blur_use_jitter = p_use_jitter;
}
-void RasterizerSceneRD::camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape p_shape) {
+void RasterizerSceneRD::camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape p_shape) {
dof_blur_bokeh_shape = p_shape;
}
@@ -2014,7 +2014,7 @@ void RasterizerSceneRD::light_instance_set_shadow_transform(RID p_light_instance
LightInstance *light_instance = light_instance_owner.getornull(p_light_instance);
ERR_FAIL_COND(!light_instance);
- if (storage->light_get_type(light_instance->light) != VS::LIGHT_DIRECTIONAL) {
+ if (storage->light_get_type(light_instance->light) != RS::LIGHT_DIRECTIONAL) {
p_pass = 0;
}
@@ -2257,7 +2257,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_SAMPLER;
u.binding = 10;
- u.ids.push_back(storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
+ u.ids.push_back(storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
uniforms.push_back(u);
}
@@ -2446,7 +2446,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_SAMPLER;
u.binding = 10;
- u.ids.push_back(storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
+ u.ids.push_back(storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
uniforms.push_back(u);
}
{
@@ -2516,7 +2516,7 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_SAMPLER;
u.binding = 10;
- u.ids.push_back(storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
+ u.ids.push_back(storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
uniforms.push_back(u);
}
@@ -2589,16 +2589,16 @@ void RasterizerSceneRD::gi_probe_update(RID p_probe, bool p_update_light_instanc
RID light = light_instance_get_base_light(light_instance);
l.type = storage->light_get_type(light);
- l.attenuation = storage->light_get_param(light, VS::LIGHT_PARAM_ATTENUATION);
- l.energy = storage->light_get_param(light, VS::LIGHT_PARAM_ENERGY) * storage->light_get_param(light, VS::LIGHT_PARAM_INDIRECT_ENERGY);
- l.radius = to_cell.basis.xform(Vector3(storage->light_get_param(light, VS::LIGHT_PARAM_RANGE), 0, 0)).length();
+ l.attenuation = storage->light_get_param(light, RS::LIGHT_PARAM_ATTENUATION);
+ l.energy = storage->light_get_param(light, RS::LIGHT_PARAM_ENERGY) * storage->light_get_param(light, RS::LIGHT_PARAM_INDIRECT_ENERGY);
+ l.radius = to_cell.basis.xform(Vector3(storage->light_get_param(light, RS::LIGHT_PARAM_RANGE), 0, 0)).length();
Color color = storage->light_get_color(light).to_linear();
l.color[0] = color.r;
l.color[1] = color.g;
l.color[2] = color.b;
- l.spot_angle_radians = Math::deg2rad(storage->light_get_param(light, VS::LIGHT_PARAM_SPOT_ANGLE));
- l.spot_attenuation = storage->light_get_param(light, VS::LIGHT_PARAM_SPOT_ATTENUATION);
+ l.spot_angle_radians = Math::deg2rad(storage->light_get_param(light, RS::LIGHT_PARAM_SPOT_ANGLE));
+ l.spot_attenuation = storage->light_get_param(light, RS::LIGHT_PARAM_SPOT_ATTENUATION);
Transform xform = light_instance_get_base_transform(light_instance);
@@ -2975,7 +2975,7 @@ void RasterizerSceneRD::_debug_giprobe(RID p_gi_probe, RD::DrawListID p_draw_lis
RD::Uniform u;
u.type = RD::UNIFORM_TYPE_SAMPLER;
u.binding = 3;
- u.ids.push_back(storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
+ u.ids.push_back(storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED));
uniforms.push_back(u);
}
@@ -3271,7 +3271,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
//swap final reduce with prev luminance
SWAP(rb->luminance.current, rb->luminance.reduce.write[rb->luminance.reduce.size() - 1]);
- VisualServerRaster::redraw_request(); //redraw all the time if auto exposure rendering is on
+ RenderingServerRaster::redraw_request(); //redraw all the time if auto exposure rendering is on
}
int max_glow_level = -1;
@@ -3286,7 +3286,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
_render_buffers_uniform_set_changed(p_render_buffers);
}
- for (int i = 0; i < VS::MAX_GLOW_LEVELS; i++) {
+ for (int i = 0; i < RS::MAX_GLOW_LEVELS; i++) {
if (env->glow_levels & (1 << i)) {
if (i >= rb->blur[1].mipmaps.size()) {
@@ -3335,7 +3335,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
if (can_use_effects && env && env->glow_enabled) {
tonemap.use_glow = true;
tonemap.glow_mode = RasterizerEffectsRD::TonemapSettings::GlowMode(env->glow_blend_mode);
- tonemap.glow_intensity = env->glow_blend_mode == VS::ENV_GLOW_BLEND_MODE_MIX ? env->glow_mix : env->glow_intensity;
+ tonemap.glow_intensity = env->glow_blend_mode == RS::ENV_GLOW_BLEND_MODE_MIX ? env->glow_mix : env->glow_intensity;
tonemap.glow_level_flags = glow_mask;
tonemap.glow_texture_size.x = rb->blur[1].mipmaps[0].width;
tonemap.glow_texture_size.y = rb->blur[1].mipmaps[0].height;
@@ -3363,7 +3363,7 @@ void RasterizerSceneRD::_render_buffers_debug_draw(RID p_render_buffers, RID p_s
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
ERR_FAIL_COND(!rb);
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS) {
if (p_shadow_atlas.is_valid()) {
RID shadow_atlas_texture = shadow_atlas_get_texture(p_shadow_atlas);
Size2 rtsize = storage->render_target_get_size(rb->render_target);
@@ -3372,7 +3372,7 @@ void RasterizerSceneRD::_render_buffers_debug_draw(RID p_render_buffers, RID p_s
}
}
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS) {
if (directional_shadow_get_texture().is_valid()) {
RID shadow_atlas_texture = directional_shadow_get_texture();
Size2 rtsize = storage->render_target_get_size(rb->render_target);
@@ -3381,7 +3381,7 @@ void RasterizerSceneRD::_render_buffers_debug_draw(RID p_render_buffers, RID p_s
}
}
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE) {
if (rb->luminance.current.is_valid()) {
Size2 rtsize = storage->render_target_get_size(rb->render_target);
@@ -3389,18 +3389,18 @@ void RasterizerSceneRD::_render_buffers_debug_draw(RID p_render_buffers, RID p_s
}
}
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_SSAO && rb->ssao.ao[0].is_valid()) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_SSAO && rb->ssao.ao[0].is_valid()) {
Size2 rtsize = storage->render_target_get_size(rb->render_target);
RID ao_buf = rb->ssao.ao_full.is_valid() ? rb->ssao.ao_full : rb->ssao.ao[0];
effects->copy_to_rect(ao_buf, storage->render_target_get_rd_framebuffer(rb->render_target), Rect2(Vector2(), rtsize), false, true);
}
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_ROUGHNESS_LIMITER && _render_buffers_get_roughness_texture(p_render_buffers).is_valid()) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_ROUGHNESS_LIMITER && _render_buffers_get_roughness_texture(p_render_buffers).is_valid()) {
Size2 rtsize = storage->render_target_get_size(rb->render_target);
effects->copy_to_rect(_render_buffers_get_roughness_texture(p_render_buffers), storage->render_target_get_rd_framebuffer(rb->render_target), Rect2(Vector2(), rtsize), false, true);
}
- if (debug_draw == VS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER && _render_buffers_get_normal_texture(p_render_buffers).is_valid()) {
+ if (debug_draw == RS::VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER && _render_buffers_get_normal_texture(p_render_buffers).is_valid()) {
Size2 rtsize = storage->render_target_get_size(rb->render_target);
effects->copy_to_rect(_render_buffers_get_normal_texture(p_render_buffers), storage->render_target_get_rd_framebuffer(rb->render_target), Rect2(Vector2(), rtsize));
}
@@ -3423,7 +3423,7 @@ RID RasterizerSceneRD::render_buffers_get_ao_texture(RID p_render_buffers) {
return rb->ssao.ao_full.is_valid() ? rb->ssao.ao_full : rb->ssao.ao[0];
}
-void RasterizerSceneRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, VS::ViewportMSAA p_msaa) {
+void RasterizerSceneRD::render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa) {
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
rb->width = p_width;
@@ -3513,7 +3513,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
CameraMatrix light_projection;
Transform light_transform;
- if (storage->light_get_type(light_instance->light) == VS::LIGHT_DIRECTIONAL) {
+ if (storage->light_get_type(light_instance->light) == RS::LIGHT_DIRECTIONAL) {
//set pssm stuff
if (light_instance->last_scene_shadow_pass != scene_pass) {
light_instance->directional_rect = _get_directional_shadow_rect(directional_shadow.size, directional_shadow.light_count, directional_shadow.current_light);
@@ -3529,7 +3529,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
atlas_rect.size.width = light_instance->directional_rect.size.x;
atlas_rect.size.height = light_instance->directional_rect.size.y;
- if (storage->light_directional_get_shadow_mode(light_instance->light) == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
+ if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
atlas_rect.size.width /= 2;
atlas_rect.size.height /= 2;
@@ -3543,7 +3543,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
atlas_rect.position.y += atlas_rect.size.height;
}
- } else if (storage->light_directional_get_shadow_mode(light_instance->light) == VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
+ } else if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
atlas_rect.size.height /= 2;
@@ -3559,10 +3559,10 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
light_instance->shadow_transform[p_pass].atlas_rect.position /= directional_shadow.size;
light_instance->shadow_transform[p_pass].atlas_rect.size /= directional_shadow.size;
- float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE));
- zfar = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_RANGE);
- bias = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_SHADOW_BIAS) * bias_mult;
- normal_bias = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS) * bias_mult;
+ float bias_mult = Math::lerp(1.0f, light_instance->shadow_transform[p_pass].bias_scale, storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE));
+ zfar = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_RANGE);
+ bias = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_BIAS) * bias_mult;
+ normal_bias = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS) * bias_mult;
ShadowMap *shadow_map = _get_shadow_map(atlas_rect.size);
render_fb = shadow_map->fb;
@@ -3596,13 +3596,13 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
atlas_rect.size.height = shadow_size;
atlas_fb = shadow_atlas->fb;
- zfar = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_RANGE);
- bias = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_SHADOW_BIAS);
- normal_bias = storage->light_get_param(light_instance->light, VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS);
+ zfar = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_RANGE);
+ bias = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_BIAS);
+ normal_bias = storage->light_get_param(light_instance->light, RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS);
- if (storage->light_get_type(light_instance->light) == VS::LIGHT_OMNI) {
+ if (storage->light_get_type(light_instance->light) == RS::LIGHT_OMNI) {
- if (storage->light_omni_get_shadow_mode(light_instance->light) == VS::LIGHT_OMNI_SHADOW_CUBE) {
+ if (storage->light_omni_get_shadow_mode(light_instance->light) == RS::LIGHT_OMNI_SHADOW_CUBE) {
ShadowCubemap *cubemap = _get_shadow_cubemap(shadow_size / 2);
@@ -3630,7 +3630,7 @@ void RasterizerSceneRD::render_shadow(RID p_light, RID p_shadow_atlas, int p_pas
render_texture = shadow_map->depth;
}
- } else if (storage->light_get_type(light_instance->light) == VS::LIGHT_SPOT) {
+ } else if (storage->light_get_type(light_instance->light) == RS::LIGHT_SPOT) {
light_projection = light_instance->shadow_transform[0].camera;
light_transform = light_instance->shadow_transform[0].transform;
@@ -3769,7 +3769,7 @@ bool RasterizerSceneRD::free(RID p_rid) {
return true;
}
-void RasterizerSceneRD::set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) {
+void RasterizerSceneRD::set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw) {
debug_draw = p_debug_draw;
}
@@ -3985,27 +3985,27 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
u.binding = 0;
u.ids.resize(12);
RID *ids_ptr = u.ids.ptrw();
- ids_ptr[0] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[1] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[2] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[3] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[4] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[5] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- ids_ptr[6] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[7] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[8] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[9] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[10] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
- ids_ptr[11] = storage->sampler_rd_get_default(VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[0] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[1] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[2] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[3] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[4] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[5] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ ids_ptr[6] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[7] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[8] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[9] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[10] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
+ ids_ptr[11] = storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED);
uniforms.push_back(u);
}
sky_scene_state.sampler_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, sky_shader.default_shader_rd, SKY_SET_SAMPLERS);
}
- camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_shape"))));
- camera_effects_set_dof_blur_quality(VS::DOFBlurQuality(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_quality"))), GLOBAL_GET("rendering/quality/filters/depth_of_field_use_jitter"));
- environment_set_ssao_quality(VS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
+ camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_shape"))));
+ camera_effects_set_dof_blur_quality(RS::DOFBlurQuality(int(GLOBAL_GET("rendering/quality/filters/depth_of_field_bokeh_quality"))), GLOBAL_GET("rendering/quality/filters/depth_of_field_use_jitter"));
+ environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
screen_space_roughness_limiter = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter");
screen_space_roughness_limiter_curve = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve");
}
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
index 7332f93dc5..0a1cc8ebd7 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
@@ -32,12 +32,12 @@
#define RASTERIZER_SCENE_RD_H
#include "core/rid_owner.h"
-#include "servers/visual/rasterizer.h"
-#include "servers/visual/rasterizer_rd/rasterizer_storage_rd.h"
-#include "servers/visual/rasterizer_rd/shaders/giprobe.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/giprobe_debug.glsl.gen.h"
-#include "servers/visual/rasterizer_rd/shaders/sky.glsl.gen.h"
-#include "servers/visual/rendering_device.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_storage_rd.h"
+#include "servers/rendering/rasterizer_rd/shaders/giprobe.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl.gen.h"
+#include "servers/rendering/rasterizer_rd/shaders/sky.glsl.gen.h"
+#include "servers/rendering/rendering_device.h"
class RasterizerSceneRD : public RasterizerScene {
public:
@@ -73,7 +73,7 @@ protected:
struct RenderBufferData {
- virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, VS::ViewportMSAA p_msaa) = 0;
+ virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) = 0;
virtual ~RenderBufferData() {}
};
virtual RenderBufferData *_create_render_buffer_data() = 0;
@@ -98,7 +98,7 @@ protected:
void _draw_sky(bool p_can_continue, RID p_fb, RID p_environment, const CameraMatrix &p_projection, const Transform &p_transform);
private:
- VS::ViewportDebugDraw debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED;
+ RS::ViewportDebugDraw debug_draw = RS::VIEWPORT_DEBUG_DRAW_DISABLED;
double time_step = 0;
static RasterizerSceneRD *singleton;
@@ -255,7 +255,7 @@ private:
int radiance_size = 256;
- VS::SkyMode mode = VS::SKY_MODE_QUALITY;
+ RS::SkyMode mode = RS::SKY_MODE_QUALITY;
ReflectionData reflection;
bool dirty = false;
@@ -571,7 +571,7 @@ private:
Rect2 atlas_rect;
};
- VS::LightType light_type;
+ RS::LightType light_type;
ShadowTransform shadow_transform[4];
@@ -608,23 +608,23 @@ private:
struct Environent {
// BG
- VS::EnvironmentBG background = VS::ENV_BG_CLEAR_COLOR;
+ RS::EnvironmentBG background = RS::ENV_BG_CLEAR_COLOR;
RID sky;
float sky_custom_fov = 0.0;
Basis sky_orientation;
Color bg_color;
float bg_energy = 1.0;
int canvas_max_layer = 0;
- VS::EnvironmentAmbientSource ambient_source = VS::ENV_AMBIENT_SOURCE_BG;
+ RS::EnvironmentAmbientSource ambient_source = RS::ENV_AMBIENT_SOURCE_BG;
Color ambient_light;
float ambient_light_energy = 1.0;
float ambient_sky_contribution = 1.0;
- VS::EnvironmentReflectionSource reflection_source = VS::ENV_REFLECTION_SOURCE_BG;
+ RS::EnvironmentReflectionSource reflection_source = RS::ENV_REFLECTION_SOURCE_BG;
Color ao_color;
/// Tonemap
- VS::EnvironmentToneMapper tone_mapper;
+ RS::EnvironmentToneMapper tone_mapper;
float exposure = 1.0;
float white = 1.0;
bool auto_exposure = false;
@@ -642,7 +642,7 @@ private:
float glow_strength = 1.0;
float glow_bloom = 0.0;
float glow_mix = 0.01;
- VS::EnvironmentGlowBlendMode glow_blend_mode = VS::ENV_GLOW_BLEND_MODE_SOFTLIGHT;
+ RS::EnvironmentGlowBlendMode glow_blend_mode = RS::ENV_GLOW_BLEND_MODE_SOFTLIGHT;
float glow_hdr_bleed_threshold = 1.0;
float glow_hdr_luminance_cap = 12.0;
float glow_hdr_bleed_scale = 2.0;
@@ -657,10 +657,10 @@ private:
float ssao_direct_light_affect = 0.0;
float ssao_ao_channel_affect = 0.0;
float ssao_blur_edge_sharpness = 4.0;
- VS::EnvironmentSSAOBlur ssao_blur = VS::ENV_SSAO_BLUR_3x3;
+ RS::EnvironmentSSAOBlur ssao_blur = RS::ENV_SSAO_BLUR_3x3;
};
- VS::EnvironmentSSAOQuality ssao_quality = VS::ENV_SSAO_QUALITY_MEDIUM;
+ RS::EnvironmentSSAOQuality ssao_quality = RS::ENV_SSAO_QUALITY_MEDIUM;
bool ssao_half_size = false;
static uint64_t auto_exposure_counter;
@@ -685,8 +685,8 @@ private:
float override_exposure = 1;
};
- VS::DOFBlurQuality dof_blur_quality = VS::DOF_BLUR_QUALITY_MEDIUM;
- VS::DOFBokehShape dof_blur_bokeh_shape = VS::DOF_BOKEH_HEXAGON;
+ RS::DOFBlurQuality dof_blur_quality = RS::DOF_BLUR_QUALITY_MEDIUM;
+ RS::DOFBokehShape dof_blur_bokeh_shape = RS::DOF_BOKEH_HEXAGON;
bool dof_blur_use_jitter = false;
mutable RID_Owner<CameraEffects> camera_effects_owner;
@@ -697,7 +697,7 @@ private:
RenderBufferData *data = nullptr;
int width = 0, height = 0;
- VS::ViewportMSAA msaa = VS::VIEWPORT_MSAA_DISABLED;
+ RS::ViewportMSAA msaa = RS::VIEWPORT_MSAA_DISABLED;
RID render_target;
uint64_t auto_exposure_version = 1;
@@ -791,7 +791,7 @@ public:
RID sky_create();
void sky_set_radiance_size(RID p_sky, int p_radiance_size);
- void sky_set_mode(RID p_sky, VS::SkyMode p_mode);
+ void sky_set_mode(RID p_sky, RS::SkyMode p_mode);
void sky_set_material(RID p_sky, RID p_material);
RID sky_get_radiance_texture_rd(RID p_sky) const;
@@ -802,16 +802,16 @@ public:
RID environment_create();
- void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
+ void environment_set_background(RID p_env, RS::EnvironmentBG p_bg);
void environment_set_sky(RID p_env, RID p_sky);
void environment_set_sky_custom_fov(RID p_env, float p_scale);
void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
void environment_set_bg_color(RID p_env, const Color &p_color);
void environment_set_bg_energy(RID p_env, float p_energy);
void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
- void environment_set_ambient_light(RID p_env, const Color &p_color, VS::EnvironmentAmbientSource p_ambient = VS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, VS::EnvironmentReflectionSource p_reflection_source = VS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color());
+ void environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient = RS::ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, RS::EnvironmentReflectionSource p_reflection_source = RS::ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color());
- VS::EnvironmentBG environment_get_background(RID p_env) const;
+ RS::EnvironmentBG environment_get_background(RID p_env) const;
RID environment_get_sky(RID p_env) const;
float environment_get_sky_custom_fov(RID p_env) const;
Basis environment_get_sky_orientation(RID p_env) const;
@@ -819,27 +819,27 @@ public:
float environment_get_bg_energy(RID p_env) const;
int environment_get_canvas_max_layer(RID p_env) const;
Color environment_get_ambient_light_color(RID p_env) const;
- VS::EnvironmentAmbientSource environment_get_ambient_light_ambient_source(RID p_env) const;
+ RS::EnvironmentAmbientSource environment_get_ambient_light_ambient_source(RID p_env) const;
float environment_get_ambient_light_ambient_energy(RID p_env) const;
float environment_get_ambient_sky_contribution(RID p_env) const;
- VS::EnvironmentReflectionSource environment_get_reflection_source(RID p_env) const;
+ RS::EnvironmentReflectionSource environment_get_reflection_source(RID p_env) const;
Color environment_get_ao_color(RID p_env) const;
bool is_environment(RID p_env) const;
- void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
+ void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance, bool p_roughness) {}
- void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, VS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
- void environment_set_ssao_quality(VS::EnvironmentSSAOQuality p_quality, bool p_half_size);
+ void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness);
+ void environment_set_ssao_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size);
bool environment_is_ssao_enabled(RID p_env) const;
float environment_get_ssao_ao_affect(RID p_env) const;
float environment_get_ssao_light_affect(RID p_env) const;
bool environment_is_ssr_enabled(RID p_env) const;
- void environment_set_tonemap(RID p_env, VS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
+ void environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale);
void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) {}
void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) {}
@@ -848,8 +848,8 @@ public:
virtual RID camera_effects_create();
- virtual void camera_effects_set_dof_blur_quality(VS::DOFBlurQuality p_quality, bool p_use_jitter);
- virtual void camera_effects_set_dof_blur_bokeh_shape(VS::DOFBokehShape p_shape);
+ virtual void camera_effects_set_dof_blur_quality(RS::DOFBlurQuality p_quality, bool p_use_jitter);
+ virtual void camera_effects_set_dof_blur_bokeh_shape(RS::DOFBokehShape p_shape);
virtual void camera_effects_set_dof_blur(RID p_camera_effects, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount);
virtual void camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure);
@@ -940,7 +940,7 @@ public:
return li->light_index;
}
- _FORCE_INLINE_ VS::LightType light_instance_get_type(RID p_light_instance) {
+ _FORCE_INLINE_ RS::LightType light_instance_get_type(RID p_light_instance) {
LightInstance *li = light_instance_owner.getornull(p_light_instance);
return li->light_type;
}
@@ -1072,7 +1072,7 @@ public:
GIProbeQuality gi_probe_get_quality() const;
RID render_buffers_create();
- void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, VS::ViewportMSAA p_msaa);
+ void render_buffers_configure(RID p_render_buffers, RID p_render_target, int p_width, int p_height, RS::ViewportMSAA p_msaa);
RID render_buffers_get_ao_texture(RID p_render_buffers);
RID render_buffers_get_back_buffer_texture(RID p_render_buffers);
@@ -1097,8 +1097,8 @@ public:
virtual void update();
- virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw);
- _FORCE_INLINE_ VS::ViewportDebugDraw get_debug_draw_mode() const { return debug_draw; }
+ virtual void set_debug_draw_mode(RS::ViewportDebugDraw p_debug_draw);
+ _FORCE_INLINE_ RS::ViewportDebugDraw get_debug_draw_mode() const { return debug_draw; }
virtual void set_time(double p_time, double p_step);
diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 6e7f0aac07..83af15602c 100644
--- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -31,7 +31,7 @@
#include "rasterizer_storage_rd.h"
#include "core/engine.h"
#include "core/project_settings.h"
-#include "servers/visual/shader_language.h"
+#include "servers/rendering/shader_language.h"
Ref<Image> RasterizerStorageRD::_validate_texture_format(const Ref<Image> &p_image, TextureToRDFormat &r_format) {
@@ -608,7 +608,7 @@ RID RasterizerStorageRD::texture_2d_create(const Ref<Image> &p_image) {
return texture_owner.make_rid(texture);
}
-RID RasterizerStorageRD::texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, VS::TextureLayeredType p_layered_type) {
+RID RasterizerStorageRD::texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) {
return RID();
}
@@ -826,25 +826,25 @@ String RasterizerStorageRD::texture_get_path(RID p_texture) const {
return String();
}
-void RasterizerStorageRD::texture_set_detect_3d_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {
+void RasterizerStorageRD::texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {
Texture *tex = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!tex);
tex->detect_3d_callback_ud = p_userdata;
tex->detect_3d_callback = p_callback;
}
-void RasterizerStorageRD::texture_set_detect_normal_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata) {
+void RasterizerStorageRD::texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) {
Texture *tex = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!tex);
tex->detect_normal_callback_ud = p_userdata;
tex->detect_normal_callback = p_callback;
}
-void RasterizerStorageRD::texture_set_detect_roughness_callback(RID p_texture, VS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {
+void RasterizerStorageRD::texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) {
Texture *tex = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!tex);
tex->detect_roughness_callback_ud = p_userdata;
tex->detect_roughness_callback = p_callback;
}
-void RasterizerStorageRD::texture_debug_usage(List<VS::TextureInfo> *r_info) {
+void RasterizerStorageRD::texture_debug_usage(List<RS::TextureInfo> *r_info) {
}
void RasterizerStorageRD::texture_set_proxy(RID p_proxy, RID p_base) {
@@ -1664,7 +1664,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va
RasterizerStorageRD *singleton = (RasterizerStorageRD *)RasterizerStorage::base_singleton;
#ifdef TOOLS_ENABLED
Texture *roughness_detect_texture = nullptr;
- VS::TextureDetectRoughnessChannel roughness_channel;
+ RS::TextureDetectRoughnessChannel roughness_channel;
Texture *normal_detect_texture = nullptr;
#endif
@@ -1727,7 +1727,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va
if (tex->detect_roughness_callback && (p_texture_uniforms[i].hint >= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R || p_texture_uniforms[i].hint <= ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_GRAY)) {
//find the normal texture
roughness_detect_texture = tex;
- roughness_channel = VS::TextureDetectRoughnessChannel(p_texture_uniforms[i].hint - ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R);
+ roughness_channel = RS::TextureDetectRoughnessChannel(p_texture_uniforms[i].hint - ShaderLanguage::ShaderNode::Uniform::HINT_ROUGHNESS_R);
}
#endif
@@ -1782,7 +1782,7 @@ RID RasterizerStorageRD::mesh_create() {
}
/// Returns stride
-void RasterizerStorageRD::mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_surface) {
+void RasterizerStorageRD::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
@@ -1797,67 +1797,67 @@ void RasterizerStorageRD::mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_
uint32_t stride = 0;
- for (int i = 0; i < VS::ARRAY_WEIGHTS; i++) {
+ for (int i = 0; i < RS::ARRAY_WEIGHTS; i++) {
if ((p_surface.format & (1 << i))) {
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
- if (p_surface.format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (p_surface.format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
stride += sizeof(float) * 2;
} else {
stride += sizeof(float) * 3;
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
- if (p_surface.format & VS::ARRAY_COMPRESS_NORMAL) {
+ if (p_surface.format & RS::ARRAY_COMPRESS_NORMAL) {
stride += sizeof(int8_t) * 4;
} else {
stride += sizeof(float) * 4;
}
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
- if (p_surface.format & VS::ARRAY_COMPRESS_TANGENT) {
+ if (p_surface.format & RS::ARRAY_COMPRESS_TANGENT) {
stride += sizeof(int8_t) * 4;
} else {
stride += sizeof(float) * 4;
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
- if (p_surface.format & VS::ARRAY_COMPRESS_COLOR) {
+ if (p_surface.format & RS::ARRAY_COMPRESS_COLOR) {
stride += sizeof(int8_t) * 4;
} else {
stride += sizeof(float) * 4;
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
- if (p_surface.format & VS::ARRAY_COMPRESS_TEX_UV) {
+ if (p_surface.format & RS::ARRAY_COMPRESS_TEX_UV) {
stride += sizeof(int16_t) * 2;
} else {
stride += sizeof(float) * 2;
}
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
- if (p_surface.format & VS::ARRAY_COMPRESS_TEX_UV2) {
+ if (p_surface.format & RS::ARRAY_COMPRESS_TEX_UV2) {
stride += sizeof(int16_t) * 2;
} else {
stride += sizeof(float) * 2;
}
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
//assumed weights too
//unique format, internally 16 bits, exposed as single array for 32
@@ -1945,16 +1945,16 @@ int RasterizerStorageRD::mesh_get_blend_shape_count(RID p_mesh) const {
return mesh->blend_shape_count;
}
-void RasterizerStorageRD::mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) {
+void RasterizerStorageRD::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
ERR_FAIL_INDEX((int)p_mode, 2);
mesh->blend_shape_mode = p_mode;
}
-VS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) const {
+RS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) const {
Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, VS::BLEND_SHAPE_MODE_NORMALIZED);
+ ERR_FAIL_COND_V(!mesh, RS::BLEND_SHAPE_MODE_NORMALIZED);
return mesh->blend_shape_mode;
}
@@ -1986,15 +1986,15 @@ RID RasterizerStorageRD::mesh_surface_get_material(RID p_mesh, int p_surface) co
return mesh->surfaces[p_surface]->material;
}
-VS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface) const {
+RS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface) const {
Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, VS::SurfaceData());
- ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, VS::SurfaceData());
+ ERR_FAIL_COND_V(!mesh, RS::SurfaceData());
+ ERR_FAIL_UNSIGNED_INDEX_V((uint32_t)p_surface, mesh->surface_count, RS::SurfaceData());
Mesh::Surface &s = *mesh->surfaces[p_surface];
- VS::SurfaceData sd;
+ RS::SurfaceData sd;
sd.format = s.format;
sd.vertex_data = RD::get_singleton()->buffer_get_data(s.vertex_buffer);
sd.vertex_count = s.vertex_count;
@@ -2006,7 +2006,7 @@ VS::SurfaceData RasterizerStorageRD::mesh_get_surface(RID p_mesh, int p_surface)
}
sd.aabb = s.aabb;
for (uint32_t i = 0; i < s.lod_count; i++) {
- VS::SurfaceData::LOD lod;
+ RS::SurfaceData::LOD lod;
lod.edge_length = s.lods[i].edge_length;
lod.index_data = RD::get_singleton()->buffer_get_data(s.lods[i].index_buffer);
sd.lods.push_back(lod);
@@ -2058,7 +2058,7 @@ AABB RasterizerStorageRD::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
for (uint32_t i = 0; i < mesh->surface_count; i++) {
AABB laabb;
- if ((mesh->surfaces[i]->format & VS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->bone_aabbs.size()) {
+ if ((mesh->surfaces[i]->format & RS::ARRAY_FORMAT_BONES) && mesh->surfaces[i]->bone_aabbs.size()) {
int bs = mesh->surfaces[i]->bone_aabbs.size();
const AABB *skbones = mesh->surfaces[i]->bone_aabbs.ptr();
@@ -2201,7 +2201,7 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
uint32_t stride = 0;
- for (int i = 0; i < VS::ARRAY_WEIGHTS; i++) {
+ for (int i = 0; i < RS::ARRAY_WEIGHTS; i++) {
RD::VertexDescription vd;
RID buffer;
@@ -2212,33 +2212,33 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
buffer = mesh_default_rd_buffers[i];
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
vd.format = RD::DATA_FORMAT_R32G32B32_SFLOAT;
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
vd.format = RD::DATA_FORMAT_R32G32B32_SFLOAT;
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
vd.format = RD::DATA_FORMAT_R32G32B32A32_SFLOAT;
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
vd.format = RD::DATA_FORMAT_R32G32B32A32_SFLOAT;
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
//assumed weights too
vd.format = RD::DATA_FORMAT_R32G32B32A32_UINT;
@@ -2253,9 +2253,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
- if (s->format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (s->format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
vd.format = RD::DATA_FORMAT_R32G32_SFLOAT;
stride += sizeof(float) * 2;
} else {
@@ -2264,9 +2264,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
- if (s->format & VS::ARRAY_COMPRESS_NORMAL) {
+ if (s->format & RS::ARRAY_COMPRESS_NORMAL) {
vd.format = RD::DATA_FORMAT_R8G8B8A8_SNORM;
stride += sizeof(int8_t) * 4;
} else {
@@ -2275,9 +2275,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
- if (s->format & VS::ARRAY_COMPRESS_TANGENT) {
+ if (s->format & RS::ARRAY_COMPRESS_TANGENT) {
vd.format = RD::DATA_FORMAT_R8G8B8A8_SNORM;
stride += sizeof(int8_t) * 4;
} else {
@@ -2286,9 +2286,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
- if (s->format & VS::ARRAY_COMPRESS_COLOR) {
+ if (s->format & RS::ARRAY_COMPRESS_COLOR) {
vd.format = RD::DATA_FORMAT_R8G8B8A8_UNORM;
stride += sizeof(int8_t) * 4;
} else {
@@ -2297,9 +2297,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
- if (s->format & VS::ARRAY_COMPRESS_TEX_UV) {
+ if (s->format & RS::ARRAY_COMPRESS_TEX_UV) {
vd.format = RD::DATA_FORMAT_R16G16_SFLOAT;
stride += sizeof(int16_t) * 2;
} else {
@@ -2308,9 +2308,9 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
- if (s->format & VS::ARRAY_COMPRESS_TEX_UV2) {
+ if (s->format & RS::ARRAY_COMPRESS_TEX_UV2) {
vd.format = RD::DATA_FORMAT_R16G16_SFLOAT;
stride += sizeof(int16_t) * 2;
} else {
@@ -2319,7 +2319,7 @@ void RasterizerStorageRD::_mesh_surface_generate_version_for_input_mask(Mesh::Su
}
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
//assumed weights too
//unique format, internally 16 bits, exposed as single array for 32
@@ -2358,7 +2358,7 @@ RID RasterizerStorageRD::multimesh_create() {
return multimesh_owner.make_rid(MultiMesh());
}
-void RasterizerStorageRD::multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, bool p_use_colors, bool p_use_custom_data) {
+void RasterizerStorageRD::multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors, bool p_use_custom_data) {
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
@@ -2382,13 +2382,13 @@ void RasterizerStorageRD::multimesh_allocate(RID p_multimesh, int p_instances, V
multimesh->instances = p_instances;
multimesh->xform_format = p_transform_format;
multimesh->uses_colors = p_use_colors;
- multimesh->color_offset_cache = p_transform_format == VS::MULTIMESH_TRANSFORM_2D ? 8 : 12;
+ multimesh->color_offset_cache = p_transform_format == RS::MULTIMESH_TRANSFORM_2D ? 8 : 12;
multimesh->uses_custom_data = p_use_custom_data;
multimesh->custom_data_offset_cache = multimesh->color_offset_cache + (p_use_colors ? 4 : 0);
multimesh->stride_cache = multimesh->custom_data_offset_cache + (p_use_custom_data ? 4 : 0);
multimesh->buffer_set = false;
- //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == VS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances));
+ //print_line("allocate, elements: " + itos(p_instances) + " 2D: " + itos(p_transform_format == RS::MULTIMESH_TRANSFORM_2D) + " colors " + itos(multimesh->uses_colors) + " data " + itos(multimesh->uses_custom_data) + " stride " + itos(multimesh->stride_cache) + " total size " + itos(multimesh->stride_cache * multimesh->instances));
multimesh->data_cache = Vector<float>();
multimesh->aabb = AABB();
multimesh->aabb_dirty = false;
@@ -2521,7 +2521,7 @@ void RasterizerStorageRD::_multimesh_re_create_aabb(MultiMesh *multimesh, const
const float *data = p_data + multimesh->stride_cache * i;
Transform t;
- if (multimesh->xform_format == VS::MULTIMESH_TRANSFORM_3D) {
+ if (multimesh->xform_format == RS::MULTIMESH_TRANSFORM_3D) {
t.basis.elements[0][0] = data[0];
t.basis.elements[0][1] = data[1];
@@ -2562,7 +2562,7 @@ void RasterizerStorageRD::multimesh_instance_set_transform(RID p_multimesh, int
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->instances);
- ERR_FAIL_COND(multimesh->xform_format != VS::MULTIMESH_TRANSFORM_3D);
+ ERR_FAIL_COND(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_3D);
_multimesh_make_local(multimesh);
@@ -2593,7 +2593,7 @@ void RasterizerStorageRD::multimesh_instance_set_transform_2d(RID p_multimesh, i
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND(!multimesh);
ERR_FAIL_INDEX(p_index, multimesh->instances);
- ERR_FAIL_COND(multimesh->xform_format != VS::MULTIMESH_TRANSFORM_2D);
+ ERR_FAIL_COND(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_2D);
_multimesh_make_local(multimesh);
@@ -2671,7 +2671,7 @@ Transform RasterizerStorageRD::multimesh_instance_get_transform(RID p_multimesh,
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Transform());
ERR_FAIL_INDEX_V(p_index, multimesh->instances, Transform());
- ERR_FAIL_COND_V(multimesh->xform_format != VS::MULTIMESH_TRANSFORM_3D, Transform());
+ ERR_FAIL_COND_V(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_3D, Transform());
_multimesh_make_local(multimesh);
@@ -2702,7 +2702,7 @@ Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multi
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
ERR_FAIL_COND_V(!multimesh, Transform2D());
ERR_FAIL_INDEX_V(p_index, multimesh->instances, Transform2D());
- ERR_FAIL_COND_V(multimesh->xform_format != VS::MULTIMESH_TRANSFORM_2D, Transform2D());
+ ERR_FAIL_COND_V(multimesh->xform_format != RS::MULTIMESH_TRANSFORM_2D, Transform2D());
_multimesh_make_local(multimesh);
@@ -3094,24 +3094,24 @@ void RasterizerStorageRD::_update_dirty_skeletons() {
/* LIGHT */
-RID RasterizerStorageRD::light_create(VS::LightType p_type) {
+RID RasterizerStorageRD::light_create(RS::LightType p_type) {
Light light;
light.type = p_type;
- light.param[VS::LIGHT_PARAM_ENERGY] = 1.0;
- light.param[VS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
- light.param[VS::LIGHT_PARAM_SPECULAR] = 0.5;
- light.param[VS::LIGHT_PARAM_RANGE] = 1.0;
- light.param[VS::LIGHT_PARAM_SPOT_ANGLE] = 45;
- light.param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] = 45;
- light.param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE] = 0;
- light.param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET] = 0.1;
- light.param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET] = 0.3;
- light.param[VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET] = 0.6;
- light.param[VS::LIGHT_PARAM_SHADOW_FADE_START] = 0.8;
- light.param[VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] = 0.1;
- light.param[VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE] = 0.1;
+ light.param[RS::LIGHT_PARAM_ENERGY] = 1.0;
+ light.param[RS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
+ light.param[RS::LIGHT_PARAM_SPECULAR] = 0.5;
+ light.param[RS::LIGHT_PARAM_RANGE] = 1.0;
+ light.param[RS::LIGHT_PARAM_SPOT_ANGLE] = 45;
+ light.param[RS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] = 45;
+ light.param[RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE] = 0;
+ light.param[RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET] = 0.1;
+ light.param[RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET] = 0.3;
+ light.param[RS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET] = 0.6;
+ light.param[RS::LIGHT_PARAM_SHADOW_FADE_START] = 0.8;
+ light.param[RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS] = 0.1;
+ light.param[RS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE] = 0.1;
return light_owner.make_rid(light);
}
@@ -3123,21 +3123,21 @@ void RasterizerStorageRD::light_set_color(RID p_light, const Color &p_color) {
light->color = p_color;
}
-void RasterizerStorageRD::light_set_param(RID p_light, VS::LightParam p_param, float p_value) {
+void RasterizerStorageRD::light_set_param(RID p_light, RS::LightParam p_param, float p_value) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
- ERR_FAIL_INDEX(p_param, VS::LIGHT_PARAM_MAX);
+ ERR_FAIL_INDEX(p_param, RS::LIGHT_PARAM_MAX);
switch (p_param) {
- case VS::LIGHT_PARAM_RANGE:
- case VS::LIGHT_PARAM_SPOT_ANGLE:
- case VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET:
- case VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS:
- case VS::LIGHT_PARAM_SHADOW_BIAS: {
+ case RS::LIGHT_PARAM_RANGE:
+ case RS::LIGHT_PARAM_SPOT_ANGLE:
+ case RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET:
+ case RS::LIGHT_PARAM_SHADOW_NORMAL_BIAS:
+ case RS::LIGHT_PARAM_SHADOW_BIAS: {
light->version++;
light->instance_dependency.instance_notify_changed(true, false);
@@ -3211,7 +3211,7 @@ void RasterizerStorageRD::light_set_use_gi(RID p_light, bool p_enabled) {
light->version++;
light->instance_dependency.instance_notify_changed(true, false);
}
-void RasterizerStorageRD::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {
+void RasterizerStorageRD::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3222,15 +3222,15 @@ void RasterizerStorageRD::light_omni_set_shadow_mode(RID p_light, VS::LightOmniS
light->instance_dependency.instance_notify_changed(true, false);
}
-VS::LightOmniShadowMode RasterizerStorageRD::light_omni_get_shadow_mode(RID p_light) {
+RS::LightOmniShadowMode RasterizerStorageRD::light_omni_get_shadow_mode(RID p_light) {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_OMNI_SHADOW_CUBE);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_OMNI_SHADOW_CUBE);
return light->omni_shadow_mode;
}
-void RasterizerStorageRD::light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode) {
+void RasterizerStorageRD::light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3258,15 +3258,15 @@ bool RasterizerStorageRD::light_directional_get_blend_splits(RID p_light) const
return light->directional_blend_splits;
}
-VS::LightDirectionalShadowMode RasterizerStorageRD::light_directional_get_shadow_mode(RID p_light) {
+RS::LightDirectionalShadowMode RasterizerStorageRD::light_directional_get_shadow_mode(RID p_light) {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL);
return light->directional_shadow_mode;
}
-void RasterizerStorageRD::light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) {
+void RasterizerStorageRD::light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode) {
Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND(!light);
@@ -3274,10 +3274,10 @@ void RasterizerStorageRD::light_directional_set_shadow_depth_range_mode(RID p_li
light->directional_range_mode = p_range_mode;
}
-VS::LightDirectionalShadowDepthRangeMode RasterizerStorageRD::light_directional_get_shadow_depth_range_mode(RID p_light) const {
+RS::LightDirectionalShadowDepthRangeMode RasterizerStorageRD::light_directional_get_shadow_depth_range_mode(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE);
return light->directional_range_mode;
}
@@ -3304,18 +3304,18 @@ AABB RasterizerStorageRD::light_get_aabb(RID p_light) const {
switch (light->type) {
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
- float len = light->param[VS::LIGHT_PARAM_RANGE];
- float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len;
+ float len = light->param[RS::LIGHT_PARAM_RANGE];
+ float size = Math::tan(Math::deg2rad(light->param[RS::LIGHT_PARAM_SPOT_ANGLE])) * len;
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
};
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
- float r = light->param[VS::LIGHT_PARAM_RANGE];
+ float r = light->param[RS::LIGHT_PARAM_RANGE];
return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2);
};
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
return AABB();
};
@@ -3331,7 +3331,7 @@ RID RasterizerStorageRD::reflection_probe_create() {
return reflection_probe_owner.make_rid(ReflectionProbe());
}
-void RasterizerStorageRD::reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode) {
+void RasterizerStorageRD::reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {
ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe);
ERR_FAIL_COND(!reflection_probe);
@@ -3450,10 +3450,10 @@ AABB RasterizerStorageRD::reflection_probe_get_aabb(RID p_probe) const {
return aabb;
}
-VS::ReflectionProbeUpdateMode RasterizerStorageRD::reflection_probe_get_update_mode(RID p_probe) const {
+RS::ReflectionProbeUpdateMode RasterizerStorageRD::reflection_probe_get_update_mode(RID p_probe) const {
const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe);
- ERR_FAIL_COND_V(!reflection_probe, VS::REFLECTION_PROBE_UPDATE_ALWAYS);
+ ERR_FAIL_COND_V(!reflection_probe, RS::REFLECTION_PROBE_UPDATE_ALWAYS);
return reflection_probe->update_mode;
}
@@ -4266,25 +4266,25 @@ void RasterizerStorageRD::skeleton_update_dependency(RID p_skeleton, RasterizerS
p_instance->update_dependency(&skeleton->instance_dependency);
}
-VS::InstanceType RasterizerStorageRD::get_base_type(RID p_rid) const {
+RS::InstanceType RasterizerStorageRD::get_base_type(RID p_rid) const {
if (mesh_owner.owns(p_rid)) {
- return VS::INSTANCE_MESH;
+ return RS::INSTANCE_MESH;
}
if (multimesh_owner.owns(p_rid)) {
- return VS::INSTANCE_MULTIMESH;
+ return RS::INSTANCE_MULTIMESH;
}
if (reflection_probe_owner.owns(p_rid)) {
- return VS::INSTANCE_REFLECTION_PROBE;
+ return RS::INSTANCE_REFLECTION_PROBE;
}
if (gi_probe_owner.owns(p_rid)) {
- return VS::INSTANCE_GI_PROBE;
+ return RS::INSTANCE_GI_PROBE;
}
if (light_owner.owns(p_rid)) {
- return VS::INSTANCE_LIGHT;
+ return RS::INSTANCE_LIGHT;
}
- return VS::INSTANCE_NONE;
+ return RS::INSTANCE_NONE;
}
void RasterizerStorageRD::update_dirty_resources() {
_update_queued_materials();
@@ -4374,7 +4374,7 @@ bool RasterizerStorageRD::free(RID p_rid) {
mesh_owner.free(p_rid);
} else if (multimesh_owner.owns(p_rid)) {
_update_dirty_multimeshes();
- multimesh_allocate(p_rid, 0, VS::MULTIMESH_TRANSFORM_2D);
+ multimesh_allocate(p_rid, 0, RS::MULTIMESH_TRANSFORM_2D);
MultiMesh *multimesh = multimesh_owner.getornull(p_rid);
multimesh->instance_dependency.instance_notify_deleted(p_rid);
multimesh_owner.free(p_rid);
@@ -4612,40 +4612,40 @@ RasterizerStorageRD::RasterizerStorageRD() {
}
//default samplers
- for (int i = 1; i < VS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
- for (int j = 1; j < VS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
+ for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
+ for (int j = 1; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
RD::SamplerState sampler_state;
switch (i) {
- case VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
sampler_state.min_filter = RD::SAMPLER_FILTER_NEAREST;
sampler_state.max_lod = 0;
} break;
- case VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.max_lod = 0;
} break;
- case VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
} break;
- case VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
} break;
- case VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_NEAREST;
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.use_anisotropy = true;
sampler_state.anisotropy_max = GLOBAL_GET("rendering/quality/filters/max_anisotropy");
} break;
- case VS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: {
+ case RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC: {
sampler_state.mag_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.min_filter = RD::SAMPLER_FILTER_LINEAR;
sampler_state.mip_filter = RD::SAMPLER_FILTER_LINEAR;
@@ -4657,17 +4657,17 @@ RasterizerStorageRD::RasterizerStorageRD() {
}
}
switch (j) {
- case VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: {
+ case RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: {
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE;
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_CLAMP_TO_EDGE;
} break;
- case VS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: {
+ case RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: {
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_REPEAT;
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_REPEAT;
} break;
- case VS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: {
+ case RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: {
sampler_state.repeat_u = RD::SAMPLER_REPEAT_MODE_MIRRORED_REPEAT;
sampler_state.repeat_v = RD::SAMPLER_REPEAT_MODE_MIRRORED_REPEAT;
} break;
@@ -4808,8 +4808,8 @@ RasterizerStorageRD::~RasterizerStorageRD() {
}
//def samplers
- for (int i = 1; i < VS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
- for (int j = 1; j < VS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
+ for (int i = 1; i < RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; i++) {
+ for (int j = 1; j < RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX; j++) {
RD::get_singleton()->free(default_rd_samplers[i][j]);
}
}
diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index 410cd4adb4..e69be644d7 100644
--- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -32,11 +32,11 @@
#define RASTERIZER_STORAGE_RD_H
#include "core/rid_owner.h"
-#include "servers/visual/rasterizer.h"
-#include "servers/visual/rasterizer_rd/rasterizer_effects_rd.h"
-#include "servers/visual/rasterizer_rd/shader_compiler_rd.h"
-#include "servers/visual/rasterizer_rd/shaders/giprobe_sdf.glsl.gen.h"
-#include "servers/visual/rendering_device.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering/rasterizer_rd/rasterizer_effects_rd.h"
+#include "servers/rendering/rasterizer_rd/shader_compiler_rd.h"
+#include "servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl.gen.h"
+#include "servers/rendering/rendering_device.h"
class RasterizerStorageRD : public RasterizerStorage {
public:
@@ -138,13 +138,13 @@ private:
RID proxy_to;
Vector<RID> proxies;
- VS::TextureDetectCallback detect_3d_callback = nullptr;
+ RS::TextureDetectCallback detect_3d_callback = nullptr;
void *detect_3d_callback_ud = nullptr;
- VS::TextureDetectCallback detect_normal_callback = nullptr;
+ RS::TextureDetectCallback detect_normal_callback = nullptr;
void *detect_normal_callback_ud = nullptr;
- VS::TextureDetectRoughnessCallback detect_roughness_callback = nullptr;
+ RS::TextureDetectRoughnessCallback detect_roughness_callback = nullptr;
void *detect_roughness_callback_ud = nullptr;
};
@@ -171,7 +171,7 @@ private:
Ref<Image> _validate_texture_format(const Ref<Image> &p_image, TextureToRDFormat &r_format);
RID default_rd_textures[DEFAULT_RD_TEXTURE_MAX];
- RID default_rd_samplers[VS::CANVAS_ITEM_TEXTURE_FILTER_MAX][VS::CANVAS_ITEM_TEXTURE_REPEAT_MAX];
+ RID default_rd_samplers[RS::CANVAS_ITEM_TEXTURE_FILTER_MAX][RS::CANVAS_ITEM_TEXTURE_REPEAT_MAX];
/* SHADER */
@@ -218,7 +218,7 @@ private:
struct Mesh {
struct Surface {
- VS::PrimitiveType primitive;
+ RS::PrimitiveType primitive;
uint32_t format = 0;
RID vertex_buffer;
@@ -271,7 +271,7 @@ private:
};
uint32_t blend_shape_count = 0;
- VS::BlendShapeMode blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
+ RS::BlendShapeMode blend_shape_mode = RS::BLEND_SHAPE_MODE_NORMALIZED;
Surface **surfaces = nullptr;
uint32_t surface_count = 0;
@@ -296,7 +296,7 @@ private:
struct MultiMesh {
RID mesh;
int instances = 0;
- VS::MultimeshTransformFormat xform_format = VS::MULTIMESH_TRANSFORM_3D;
+ RS::MultimeshTransformFormat xform_format = RS::MULTIMESH_TRANSFORM_3D;
bool uses_colors = false;
bool uses_custom_data = false;
int visible_instances = -1;
@@ -359,8 +359,8 @@ private:
struct Light {
- VS::LightType type;
- float param[VS::LIGHT_PARAM_MAX];
+ RS::LightType type;
+ float param[RS::LIGHT_PARAM_MAX];
Color color = Color(1, 1, 1, 1);
Color shadow_color;
RID projector;
@@ -369,9 +369,9 @@ private:
bool reverse_cull = false;
bool use_gi = true;
uint32_t cull_mask = 0xFFFFFFFF;
- VS::LightOmniShadowMode omni_shadow_mode = VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
- VS::LightDirectionalShadowMode directional_shadow_mode = VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
- VS::LightDirectionalShadowDepthRangeMode directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
+ RS::LightOmniShadowMode omni_shadow_mode = RS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID;
+ RS::LightDirectionalShadowMode directional_shadow_mode = RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL;
+ RS::LightDirectionalShadowDepthRangeMode directional_range_mode = RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE;
bool directional_blend_splits = false;
uint64_t version = 0;
@@ -384,7 +384,7 @@ private:
struct ReflectionProbe {
- VS::ReflectionProbeUpdateMode update_mode = VS::REFLECTION_PROBE_UPDATE_ONCE;
+ RS::ReflectionProbeUpdateMode update_mode = RS::REFLECTION_PROBE_UPDATE_ONCE;
int resolution = 256;
float intensity = 1.0;
Color interior_ambient;
@@ -498,7 +498,7 @@ public:
/* TEXTURE API */
virtual RID texture_2d_create(const Ref<Image> &p_image);
- virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, VS::TextureLayeredType p_layered_type);
+ virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type);
virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices); //all slices, then all the mipmaps, must be coherent
virtual RID texture_proxy_create(RID p_base);
@@ -524,11 +524,11 @@ public:
virtual void texture_set_path(RID p_texture, const String &p_path);
virtual String texture_get_path(RID p_texture) const;
- virtual void texture_set_detect_3d_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata);
- virtual void texture_set_detect_normal_callback(RID p_texture, VS::TextureDetectCallback p_callback, void *p_userdata);
- virtual void texture_set_detect_roughness_callback(RID p_texture, VS::TextureDetectRoughnessCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_3d_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata);
- virtual void texture_debug_usage(List<VS::TextureInfo> *r_info);
+ virtual void texture_debug_usage(List<RS::TextureInfo> *r_info);
virtual void texture_set_proxy(RID p_proxy, RID p_base);
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable);
@@ -564,7 +564,7 @@ public:
_FORCE_INLINE_ RID texture_rd_get_default(DefaultRDTexture p_texture) {
return default_rd_textures[p_texture];
}
- _FORCE_INLINE_ RID sampler_rd_get_default(VS::CanvasItemTextureFilter p_filter, VS::CanvasItemTextureRepeat p_repeat) {
+ _FORCE_INLINE_ RID sampler_rd_get_default(RS::CanvasItemTextureFilter p_filter, RS::CanvasItemTextureRepeat p_repeat) {
return default_rd_samplers[p_filter][p_repeat];
}
@@ -615,19 +615,19 @@ public:
virtual RID mesh_create();
/// Return stride
- virtual void mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_surface);
+ virtual void mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface);
virtual int mesh_get_blend_shape_count(RID p_mesh) const;
- virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode);
- virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
+ virtual void mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMode p_mode);
+ virtual RS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const Vector<uint8_t> &p_data);
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material);
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const;
- virtual VS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const;
+ virtual RS::SurfaceData mesh_get_surface(RID p_mesh, int p_surface) const;
virtual int mesh_get_surface_count(RID p_mesh) const;
@@ -655,10 +655,10 @@ public:
return mesh->material_cache.ptr();
}
- _FORCE_INLINE_ VS::PrimitiveType mesh_surface_get_primitive(RID p_mesh, uint32_t p_surface_index) {
+ _FORCE_INLINE_ RS::PrimitiveType mesh_surface_get_primitive(RID p_mesh, uint32_t p_surface_index) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, VS::PRIMITIVE_MAX);
- ERR_FAIL_UNSIGNED_INDEX_V(p_surface_index, mesh->surface_count, VS::PRIMITIVE_MAX);
+ ERR_FAIL_COND_V(!mesh, RS::PRIMITIVE_MAX);
+ ERR_FAIL_UNSIGNED_INDEX_V(p_surface_index, mesh->surface_count, RS::PRIMITIVE_MAX);
return mesh->surfaces[p_surface_index]->primitive;
}
@@ -732,7 +732,7 @@ public:
RID multimesh_create();
- void multimesh_allocate(RID p_multimesh, int p_instances, VS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false);
+ void multimesh_allocate(RID p_multimesh, int p_instances, RS::MultimeshTransformFormat p_transform_format, bool p_use_colors = false, bool p_use_custom_data = false);
int multimesh_get_instance_count(RID p_multimesh) const;
void multimesh_set_mesh(RID p_multimesh, RID p_mesh);
@@ -756,7 +756,7 @@ public:
AABB multimesh_get_aabb(RID p_multimesh) const;
- _FORCE_INLINE_ VS::MultimeshTransformFormat multimesh_get_transform_format(RID p_multimesh) const {
+ _FORCE_INLINE_ RS::MultimeshTransformFormat multimesh_get_transform_format(RID p_multimesh) const {
MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh);
return multimesh->xform_format;
}
@@ -797,7 +797,7 @@ public:
/* IMMEDIATE API */
RID immediate_create() { return RID(); }
- void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID()) {}
+ void immediate_begin(RID p_immediate, RS::PrimitiveType p_rimitive, RID p_texture = RID()) {}
void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {}
void immediate_normal(RID p_immediate, const Vector3 &p_normal) {}
void immediate_tangent(RID p_immediate, const Plane &p_tangent) {}
@@ -843,14 +843,14 @@ public:
}
/* Light API */
- RID light_create(VS::LightType p_type);
+ RID light_create(RS::LightType p_type);
- RID directional_light_create() { return light_create(VS::LIGHT_DIRECTIONAL); }
- RID omni_light_create() { return light_create(VS::LIGHT_OMNI); }
- RID spot_light_create() { return light_create(VS::LIGHT_SPOT); }
+ RID directional_light_create() { return light_create(RS::LIGHT_DIRECTIONAL); }
+ RID omni_light_create() { return light_create(RS::LIGHT_OMNI); }
+ RID spot_light_create() { return light_create(RS::LIGHT_SPOT); }
void light_set_color(RID p_light, const Color &p_color);
- void light_set_param(RID p_light, VS::LightParam p_param, float p_value);
+ void light_set_param(RID p_light, RS::LightParam p_param, float p_value);
void light_set_shadow(RID p_light, bool p_enabled);
void light_set_shadow_color(RID p_light, const Color &p_color);
void light_set_projector(RID p_light, RID p_texture);
@@ -859,26 +859,26 @@ public:
void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
void light_set_use_gi(RID p_light, bool p_enabled);
- void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
+ void light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode);
- void light_directional_set_shadow_mode(RID p_light, VS::LightDirectionalShadowMode p_mode);
+ void light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode);
void light_directional_set_blend_splits(RID p_light, bool p_enable);
bool light_directional_get_blend_splits(RID p_light) const;
- void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode);
- VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
+ void light_directional_set_shadow_depth_range_mode(RID p_light, RS::LightDirectionalShadowDepthRangeMode p_range_mode);
+ RS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const;
- VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
- VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
+ RS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light);
+ RS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light);
- _FORCE_INLINE_ VS::LightType light_get_type(RID p_light) const {
+ _FORCE_INLINE_ RS::LightType light_get_type(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
return light->type;
}
AABB light_get_aabb(RID p_light) const;
- _FORCE_INLINE_ float light_get_param(RID p_light, VS::LightParam p_param) {
+ _FORCE_INLINE_ float light_get_param(RID p_light, RS::LightParam p_param) {
const Light *light = light_owner.getornull(p_light);
ERR_FAIL_COND_V(!light, 0);
@@ -913,7 +913,7 @@ public:
_FORCE_INLINE_ bool light_has_shadow(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
return light->shadow;
}
@@ -921,7 +921,7 @@ public:
_FORCE_INLINE_ bool light_is_negative(RID p_light) const {
const Light *light = light_owner.getornull(p_light);
- ERR_FAIL_COND_V(!light, VS::LIGHT_DIRECTIONAL);
+ ERR_FAIL_COND_V(!light, RS::LIGHT_DIRECTIONAL);
return light->negative;
}
@@ -933,7 +933,7 @@ public:
RID reflection_probe_create();
- void reflection_probe_set_update_mode(RID p_probe, VS::ReflectionProbeUpdateMode p_mode);
+ void reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode);
void reflection_probe_set_intensity(RID p_probe, float p_intensity);
void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_ambient);
void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy);
@@ -948,7 +948,7 @@ public:
void reflection_probe_set_resolution(RID p_probe, int p_resolution);
AABB reflection_probe_get_aabb(RID p_probe) const;
- VS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
+ RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
uint32_t reflection_probe_get_cull_mask(RID p_probe) const;
Vector3 reflection_probe_get_extents(RID p_probe) const;
Vector3 reflection_probe_get_origin_offset(RID p_probe) const;
@@ -1059,7 +1059,7 @@ public:
void particles_set_fractional_delta(RID p_particles, bool p_enable) {}
void particles_restart(RID p_particles) {}
- void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order) {}
+ void particles_set_draw_order(RID p_particles, RS::ParticlesDrawOrder p_order) {}
void particles_set_draw_passes(RID p_particles, int p_count) {}
void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) {}
@@ -1098,7 +1098,7 @@ public:
Size2 render_target_get_size(RID p_render_target);
RID render_target_get_rd_framebuffer(RID p_render_target);
- VS::InstanceType get_base_type(RID p_rid) const;
+ RS::InstanceType get_base_type(RID p_rid) const;
bool free(RID p_rid);
@@ -1110,9 +1110,9 @@ public:
void render_info_begin_capture() {}
void render_info_end_capture() {}
- int get_captured_render_info(VS::RenderInfo p_info) { return 0; }
+ int get_captured_render_info(RS::RenderInfo p_info) { return 0; }
- int get_render_info(VS::RenderInfo p_info) { return 0; }
+ int get_render_info(RS::RenderInfo p_info) { return 0; }
String get_video_adapter_name() const { return String(); }
String get_video_adapter_vendor() const { return String(); }
diff --git a/servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
index 4ee020aa69..4ee020aa69 100644
--- a/servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
+++ b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
diff --git a/servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
index 05c5968360..ecb1b42b06 100644
--- a/servers/visual/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
+++ b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.h
@@ -32,7 +32,7 @@
#define RENDER_PIPELINE_CACHE_RD_H
#include "core/spin_lock.h"
-#include "servers/visual/rendering_device.h"
+#include "servers/rendering/rendering_device.h"
class RenderPipelineVertexFormatCacheRD {
diff --git a/servers/visual/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
index ecff8d81f6..b3a4b0ede8 100644
--- a/servers/visual/rasterizer_rd/shader_compiler_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
@@ -1037,7 +1037,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
return code;
}
-Error ShaderCompilerRD::compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
+Error ShaderCompilerRD::compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code) {
Error err = parser.compile(p_code, ShaderTypes::get_singleton()->get_functions(p_mode), ShaderTypes::get_singleton()->get_modes(p_mode), ShaderTypes::get_singleton()->get_types());
@@ -1099,145 +1099,145 @@ ShaderCompilerRD::ShaderCompilerRD() {
/** SPATIAL SHADER **/
- actions[VS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
- actions[VS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
- actions[VS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
- actions[VS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
- actions[VS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
- actions[VS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
-
- actions[VS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
- actions[VS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
- actions[VS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
- actions[VS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
- actions[VS::SHADER_SPATIAL].renames["POSITION"] = "position";
- actions[VS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
- actions[VS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
- actions[VS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
- actions[VS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
- actions[VS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID";
+ actions[RS::SHADER_SPATIAL].renames["WORLD_MATRIX"] = "world_transform";
+ actions[RS::SHADER_SPATIAL].renames["INV_CAMERA_MATRIX"] = "camera_inverse_matrix";
+ actions[RS::SHADER_SPATIAL].renames["CAMERA_MATRIX"] = "camera_matrix";
+ actions[RS::SHADER_SPATIAL].renames["PROJECTION_MATRIX"] = "projection_matrix";
+ actions[RS::SHADER_SPATIAL].renames["INV_PROJECTION_MATRIX"] = "inv_projection_matrix";
+ actions[RS::SHADER_SPATIAL].renames["MODELVIEW_MATRIX"] = "modelview";
+
+ actions[RS::SHADER_SPATIAL].renames["VERTEX"] = "vertex.xyz";
+ actions[RS::SHADER_SPATIAL].renames["NORMAL"] = "normal";
+ actions[RS::SHADER_SPATIAL].renames["TANGENT"] = "tangent";
+ actions[RS::SHADER_SPATIAL].renames["BINORMAL"] = "binormal";
+ actions[RS::SHADER_SPATIAL].renames["POSITION"] = "position";
+ actions[RS::SHADER_SPATIAL].renames["UV"] = "uv_interp";
+ actions[RS::SHADER_SPATIAL].renames["UV2"] = "uv2_interp";
+ actions[RS::SHADER_SPATIAL].renames["COLOR"] = "color_interp";
+ actions[RS::SHADER_SPATIAL].renames["POINT_SIZE"] = "gl_PointSize";
+ actions[RS::SHADER_SPATIAL].renames["INSTANCE_ID"] = "gl_InstanceID";
//builtins
- actions[VS::SHADER_SPATIAL].renames["TIME"] = "time";
- actions[VS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
-
- actions[VS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
- actions[VS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
- actions[VS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
- actions[VS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
- actions[VS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
- actions[VS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
- actions[VS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
- actions[VS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
- actions[VS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
- actions[VS::SHADER_SPATIAL].renames["RIM"] = "rim";
- actions[VS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
- actions[VS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
- actions[VS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
- actions[VS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
- actions[VS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
- actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
- actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
- actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
- actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
- actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
- actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
- actions[VS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
- actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
- actions[VS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
- actions[VS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer";
- actions[VS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
- actions[VS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
- actions[VS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
+ actions[RS::SHADER_SPATIAL].renames["TIME"] = "time";
+ actions[RS::SHADER_SPATIAL].renames["VIEWPORT_SIZE"] = "viewport_size";
+
+ actions[RS::SHADER_SPATIAL].renames["FRAGCOORD"] = "gl_FragCoord";
+ actions[RS::SHADER_SPATIAL].renames["FRONT_FACING"] = "gl_FrontFacing";
+ actions[RS::SHADER_SPATIAL].renames["NORMALMAP"] = "normalmap";
+ actions[RS::SHADER_SPATIAL].renames["NORMALMAP_DEPTH"] = "normaldepth";
+ actions[RS::SHADER_SPATIAL].renames["ALBEDO"] = "albedo";
+ actions[RS::SHADER_SPATIAL].renames["ALPHA"] = "alpha";
+ actions[RS::SHADER_SPATIAL].renames["METALLIC"] = "metallic";
+ actions[RS::SHADER_SPATIAL].renames["SPECULAR"] = "specular";
+ actions[RS::SHADER_SPATIAL].renames["ROUGHNESS"] = "roughness";
+ actions[RS::SHADER_SPATIAL].renames["RIM"] = "rim";
+ actions[RS::SHADER_SPATIAL].renames["RIM_TINT"] = "rim_tint";
+ actions[RS::SHADER_SPATIAL].renames["CLEARCOAT"] = "clearcoat";
+ actions[RS::SHADER_SPATIAL].renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss";
+ actions[RS::SHADER_SPATIAL].renames["ANISOTROPY"] = "anisotropy";
+ actions[RS::SHADER_SPATIAL].renames["ANISOTROPY_FLOW"] = "anisotropy_flow";
+ actions[RS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
+ actions[RS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
+ actions[RS::SHADER_SPATIAL].renames["AO"] = "ao";
+ actions[RS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
+ actions[RS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
+ actions[RS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
+ actions[RS::SHADER_SPATIAL].renames["INSTANCE_CUSTOM"] = "instance_custom";
+ actions[RS::SHADER_SPATIAL].renames["SCREEN_UV"] = "screen_uv";
+ actions[RS::SHADER_SPATIAL].renames["SCREEN_TEXTURE"] = "screen_texture";
+ actions[RS::SHADER_SPATIAL].renames["DEPTH_TEXTURE"] = "depth_buffer";
+ actions[RS::SHADER_SPATIAL].renames["DEPTH"] = "gl_FragDepth";
+ actions[RS::SHADER_SPATIAL].renames["ALPHA_SCISSOR"] = "alpha_scissor";
+ actions[RS::SHADER_SPATIAL].renames["OUTPUT_IS_SRGB"] = "SHADER_IS_SRGB";
//for light
- actions[VS::SHADER_SPATIAL].renames["VIEW"] = "view";
- actions[VS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
- actions[VS::SHADER_SPATIAL].renames["LIGHT"] = "light";
- actions[VS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
- actions[VS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
- actions[VS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
-
- actions[VS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
- actions[VS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
- actions[VS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
- actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
- actions[VS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
- actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
- actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
- actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
- actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
- actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
- actions[VS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
- actions[VS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
- actions[VS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
-
- actions[VS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
- actions[VS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
-
- actions[VS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
- actions[VS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
-
- actions[VS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
+ actions[RS::SHADER_SPATIAL].renames["VIEW"] = "view";
+ actions[RS::SHADER_SPATIAL].renames["LIGHT_COLOR"] = "light_color";
+ actions[RS::SHADER_SPATIAL].renames["LIGHT"] = "light";
+ actions[RS::SHADER_SPATIAL].renames["ATTENUATION"] = "attenuation";
+ actions[RS::SHADER_SPATIAL].renames["DIFFUSE_LIGHT"] = "diffuse_light";
+ actions[RS::SHADER_SPATIAL].renames["SPECULAR_LIGHT"] = "specular_light";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["TANGENT"] = "#define ENABLE_TANGENT_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["BINORMAL"] = "@TANGENT";
+ actions[RS::SHADER_SPATIAL].usage_defines["RIM"] = "#define LIGHT_USE_RIM\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["RIM_TINT"] = "@RIM";
+ actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT"] = "#define LIGHT_USE_CLEARCOAT\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT";
+ actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
+ actions[RS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["NORMALMAP_DEPTH"] = "@NORMALMAP";
+ actions[RS::SHADER_SPATIAL].usage_defines["COLOR"] = "#define ENABLE_COLOR_INTERP\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["ALPHA_SCISSOR"] = "#define ALPHA_SCISSOR_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["TRANSMISSION"] = "#define TRANSMISSION_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n";
+
+ actions[RS::SHADER_SPATIAL].usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+ actions[RS::SHADER_SPATIAL].usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n";
+
+ actions[RS::SHADER_SPATIAL].render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n";
bool force_lambert = GLOBAL_GET("rendering/quality/shading/force_lambert_over_burley");
if (!force_lambert) {
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n";
}
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n";
bool force_blinn = GLOBAL_GET("rendering/quality/shading/force_blinn_over_ggx");
if (!force_blinn) {
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n";
} else {
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n";
}
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
- actions[VS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
+ actions[RS::SHADER_SPATIAL].render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
/* PARTICLES SHADER */
- actions[VS::SHADER_PARTICLES].renames["COLOR"] = "out_color";
- actions[VS::SHADER_PARTICLES].renames["VELOCITY"] = "out_velocity_active.xyz";
- actions[VS::SHADER_PARTICLES].renames["MASS"] = "mass";
- actions[VS::SHADER_PARTICLES].renames["ACTIVE"] = "shader_active";
- actions[VS::SHADER_PARTICLES].renames["RESTART"] = "restart";
- actions[VS::SHADER_PARTICLES].renames["CUSTOM"] = "out_custom";
- actions[VS::SHADER_PARTICLES].renames["TRANSFORM"] = "xform";
- actions[VS::SHADER_PARTICLES].renames["TIME"] = "time";
- actions[VS::SHADER_PARTICLES].renames["LIFETIME"] = "lifetime";
- actions[VS::SHADER_PARTICLES].renames["DELTA"] = "local_delta";
- actions[VS::SHADER_PARTICLES].renames["NUMBER"] = "particle_number";
- actions[VS::SHADER_PARTICLES].renames["INDEX"] = "index";
- actions[VS::SHADER_PARTICLES].renames["GRAVITY"] = "current_gravity";
- actions[VS::SHADER_PARTICLES].renames["EMISSION_TRANSFORM"] = "emission_transform";
- actions[VS::SHADER_PARTICLES].renames["RANDOM_SEED"] = "random_seed";
-
- actions[VS::SHADER_PARTICLES].render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
- actions[VS::SHADER_PARTICLES].render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
- actions[VS::SHADER_PARTICLES].render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
+ actions[RS::SHADER_PARTICLES].renames["COLOR"] = "out_color";
+ actions[RS::SHADER_PARTICLES].renames["VELOCITY"] = "out_velocity_active.xyz";
+ actions[RS::SHADER_PARTICLES].renames["MASS"] = "mass";
+ actions[RS::SHADER_PARTICLES].renames["ACTIVE"] = "shader_active";
+ actions[RS::SHADER_PARTICLES].renames["RESTART"] = "restart";
+ actions[RS::SHADER_PARTICLES].renames["CUSTOM"] = "out_custom";
+ actions[RS::SHADER_PARTICLES].renames["TRANSFORM"] = "xform";
+ actions[RS::SHADER_PARTICLES].renames["TIME"] = "time";
+ actions[RS::SHADER_PARTICLES].renames["LIFETIME"] = "lifetime";
+ actions[RS::SHADER_PARTICLES].renames["DELTA"] = "local_delta";
+ actions[RS::SHADER_PARTICLES].renames["NUMBER"] = "particle_number";
+ actions[RS::SHADER_PARTICLES].renames["INDEX"] = "index";
+ actions[RS::SHADER_PARTICLES].renames["GRAVITY"] = "current_gravity";
+ actions[RS::SHADER_PARTICLES].renames["EMISSION_TRANSFORM"] = "emission_transform";
+ actions[RS::SHADER_PARTICLES].renames["RANDOM_SEED"] = "random_seed";
+
+ actions[RS::SHADER_PARTICLES].render_mode_defines["disable_force"] = "#define DISABLE_FORCE\n";
+ actions[RS::SHADER_PARTICLES].render_mode_defines["disable_velocity"] = "#define DISABLE_VELOCITY\n";
+ actions[RS::SHADER_PARTICLES].render_mode_defines["keep_data"] = "#define ENABLE_KEEP_DATA\n";
#endif
}
diff --git a/servers/visual/rasterizer_rd/shader_compiler_rd.h b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
index 95e1f0aa23..7d78469e9c 100644
--- a/servers/visual/rasterizer_rd/shader_compiler_rd.h
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.h
@@ -32,9 +32,9 @@
#define SHADER_COMPILER_RD_H
#include "core/pair.h"
-#include "servers/visual/shader_language.h"
-#include "servers/visual/shader_types.h"
-#include "servers/visual_server.h"
+#include "servers/rendering/shader_language.h"
+#include "servers/rendering/shader_types.h"
+#include "servers/rendering_server.h"
class ShaderCompilerRD {
public:
@@ -114,7 +114,7 @@ private:
DefaultIdentifierActions actions;
public:
- Error compile(VS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
+ Error compile(RS::ShaderMode p_mode, const String &p_code, IdentifierActions *p_actions, const String &p_path, GeneratedCode &r_gen_code);
void initialize(DefaultIdentifierActions p_actions);
ShaderCompilerRD();
diff --git a/servers/visual/rasterizer_rd/shader_rd.cpp b/servers/rendering/rasterizer_rd/shader_rd.cpp
index 74edaee983..3dcfd0faf9 100644
--- a/servers/visual/rasterizer_rd/shader_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_rd.cpp
@@ -32,7 +32,7 @@
#include "core/string_builder.h"
#include "rasterizer_rd.h"
-#include "servers/visual/rendering_device.h"
+#include "servers/rendering/rendering_device.h"
void ShaderRD::setup(const char *p_vertex_code, const char *p_fragment_code, const char *p_compute_code, const char *p_name) {
diff --git a/servers/visual/rasterizer_rd/shader_rd.h b/servers/rendering/rasterizer_rd/shader_rd.h
index 6635b08cc8..6635b08cc8 100644
--- a/servers/visual/rasterizer_rd/shader_rd.h
+++ b/servers/rendering/rasterizer_rd/shader_rd.h
diff --git a/servers/visual/rasterizer_rd/shaders/SCsub b/servers/rendering/rasterizer_rd/shaders/SCsub
index 2dcb2a703f..2dcb2a703f 100644
--- a/servers/visual/rasterizer_rd/shaders/SCsub
+++ b/servers/rendering/rasterizer_rd/shaders/SCsub
diff --git a/servers/visual/rasterizer_rd/shaders/blur.glsl b/servers/rendering/rasterizer_rd/shaders/blur.glsl
index 87c20ebaef..87c20ebaef 100644
--- a/servers/visual/rasterizer_rd/shaders/blur.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/blur.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/blur_inc.glsl b/servers/rendering/rasterizer_rd/shaders/blur_inc.glsl
index 33ba9de7bb..33ba9de7bb 100644
--- a/servers/visual/rasterizer_rd/shaders/blur_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/blur_inc.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl
index 7153fe6b17..7153fe6b17 100644
--- a/servers/visual/rasterizer_rd/shaders/bokeh_dof.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/canvas.glsl b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
index 28135fce31..28135fce31 100644
--- a/servers/visual/rasterizer_rd/shaders/canvas.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
index 7b30cc8fe9..7b30cc8fe9 100644
--- a/servers/visual/rasterizer_rd/shaders/canvas_occlusion.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
index 1ac43480cd..1ac43480cd 100644
--- a/servers/visual/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl
index cbb9b546a3..cbb9b546a3 100644
--- a/servers/visual/rasterizer_rd/shaders/copy.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/cubemap_downsampler.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl
index 9f3ecf6053..9f3ecf6053 100644
--- a/servers/visual/rasterizer_rd/shaders/cubemap_downsampler.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl
index 193d0a8a3c..193d0a8a3c 100644
--- a/servers/visual/rasterizer_rd/shaders/cubemap_filter.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl
index e85996fa1a..e85996fa1a 100644
--- a/servers/visual/rasterizer_rd/shaders/cubemap_roughness.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl
index fd09f96a57..fd09f96a57 100644
--- a/servers/visual/rasterizer_rd/shaders/giprobe.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl
index b1784e7eee..b1784e7eee 100644
--- a/servers/visual/rasterizer_rd/shaders/giprobe_debug.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl
index d089236723..d089236723 100644
--- a/servers/visual/rasterizer_rd/shaders/giprobe_sdf.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl
index c832223b1e..c832223b1e 100644
--- a/servers/visual/rasterizer_rd/shaders/giprobe_write.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl
index 4bf5b7e7f1..4bf5b7e7f1 100644
--- a/servers/visual/rasterizer_rd/shaders/luminance_reduce.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl
index 3637b1abb2..3637b1abb2 100644
--- a/servers/visual/rasterizer_rd/shaders/roughness_limiter.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/scene_high_end.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
index 07f4770b14..07f4770b14 100644
--- a/servers/visual/rasterizer_rd/shaders/scene_high_end.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
index baef1e060f..baef1e060f 100644
--- a/servers/visual/rasterizer_rd/shaders/scene_high_end_inc.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl
index 3f433eb2ee..3f433eb2ee 100644
--- a/servers/visual/rasterizer_rd/shaders/sky.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/ssao.glsl b/servers/rendering/rasterizer_rd/shaders/ssao.glsl
index c9d7134610..c9d7134610 100644
--- a/servers/visual/rasterizer_rd/shaders/ssao.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl
index e90c788e08..e90c788e08 100644
--- a/servers/visual/rasterizer_rd/shaders/ssao_blur.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl
index 8728154347..8728154347 100644
--- a/servers/visual/rasterizer_rd/shaders/ssao_minify.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl
diff --git a/servers/visual/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
index 524ca5e2ea..524ca5e2ea 100644
--- a/servers/visual/rasterizer_rd/shaders/tonemap.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl
diff --git a/servers/visual/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index 3c1795161d..3c1795161d 100644
--- a/servers/visual/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
diff --git a/servers/visual/rendering_device.h b/servers/rendering/rendering_device.h
index 4705bcaa75..4705bcaa75 100644
--- a/servers/visual/rendering_device.h
+++ b/servers/rendering/rendering_device.h
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp
index c192b77988..7b28c586b9 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/rendering/rendering_server_canvas.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_canvas.cpp */
+/* rendering_server_canvas.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_canvas.h"
-#include "visual_server_globals.h"
-#include "visual_server_raster.h"
-#include "visual_server_viewport.h"
+#include "rendering_server_canvas.h"
+#include "rendering_server_globals.h"
+#include "rendering_server_raster.h"
+#include "rendering_server_viewport.h"
-static const int z_range = VS::CANVAS_ITEM_Z_MAX - VS::CANVAS_ITEM_Z_MIN + 1;
+static const int z_range = RS::CANVAS_ITEM_Z_MAX - RS::CANVAS_ITEM_Z_MIN + 1;
-void VisualServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) {
+void RenderingServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Canvas::ChildItem *p_child_items, int p_child_item_count, Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, RasterizerCanvas::Light *p_lights) {
RENDER_TIMESTAMP("Cull CanvasItem Tree");
@@ -66,12 +66,12 @@ void VisualServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Canvas
RENDER_TIMESTAMP("Render Canvas Items");
- VSG::canvas_render->canvas_render_items(p_to_render_target, list, p_modulate, p_lights, p_transform);
+ RSG::canvas_render->canvas_render_items(p_to_render_target, list, p_modulate, p_lights, p_transform);
}
-void _collect_ysort_children(VisualServerCanvas::Item *p_canvas_item, Transform2D p_transform, VisualServerCanvas::Item *p_material_owner, VisualServerCanvas::Item **r_items, int &r_index) {
+void _collect_ysort_children(RenderingServerCanvas::Item *p_canvas_item, Transform2D p_transform, RenderingServerCanvas::Item *p_material_owner, RenderingServerCanvas::Item **r_items, int &r_index) {
int child_item_count = p_canvas_item->child_items.size();
- VisualServerCanvas::Item **child_items = p_canvas_item->child_items.ptrw();
+ RenderingServerCanvas::Item **child_items = p_canvas_item->child_items.ptrw();
for (int i = 0; i < child_item_count; i++) {
if (child_items[i]->visible) {
if (r_items) {
@@ -89,14 +89,14 @@ void _collect_ysort_children(VisualServerCanvas::Item *p_canvas_item, Transform2
}
}
-void _mark_ysort_dirty(VisualServerCanvas::Item *ysort_owner, RID_PtrOwner<VisualServerCanvas::Item> &canvas_item_owner) {
+void _mark_ysort_dirty(RenderingServerCanvas::Item *ysort_owner, RID_PtrOwner<RenderingServerCanvas::Item> &canvas_item_owner) {
do {
ysort_owner->ysort_children_count = -1;
ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : NULL;
} while (ysort_owner && ysort_owner->sort_y);
}
-void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner) {
+void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2D &p_transform, const Rect2 &p_clip_rect, const Color &p_modulate, int p_z, RasterizerCanvas::Item **z_list, RasterizerCanvas::Item **z_last_list, Item *p_canvas_clip, Item *p_material_owner) {
Item *ci = p_canvas_item;
@@ -159,7 +159,7 @@ void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2
}
if (ci->z_relative)
- p_z = CLAMP(p_z + ci->z_index, VS::CANVAS_ITEM_Z_MIN, VS::CANVAS_ITEM_Z_MAX);
+ p_z = CLAMP(p_z + ci->z_index, RS::CANVAS_ITEM_Z_MIN, RS::CANVAS_ITEM_Z_MAX);
else
p_z = ci->z_index;
@@ -180,7 +180,7 @@ void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2
}
if (ci->update_when_visible) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
if ((ci->commands != NULL && p_clip_rect.intersects(global_rect, true)) || ci->vp_render || ci->copy_back_buffer) {
@@ -191,7 +191,7 @@ void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2
ci->global_rect_cache.position -= p_clip_rect.position;
ci->light_masked = false;
- int zidx = p_z - VS::CANVAS_ITEM_Z_MIN;
+ int zidx = p_z - RS::CANVAS_ITEM_Z_MIN;
if (z_last_list[zidx]) {
z_last_list[zidx]->next = ci;
@@ -219,7 +219,7 @@ void VisualServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transform2
}
}
-void VisualServerCanvas::_light_mask_canvas_items(int p_z, RasterizerCanvas::Item *p_canvas_item, RasterizerCanvas::Light *p_masked_lights) {
+void RenderingServerCanvas::_light_mask_canvas_items(int p_z, RasterizerCanvas::Item *p_canvas_item, RasterizerCanvas::Light *p_masked_lights) {
if (!p_masked_lights)
return;
@@ -242,7 +242,7 @@ void VisualServerCanvas::_light_mask_canvas_items(int p_z, RasterizerCanvas::Ite
}
}
-void VisualServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) {
+void RenderingServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas, const Transform2D &p_transform, RasterizerCanvas::Light *p_lights, RasterizerCanvas::Light *p_masked_lights, const Rect2 &p_clip_rect) {
RENDER_TIMESTAMP(">Render Canvas");
@@ -296,7 +296,7 @@ void VisualServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas, co
RENDER_TIMESTAMP("<End Render Canvas");
}
-RID VisualServerCanvas::canvas_create() {
+RID RenderingServerCanvas::canvas_create() {
Canvas *canvas = memnew(Canvas);
ERR_FAIL_COND_V(!canvas, RID());
@@ -305,7 +305,7 @@ RID VisualServerCanvas::canvas_create() {
return rid;
}
-void VisualServerCanvas::canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) {
+void RenderingServerCanvas::canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) {
Canvas *canvas = canvas_owner.getornull(p_canvas);
ERR_FAIL_COND(!canvas);
@@ -316,18 +316,18 @@ void VisualServerCanvas::canvas_set_item_mirroring(RID p_canvas, RID p_item, con
ERR_FAIL_COND(idx == -1);
canvas->child_items.write[idx].mirror = p_mirroring;
}
-void VisualServerCanvas::canvas_set_modulate(RID p_canvas, const Color &p_color) {
+void RenderingServerCanvas::canvas_set_modulate(RID p_canvas, const Color &p_color) {
Canvas *canvas = canvas_owner.getornull(p_canvas);
ERR_FAIL_COND(!canvas);
canvas->modulate = p_color;
}
-void VisualServerCanvas::canvas_set_disable_scale(bool p_disable) {
+void RenderingServerCanvas::canvas_set_disable_scale(bool p_disable) {
disable_scale = p_disable;
}
-void VisualServerCanvas::canvas_set_parent(RID p_canvas, RID p_parent, float p_scale) {
+void RenderingServerCanvas::canvas_set_parent(RID p_canvas, RID p_parent, float p_scale) {
Canvas *canvas = canvas_owner.getornull(p_canvas);
ERR_FAIL_COND(!canvas);
@@ -336,7 +336,7 @@ void VisualServerCanvas::canvas_set_parent(RID p_canvas, RID p_parent, float p_s
canvas->parent_scale = p_scale;
}
-RID VisualServerCanvas::canvas_item_create() {
+RID RenderingServerCanvas::canvas_item_create() {
Item *canvas_item = memnew(Item);
ERR_FAIL_COND_V(!canvas_item, RID());
@@ -344,7 +344,7 @@ RID VisualServerCanvas::canvas_item_create() {
return canvas_item_owner.make_rid(canvas_item);
}
-void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
+void RenderingServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -394,7 +394,7 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
canvas_item->parent = p_parent;
}
-void VisualServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) {
+void RenderingServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -403,7 +403,7 @@ void VisualServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) {
_mark_ysort_dirty(canvas_item, canvas_item_owner);
}
-void VisualServerCanvas::canvas_item_set_light_mask(RID p_item, int p_mask) {
+void RenderingServerCanvas::canvas_item_set_light_mask(RID p_item, int p_mask) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -411,28 +411,28 @@ void VisualServerCanvas::canvas_item_set_light_mask(RID p_item, int p_mask) {
canvas_item->light_mask = p_mask;
}
-void VisualServerCanvas::canvas_item_set_transform(RID p_item, const Transform2D &p_transform) {
+void RenderingServerCanvas::canvas_item_set_transform(RID p_item, const Transform2D &p_transform) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->xform = p_transform;
}
-void VisualServerCanvas::canvas_item_set_clip(RID p_item, bool p_clip) {
+void RenderingServerCanvas::canvas_item_set_clip(RID p_item, bool p_clip) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->clip = p_clip;
}
-void VisualServerCanvas::canvas_item_set_distance_field_mode(RID p_item, bool p_enable) {
+void RenderingServerCanvas::canvas_item_set_distance_field_mode(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->distance_field = p_enable;
}
-void VisualServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect) {
+void RenderingServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -440,14 +440,14 @@ void VisualServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_r
canvas_item->custom_rect = p_custom_rect;
canvas_item->rect = p_rect;
}
-void VisualServerCanvas::canvas_item_set_modulate(RID p_item, const Color &p_color) {
+void RenderingServerCanvas::canvas_item_set_modulate(RID p_item, const Color &p_color) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->modulate = p_color;
}
-void VisualServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color &p_color) {
+void RenderingServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color &p_color) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -455,7 +455,7 @@ void VisualServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color &
canvas_item->self_modulate = p_color;
}
-void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) {
+void RenderingServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -463,7 +463,7 @@ void VisualServerCanvas::canvas_item_set_draw_behind_parent(RID p_item, bool p_e
canvas_item->behind = p_enable;
}
-void VisualServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool p_update) {
+void RenderingServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool p_update) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -471,21 +471,21 @@ void VisualServerCanvas::canvas_item_set_update_when_visible(RID p_item, bool p_
canvas_item->update_when_visible = p_update;
}
-void VisualServerCanvas::canvas_item_set_default_texture_filter(RID p_item, VS::CanvasItemTextureFilter p_filter) {
+void RenderingServerCanvas::canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->texture_filter = p_filter;
}
-void VisualServerCanvas::canvas_item_set_default_texture_repeat(RID p_item, VS::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->texture_repeat = p_repeat;
}
-void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width) {
+void RenderingServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -511,7 +511,7 @@ void VisualServerCanvas::canvas_item_add_line(RID p_item, const Point2 &p_from,
line->specular_shininess = Color(1, 1, 1, 1);
}
-void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
+void RenderingServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
ERR_FAIL_COND(p_points.size() < 2);
Item *canvas_item = canvas_item_owner.getornull(p_item);
@@ -520,7 +520,7 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point
Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!pline);
- pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
+ pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
if (true || p_width <= 1) {
#define TODO make thick lines possible
@@ -535,7 +535,7 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point
}
}
- pline->primitive = VS::PRIMITIVE_LINES;
+ pline->primitive = RS::PRIMITIVE_LINES;
pline->specular_shininess = Color(1, 1, 1, 1);
pline->polygon.create(indices, p_points, p_colors);
} else {
@@ -603,7 +603,7 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point
}
}
-void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
+void RenderingServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
ERR_FAIL_COND(p_points.size() < 2);
Item *canvas_item = canvas_item_owner.getornull(p_item);
@@ -612,19 +612,19 @@ void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Poin
Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!pline);
- pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
+ pline->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
if (true || p_width <= 1) {
#define TODO make thick lines possible
- pline->primitive = VS::PRIMITIVE_LINES;
+ pline->primitive = RS::PRIMITIVE_LINES;
pline->specular_shininess = Color(1, 1, 1, 1);
pline->polygon.create(Vector<int>(), p_points, p_colors);
} else {
}
}
-void VisualServerCanvas::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) {
+void RenderingServerCanvas::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -635,7 +635,7 @@ void VisualServerCanvas::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, c
rect->rect = p_rect;
}
-void VisualServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) {
+void RenderingServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -643,9 +643,9 @@ void VisualServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_pos,
Item::CommandPolygon *circle = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!circle);
- circle->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), VS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, VS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
+ circle->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, RID(), RID(), RID(), RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, RID());
- circle->primitive = VS::PRIMITIVE_TRIANGLES;
+ circle->primitive = RS::PRIMITIVE_TRIANGLES;
circle->specular_shininess = Color(1, 1, 1, 1);
Vector<int> indices;
@@ -673,7 +673,7 @@ void VisualServerCanvas::canvas_item_add_circle(RID p_item, const Point2 &p_pos,
circle->polygon.create(indices, points, color);
}
-void VisualServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -707,7 +707,7 @@ void VisualServerCanvas::canvas_item_add_texture_rect(RID p_item, const Rect2 &p
rect->specular_shininess = p_specular_color_shininess;
}
-void VisualServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, bool p_clip_uv, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, bool p_clip_uv, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -752,7 +752,7 @@ void VisualServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const R
}
}
-void VisualServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode, VS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode, RS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -772,7 +772,7 @@ void VisualServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_r
style->axis_x = p_x_axis_mode;
style->axis_y = p_y_axis_mode;
}
-void VisualServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
uint32_t pc = p_points.size();
ERR_FAIL_COND(pc == 0 || pc > 4);
@@ -803,7 +803,7 @@ void VisualServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Poin
prim->specular_shininess = p_specular_color_shininess;
}
-void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -820,13 +820,13 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
Item::CommandPolygon *polygon = canvas_item->alloc_command<Item::CommandPolygon>();
ERR_FAIL_COND(!polygon);
- polygon->primitive = VS::PRIMITIVE_TRIANGLES;
+ polygon->primitive = RS::PRIMITIVE_TRIANGLES;
polygon->texture_binding.create(canvas_item->texture_filter, canvas_item->texture_repeat, p_texture, p_normal_map, p_specular_map, p_filter, p_repeat, RID());
polygon->specular_shininess = p_specular_color_shininess;
polygon->polygon.create(indices, p_points, p_colors, p_uvs);
}
-void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -846,10 +846,10 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector
polygon->specular_shininess = p_specular_color_shininess;
polygon->polygon.create(indices, p_points, p_colors, p_uvs, p_bones, p_weights);
- polygon->primitive = VS::PRIMITIVE_TRIANGLES;
+ polygon->primitive = RS::PRIMITIVE_TRIANGLES;
}
-void VisualServerCanvas::canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) {
+void RenderingServerCanvas::canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -859,7 +859,7 @@ void VisualServerCanvas::canvas_item_add_set_transform(RID p_item, const Transfo
tr->xform = p_transform;
}
-void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -872,7 +872,7 @@ void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, con
m->transform = p_transform;
m->modulate = p_modulate;
}
-void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -884,10 +884,10 @@ void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles,
part->specular_shininess = p_specular_color_shininess;
//take the chance and request processing for them, at least once until they become visible again
- VSG::storage->particles_request_process(p_particles);
+ RSG::storage->particles_request_process(p_particles);
}
-void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, VisualServer::CanvasItemTextureFilter p_filter, VisualServer::CanvasItemTextureRepeat p_repeat) {
+void RenderingServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -899,7 +899,7 @@ void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p
mm->specular_shininess = p_specular_color_shininess;
}
-void VisualServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore) {
+void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -908,7 +908,7 @@ void VisualServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignore)
ERR_FAIL_COND(!ci);
ci->ignore = p_ignore;
}
-void VisualServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) {
+void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -917,16 +917,16 @@ void VisualServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_e
_mark_ysort_dirty(canvas_item, canvas_item_owner);
}
-void VisualServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) {
+void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) {
- ERR_FAIL_COND(p_z < VS::CANVAS_ITEM_Z_MIN || p_z > VS::CANVAS_ITEM_Z_MAX);
+ ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN || p_z > RS::CANVAS_ITEM_Z_MAX);
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->z_index = p_z;
}
-void VisualServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) {
+void RenderingServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -934,7 +934,7 @@ void VisualServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, boo
canvas_item->z_relative = p_enable;
}
-void VisualServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skeleton) {
+void RenderingServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skeleton) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -942,7 +942,7 @@ void VisualServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skeleton)
canvas_item->skeleton = p_skeleton;
}
-void VisualServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) {
+void RenderingServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -961,14 +961,14 @@ void VisualServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_e
}
}
-void VisualServerCanvas::canvas_item_clear(RID p_item) {
+void RenderingServerCanvas::canvas_item_clear(RID p_item) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->clear();
}
-void VisualServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) {
+void RenderingServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -988,7 +988,7 @@ void VisualServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) {
}
}
-void VisualServerCanvas::canvas_item_set_material(RID p_item, RID p_material) {
+void RenderingServerCanvas::canvas_item_set_material(RID p_item, RID p_material) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -996,7 +996,7 @@ void VisualServerCanvas::canvas_item_set_material(RID p_item, RID p_material) {
canvas_item->material = p_material;
}
-void VisualServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool p_enable) {
+void RenderingServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool p_enable) {
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
@@ -1004,13 +1004,13 @@ void VisualServerCanvas::canvas_item_set_use_parent_material(RID p_item, bool p_
canvas_item->use_parent_material = p_enable;
}
-RID VisualServerCanvas::canvas_light_create() {
+RID RenderingServerCanvas::canvas_light_create() {
RasterizerCanvas::Light *clight = memnew(RasterizerCanvas::Light);
- clight->light_internal = VSG::canvas_render->light_create();
+ clight->light_internal = RSG::canvas_render->light_create();
return canvas_light_owner.make_rid(clight);
}
-void VisualServerCanvas::canvas_light_attach_to_canvas(RID p_light, RID p_canvas) {
+void RenderingServerCanvas::canvas_light_attach_to_canvas(RID p_light, RID p_canvas) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1033,65 +1033,65 @@ void VisualServerCanvas::canvas_light_attach_to_canvas(RID p_light, RID p_canvas
}
}
-void VisualServerCanvas::canvas_light_set_enabled(RID p_light, bool p_enabled) {
+void RenderingServerCanvas::canvas_light_set_enabled(RID p_light, bool p_enabled) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->enabled = p_enabled;
}
-void VisualServerCanvas::canvas_light_set_scale(RID p_light, float p_scale) {
+void RenderingServerCanvas::canvas_light_set_scale(RID p_light, float p_scale) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->scale = p_scale;
}
-void VisualServerCanvas::canvas_light_set_transform(RID p_light, const Transform2D &p_transform) {
+void RenderingServerCanvas::canvas_light_set_transform(RID p_light, const Transform2D &p_transform) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->xform = p_transform;
}
-void VisualServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) {
+void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->texture = p_texture;
clight->version++;
- VSG::canvas_render->light_set_texture(clight->light_internal, p_texture);
+ RSG::canvas_render->light_set_texture(clight->light_internal, p_texture);
}
-void VisualServerCanvas::canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) {
+void RenderingServerCanvas::canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->texture_offset = p_offset;
}
-void VisualServerCanvas::canvas_light_set_color(RID p_light, const Color &p_color) {
+void RenderingServerCanvas::canvas_light_set_color(RID p_light, const Color &p_color) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->color = p_color;
}
-void VisualServerCanvas::canvas_light_set_height(RID p_light, float p_height) {
+void RenderingServerCanvas::canvas_light_set_height(RID p_light, float p_height) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->height = p_height;
}
-void VisualServerCanvas::canvas_light_set_energy(RID p_light, float p_energy) {
+void RenderingServerCanvas::canvas_light_set_energy(RID p_light, float p_energy) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->energy = p_energy;
}
-void VisualServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) {
+void RenderingServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1099,7 +1099,7 @@ void VisualServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, int
clight->z_min = p_min_z;
clight->z_max = p_max_z;
}
-void VisualServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) {
+void RenderingServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1107,21 +1107,21 @@ void VisualServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_lay
clight->layer_max = p_max_layer;
clight->layer_min = p_min_layer;
}
-void VisualServerCanvas::canvas_light_set_item_cull_mask(RID p_light, int p_mask) {
+void RenderingServerCanvas::canvas_light_set_item_cull_mask(RID p_light, int p_mask) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->item_mask = p_mask;
}
-void VisualServerCanvas::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) {
+void RenderingServerCanvas::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->item_shadow_mask = p_mask;
}
-void VisualServerCanvas::canvas_light_set_mode(RID p_light, VS::CanvasLightMode p_mode) {
+void RenderingServerCanvas::canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1129,7 +1129,7 @@ void VisualServerCanvas::canvas_light_set_mode(RID p_light, VS::CanvasLightMode
clight->mode = p_mode;
}
-void VisualServerCanvas::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) {
+void RenderingServerCanvas::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1139,10 +1139,10 @@ void VisualServerCanvas::canvas_light_set_shadow_enabled(RID p_light, bool p_ena
}
clight->use_shadow = p_enabled;
clight->version++;
- VSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
+ RSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
}
-void VisualServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_size) {
+void RenderingServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_size) {
ERR_FAIL_COND(p_size < 32 || p_size > 16384);
@@ -1156,17 +1156,17 @@ void VisualServerCanvas::canvas_light_set_shadow_buffer_size(RID p_light, int p_
clight->shadow_buffer_size = next_power_of_2(p_size);
clight->version++;
- VSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
+ RSG::canvas_render->light_set_use_shadow(clight->light_internal, clight->use_shadow, clight->shadow_buffer_size);
}
-void VisualServerCanvas::canvas_light_set_shadow_filter(RID p_light, VS::CanvasLightShadowFilter p_filter) {
+void RenderingServerCanvas::canvas_light_set_shadow_filter(RID p_light, RS::CanvasLightShadowFilter p_filter) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->shadow_filter = p_filter;
}
-void VisualServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color &p_color) {
+void RenderingServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color &p_color) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
@@ -1174,20 +1174,20 @@ void VisualServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color
clight->shadow_color = p_color;
}
-void VisualServerCanvas::canvas_light_set_shadow_smooth(RID p_light, float p_smooth) {
+void RenderingServerCanvas::canvas_light_set_shadow_smooth(RID p_light, float p_smooth) {
RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light);
ERR_FAIL_COND(!clight);
clight->shadow_smooth = p_smooth;
}
-RID VisualServerCanvas::canvas_light_occluder_create() {
+RID RenderingServerCanvas::canvas_light_occluder_create() {
RasterizerCanvas::LightOccluderInstance *occluder = memnew(RasterizerCanvas::LightOccluderInstance);
return canvas_light_occluder_owner.make_rid(occluder);
}
-void VisualServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) {
+void RenderingServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) {
RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
ERR_FAIL_COND(!occluder);
@@ -1209,14 +1209,14 @@ void VisualServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder,
canvas->occluders.insert(occluder);
}
}
-void VisualServerCanvas::canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) {
+void RenderingServerCanvas::canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) {
RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
ERR_FAIL_COND(!occluder);
occluder->enabled = p_enabled;
}
-void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) {
+void RenderingServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) {
RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
ERR_FAIL_COND(!occluder);
@@ -1244,14 +1244,14 @@ void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p
}
}
}
-void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
+void RenderingServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
ERR_FAIL_COND(!occluder);
occluder->xform = p_xform;
}
-void VisualServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) {
+void RenderingServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) {
RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
ERR_FAIL_COND(!occluder);
@@ -1259,13 +1259,13 @@ void VisualServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder, in
occluder->light_mask = p_mask;
}
-RID VisualServerCanvas::canvas_occluder_polygon_create() {
+RID RenderingServerCanvas::canvas_occluder_polygon_create() {
LightOccluderPolygon *occluder_poly = memnew(LightOccluderPolygon);
- occluder_poly->occluder = VSG::canvas_render->occluder_polygon_create();
+ occluder_poly->occluder = RSG::canvas_render->occluder_polygon_create();
return canvas_light_occluder_polygon_owner.make_rid(occluder_poly);
}
-void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) {
+void RenderingServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) {
if (p_shape.size() < 3) {
canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, p_shape);
@@ -1295,7 +1295,7 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygo
canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, lines);
}
-void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) {
+void RenderingServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) {
LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon);
ERR_FAIL_COND(!occluder_poly);
@@ -1313,24 +1313,24 @@ void VisualServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occlud
}
}
- VSG::canvas_render->occluder_polygon_set_shape_as_lines(occluder_poly->occluder, p_shape);
+ RSG::canvas_render->occluder_polygon_set_shape_as_lines(occluder_poly->occluder, p_shape);
for (Set<RasterizerCanvas::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) {
E->get()->aabb_cache = occluder_poly->aabb;
}
}
-void VisualServerCanvas::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, VS::CanvasOccluderPolygonCullMode p_mode) {
+void RenderingServerCanvas::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, RS::CanvasOccluderPolygonCullMode p_mode) {
LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon);
ERR_FAIL_COND(!occluder_poly);
occluder_poly->cull_mode = p_mode;
- VSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, p_mode);
+ RSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, p_mode);
for (Set<RasterizerCanvas::LightOccluderInstance *>::Element *E = occluder_poly->owners.front(); E; E = E->next()) {
E->get()->cull_cache = p_mode;
}
}
-bool VisualServerCanvas::free(RID p_rid) {
+bool RenderingServerCanvas::free(RID p_rid) {
if (canvas_owner.owns(p_rid)) {
@@ -1339,10 +1339,10 @@ bool VisualServerCanvas::free(RID p_rid) {
while (canvas->viewports.size()) {
- VisualServerViewport::Viewport *vp = VSG::viewport->viewport_owner.getornull(canvas->viewports.front()->get());
+ RenderingServerViewport::Viewport *vp = RSG::viewport->viewport_owner.getornull(canvas->viewports.front()->get());
ERR_FAIL_COND_V(!vp, true);
- Map<RID, VisualServerViewport::Viewport::CanvasData>::Element *E = vp->canvas_map.find(p_rid);
+ Map<RID, RenderingServerViewport::Viewport::CanvasData>::Element *E = vp->canvas_map.find(p_rid);
ERR_FAIL_COND_V(!E, true);
vp->canvas_map.erase(p_rid);
@@ -1416,7 +1416,7 @@ bool VisualServerCanvas::free(RID p_rid) {
canvas->lights.erase(canvas_light);
}
- VSG::canvas_render->free(canvas_light->light_internal);
+ RSG::canvas_render->free(canvas_light->light_internal);
canvas_light_owner.free(p_rid);
memdelete(canvas_light);
@@ -1447,7 +1447,7 @@ bool VisualServerCanvas::free(RID p_rid) {
LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_rid);
ERR_FAIL_COND_V(!occluder_poly, true);
- VSG::canvas_render->free(occluder_poly->occluder);
+ RSG::canvas_render->free(occluder_poly->occluder);
while (occluder_poly->owners.size()) {
@@ -1464,7 +1464,7 @@ bool VisualServerCanvas::free(RID p_rid) {
return true;
}
-VisualServerCanvas::VisualServerCanvas() {
+RenderingServerCanvas::RenderingServerCanvas() {
z_list = (RasterizerCanvas::Item **)memalloc(z_range * sizeof(RasterizerCanvas::Item *));
z_last_list = (RasterizerCanvas::Item **)memalloc(z_range * sizeof(RasterizerCanvas::Item *));
@@ -1472,7 +1472,7 @@ VisualServerCanvas::VisualServerCanvas() {
disable_scale = false;
}
-VisualServerCanvas::~VisualServerCanvas() {
+RenderingServerCanvas::~RenderingServerCanvas() {
memfree(z_list);
memfree(z_last_list);
diff --git a/servers/visual/visual_server_canvas.h b/servers/rendering/rendering_server_canvas.h
index dea4183752..579bcd36e7 100644
--- a/servers/visual/visual_server_canvas.h
+++ b/servers/rendering/rendering_server_canvas.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_canvas.h */
+/* rendering_server_canvas.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -32,9 +32,9 @@
#define VISUALSERVERCANVAS_H
#include "rasterizer.h"
-#include "visual_server_viewport.h"
+#include "rendering_server_viewport.h"
-class VisualServerCanvas {
+class RenderingServerCanvas {
public:
struct Item : public RasterizerCanvas::Item {
@@ -52,8 +52,8 @@ public:
Color ysort_modulate;
Transform2D ysort_xform;
Vector2 ysort_pos;
- VS::CanvasItemTextureFilter texture_filter;
- VS::CanvasItemTextureRepeat texture_repeat;
+ RS::CanvasItemTextureFilter texture_filter;
+ RS::CanvasItemTextureRepeat texture_repeat;
Vector<Item *> child_items;
@@ -70,8 +70,8 @@ public:
ysort_children_count = -1;
ysort_xform = Transform2D();
ysort_pos = Vector2();
- texture_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
- texture_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
+ texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT;
+ texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT;
}
};
@@ -98,13 +98,13 @@ public:
bool active;
Rect2 aabb;
- VS::CanvasOccluderPolygonCullMode cull_mode;
+ RS::CanvasOccluderPolygonCullMode cull_mode;
RID occluder;
Set<RasterizerCanvas::LightOccluderInstance *> owners;
LightOccluderPolygon() {
active = false;
- cull_mode = VS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
+ cull_mode = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
}
};
@@ -112,7 +112,7 @@ public:
RID_PtrOwner<RasterizerCanvas::LightOccluderInstance> canvas_light_occluder_owner;
- struct Canvas : public VisualServerViewport::CanvasBase {
+ struct Canvas : public RenderingServerViewport::CanvasBase {
Set<RID> viewports;
struct ChildItem {
@@ -194,23 +194,23 @@ public:
void canvas_item_set_update_when_visible(RID p_item, bool p_update);
- void canvas_item_set_default_texture_filter(RID p_item, VS::CanvasItemTextureFilter p_filter);
- void canvas_item_set_default_texture_repeat(RID p_item, VS::CanvasItemTextureRepeat p_repeat);
+ void canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter);
+ void canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat);
void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0);
void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0);
void canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0);
void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color);
void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color);
- void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), bool p_clip_uv = false, VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode = VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode = VS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
- void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), VS::CanvasItemTextureFilter p_filter = VS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, VS::CanvasItemTextureRepeat p_repeat = VS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), bool p_clip_uv = false, RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode = RS::NINE_PATCH_STRETCH, RS::NinePatchAxisMode p_y_axis_mode = RS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform = Transform2D(), const Color &p_modulate = Color(1, 1, 1), RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID(), RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
+ void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map = RID(), const Color &p_specular_color_shininess = Color(), RS::CanvasItemTextureFilter p_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, RS::CanvasItemTextureRepeat p_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT);
void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform);
void canvas_item_add_clip_ignore(RID p_item, bool p_ignore);
void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable);
@@ -241,11 +241,11 @@ public:
void canvas_light_set_item_cull_mask(RID p_light, int p_mask);
void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask);
- void canvas_light_set_mode(RID p_light, VS::CanvasLightMode p_mode);
+ void canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode);
void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled);
void canvas_light_set_shadow_buffer_size(RID p_light, int p_size);
- void canvas_light_set_shadow_filter(RID p_light, VS::CanvasLightShadowFilter p_filter);
+ void canvas_light_set_shadow_filter(RID p_light, RS::CanvasLightShadowFilter p_filter);
void canvas_light_set_shadow_color(RID p_light, const Color &p_color);
void canvas_light_set_shadow_smooth(RID p_light, float p_smooth);
@@ -260,11 +260,11 @@ public:
void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed);
void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape);
- void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, VS::CanvasOccluderPolygonCullMode p_mode);
+ void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, RS::CanvasOccluderPolygonCullMode p_mode);
bool free(RID p_rid);
- VisualServerCanvas();
- ~VisualServerCanvas();
+ RenderingServerCanvas();
+ ~RenderingServerCanvas();
};
#endif // VISUALSERVERCANVAS_H
diff --git a/servers/visual/visual_server_globals.cpp b/servers/rendering/rendering_server_globals.cpp
index 248d27e08a..60183956e0 100644
--- a/servers/visual/visual_server_globals.cpp
+++ b/servers/rendering/rendering_server_globals.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_globals.cpp */
+/* rendering_server_globals.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,13 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_globals.h"
+#include "rendering_server_globals.h"
-RasterizerStorage *VisualServerGlobals::storage = NULL;
-RasterizerCanvas *VisualServerGlobals::canvas_render = NULL;
-RasterizerScene *VisualServerGlobals::scene_render = NULL;
-Rasterizer *VisualServerGlobals::rasterizer = NULL;
+RasterizerStorage *RenderingServerGlobals::storage = NULL;
+RasterizerCanvas *RenderingServerGlobals::canvas_render = NULL;
+RasterizerScene *RenderingServerGlobals::scene_render = NULL;
+Rasterizer *RenderingServerGlobals::rasterizer = NULL;
-VisualServerCanvas *VisualServerGlobals::canvas = NULL;
-VisualServerViewport *VisualServerGlobals::viewport = NULL;
-VisualServerScene *VisualServerGlobals::scene = NULL;
+RenderingServerCanvas *RenderingServerGlobals::canvas = NULL;
+RenderingServerViewport *RenderingServerGlobals::viewport = NULL;
+RenderingServerScene *RenderingServerGlobals::scene = NULL;
diff --git a/servers/visual/visual_server_globals.h b/servers/rendering/rendering_server_globals.h
index 5a9d365eca..79abc55fea 100644
--- a/servers/visual/visual_server_globals.h
+++ b/servers/rendering/rendering_server_globals.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_globals.h */
+/* rendering_server_globals.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,27 +28,27 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUAL_SERVER_GLOBALS_H
-#define VISUAL_SERVER_GLOBALS_H
+#ifndef RENDERING_SERVER_GLOBALS_H
+#define RENDERING_SERVER_GLOBALS_H
#include "rasterizer.h"
-class VisualServerCanvas;
-class VisualServerViewport;
-class VisualServerScene;
+class RenderingServerCanvas;
+class RenderingServerViewport;
+class RenderingServerScene;
-class VisualServerGlobals {
+class RenderingServerGlobals {
public:
static RasterizerStorage *storage;
static RasterizerCanvas *canvas_render;
static RasterizerScene *scene_render;
static Rasterizer *rasterizer;
- static VisualServerCanvas *canvas;
- static VisualServerViewport *viewport;
- static VisualServerScene *scene;
+ static RenderingServerCanvas *canvas;
+ static RenderingServerViewport *viewport;
+ static RenderingServerScene *scene;
};
-#define VSG VisualServerGlobals
+#define RSG RenderingServerGlobals
-#endif // VISUAL_SERVER_GLOBALS_H
+#endif // RENDERING_SERVER_GLOBALS_H
diff --git a/servers/visual/visual_server_raster.cpp b/servers/rendering/rendering_server_raster.cpp
index 1026972a62..9b769b46fc 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/rendering/rendering_server_raster.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_raster.cpp */
+/* rendering_server_raster.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,23 +28,23 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_raster.h"
+#include "rendering_server_raster.h"
#include "core/io/marshalls.h"
#include "core/os/os.h"
#include "core/project_settings.h"
#include "core/sort_array.h"
-#include "visual_server_canvas.h"
-#include "visual_server_globals.h"
-#include "visual_server_scene.h"
+#include "rendering_server_canvas.h"
+#include "rendering_server_globals.h"
+#include "rendering_server_scene.h"
// careful, these may run in different threads than the visual server
-int VisualServerRaster::changes = 0;
+int RenderingServerRaster::changes = 0;
/* BLACK BARS */
-void VisualServerRaster::black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) {
+void RenderingServerRaster::black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) {
black_margin[MARGIN_LEFT] = p_left;
black_margin[MARGIN_TOP] = p_top;
@@ -52,7 +52,7 @@ void VisualServerRaster::black_bars_set_margins(int p_left, int p_top, int p_rig
black_margin[MARGIN_BOTTOM] = p_bottom;
}
-void VisualServerRaster::black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) {
+void RenderingServerRaster::black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) {
black_image[MARGIN_LEFT] = p_left;
black_image[MARGIN_TOP] = p_top;
@@ -60,30 +60,30 @@ void VisualServerRaster::black_bars_set_images(RID p_left, RID p_top, RID p_righ
black_image[MARGIN_BOTTOM] = p_bottom;
}
-void VisualServerRaster::_draw_margins() {
+void RenderingServerRaster::_draw_margins() {
- VSG::canvas_render->draw_window_margins(black_margin, black_image);
+ RSG::canvas_render->draw_window_margins(black_margin, black_image);
};
/* FREE */
-void VisualServerRaster::free(RID p_rid) {
+void RenderingServerRaster::free(RID p_rid) {
- if (VSG::storage->free(p_rid))
+ if (RSG::storage->free(p_rid))
return;
- if (VSG::canvas->free(p_rid))
+ if (RSG::canvas->free(p_rid))
return;
- if (VSG::viewport->free(p_rid))
+ if (RSG::viewport->free(p_rid))
return;
- if (VSG::scene->free(p_rid))
+ if (RSG::scene->free(p_rid))
return;
- if (VSG::scene_render->free(p_rid))
+ if (RSG::scene_render->free(p_rid))
return;
}
/* EVENT QUEUING */
-void VisualServerRaster::request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata) {
+void RenderingServerRaster::request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata) {
ERR_FAIL_NULL(p_where);
FrameDrawnCallbacks fdc;
@@ -94,27 +94,27 @@ void VisualServerRaster::request_frame_drawn_callback(Object *p_where, const Str
frame_drawn_callbacks.push_back(fdc);
}
-void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
+void RenderingServerRaster::draw(bool p_swap_buffers, double frame_step) {
//needs to be done before changes is reset to 0, to not force the editor to redraw
- VS::get_singleton()->emit_signal("frame_pre_draw");
+ RS::get_singleton()->emit_signal("frame_pre_draw");
changes = 0;
- VSG::rasterizer->begin_frame(frame_step);
+ RSG::rasterizer->begin_frame(frame_step);
TIMESTAMP_BEGIN()
- VSG::scene_render->update(); //update scenes stuff before updating instances
+ RSG::scene_render->update(); //update scenes stuff before updating instances
- VSG::scene->update_dirty_instances(); //update scene stuff
+ RSG::scene->update_dirty_instances(); //update scene stuff
- VSG::scene->render_probes();
- VSG::viewport->draw_viewports();
- VSG::canvas_render->update();
+ RSG::scene->render_probes();
+ RSG::viewport->draw_viewports();
+ RSG::canvas_render->update();
_draw_margins();
- VSG::rasterizer->end_frame(p_swap_buffers);
+ RSG::rasterizer->end_frame(p_swap_buffers);
while (frame_drawn_callbacks.front()) {
@@ -131,128 +131,128 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
frame_drawn_callbacks.pop_front();
}
- VS::get_singleton()->emit_signal("frame_post_draw");
+ RS::get_singleton()->emit_signal("frame_post_draw");
- if (VSG::storage->get_captured_timestamps_count()) {
+ if (RSG::storage->get_captured_timestamps_count()) {
Vector<FrameProfileArea> new_profile;
- new_profile.resize(VSG::storage->get_captured_timestamps_count());
+ new_profile.resize(RSG::storage->get_captured_timestamps_count());
- uint64_t base_cpu = VSG::storage->get_captured_timestamp_cpu_time(0);
- uint64_t base_gpu = VSG::storage->get_captured_timestamp_gpu_time(0);
- for (uint32_t i = 0; i < VSG::storage->get_captured_timestamps_count(); i++) {
- uint64_t time_cpu = VSG::storage->get_captured_timestamp_cpu_time(i) - base_cpu;
- uint64_t time_gpu = VSG::storage->get_captured_timestamp_gpu_time(i) - base_gpu;
+ uint64_t base_cpu = RSG::storage->get_captured_timestamp_cpu_time(0);
+ uint64_t base_gpu = RSG::storage->get_captured_timestamp_gpu_time(0);
+ for (uint32_t i = 0; i < RSG::storage->get_captured_timestamps_count(); i++) {
+ uint64_t time_cpu = RSG::storage->get_captured_timestamp_cpu_time(i) - base_cpu;
+ uint64_t time_gpu = RSG::storage->get_captured_timestamp_gpu_time(i) - base_gpu;
new_profile.write[i].gpu_msec = float(time_gpu / 1000) / 1000.0;
new_profile.write[i].cpu_msec = float(time_cpu) / 1000.0;
- new_profile.write[i].name = VSG::storage->get_captured_timestamp_name(i);
+ new_profile.write[i].name = RSG::storage->get_captured_timestamp_name(i);
}
frame_profile = new_profile;
}
- frame_profile_frame = VSG::storage->get_captured_timestamps_frame();
+ frame_profile_frame = RSG::storage->get_captured_timestamps_frame();
}
-void VisualServerRaster::sync() {
+void RenderingServerRaster::sync() {
}
-bool VisualServerRaster::has_changed() const {
+bool RenderingServerRaster::has_changed() const {
return changes > 0;
}
-void VisualServerRaster::init() {
+void RenderingServerRaster::init() {
- VSG::rasterizer->initialize();
+ RSG::rasterizer->initialize();
}
-void VisualServerRaster::finish() {
+void RenderingServerRaster::finish() {
if (test_cube.is_valid()) {
free(test_cube);
}
- VSG::rasterizer->finalize();
+ RSG::rasterizer->finalize();
}
/* STATUS INFORMATION */
-int VisualServerRaster::get_render_info(RenderInfo p_info) {
+int RenderingServerRaster::get_render_info(RenderInfo p_info) {
- return VSG::storage->get_render_info(p_info);
+ return RSG::storage->get_render_info(p_info);
}
-String VisualServerRaster::get_video_adapter_name() const {
+String RenderingServerRaster::get_video_adapter_name() const {
- return VSG::storage->get_video_adapter_name();
+ return RSG::storage->get_video_adapter_name();
}
-String VisualServerRaster::get_video_adapter_vendor() const {
+String RenderingServerRaster::get_video_adapter_vendor() const {
- return VSG::storage->get_video_adapter_vendor();
+ return RSG::storage->get_video_adapter_vendor();
}
-void VisualServerRaster::set_frame_profiling_enabled(bool p_enable) {
- VSG::storage->capturing_timestamps = p_enable;
+void RenderingServerRaster::set_frame_profiling_enabled(bool p_enable) {
+ RSG::storage->capturing_timestamps = p_enable;
}
-uint64_t VisualServerRaster::get_frame_profile_frame() {
+uint64_t RenderingServerRaster::get_frame_profile_frame() {
return frame_profile_frame;
}
-Vector<VisualServer::FrameProfileArea> VisualServerRaster::get_frame_profile() {
+Vector<RenderingServer::FrameProfileArea> RenderingServerRaster::get_frame_profile() {
return frame_profile;
}
/* TESTING */
-void VisualServerRaster::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) {
+void RenderingServerRaster::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) {
redraw_request();
- VSG::rasterizer->set_boot_image(p_image, p_color, p_scale, p_use_filter);
+ RSG::rasterizer->set_boot_image(p_image, p_color, p_scale, p_use_filter);
}
-void VisualServerRaster::set_default_clear_color(const Color &p_color) {
- VSG::viewport->set_default_clear_color(p_color);
+void RenderingServerRaster::set_default_clear_color(const Color &p_color) {
+ RSG::viewport->set_default_clear_color(p_color);
}
-bool VisualServerRaster::has_feature(Features p_feature) const {
+bool RenderingServerRaster::has_feature(Features p_feature) const {
return false;
}
-RID VisualServerRaster::get_test_cube() {
+RID RenderingServerRaster::get_test_cube() {
if (!test_cube.is_valid()) {
test_cube = _make_test_cube();
}
return test_cube;
}
-bool VisualServerRaster::has_os_feature(const String &p_feature) const {
+bool RenderingServerRaster::has_os_feature(const String &p_feature) const {
- return VSG::storage->has_os_feature(p_feature);
+ return RSG::storage->has_os_feature(p_feature);
}
-void VisualServerRaster::set_debug_generate_wireframes(bool p_generate) {
+void RenderingServerRaster::set_debug_generate_wireframes(bool p_generate) {
- VSG::storage->set_debug_generate_wireframes(p_generate);
+ RSG::storage->set_debug_generate_wireframes(p_generate);
}
-void VisualServerRaster::call_set_use_vsync(bool p_enable) {
+void RenderingServerRaster::call_set_use_vsync(bool p_enable) {
DisplayServer::get_singleton()->_set_use_vsync(p_enable);
}
-bool VisualServerRaster::is_low_end() const {
+bool RenderingServerRaster::is_low_end() const {
// FIXME: Commented out when rebasing vulkan branch on master,
// causes a crash, it seems rasterizer is not initialized yet the
// first time it's called.
- //return VSG::rasterizer->is_low_end();
+ //return RSG::rasterizer->is_low_end();
return false;
}
-VisualServerRaster::VisualServerRaster() {
+RenderingServerRaster::RenderingServerRaster() {
- VSG::canvas = memnew(VisualServerCanvas);
- VSG::viewport = memnew(VisualServerViewport);
- VSG::scene = memnew(VisualServerScene);
- VSG::rasterizer = Rasterizer::create();
- VSG::storage = VSG::rasterizer->get_storage();
- VSG::canvas_render = VSG::rasterizer->get_canvas();
- VSG::scene_render = VSG::rasterizer->get_scene();
+ RSG::canvas = memnew(RenderingServerCanvas);
+ RSG::viewport = memnew(RenderingServerViewport);
+ RSG::scene = memnew(RenderingServerScene);
+ RSG::rasterizer = Rasterizer::create();
+ RSG::storage = RSG::rasterizer->get_storage();
+ RSG::canvas_render = RSG::rasterizer->get_canvas();
+ RSG::scene_render = RSG::rasterizer->get_scene();
frame_profile_frame = 0;
@@ -262,10 +262,10 @@ VisualServerRaster::VisualServerRaster() {
}
}
-VisualServerRaster::~VisualServerRaster() {
+RenderingServerRaster::~RenderingServerRaster() {
- memdelete(VSG::canvas);
- memdelete(VSG::viewport);
- memdelete(VSG::rasterizer);
- memdelete(VSG::scene);
+ memdelete(RSG::canvas);
+ memdelete(RSG::viewport);
+ memdelete(RSG::rasterizer);
+ memdelete(RSG::scene);
}
diff --git a/servers/visual/visual_server_raster.h b/servers/rendering/rendering_server_raster.h
index 1a40fc96a2..24fbe4577a 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/rendering/rendering_server_raster.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_raster.h */
+/* rendering_server_raster.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,18 +28,18 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUAL_SERVER_RASTER_H
-#define VISUAL_SERVER_RASTER_H
+#ifndef RENDERING_SERVER_RASTER_H
+#define RENDERING_SERVER_RASTER_H
#include "core/math/octree.h"
-#include "servers/visual/rasterizer.h"
-#include "servers/visual_server.h"
-#include "visual_server_canvas.h"
-#include "visual_server_globals.h"
-#include "visual_server_scene.h"
-#include "visual_server_viewport.h"
+#include "rendering_server_canvas.h"
+#include "rendering_server_globals.h"
+#include "rendering_server_scene.h"
+#include "rendering_server_viewport.h"
+#include "servers/rendering/rasterizer.h"
+#include "servers/rendering_server.h"
-class VisualServerRaster : public VisualServer {
+class RenderingServerRaster : public RenderingServer {
enum {
@@ -145,7 +145,7 @@ public:
void m_name(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12, m_type13 arg13, m_type14 arg14, m_type15 arg15) { DISPLAY_CHANGED BINDBASE->m_name(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); }
//from now on, calls forwarded to this singleton
-#define BINDBASE VSG::storage
+#define BINDBASE RSG::storage
/* TEXTURE API */
@@ -424,7 +424,7 @@ public:
BIND1(particles_request_process, RID)
BIND1(particles_restart, RID)
- BIND2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
+ BIND2(particles_set_draw_order, RID, RS::ParticlesDrawOrder)
BIND2(particles_set_draw_passes, RID, int)
BIND3(particles_set_draw_pass_mesh, RID, int, RID)
@@ -434,7 +434,7 @@ public:
#undef BINDBASE
//from now on, calls forwarded to this singleton
-#define BINDBASE VSG::scene
+#define BINDBASE RSG::scene
/* CAMERA API */
@@ -450,7 +450,7 @@ public:
#undef BINDBASE
//from now on, calls forwarded to this singleton
-#define BINDBASE VSG::viewport
+#define BINDBASE RSG::viewport
/* VIEWPORT TARGET API */
@@ -497,7 +497,7 @@ public:
#undef BINDBASE
//from now on, calls forwarded to this singleton
-#define BINDBASE VSG::scene_render
+#define BINDBASE RSG::scene_render
BIND1(directional_shadow_atlas_set_size, int)
@@ -552,7 +552,7 @@ public:
/* SCENARIO API */
#undef BINDBASE
-#define BINDBASE VSG::scene
+#define BINDBASE RSG::scene
BIND0R(RID, scenario_create)
@@ -595,7 +595,7 @@ public:
#undef BINDBASE
//from now on, calls forwarded to this singleton
-#define BINDBASE VSG::canvas
+#define BINDBASE RSG::canvas
/* CANVAS (2D) */
@@ -735,8 +735,8 @@ public:
virtual bool is_low_end() const;
- VisualServerRaster();
- ~VisualServerRaster();
+ RenderingServerRaster();
+ ~RenderingServerRaster();
#undef DISPLAY_CHANGED
diff --git a/servers/visual/visual_server_scene.cpp b/servers/rendering/rendering_server_scene.cpp
index 1a9ecae23a..0530846e95 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/rendering/rendering_server_scene.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_scene.cpp */
+/* rendering_server_scene.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,23 +28,23 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_scene.h"
+#include "rendering_server_scene.h"
#include "core/os/os.h"
-#include "visual_server_globals.h"
-#include "visual_server_raster.h"
+#include "rendering_server_globals.h"
+#include "rendering_server_raster.h"
#include <new>
/* CAMERA API */
-RID VisualServerScene::camera_create() {
+RID RenderingServerScene::camera_create() {
Camera *camera = memnew(Camera);
return camera_owner.make_rid(camera);
}
-void VisualServerScene::camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far) {
+void RenderingServerScene::camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
@@ -54,7 +54,7 @@ void VisualServerScene::camera_set_perspective(RID p_camera, float p_fovy_degree
camera->zfar = p_z_far;
}
-void VisualServerScene::camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) {
+void RenderingServerScene::camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
@@ -64,7 +64,7 @@ void VisualServerScene::camera_set_orthogonal(RID p_camera, float p_size, float
camera->zfar = p_z_far;
}
-void VisualServerScene::camera_set_frustum(RID p_camera, float p_size, Vector2 p_offset, float p_z_near, float p_z_far) {
+void RenderingServerScene::camera_set_frustum(RID p_camera, float p_size, Vector2 p_offset, float p_z_near, float p_z_far) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
camera->type = Camera::FRUSTUM;
@@ -74,14 +74,14 @@ void VisualServerScene::camera_set_frustum(RID p_camera, float p_size, Vector2 p
camera->zfar = p_z_far;
}
-void VisualServerScene::camera_set_transform(RID p_camera, const Transform &p_transform) {
+void RenderingServerScene::camera_set_transform(RID p_camera, const Transform &p_transform) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
camera->transform = p_transform.orthonormalized();
}
-void VisualServerScene::camera_set_cull_mask(RID p_camera, uint32_t p_layers) {
+void RenderingServerScene::camera_set_cull_mask(RID p_camera, uint32_t p_layers) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
@@ -89,21 +89,21 @@ void VisualServerScene::camera_set_cull_mask(RID p_camera, uint32_t p_layers) {
camera->visible_layers = p_layers;
}
-void VisualServerScene::camera_set_environment(RID p_camera, RID p_env) {
+void RenderingServerScene::camera_set_environment(RID p_camera, RID p_env) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
camera->env = p_env;
}
-void VisualServerScene::camera_set_camera_effects(RID p_camera, RID p_fx) {
+void RenderingServerScene::camera_set_camera_effects(RID p_camera, RID p_fx) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
camera->effects = p_fx;
}
-void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera, bool p_enable) {
+void RenderingServerScene::camera_set_use_vertical_aspect(RID p_camera, bool p_enable) {
Camera *camera = camera_owner.getornull(p_camera);
ERR_FAIL_COND(!camera);
@@ -112,9 +112,9 @@ void VisualServerScene::camera_set_use_vertical_aspect(RID p_camera, bool p_enab
/* SCENARIO API */
-void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int) {
+void *RenderingServerScene::_instance_pair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int) {
- //VisualServerScene *self = (VisualServerScene*)p_self;
+ //RenderingServerScene *self = (RenderingServerScene*)p_self;
Instance *A = p_A;
Instance *B = p_B;
@@ -123,7 +123,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
SWAP(A, B); //lesser always first
}
- if (B->base_type == VS::INSTANCE_LIGHT && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ if (B->base_type == RS::INSTANCE_LIGHT && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceLightData *light = static_cast<InstanceLightData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -141,7 +141,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
geom->lighting_dirty = true;
return E; //this element should make freeing faster
- } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -155,7 +155,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
geom->reflection_dirty = true;
return E; //this element should make freeing faster
- } else if (B->base_type == VS::INSTANCE_LIGHTMAP_CAPTURE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_LIGHTMAP_CAPTURE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -165,10 +165,10 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
pinfo.L = geom->lightmap_captures.push_back(B);
List<InstanceLightmapCaptureData::PairInfo>::Element *E = lightmap_capture->geometries.push_back(pinfo);
- ((VisualServerScene *)p_self)->_instance_queue_update(A, false, false); //need to update capture
+ ((RenderingServerScene *)p_self)->_instance_queue_update(A, false, false); //need to update capture
return E; //this element should make freeing faster
- } else if (B->base_type == VS::INSTANCE_GI_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_GI_PROBE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -188,7 +188,7 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
return E; //this element should make freeing faster
- } else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
+ } else if (B->base_type == RS::INSTANCE_GI_PROBE && A->base_type == RS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
return gi_probe->lights.insert(A);
@@ -196,9 +196,9 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
return NULL;
}
-void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *udata) {
+void RenderingServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *udata) {
- //VisualServerScene *self = (VisualServerScene*)p_self;
+ //RenderingServerScene *self = (RenderingServerScene*)p_self;
Instance *A = p_A;
Instance *B = p_B;
@@ -207,7 +207,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
SWAP(A, B); //lesser always first
}
- if (B->base_type == VS::INSTANCE_LIGHT && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ if (B->base_type == RS::INSTANCE_LIGHT && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceLightData *light = static_cast<InstanceLightData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -222,7 +222,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
}
geom->lighting_dirty = true;
- } else if (B->base_type == VS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_REFLECTION_PROBE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -233,7 +233,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
reflection_probe->geometries.erase(E);
geom->reflection_dirty = true;
- } else if (B->base_type == VS::INSTANCE_LIGHTMAP_CAPTURE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_LIGHTMAP_CAPTURE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -242,9 +242,9 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
geom->lightmap_captures.erase(E->get().L);
lightmap_capture->geometries.erase(E);
- ((VisualServerScene *)p_self)->_instance_queue_update(A, false, false); //need to update capture
+ ((RenderingServerScene *)p_self)->_instance_queue_update(A, false, false); //need to update capture
- } else if (B->base_type == VS::INSTANCE_GI_PROBE && ((1 << A->base_type) & VS::INSTANCE_GEOMETRY_MASK)) {
+ } else if (B->base_type == RS::INSTANCE_GI_PROBE && ((1 << A->base_type) & RS::INSTANCE_GEOMETRY_MASK)) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(A->base_data);
@@ -260,7 +260,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
geom->gi_probes_dirty = true;
- } else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
+ } else if (B->base_type == RS::INSTANCE_GI_PROBE && A->base_type == RS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
Set<Instance *>::Element *E = reinterpret_cast<Set<Instance *>::Element *>(udata);
@@ -269,7 +269,7 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
}
}
-RID VisualServerScene::scenario_create() {
+RID RenderingServerScene::scenario_create() {
Scenario *scenario = memnew(Scenario);
ERR_FAIL_COND_V(!scenario, RID());
@@ -278,54 +278,54 @@ RID VisualServerScene::scenario_create() {
scenario->octree.set_pair_callback(_instance_pair, this);
scenario->octree.set_unpair_callback(_instance_unpair, this);
- scenario->reflection_probe_shadow_atlas = VSG::scene_render->shadow_atlas_create();
- VSG::scene_render->shadow_atlas_set_size(scenario->reflection_probe_shadow_atlas, 1024); //make enough shadows for close distance, don't bother with rest
- VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 0, 4);
- VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 1, 4);
- VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 2, 4);
- VSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 3, 8);
- scenario->reflection_atlas = VSG::scene_render->reflection_atlas_create();
+ scenario->reflection_probe_shadow_atlas = RSG::scene_render->shadow_atlas_create();
+ RSG::scene_render->shadow_atlas_set_size(scenario->reflection_probe_shadow_atlas, 1024); //make enough shadows for close distance, don't bother with rest
+ RSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 0, 4);
+ RSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 1, 4);
+ RSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 2, 4);
+ RSG::scene_render->shadow_atlas_set_quadrant_subdivision(scenario->reflection_probe_shadow_atlas, 3, 8);
+ scenario->reflection_atlas = RSG::scene_render->reflection_atlas_create();
return scenario_rid;
}
-void VisualServerScene::scenario_set_debug(RID p_scenario, VS::ScenarioDebugMode p_debug_mode) {
+void RenderingServerScene::scenario_set_debug(RID p_scenario, RS::ScenarioDebugMode p_debug_mode) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND(!scenario);
scenario->debug = p_debug_mode;
}
-void VisualServerScene::scenario_set_environment(RID p_scenario, RID p_environment) {
+void RenderingServerScene::scenario_set_environment(RID p_scenario, RID p_environment) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND(!scenario);
scenario->environment = p_environment;
}
-void VisualServerScene::scenario_set_camera_effects(RID p_scenario, RID p_camera_effects) {
+void RenderingServerScene::scenario_set_camera_effects(RID p_scenario, RID p_camera_effects) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND(!scenario);
scenario->camera_effects = p_camera_effects;
}
-void VisualServerScene::scenario_set_fallback_environment(RID p_scenario, RID p_environment) {
+void RenderingServerScene::scenario_set_fallback_environment(RID p_scenario, RID p_environment) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND(!scenario);
scenario->fallback_environment = p_environment;
}
-void VisualServerScene::scenario_set_reflection_atlas_size(RID p_scenario, int p_reflection_size, int p_reflection_count) {
+void RenderingServerScene::scenario_set_reflection_atlas_size(RID p_scenario, int p_reflection_size, int p_reflection_count) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND(!scenario);
- VSG::scene_render->reflection_atlas_set_size(scenario->reflection_atlas, p_reflection_size, p_reflection_count);
+ RSG::scene_render->reflection_atlas_set_size(scenario->reflection_atlas, p_reflection_size, p_reflection_count);
}
/* INSTANCING API */
-void VisualServerScene::_instance_queue_update(Instance *p_instance, bool p_update_aabb, bool p_update_dependencies) {
+void RenderingServerScene::_instance_queue_update(Instance *p_instance, bool p_update_aabb, bool p_update_dependencies) {
if (p_update_aabb)
p_instance->update_aabb = true;
@@ -338,7 +338,7 @@ void VisualServerScene::_instance_queue_update(Instance *p_instance, bool p_upda
_instance_update_list.add(&p_instance->update_item);
}
-RID VisualServerScene::instance_create() {
+RID RenderingServerScene::instance_create() {
Instance *instance = memnew(Instance);
ERR_FAIL_COND_V(!instance, RID());
@@ -349,14 +349,14 @@ RID VisualServerScene::instance_create() {
return instance_rid;
}
-void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
+void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
Scenario *scenario = instance->scenario;
- if (instance->base_type != VS::INSTANCE_NONE) {
+ if (instance->base_type != RS::INSTANCE_NONE) {
//free anything related to that base
if (scenario && instance->octree_id) {
@@ -365,7 +365,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
}
switch (instance->base_type) {
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data);
#ifdef DEBUG_ENABLED
@@ -377,17 +377,17 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
instance->scenario->directional_lights.erase(light->D);
light->D = NULL;
}
- VSG::scene_render->free(light->instance);
+ RSG::scene_render->free(light->instance);
} break;
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(instance->base_data);
- VSG::scene_render->free(reflection_probe->instance);
+ RSG::scene_render->free(reflection_probe->instance);
if (reflection_probe->update_list.in_list()) {
reflection_probe_render_list.remove(&reflection_probe->update_list);
}
} break;
- case VS::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RS::INSTANCE_LIGHTMAP_CAPTURE: {
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(instance->base_data);
//erase dependencies, since no longer a lightmap
@@ -395,7 +395,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
instance_set_use_lightmap(lightmap_capture->users.front()->get()->self, RID(), RID());
}
} break;
- case VS::INSTANCE_GI_PROBE: {
+ case RS::INSTANCE_GI_PROBE: {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(instance->base_data);
#ifdef DEBUG_ENABLED
@@ -420,7 +420,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
instance->lightmap = RID();
}
- VSG::scene_render->free(gi_probe->probe_instance);
+ RSG::scene_render->free(gi_probe->probe_instance);
} break;
default: {
@@ -436,53 +436,53 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
instance->materials.clear();
}
- instance->base_type = VS::INSTANCE_NONE;
+ instance->base_type = RS::INSTANCE_NONE;
instance->base = RID();
if (p_base.is_valid()) {
- instance->base_type = VSG::storage->get_base_type(p_base);
- ERR_FAIL_COND(instance->base_type == VS::INSTANCE_NONE);
+ instance->base_type = RSG::storage->get_base_type(p_base);
+ ERR_FAIL_COND(instance->base_type == RS::INSTANCE_NONE);
switch (instance->base_type) {
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
InstanceLightData *light = memnew(InstanceLightData);
- if (scenario && VSG::storage->light_get_type(p_base) == VS::LIGHT_DIRECTIONAL) {
+ if (scenario && RSG::storage->light_get_type(p_base) == RS::LIGHT_DIRECTIONAL) {
light->D = scenario->directional_lights.push_back(instance);
}
- light->instance = VSG::scene_render->light_instance_create(p_base);
+ light->instance = RSG::scene_render->light_instance_create(p_base);
instance->base_data = light;
} break;
- case VS::INSTANCE_MESH:
- case VS::INSTANCE_MULTIMESH:
- case VS::INSTANCE_IMMEDIATE:
- case VS::INSTANCE_PARTICLES: {
+ case RS::INSTANCE_MESH:
+ case RS::INSTANCE_MULTIMESH:
+ case RS::INSTANCE_IMMEDIATE:
+ case RS::INSTANCE_PARTICLES: {
InstanceGeometryData *geom = memnew(InstanceGeometryData);
instance->base_data = geom;
- if (instance->base_type == VS::INSTANCE_MESH) {
- instance->blend_values.resize(VSG::storage->mesh_get_blend_shape_count(p_base));
+ if (instance->base_type == RS::INSTANCE_MESH) {
+ instance->blend_values.resize(RSG::storage->mesh_get_blend_shape_count(p_base));
}
} break;
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
InstanceReflectionProbeData *reflection_probe = memnew(InstanceReflectionProbeData);
reflection_probe->owner = instance;
instance->base_data = reflection_probe;
- reflection_probe->instance = VSG::scene_render->reflection_probe_instance_create(p_base);
+ reflection_probe->instance = RSG::scene_render->reflection_probe_instance_create(p_base);
} break;
- case VS::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RS::INSTANCE_LIGHTMAP_CAPTURE: {
InstanceLightmapCaptureData *lightmap_capture = memnew(InstanceLightmapCaptureData);
instance->base_data = lightmap_capture;
- //lightmap_capture->instance = VSG::scene_render->lightmap_capture_instance_create(p_base);
+ //lightmap_capture->instance = RSG::scene_render->lightmap_capture_instance_create(p_base);
} break;
- case VS::INSTANCE_GI_PROBE: {
+ case RS::INSTANCE_GI_PROBE: {
InstanceGIProbeData *gi_probe = memnew(InstanceGIProbeData);
instance->base_data = gi_probe;
@@ -492,7 +492,7 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
gi_probe_update_list.add(&gi_probe->update_element);
}
- gi_probe->probe_instance = VSG::scene_render->gi_probe_instance_create(p_base);
+ gi_probe->probe_instance = RSG::scene_render->gi_probe_instance_create(p_base);
} break;
default: {
@@ -502,12 +502,12 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) {
instance->base = p_base;
//forcefully update the dependency now, so if for some reason it gets removed, we can immediately clear it
- VSG::storage->base_update_dependency(p_base, instance);
+ RSG::storage->base_update_dependency(p_base, instance);
}
_instance_queue_update(instance, true, true);
}
-void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
+void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -523,7 +523,7 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
switch (instance->base_type) {
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data);
#ifdef DEBUG_ENABLED
@@ -536,12 +536,12 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
light->D = NULL;
}
} break;
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(instance->base_data);
- VSG::scene_render->reflection_probe_release_atlas_index(reflection_probe->instance);
+ RSG::scene_render->reflection_probe_release_atlas_index(reflection_probe->instance);
} break;
- case VS::INSTANCE_GI_PROBE: {
+ case RS::INSTANCE_GI_PROBE: {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(instance->base_data);
@@ -578,15 +578,15 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
switch (instance->base_type) {
- case VS::INSTANCE_LIGHT: {
+ case RS::INSTANCE_LIGHT: {
InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data);
- if (VSG::storage->light_get_type(instance->base) == VS::LIGHT_DIRECTIONAL) {
+ if (RSG::storage->light_get_type(instance->base) == RS::LIGHT_DIRECTIONAL) {
light->D = scenario->directional_lights.push_back(instance);
}
} break;
- case VS::INSTANCE_GI_PROBE: {
+ case RS::INSTANCE_GI_PROBE: {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(instance->base_data);
if (!gi_probe->update_element.in_list()) {
@@ -600,14 +600,14 @@ void VisualServerScene::instance_set_scenario(RID p_instance, RID p_scenario) {
_instance_queue_update(instance, true, true);
}
}
-void VisualServerScene::instance_set_layer_mask(RID p_instance, uint32_t p_mask) {
+void RenderingServerScene::instance_set_layer_mask(RID p_instance, uint32_t p_mask) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
instance->layer_mask = p_mask;
}
-void VisualServerScene::instance_set_transform(RID p_instance, const Transform &p_transform) {
+void RenderingServerScene::instance_set_transform(RID p_instance, const Transform &p_transform) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -631,14 +631,14 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform &
instance->transform = p_transform;
_instance_queue_update(instance, true);
}
-void VisualServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_id) {
+void RenderingServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_id) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
instance->object_id = p_id;
}
-void VisualServerScene::instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) {
+void RenderingServerScene::instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -651,14 +651,14 @@ void VisualServerScene::instance_set_blend_shape_weight(RID p_instance, int p_sh
instance->blend_values.write[p_shape] = p_weight;
}
-void VisualServerScene::instance_set_surface_material(RID p_instance, int p_surface, RID p_material) {
+void RenderingServerScene::instance_set_surface_material(RID p_instance, int p_surface, RID p_material) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
- if (instance->base_type == VS::INSTANCE_MESH) {
+ if (instance->base_type == RS::INSTANCE_MESH) {
//may not have been updated yet, may also have not been set yet. When updated will be correcte, worst case
- instance->materials.resize(MAX(p_surface + 1, VSG::storage->mesh_get_surface_count(instance->base)));
+ instance->materials.resize(MAX(p_surface + 1, RSG::storage->mesh_get_surface_count(instance->base)));
}
ERR_FAIL_INDEX(p_surface, instance->materials.size());
@@ -668,7 +668,7 @@ void VisualServerScene::instance_set_surface_material(RID p_instance, int p_surf
_instance_queue_update(instance, false, true);
}
-void VisualServerScene::instance_set_visible(RID p_instance, bool p_visible) {
+void RenderingServerScene::instance_set_visible(RID p_instance, bool p_visible) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -679,27 +679,27 @@ void VisualServerScene::instance_set_visible(RID p_instance, bool p_visible) {
instance->visible = p_visible;
switch (instance->base_type) {
- case VS::INSTANCE_LIGHT: {
- if (VSG::storage->light_get_type(instance->base) != VS::LIGHT_DIRECTIONAL && instance->octree_id && instance->scenario) {
- instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << VS::INSTANCE_LIGHT, p_visible ? VS::INSTANCE_GEOMETRY_MASK : 0);
+ case RS::INSTANCE_LIGHT: {
+ if (RSG::storage->light_get_type(instance->base) != RS::LIGHT_DIRECTIONAL && instance->octree_id && instance->scenario) {
+ instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << RS::INSTANCE_LIGHT, p_visible ? RS::INSTANCE_GEOMETRY_MASK : 0);
}
} break;
- case VS::INSTANCE_REFLECTION_PROBE: {
+ case RS::INSTANCE_REFLECTION_PROBE: {
if (instance->octree_id && instance->scenario) {
- instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << VS::INSTANCE_REFLECTION_PROBE, p_visible ? VS::INSTANCE_GEOMETRY_MASK : 0);
+ instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << RS::INSTANCE_REFLECTION_PROBE, p_visible ? RS::INSTANCE_GEOMETRY_MASK : 0);
}
} break;
- case VS::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RS::INSTANCE_LIGHTMAP_CAPTURE: {
if (instance->octree_id && instance->scenario) {
- instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << VS::INSTANCE_LIGHTMAP_CAPTURE, p_visible ? VS::INSTANCE_GEOMETRY_MASK : 0);
+ instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << RS::INSTANCE_LIGHTMAP_CAPTURE, p_visible ? RS::INSTANCE_GEOMETRY_MASK : 0);
}
} break;
- case VS::INSTANCE_GI_PROBE: {
+ case RS::INSTANCE_GI_PROBE: {
if (instance->octree_id && instance->scenario) {
- instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << VS::INSTANCE_GI_PROBE, p_visible ? (VS::INSTANCE_GEOMETRY_MASK | (1 << VS::INSTANCE_LIGHT)) : 0);
+ instance->scenario->octree.set_pairable(instance->octree_id, p_visible, 1 << RS::INSTANCE_GI_PROBE, p_visible ? (RS::INSTANCE_GEOMETRY_MASK | (1 << RS::INSTANCE_LIGHT)) : 0);
}
} break;
@@ -707,11 +707,11 @@ void VisualServerScene::instance_set_visible(RID p_instance, bool p_visible) {
}
}
}
-inline bool is_geometry_instance(VisualServer::InstanceType p_type) {
- return p_type == VS::INSTANCE_MESH || p_type == VS::INSTANCE_MULTIMESH || p_type == VS::INSTANCE_PARTICLES || p_type == VS::INSTANCE_IMMEDIATE;
+inline bool is_geometry_instance(RenderingServer::InstanceType p_type) {
+ return p_type == RS::INSTANCE_MESH || p_type == RS::INSTANCE_MULTIMESH || p_type == RS::INSTANCE_PARTICLES || p_type == RS::INSTANCE_IMMEDIATE;
}
-void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap_instance, RID p_lightmap) {
+void RenderingServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap_instance, RID p_lightmap) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -726,7 +726,7 @@ void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap
if (p_lightmap_instance.is_valid()) {
Instance *lightmap_instance = instance_owner.getornull(p_lightmap_instance);
ERR_FAIL_COND(!lightmap_instance);
- ERR_FAIL_COND(lightmap_instance->base_type != VS::INSTANCE_LIGHTMAP_CAPTURE);
+ ERR_FAIL_COND(lightmap_instance->base_type != RS::INSTANCE_LIGHTMAP_CAPTURE);
instance->lightmap_capture = lightmap_instance;
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(((Instance *)instance->lightmap_capture)->base_data);
@@ -735,7 +735,7 @@ void VisualServerScene::instance_set_use_lightmap(RID p_instance, RID p_lightmap
}
}
-void VisualServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) {
+void RenderingServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -761,7 +761,7 @@ void VisualServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) {
_instance_queue_update(instance, true, false);
}
-void VisualServerScene::instance_attach_skeleton(RID p_instance, RID p_skeleton) {
+void RenderingServerScene::instance_attach_skeleton(RID p_instance, RID p_skeleton) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -773,15 +773,15 @@ void VisualServerScene::instance_attach_skeleton(RID p_instance, RID p_skeleton)
if (p_skeleton.is_valid()) {
//update the dependency now, so if cleared, we remove it
- VSG::storage->skeleton_update_dependency(p_skeleton, instance);
+ RSG::storage->skeleton_update_dependency(p_skeleton, instance);
}
_instance_queue_update(instance, true, true);
}
-void VisualServerScene::instance_set_exterior(RID p_instance, bool p_enabled) {
+void RenderingServerScene::instance_set_exterior(RID p_instance, bool p_enabled) {
}
-void VisualServerScene::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) {
+void RenderingServerScene::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -789,13 +789,13 @@ void VisualServerScene::instance_set_extra_visibility_margin(RID p_instance, rea
_instance_queue_update(instance, true, false);
}
-Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID p_scenario) const {
+Vector<ObjectID> RenderingServerScene::instances_cull_aabb(const AABB &p_aabb, RID p_scenario) const {
Vector<ObjectID> instances;
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND_V(!scenario, instances);
- const_cast<VisualServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
+ const_cast<RenderingServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
int culled = 0;
Instance *cull[1024];
@@ -813,12 +813,12 @@ Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID
return instances;
}
-Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
+Vector<ObjectID> RenderingServerScene::instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
Vector<ObjectID> instances;
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND_V(!scenario, instances);
- const_cast<VisualServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
+ const_cast<RenderingServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
int culled = 0;
Instance *cull[1024];
@@ -835,12 +835,12 @@ Vector<ObjectID> VisualServerScene::instances_cull_ray(const Vector3 &p_from, co
return instances;
}
-Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario) const {
+Vector<ObjectID> RenderingServerScene::instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario) const {
Vector<ObjectID> instances;
Scenario *scenario = scenario_owner.getornull(p_scenario);
ERR_FAIL_COND_V(!scenario, instances);
- const_cast<VisualServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
+ const_cast<RenderingServerScene *>(this)->update_dirty_instances(); // check dirty instances before culling
int culled = 0;
Instance *cull[1024];
@@ -860,21 +860,21 @@ Vector<ObjectID> VisualServerScene::instances_cull_convex(const Vector<Plane> &p
return instances;
}
-void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceFlags p_flags, bool p_enabled) {
+void RenderingServerScene::instance_geometry_set_flag(RID p_instance, RS::InstanceFlags p_flags, bool p_enabled) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
- //ERR_FAIL_COND(((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK));
+ //ERR_FAIL_COND(((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK));
switch (p_flags) {
- case VS::INSTANCE_FLAG_USE_BAKED_LIGHT: {
+ case RS::INSTANCE_FLAG_USE_BAKED_LIGHT: {
instance->baked_light = p_enabled;
} break;
- case VS::INSTANCE_FLAG_USE_DYNAMIC_GI: {
+ case RS::INSTANCE_FLAG_USE_DYNAMIC_GI: {
if (p_enabled == instance->dynamic_gi) {
//bye, redundant
@@ -892,7 +892,7 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
instance->dynamic_gi = p_enabled;
} break;
- case VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE: {
+ case RS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE: {
instance->redraw_if_visible = p_enabled;
@@ -901,7 +901,7 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
}
}
}
-void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) {
+void RenderingServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -909,7 +909,7 @@ void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instanc
instance->cast_shadows = p_shadow_casting_setting;
_instance_queue_update(instance, false, true);
}
-void VisualServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) {
+void RenderingServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) {
Instance *instance = instance_owner.getornull(p_instance);
ERR_FAIL_COND(!instance);
@@ -918,48 +918,48 @@ void VisualServerScene::instance_geometry_set_material_override(RID p_instance,
_instance_queue_update(instance, false, true);
}
-void VisualServerScene::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) {
+void RenderingServerScene::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) {
}
-void VisualServerScene::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) {
+void RenderingServerScene::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) {
}
-void VisualServerScene::_update_instance(Instance *p_instance) {
+void RenderingServerScene::_update_instance(Instance *p_instance) {
p_instance->version++;
- if (p_instance->base_type == VS::INSTANCE_LIGHT) {
+ if (p_instance->base_type == RS::INSTANCE_LIGHT) {
InstanceLightData *light = static_cast<InstanceLightData *>(p_instance->base_data);
- VSG::scene_render->light_instance_set_transform(light->instance, p_instance->transform);
+ RSG::scene_render->light_instance_set_transform(light->instance, p_instance->transform);
light->shadow_dirty = true;
}
- if (p_instance->base_type == VS::INSTANCE_REFLECTION_PROBE) {
+ if (p_instance->base_type == RS::INSTANCE_REFLECTION_PROBE) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(p_instance->base_data);
- VSG::scene_render->reflection_probe_instance_set_transform(reflection_probe->instance, p_instance->transform);
+ RSG::scene_render->reflection_probe_instance_set_transform(reflection_probe->instance, p_instance->transform);
reflection_probe->reflection_dirty = true;
}
- if (p_instance->base_type == VS::INSTANCE_GI_PROBE) {
+ if (p_instance->base_type == RS::INSTANCE_GI_PROBE) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(p_instance->base_data);
- VSG::scene_render->gi_probe_instance_set_transform_to_data(gi_probe->probe_instance, p_instance->transform);
+ RSG::scene_render->gi_probe_instance_set_transform_to_data(gi_probe->probe_instance, p_instance->transform);
}
- if (p_instance->base_type == VS::INSTANCE_PARTICLES) {
+ if (p_instance->base_type == RS::INSTANCE_PARTICLES) {
- VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform);
+ RSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform);
}
if (p_instance->aabb.has_no_surface()) {
return;
}
- if ((1 << p_instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) {
+ if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
//make sure lights are updated if it casts shadow
@@ -1000,15 +1000,15 @@ void VisualServerScene::_update_instance(Instance *p_instance) {
uint32_t pairable_mask = 0;
bool pairable = false;
- if (p_instance->base_type == VS::INSTANCE_LIGHT || p_instance->base_type == VS::INSTANCE_REFLECTION_PROBE || p_instance->base_type == VS::INSTANCE_LIGHTMAP_CAPTURE) {
+ if (p_instance->base_type == RS::INSTANCE_LIGHT || p_instance->base_type == RS::INSTANCE_REFLECTION_PROBE || p_instance->base_type == RS::INSTANCE_LIGHTMAP_CAPTURE) {
- pairable_mask = p_instance->visible ? VS::INSTANCE_GEOMETRY_MASK : 0;
+ pairable_mask = p_instance->visible ? RS::INSTANCE_GEOMETRY_MASK : 0;
pairable = true;
}
- if (p_instance->base_type == VS::INSTANCE_GI_PROBE) {
+ if (p_instance->base_type == RS::INSTANCE_GI_PROBE) {
//lights and geometries
- pairable_mask = p_instance->visible ? VS::INSTANCE_GEOMETRY_MASK | (1 << VS::INSTANCE_LIGHT) : 0;
+ pairable_mask = p_instance->visible ? RS::INSTANCE_GEOMETRY_MASK | (1 << RS::INSTANCE_LIGHT) : 0;
pairable = true;
}
@@ -1026,68 +1026,68 @@ void VisualServerScene::_update_instance(Instance *p_instance) {
}
}
-void VisualServerScene::_update_instance_aabb(Instance *p_instance) {
+void RenderingServerScene::_update_instance_aabb(Instance *p_instance) {
AABB new_aabb;
- ERR_FAIL_COND(p_instance->base_type != VS::INSTANCE_NONE && !p_instance->base.is_valid());
+ ERR_FAIL_COND(p_instance->base_type != RS::INSTANCE_NONE && !p_instance->base.is_valid());
switch (p_instance->base_type) {
- case VisualServer::INSTANCE_NONE: {
+ case RenderingServer::INSTANCE_NONE: {
// do nothing
} break;
- case VisualServer::INSTANCE_MESH: {
+ case RenderingServer::INSTANCE_MESH: {
if (p_instance->custom_aabb)
new_aabb = *p_instance->custom_aabb;
else
- new_aabb = VSG::storage->mesh_get_aabb(p_instance->base, p_instance->skeleton);
+ new_aabb = RSG::storage->mesh_get_aabb(p_instance->base, p_instance->skeleton);
} break;
- case VisualServer::INSTANCE_MULTIMESH: {
+ case RenderingServer::INSTANCE_MULTIMESH: {
if (p_instance->custom_aabb)
new_aabb = *p_instance->custom_aabb;
else
- new_aabb = VSG::storage->multimesh_get_aabb(p_instance->base);
+ new_aabb = RSG::storage->multimesh_get_aabb(p_instance->base);
} break;
- case VisualServer::INSTANCE_IMMEDIATE: {
+ case RenderingServer::INSTANCE_IMMEDIATE: {
if (p_instance->custom_aabb)
new_aabb = *p_instance->custom_aabb;
else
- new_aabb = VSG::storage->immediate_get_aabb(p_instance->base);
+ new_aabb = RSG::storage->immediate_get_aabb(p_instance->base);
} break;
- case VisualServer::INSTANCE_PARTICLES: {
+ case RenderingServer::INSTANCE_PARTICLES: {
if (p_instance->custom_aabb)
new_aabb = *p_instance->custom_aabb;
else
- new_aabb = VSG::storage->particles_get_aabb(p_instance->base);
+ new_aabb = RSG::storage->particles_get_aabb(p_instance->base);
} break;
- case VisualServer::INSTANCE_LIGHT: {
+ case RenderingServer::INSTANCE_LIGHT: {
- new_aabb = VSG::storage->light_get_aabb(p_instance->base);
+ new_aabb = RSG::storage->light_get_aabb(p_instance->base);
} break;
- case VisualServer::INSTANCE_REFLECTION_PROBE: {
+ case RenderingServer::INSTANCE_REFLECTION_PROBE: {
- new_aabb = VSG::storage->reflection_probe_get_aabb(p_instance->base);
+ new_aabb = RSG::storage->reflection_probe_get_aabb(p_instance->base);
} break;
- case VisualServer::INSTANCE_GI_PROBE: {
+ case RenderingServer::INSTANCE_GI_PROBE: {
- new_aabb = VSG::storage->gi_probe_get_bounds(p_instance->base);
+ new_aabb = RSG::storage->gi_probe_get_bounds(p_instance->base);
} break;
- case VisualServer::INSTANCE_LIGHTMAP_CAPTURE: {
+ case RenderingServer::INSTANCE_LIGHTMAP_CAPTURE: {
- new_aabb = VSG::storage->lightmap_capture_get_bounds(p_instance->base);
+ new_aabb = RSG::storage->lightmap_capture_get_bounds(p_instance->base);
} break;
default: {
@@ -1281,7 +1281,7 @@ _FORCE_INLINE_ static Color _light_capture_voxel_cone_trace(const RasterizerStor
return Color(color.x, color.y, color.z, alpha);
}
-void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance) {
+void RenderingServerScene::_update_instance_lightmap_captures(Instance *p_instance) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
@@ -1313,12 +1313,12 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
//this could use some sort of blending..
for (List<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) {
- const Vector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base);
+ const Vector<RasterizerStorage::LightmapCaptureOctree> *octree = RSG::storage->lightmap_capture_get_octree_ptr(E->get()->base);
//print_line("octree size: " + itos(octree->size()));
if (octree->size() == 0)
continue;
- Transform to_cell_xform = VSG::storage->lightmap_capture_get_octree_cell_transform(E->get()->base);
- int cell_subdiv = VSG::storage->lightmap_capture_get_octree_cell_subdiv(E->get()->base);
+ Transform to_cell_xform = RSG::storage->lightmap_capture_get_octree_cell_transform(E->get()->base);
+ int cell_subdiv = RSG::storage->lightmap_capture_get_octree_cell_subdiv(E->get()->base);
to_cell_xform = to_cell_xform * E->get()->transform.affine_inverse();
const RasterizerStorage::LightmapCaptureOctree *octree_r = octree->ptr();
@@ -1334,7 +1334,7 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
}
}
-bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_shadow_atlas, Scenario *p_scenario) {
+bool RenderingServerScene::_light_instance_update_shadow(Instance *p_instance, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_shadow_atlas, Scenario *p_scenario) {
InstanceLightData *light = static_cast<InstanceLightData *>(p_instance->base_data);
@@ -1343,24 +1343,24 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
bool animated_material_found = false;
- switch (VSG::storage->light_get_type(p_instance->base)) {
+ switch (RSG::storage->light_get_type(p_instance->base)) {
- case VS::LIGHT_DIRECTIONAL: {
+ case RS::LIGHT_DIRECTIONAL: {
float max_distance = p_cam_projection.get_z_far();
- float shadow_max = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE);
+ float shadow_max = RSG::storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_SHADOW_MAX_DISTANCE);
if (shadow_max > 0 && !p_cam_orthogonal) { //its impractical (and leads to unwanted behaviors) to set max distance in orthogonal camera
max_distance = MIN(shadow_max, max_distance);
}
max_distance = MAX(max_distance, p_cam_projection.get_z_near() + 0.001);
float min_distance = MIN(p_cam_projection.get_z_near(), max_distance);
- VS::LightDirectionalShadowDepthRangeMode depth_range_mode = VSG::storage->light_directional_get_shadow_depth_range_mode(p_instance->base);
+ RS::LightDirectionalShadowDepthRangeMode depth_range_mode = RSG::storage->light_directional_get_shadow_depth_range_mode(p_instance->base);
- if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
+ if (depth_range_mode == RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
//optimize min/max
Vector<Plane> planes = p_cam_projection.get_projection_planes(p_cam_transform);
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
Plane base(p_cam_transform.origin, -p_cam_transform.basis.get_axis(2));
//check distance max and min
@@ -1371,7 +1371,7 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
for (int i = 0; i < cull_count; i++) {
Instance *instance = instance_shadow_cull_result[i];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ if (!instance->visible || !((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
continue;
}
@@ -1402,24 +1402,24 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
float range = max_distance - min_distance;
int splits = 0;
- switch (VSG::storage->light_directional_get_shadow_mode(p_instance->base)) {
- case VS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: splits = 1; break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: splits = 2; break;
- case VS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: splits = 4; break;
+ switch (RSG::storage->light_directional_get_shadow_mode(p_instance->base)) {
+ case RS::LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL: splits = 1; break;
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS: splits = 2; break;
+ case RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS: splits = 4; break;
}
float distances[5];
distances[0] = min_distance;
for (int i = 0; i < splits; i++) {
- distances[i + 1] = min_distance + VSG::storage->light_get_param(p_instance->base, VS::LightParam(VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET + i)) * range;
+ distances[i + 1] = min_distance + RSG::storage->light_get_param(p_instance->base, RS::LightParam(RS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET + i)) * range;
};
distances[splits] = max_distance;
- float texture_size = VSG::scene_render->get_directional_light_shadow_size(light->instance);
+ float texture_size = RSG::scene_render->get_directional_light_shadow_size(light->instance);
- bool overlap = VSG::storage->light_directional_get_blend_splits(p_instance->base);
+ bool overlap = RSG::storage->light_directional_get_blend_splits(p_instance->base);
float first_radius = 0.0;
@@ -1532,7 +1532,7 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
//z_max_cam = z_vec.dot(center) + radius;
z_min_cam = z_vec.dot(center) - radius;
- if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
+ if (depth_range_mode == RS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
//this trick here is what stabilizes the shadow (make potential jaggies to not move)
//at the cost of some wasted resolution. Still the quality increase is very well worth it
@@ -1560,7 +1560,7 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
light_frustum_planes.write[4] = Plane(z_vec, z_max + 1e6);
light_frustum_planes.write[5] = Plane(-z_vec, -z_min); // z_min is ok, since casters further than far-light plane are not needed
- int cull_count = p_scenario->octree.cull_convex(light_frustum_planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ int cull_count = p_scenario->octree.cull_convex(light_frustum_planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
// a pre pass will need to be needed to determine the actual z-near to be used
@@ -1570,7 +1570,7 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
float min, max;
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ if (!instance->visible || !((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
cull_count--;
SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
j--;
@@ -1596,25 +1596,25 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
ortho_transform.basis = transform.basis;
ortho_transform.origin = x_vec * (x_min_cam + half_x) + y_vec * (y_min_cam + half_y) + z_vec * z_max;
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, ortho_camera, ortho_transform, 0, distances[i + 1], i, bias_scale);
+ RSG::scene_render->light_instance_set_shadow_transform(light->instance, ortho_camera, ortho_transform, 0, distances[i + 1], i, bias_scale);
}
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ RSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
}
} break;
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
- VS::LightOmniShadowMode shadow_mode = VSG::storage->light_omni_get_shadow_mode(p_instance->base);
+ RS::LightOmniShadowMode shadow_mode = RSG::storage->light_omni_get_shadow_mode(p_instance->base);
- if (shadow_mode == VS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID || !VSG::scene_render->light_instances_can_render_shadow_cube()) {
+ if (shadow_mode == RS::LIGHT_OMNI_SHADOW_DUAL_PARABOLOID || !RSG::scene_render->light_instances_can_render_shadow_cube()) {
for (int i = 0; i < 2; i++) {
//using this one ensures that raster deferred will have it
RENDER_TIMESTAMP("Culling Shadow Paraboloid" + itos(i));
- float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
+ float radius = RSG::storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_RANGE);
float z = i == 0 ? -1 : 1;
Vector<Plane> planes;
@@ -1625,13 +1625,13 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
planes.write[3] = light_transform.xform(Plane(Vector3(0, 1, z).normalized(), radius));
planes.write[4] = light_transform.xform(Plane(Vector3(0, -1, z).normalized(), radius));
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
Plane near_plane(light_transform.origin, light_transform.basis.get_axis(2) * z);
for (int j = 0; j < cull_count; j++) {
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ if (!instance->visible || !((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
cull_count--;
SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
j--;
@@ -1645,12 +1645,12 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
}
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, i);
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ RSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, i);
+ RSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
}
} else { //shadow cube
- float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
+ float radius = RSG::storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_RANGE);
CameraMatrix cm;
cm.set_perspective(90, 1, 0.01, radius);
@@ -1680,13 +1680,13 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
Vector<Plane> planes = cm.get_projection_planes(xform);
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
Plane near_plane(xform.origin, -xform.basis.get_axis(2));
for (int j = 0; j < cull_count; j++) {
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ if (!instance->visible || !((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
cull_count--;
SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
j--;
@@ -1699,33 +1699,33 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
}
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, xform, radius, 0, i);
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ RSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, xform, radius, 0, i);
+ RSG::scene_render->render_shadow(light->instance, p_shadow_atlas, i, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
}
//restore the regular DP matrix
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, 0);
+ RSG::scene_render->light_instance_set_shadow_transform(light->instance, CameraMatrix(), light_transform, radius, 0, 0);
}
} break;
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
RENDER_TIMESTAMP("Culling Spot Light");
- float radius = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_RANGE);
- float angle = VSG::storage->light_get_param(p_instance->base, VS::LIGHT_PARAM_SPOT_ANGLE);
+ float radius = RSG::storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_RANGE);
+ float angle = RSG::storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_SPOT_ANGLE);
CameraMatrix cm;
cm.set_perspective(angle * 2.0, 1.0, 0.01, radius);
Vector<Plane> planes = cm.get_projection_planes(light_transform);
- int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
+ int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, RS::INSTANCE_GEOMETRY_MASK);
Plane near_plane(light_transform.origin, -light_transform.basis.get_axis(2));
for (int j = 0; j < cull_count; j++) {
Instance *instance = instance_shadow_cull_result[j];
- if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
+ if (!instance->visible || !((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
cull_count--;
SWAP(instance_shadow_cull_result[j], instance_shadow_cull_result[cull_count]);
j--;
@@ -1738,8 +1738,8 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
}
}
- VSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, light_transform, radius, 0, 0);
- VSG::scene_render->render_shadow(light->instance, p_shadow_atlas, 0, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
+ RSG::scene_render->light_instance_set_shadow_transform(light->instance, cm, light_transform, radius, 0, 0);
+ RSG::scene_render->render_shadow(light->instance, p_shadow_atlas, 0, (RasterizerScene::InstanceBase **)instance_shadow_cull_result, cull_count);
} break;
}
@@ -1747,7 +1747,7 @@ bool VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
return animated_material_found;
}
-void VisualServerScene::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
+void RenderingServerScene::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
// render to mono camera
#ifndef _3D_DISABLED
@@ -1798,7 +1798,7 @@ void VisualServerScene::render_camera(RID p_render_buffers, RID p_camera, RID p_
#endif
}
-void VisualServerScene::render_camera(RID p_render_buffers, Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
+void RenderingServerScene::render_camera(RID p_render_buffers, Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas) {
// render for AR/VR interface
Camera *camera = camera_owner.getornull(p_camera);
@@ -1882,7 +1882,7 @@ void VisualServerScene::render_camera(RID p_render_buffers, Ref<ARVRInterface> &
_render_scene(p_render_buffers, cam_transform, camera_matrix, false, camera->env, camera->effects, p_scenario, p_shadow_atlas, RID(), -1);
};
-void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, bool p_using_shadows) {
+void RenderingServerScene::_prepare_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, bool p_using_shadows) {
// Note, in stereo rendering:
// - p_cam_transform will be a transform in the middle of our two eyes
// - p_cam_projection is a wider frustrum that encompasses both eyes
@@ -1892,7 +1892,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
render_pass++;
uint32_t camera_layer_mask = p_visible_layers;
- VSG::scene_render->set_scene_pass(render_pass);
+ RSG::scene_render->set_scene_pass(render_pass);
RENDER_TIMESTAMP("Frustum Culling");
@@ -1932,7 +1932,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
if ((camera_layer_mask & ins->layer_mask) == 0) {
//failure
- } else if (ins->base_type == VS::INSTANCE_LIGHT && ins->visible) {
+ } else if (ins->base_type == RS::INSTANCE_LIGHT && ins->visible) {
if (light_cull_count < MAX_LIGHTS_CULLED) {
@@ -1942,14 +1942,14 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
//do not add this light if no geometry is affected by it..
light_cull_result[light_cull_count] = ins;
light_instance_cull_result[light_cull_count] = light->instance;
- if (p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(ins->base)) {
- VSG::scene_render->light_instance_mark_visible(light->instance); //mark it visible for shadow allocation later
+ if (p_shadow_atlas.is_valid() && RSG::storage->light_has_shadow(ins->base)) {
+ RSG::scene_render->light_instance_mark_visible(light->instance); //mark it visible for shadow allocation later
}
light_cull_count++;
}
}
- } else if (ins->base_type == VS::INSTANCE_REFLECTION_PROBE && ins->visible) {
+ } else if (ins->base_type == RS::INSTANCE_REFLECTION_PROBE && ins->visible) {
if (reflection_probe_cull_count < MAX_REFLECTION_PROBES_CULLED) {
@@ -1961,7 +1961,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
if (!reflection_probe->geometries.empty()) {
//do not add this light if no geometry is affected by it..
- if (reflection_probe->reflection_dirty || VSG::scene_render->reflection_probe_instance_needs_redraw(reflection_probe->instance)) {
+ if (reflection_probe->reflection_dirty || RSG::scene_render->reflection_probe_instance_needs_redraw(reflection_probe->instance)) {
if (!reflection_probe->update_list.in_list()) {
reflection_probe->render_step = 0;
reflection_probe_render_list.add_last(&reflection_probe->update_list);
@@ -1970,7 +1970,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
reflection_probe->reflection_dirty = false;
}
- if (VSG::scene_render->reflection_probe_instance_has_reflection(reflection_probe->instance)) {
+ if (RSG::scene_render->reflection_probe_instance_has_reflection(reflection_probe->instance)) {
reflection_probe_instance_cull_result[reflection_probe_cull_count] = reflection_probe->instance;
reflection_probe_cull_count++;
}
@@ -1978,7 +1978,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
}
}
- } else if (ins->base_type == VS::INSTANCE_GI_PROBE && ins->visible) {
+ } else if (ins->base_type == RS::INSTANCE_GI_PROBE && ins->visible) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(ins->base_data);
if (!gi_probe->update_element.in_list()) {
@@ -1990,25 +1990,25 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
gi_probe_cull_count++;
}
- } else if (((1 << ins->base_type) & VS::INSTANCE_GEOMETRY_MASK) && ins->visible && ins->cast_shadows != VS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) {
+ } else if (((1 << ins->base_type) & RS::INSTANCE_GEOMETRY_MASK) && ins->visible && ins->cast_shadows != RS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) {
keep = true;
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(ins->base_data);
if (ins->redraw_if_visible) {
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
- if (ins->base_type == VS::INSTANCE_PARTICLES) {
+ if (ins->base_type == RS::INSTANCE_PARTICLES) {
//particles visible? process them
- if (VSG::storage->particles_is_inactive(ins->base)) {
+ if (RSG::storage->particles_is_inactive(ins->base)) {
//but if nothing is going on, don't do it.
keep = false;
} else {
- VSG::storage->particles_request_process(ins->base);
+ RSG::storage->particles_request_process(ins->base);
//particles visible? request redraw
- VisualServerRaster::redraw_request();
+ RenderingServerRaster::redraw_request();
}
}
@@ -2098,7 +2098,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
//check shadow..
if (light) {
- if (p_using_shadows && p_shadow_atlas.is_valid() && VSG::storage->light_has_shadow(E->get()->base)) {
+ if (p_using_shadows && p_shadow_atlas.is_valid() && RSG::storage->light_has_shadow(E->get()->base)) {
lights_with_shadow[directional_shadow_count++] = E->get();
}
//add to list
@@ -2106,7 +2106,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
}
}
- VSG::scene_render->set_directional_shadow_count(directional_shadow_count);
+ RSG::scene_render->set_directional_shadow_count(directional_shadow_count);
for (int i = 0; i < directional_shadow_count; i++) {
@@ -2126,7 +2126,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
Instance *ins = light_cull_result[i];
- if (!p_shadow_atlas.is_valid() || !VSG::storage->light_has_shadow(ins->base))
+ if (!p_shadow_atlas.is_valid() || !RSG::storage->light_has_shadow(ins->base))
continue;
InstanceLightData *light = static_cast<InstanceLightData *>(ins->base_data);
@@ -2142,11 +2142,11 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
// near plane half width and height
Vector2 vp_half_extents = p_cam_projection.get_viewport_half_extents();
- switch (VSG::storage->light_get_type(ins->base)) {
+ switch (RSG::storage->light_get_type(ins->base)) {
- case VS::LIGHT_OMNI: {
+ case RS::LIGHT_OMNI: {
- float radius = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_RANGE);
+ float radius = RSG::storage->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE);
//get two points parallel to near plane
Vector3 points[2] = {
@@ -2168,10 +2168,10 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
float screen_diameter = points[0].distance_to(points[1]) * 2;
coverage = screen_diameter / (vp_half_extents.x + vp_half_extents.y);
} break;
- case VS::LIGHT_SPOT: {
+ case RS::LIGHT_SPOT: {
- float radius = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_RANGE);
- float angle = VSG::storage->light_get_param(ins->base, VS::LIGHT_PARAM_SPOT_ANGLE);
+ float radius = RSG::storage->light_get_param(ins->base, RS::LIGHT_PARAM_RANGE);
+ float angle = RSG::storage->light_get_param(ins->base, RS::LIGHT_PARAM_SPOT_ANGLE);
float w = radius * Math::sin(Math::deg2rad(angle));
float d = radius * Math::cos(Math::deg2rad(angle));
@@ -2209,7 +2209,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
light->shadow_dirty = false;
}
- bool redraw = VSG::scene_render->shadow_atlas_update_light(p_shadow_atlas, light->instance, coverage, light->last_version);
+ bool redraw = RSG::scene_render->shadow_atlas_update_light(p_shadow_atlas, light->instance, coverage, light->last_version);
if (redraw) {
//must redraw!
@@ -2221,7 +2221,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
}
}
-void VisualServerScene::_render_scene(RID p_render_buffers, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
+void RenderingServerScene::_render_scene(RID p_render_buffers, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {
Scenario *scenario = scenario_owner.getornull(p_scenario);
@@ -2244,10 +2244,10 @@ void VisualServerScene::_render_scene(RID p_render_buffers, const Transform p_ca
/* PROCESS GEOMETRY AND DRAW SCENE */
RENDER_TIMESTAMP("Render Scene ");
- VSG::scene_render->render_scene(p_render_buffers, p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, instance_cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, gi_probe_instance_cull_result, gi_probe_cull_count, environment, camera_effects, p_shadow_atlas, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass);
+ RSG::scene_render->render_scene(p_render_buffers, p_cam_transform, p_cam_projection, p_cam_orthogonal, (RasterizerScene::InstanceBase **)instance_cull_result, instance_cull_count, light_instance_cull_result, light_cull_count + directional_light_count, reflection_probe_instance_cull_result, reflection_probe_cull_count, gi_probe_instance_cull_result, gi_probe_cull_count, environment, camera_effects, p_shadow_atlas, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass);
}
-void VisualServerScene::render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas) {
+void RenderingServerScene::render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas) {
#ifndef _3D_DISABLED
@@ -2259,21 +2259,21 @@ void VisualServerScene::render_empty_scene(RID p_render_buffers, RID p_scenario,
else
environment = scenario->fallback_environment;
RENDER_TIMESTAMP("Render Empty Scene ");
- VSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, NULL, 0, environment, RID(), p_shadow_atlas, scenario->reflection_atlas, RID(), 0);
+ RSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, NULL, 0, environment, RID(), p_shadow_atlas, scenario->reflection_atlas, RID(), 0);
#endif
}
-bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int p_step) {
+bool RenderingServerScene::_render_reflection_probe_step(Instance *p_instance, int p_step) {
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(p_instance->base_data);
Scenario *scenario = p_instance->scenario;
ERR_FAIL_COND_V(!scenario, true);
- VisualServerRaster::redraw_request(); //update, so it updates in editor
+ RenderingServerRaster::redraw_request(); //update, so it updates in editor
if (p_step == 0) {
- if (!VSG::scene_render->reflection_probe_instance_begin_render(reflection_probe->instance, scenario->reflection_atlas)) {
+ if (!RSG::scene_render->reflection_probe_instance_begin_render(reflection_probe->instance, scenario->reflection_atlas)) {
return true; //all full
}
}
@@ -2297,9 +2297,9 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int
Vector3(0, -1, 0)
};
- Vector3 extents = VSG::storage->reflection_probe_get_extents(p_instance->base);
- Vector3 origin_offset = VSG::storage->reflection_probe_get_origin_offset(p_instance->base);
- float max_distance = VSG::storage->reflection_probe_get_origin_max_distance(p_instance->base);
+ Vector3 extents = RSG::storage->reflection_probe_get_extents(p_instance->base);
+ Vector3 origin_offset = RSG::storage->reflection_probe_get_origin_offset(p_instance->base);
+ float max_distance = RSG::storage->reflection_probe_get_origin_max_distance(p_instance->base);
Vector3 edge = view_normals[p_step] * extents;
float distance = ABS(view_normals[p_step].dot(edge) - view_normals[p_step].dot(origin_offset)); //distance from origin offset to actual view distance limit
@@ -2317,26 +2317,26 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int
RID shadow_atlas;
- bool use_shadows = VSG::storage->reflection_probe_renders_shadows(p_instance->base);
+ bool use_shadows = RSG::storage->reflection_probe_renders_shadows(p_instance->base);
if (use_shadows) {
shadow_atlas = scenario->reflection_probe_shadow_atlas;
}
RENDER_TIMESTAMP("Render Reflection Probe, Step " + itos(p_step));
- _prepare_scene(xform, cm, false, RID(), RID(), VSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, use_shadows);
+ _prepare_scene(xform, cm, false, RID(), RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, use_shadows);
_render_scene(RID(), xform, cm, false, RID(), RID(), p_instance->scenario->self, shadow_atlas, reflection_probe->instance, p_step);
} else {
//do roughness postprocess step until it believes it's done
RENDER_TIMESTAMP("Post-Process Reflection Probe, Step " + itos(p_step));
- return VSG::scene_render->reflection_probe_instance_postprocess_step(reflection_probe->instance);
+ return RSG::scene_render->reflection_probe_instance_postprocess_step(reflection_probe->instance);
}
return false;
}
-void VisualServerScene::render_probes() {
+void RenderingServerScene::render_probes() {
/* REFLECTION PROBES */
@@ -2349,9 +2349,9 @@ void VisualServerScene::render_probes() {
SelfList<InstanceReflectionProbeData> *next = ref_probe->next();
RID base = ref_probe->self()->owner->base;
- switch (VSG::storage->reflection_probe_get_update_mode(base)) {
+ switch (RSG::storage->reflection_probe_get_update_mode(base)) {
- case VS::REFLECTION_PROBE_UPDATE_ONCE: {
+ case RS::REFLECTION_PROBE_UPDATE_ONCE: {
if (busy) //already rendering something
break;
@@ -2364,7 +2364,7 @@ void VisualServerScene::render_probes() {
busy = true; //do not render another one of this kind
} break;
- case VS::REFLECTION_PROBE_UPDATE_ALWAYS: {
+ case RS::REFLECTION_PROBE_UPDATE_ALWAYS: {
int step = 0;
bool done = false;
@@ -2422,16 +2422,16 @@ void VisualServerScene::render_probes() {
if (
instance_caches[idx] != instance_light->instance ||
- cache->has_shadow != VSG::storage->light_has_shadow(instance->base) ||
- cache->type != VSG::storage->light_get_type(instance->base) ||
+ cache->has_shadow != RSG::storage->light_has_shadow(instance->base) ||
+ cache->type != RSG::storage->light_get_type(instance->base) ||
cache->transform != instance->transform ||
- cache->color != VSG::storage->light_get_color(instance->base) ||
- cache->energy != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ENERGY) ||
- cache->bake_energy != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_INDIRECT_ENERGY) ||
- cache->radius != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_RANGE) ||
- cache->attenuation != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ATTENUATION) ||
- cache->spot_angle != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ANGLE) ||
- cache->spot_attenuation != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ATTENUATION)) {
+ cache->color != RSG::storage->light_get_color(instance->base) ||
+ cache->energy != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ENERGY) ||
+ cache->bake_energy != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_INDIRECT_ENERGY) ||
+ cache->radius != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_RANGE) ||
+ cache->attenuation != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ATTENUATION) ||
+ cache->spot_angle != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ANGLE) ||
+ cache->spot_attenuation != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ATTENUATION)) {
cache_dirty = true;
}
}
@@ -2456,16 +2456,16 @@ void VisualServerScene::render_probes() {
if (
instance_caches[idx] != instance_light->instance ||
- cache->has_shadow != VSG::storage->light_has_shadow(instance->base) ||
- cache->type != VSG::storage->light_get_type(instance->base) ||
+ cache->has_shadow != RSG::storage->light_has_shadow(instance->base) ||
+ cache->type != RSG::storage->light_get_type(instance->base) ||
cache->transform != instance->transform ||
- cache->color != VSG::storage->light_get_color(instance->base) ||
- cache->energy != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ENERGY) ||
- cache->bake_energy != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_INDIRECT_ENERGY) ||
- cache->radius != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_RANGE) ||
- cache->attenuation != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ATTENUATION) ||
- cache->spot_angle != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ANGLE) ||
- cache->spot_attenuation != VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ATTENUATION)) {
+ cache->color != RSG::storage->light_get_color(instance->base) ||
+ cache->energy != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ENERGY) ||
+ cache->bake_energy != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_INDIRECT_ENERGY) ||
+ cache->radius != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_RANGE) ||
+ cache->attenuation != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ATTENUATION) ||
+ cache->spot_angle != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ANGLE) ||
+ cache->spot_attenuation != RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ATTENUATION)) {
cache_dirty = true;
}
}
@@ -2480,7 +2480,7 @@ void VisualServerScene::render_probes() {
cache_count = idx;
}
- bool update_lights = VSG::scene_render->gi_probe_needs_update(probe->probe_instance);
+ bool update_lights = RSG::scene_render->gi_probe_needs_update(probe->probe_instance);
if (cache_dirty) {
probe->light_cache.resize(cache_count);
@@ -2501,16 +2501,16 @@ void VisualServerScene::render_probes() {
InstanceGIProbeData::LightCache *cache = &caches[idx];
instance_caches[idx] = instance_light->instance;
- cache->has_shadow = VSG::storage->light_has_shadow(instance->base);
- cache->type = VSG::storage->light_get_type(instance->base);
+ cache->has_shadow = RSG::storage->light_has_shadow(instance->base);
+ cache->type = RSG::storage->light_get_type(instance->base);
cache->transform = instance->transform;
- cache->color = VSG::storage->light_get_color(instance->base);
- cache->energy = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ENERGY);
- cache->bake_energy = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_INDIRECT_ENERGY);
- cache->radius = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_RANGE);
- cache->attenuation = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ATTENUATION);
- cache->spot_angle = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ANGLE);
- cache->spot_attenuation = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
+ cache->color = RSG::storage->light_get_color(instance->base);
+ cache->energy = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ENERGY);
+ cache->bake_energy = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_INDIRECT_ENERGY);
+ cache->radius = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_RANGE);
+ cache->attenuation = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ATTENUATION);
+ cache->spot_angle = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ANGLE);
+ cache->spot_attenuation = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ATTENUATION);
idx++;
}
@@ -2524,16 +2524,16 @@ void VisualServerScene::render_probes() {
InstanceGIProbeData::LightCache *cache = &caches[idx];
instance_caches[idx] = instance_light->instance;
- cache->has_shadow = VSG::storage->light_has_shadow(instance->base);
- cache->type = VSG::storage->light_get_type(instance->base);
+ cache->has_shadow = RSG::storage->light_has_shadow(instance->base);
+ cache->type = RSG::storage->light_get_type(instance->base);
cache->transform = instance->transform;
- cache->color = VSG::storage->light_get_color(instance->base);
- cache->energy = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ENERGY);
- cache->bake_energy = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_INDIRECT_ENERGY);
- cache->radius = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_RANGE);
- cache->attenuation = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_ATTENUATION);
- cache->spot_angle = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ANGLE);
- cache->spot_attenuation = VSG::storage->light_get_param(instance->base, VS::LIGHT_PARAM_SPOT_ATTENUATION);
+ cache->color = RSG::storage->light_get_color(instance->base);
+ cache->energy = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ENERGY);
+ cache->bake_energy = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_INDIRECT_ENERGY);
+ cache->radius = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_RANGE);
+ cache->attenuation = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_ATTENUATION);
+ cache->spot_angle = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ANGLE);
+ cache->spot_attenuation = RSG::storage->light_get_param(instance->base, RS::LIGHT_PARAM_SPOT_ATTENUATION);
idx++;
}
@@ -2571,7 +2571,7 @@ void VisualServerScene::render_probes() {
}
}
- VSG::scene_render->gi_probe_update(probe->probe_instance, update_lights, probe->light_instances, instance_cull_count, (RasterizerScene::InstanceBase **)instance_cull_result);
+ RSG::scene_render->gi_probe_update(probe->probe_instance, update_lights, probe->light_instances, instance_cull_count, (RasterizerScene::InstanceBase **)instance_cull_result);
gi_probe_update_list.remove(gi_probe);
@@ -2579,7 +2579,7 @@ void VisualServerScene::render_probes() {
}
}
-void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
+void RenderingServerScene::_update_dirty_instance(Instance *p_instance) {
if (p_instance->update_aabb) {
_update_instance_aabb(p_instance);
@@ -2590,20 +2590,20 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
p_instance->instance_increase_version();
if (p_instance->base.is_valid()) {
- VSG::storage->base_update_dependency(p_instance->base, p_instance);
+ RSG::storage->base_update_dependency(p_instance->base, p_instance);
}
if (p_instance->material_override.is_valid()) {
- VSG::storage->material_update_dependency(p_instance->material_override, p_instance);
+ RSG::storage->material_update_dependency(p_instance->material_override, p_instance);
}
- if (p_instance->base_type == VS::INSTANCE_MESH) {
+ if (p_instance->base_type == RS::INSTANCE_MESH) {
//remove materials no longer used and un-own them
- int new_mat_count = VSG::storage->mesh_get_surface_count(p_instance->base);
+ int new_mat_count = RSG::storage->mesh_get_surface_count(p_instance->base);
p_instance->materials.resize(new_mat_count);
- int new_blend_shape_count = VSG::storage->mesh_get_blend_shape_count(p_instance->base);
+ int new_blend_shape_count = RSG::storage->mesh_get_blend_shape_count(p_instance->base);
if (new_blend_shape_count != p_instance->blend_values.size()) {
p_instance->blend_values.resize(new_blend_shape_count);
for (int i = 0; i < new_blend_shape_count; i++) {
@@ -2612,21 +2612,21 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
}
}
- if ((1 << p_instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) {
+ if ((1 << p_instance->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(p_instance->base_data);
bool can_cast_shadows = true;
bool is_animated = false;
- if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_OFF) {
+ if (p_instance->cast_shadows == RS::SHADOW_CASTING_SETTING_OFF) {
can_cast_shadows = false;
} else if (p_instance->material_override.is_valid()) {
- can_cast_shadows = VSG::storage->material_casts_shadows(p_instance->material_override);
- is_animated = VSG::storage->material_is_animated(p_instance->material_override);
+ can_cast_shadows = RSG::storage->material_casts_shadows(p_instance->material_override);
+ is_animated = RSG::storage->material_is_animated(p_instance->material_override);
} else {
- if (p_instance->base_type == VS::INSTANCE_MESH) {
+ if (p_instance->base_type == RS::INSTANCE_MESH) {
RID mesh = p_instance->base;
if (mesh.is_valid()) {
@@ -2634,21 +2634,21 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
for (int i = 0; i < p_instance->materials.size(); i++) {
- RID mat = p_instance->materials[i].is_valid() ? p_instance->materials[i] : VSG::storage->mesh_surface_get_material(mesh, i);
+ RID mat = p_instance->materials[i].is_valid() ? p_instance->materials[i] : RSG::storage->mesh_surface_get_material(mesh, i);
if (!mat.is_valid()) {
cast_shadows = true;
} else {
- if (VSG::storage->material_casts_shadows(mat)) {
+ if (RSG::storage->material_casts_shadows(mat)) {
cast_shadows = true;
}
- if (VSG::storage->material_is_animated(mat)) {
+ if (RSG::storage->material_is_animated(mat)) {
is_animated = true;
}
- VSG::storage->material_update_dependency(mat, p_instance);
+ RSG::storage->material_update_dependency(mat, p_instance);
}
}
@@ -2657,30 +2657,30 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
}
}
- } else if (p_instance->base_type == VS::INSTANCE_MULTIMESH) {
- RID mesh = VSG::storage->multimesh_get_mesh(p_instance->base);
+ } else if (p_instance->base_type == RS::INSTANCE_MULTIMESH) {
+ RID mesh = RSG::storage->multimesh_get_mesh(p_instance->base);
if (mesh.is_valid()) {
bool cast_shadows = false;
- int sc = VSG::storage->mesh_get_surface_count(mesh);
+ int sc = RSG::storage->mesh_get_surface_count(mesh);
for (int i = 0; i < sc; i++) {
- RID mat = VSG::storage->mesh_surface_get_material(mesh, i);
+ RID mat = RSG::storage->mesh_surface_get_material(mesh, i);
if (!mat.is_valid()) {
cast_shadows = true;
} else {
- if (VSG::storage->material_casts_shadows(mat)) {
+ if (RSG::storage->material_casts_shadows(mat)) {
cast_shadows = true;
}
- if (VSG::storage->material_is_animated(mat)) {
+ if (RSG::storage->material_is_animated(mat)) {
is_animated = true;
}
- VSG::storage->material_update_dependency(mat, p_instance);
+ RSG::storage->material_update_dependency(mat, p_instance);
}
}
@@ -2688,52 +2688,52 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
can_cast_shadows = false;
}
- VSG::storage->base_update_dependency(mesh, p_instance);
+ RSG::storage->base_update_dependency(mesh, p_instance);
}
- } else if (p_instance->base_type == VS::INSTANCE_IMMEDIATE) {
+ } else if (p_instance->base_type == RS::INSTANCE_IMMEDIATE) {
- RID mat = VSG::storage->immediate_get_material(p_instance->base);
+ RID mat = RSG::storage->immediate_get_material(p_instance->base);
- can_cast_shadows = !mat.is_valid() || VSG::storage->material_casts_shadows(mat);
+ can_cast_shadows = !mat.is_valid() || RSG::storage->material_casts_shadows(mat);
- if (mat.is_valid() && VSG::storage->material_is_animated(mat)) {
+ if (mat.is_valid() && RSG::storage->material_is_animated(mat)) {
is_animated = true;
}
if (mat.is_valid()) {
- VSG::storage->material_update_dependency(mat, p_instance);
+ RSG::storage->material_update_dependency(mat, p_instance);
}
- } else if (p_instance->base_type == VS::INSTANCE_PARTICLES) {
+ } else if (p_instance->base_type == RS::INSTANCE_PARTICLES) {
bool cast_shadows = false;
- int dp = VSG::storage->particles_get_draw_passes(p_instance->base);
+ int dp = RSG::storage->particles_get_draw_passes(p_instance->base);
for (int i = 0; i < dp; i++) {
- RID mesh = VSG::storage->particles_get_draw_pass_mesh(p_instance->base, i);
+ RID mesh = RSG::storage->particles_get_draw_pass_mesh(p_instance->base, i);
if (!mesh.is_valid())
continue;
- int sc = VSG::storage->mesh_get_surface_count(mesh);
+ int sc = RSG::storage->mesh_get_surface_count(mesh);
for (int j = 0; j < sc; j++) {
- RID mat = VSG::storage->mesh_surface_get_material(mesh, j);
+ RID mat = RSG::storage->mesh_surface_get_material(mesh, j);
if (!mat.is_valid()) {
cast_shadows = true;
} else {
- if (VSG::storage->material_casts_shadows(mat)) {
+ if (RSG::storage->material_casts_shadows(mat)) {
cast_shadows = true;
}
- if (VSG::storage->material_is_animated(mat)) {
+ if (RSG::storage->material_is_animated(mat)) {
is_animated = true;
}
- VSG::storage->material_update_dependency(mat, p_instance);
+ RSG::storage->material_update_dependency(mat, p_instance);
}
}
}
@@ -2758,7 +2758,7 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
}
if (p_instance->skeleton.is_valid()) {
- VSG::storage->skeleton_update_dependency(p_instance->skeleton, p_instance);
+ RSG::storage->skeleton_update_dependency(p_instance->skeleton, p_instance);
}
p_instance->clean_up_dependencies();
@@ -2772,9 +2772,9 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
p_instance->update_dependencies = false;
}
-void VisualServerScene::update_dirty_instances() {
+void RenderingServerScene::update_dirty_instances() {
- VSG::storage->update_dirty_resources();
+ RSG::storage->update_dirty_resources();
while (_instance_update_list.first()) {
@@ -2782,7 +2782,7 @@ void VisualServerScene::update_dirty_instances() {
}
}
-bool VisualServerScene::free(RID p_rid) {
+bool RenderingServerScene::free(RID p_rid) {
if (camera_owner.owns(p_rid)) {
@@ -2798,8 +2798,8 @@ bool VisualServerScene::free(RID p_rid) {
while (scenario->instances.first()) {
instance_set_scenario(scenario->instances.first()->self()->self, RID());
}
- VSG::scene_render->free(scenario->reflection_probe_shadow_atlas);
- VSG::scene_render->free(scenario->reflection_atlas);
+ RSG::scene_render->free(scenario->reflection_probe_shadow_atlas);
+ RSG::scene_render->free(scenario->reflection_atlas);
scenario_owner.free(p_rid);
memdelete(scenario);
@@ -2827,13 +2827,13 @@ bool VisualServerScene::free(RID p_rid) {
return true;
}
-VisualServerScene *VisualServerScene::singleton = NULL;
+RenderingServerScene *RenderingServerScene::singleton = NULL;
-VisualServerScene::VisualServerScene() {
+RenderingServerScene::RenderingServerScene() {
render_pass = 1;
singleton = this;
}
-VisualServerScene::~VisualServerScene() {
+RenderingServerScene::~RenderingServerScene() {
}
diff --git a/servers/visual/visual_server_scene.h b/servers/rendering/rendering_server_scene.h
index 8dbd60d3ff..6012a75660 100644
--- a/servers/visual/visual_server_scene.h
+++ b/servers/rendering/rendering_server_scene.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_scene.h */
+/* rendering_server_scene.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -31,7 +31,7 @@
#ifndef VISUALSERVERSCENE_H
#define VISUALSERVERSCENE_H
-#include "servers/visual/rasterizer.h"
+#include "servers/rendering/rasterizer.h"
#include "core/math/geometry.h"
#include "core/math/octree.h"
@@ -41,7 +41,7 @@
#include "core/self_list.h"
#include "servers/arvr/arvr_interface.h"
-class VisualServerScene {
+class RenderingServerScene {
public:
enum {
@@ -55,7 +55,7 @@ public:
uint64_t render_pass;
- static VisualServerScene *singleton;
+ static RenderingServerScene *singleton;
/* CAMERA API */
@@ -109,7 +109,7 @@ public:
struct Scenario {
- VS::ScenarioDebugMode debug;
+ RS::ScenarioDebugMode debug;
RID self;
Octree<Instance, true> octree;
@@ -123,7 +123,7 @@ public:
SelfList<Instance>::List instances;
- Scenario() { debug = VS::SCENARIO_DEBUG_DISABLED; }
+ Scenario() { debug = RS::SCENARIO_DEBUG_DISABLED; }
};
mutable RID_PtrOwner<Scenario> scenario_owner;
@@ -133,7 +133,7 @@ public:
virtual RID scenario_create();
- virtual void scenario_set_debug(RID p_scenario, VS::ScenarioDebugMode p_debug_mode);
+ virtual void scenario_set_debug(RID p_scenario, RS::ScenarioDebugMode p_debug_mode);
virtual void scenario_set_environment(RID p_scenario, RID p_environment);
virtual void scenario_set_camera_effects(RID p_scenario, RID p_fx);
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment);
@@ -323,7 +323,7 @@ public:
struct LightCache {
- VS::LightType type;
+ RS::LightType type;
Transform transform;
Color color;
float energy;
@@ -406,8 +406,8 @@ public:
virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const;
- virtual void instance_geometry_set_flag(RID p_instance, VS::InstanceFlags p_flags, bool p_enabled);
- virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting);
+ virtual void instance_geometry_set_flag(RID p_instance, RS::InstanceFlags p_flags, bool p_enabled);
+ virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting);
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material);
virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin);
@@ -433,8 +433,8 @@ public:
bool free(RID p_rid);
- VisualServerScene();
- virtual ~VisualServerScene();
+ RenderingServerScene();
+ virtual ~RenderingServerScene();
};
#endif // VISUALSERVERSCENE_H
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp
index 555d5f99c7..24b2379d97 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/rendering/rendering_server_viewport.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_viewport.cpp */
+/* rendering_server_viewport.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_viewport.h"
+#include "rendering_server_viewport.h"
#include "core/project_settings.h"
-#include "visual_server_canvas.h"
-#include "visual_server_globals.h"
-#include "visual_server_scene.h"
+#include "rendering_server_canvas.h"
+#include "rendering_server_globals.h"
+#include "rendering_server_scene.h"
-static Transform2D _canvas_get_transform(VisualServerViewport::Viewport *p_viewport, VisualServerCanvas::Canvas *p_canvas, VisualServerViewport::Viewport::CanvasData *p_canvas_data, const Vector2 &p_vp_size) {
+static Transform2D _canvas_get_transform(RenderingServerViewport::Viewport *p_viewport, RenderingServerCanvas::Canvas *p_canvas, RenderingServerViewport::Viewport::CanvasData *p_canvas_data, const Vector2 &p_vp_size) {
Transform2D xf = p_viewport->global_transform;
@@ -47,7 +47,7 @@ static Transform2D _canvas_get_transform(VisualServerViewport::Viewport *p_viewp
xf = xf * p_canvas_data->transform;
- if (scale != 1.0 && !VSG::canvas->disable_scale) {
+ if (scale != 1.0 && !RSG::canvas->disable_scale) {
Vector2 pivot = p_vp_size * 0.5;
Transform2D xfpivot;
xfpivot.set_origin(pivot);
@@ -62,7 +62,7 @@ static Transform2D _canvas_get_transform(VisualServerViewport::Viewport *p_viewp
return xf;
}
-void VisualServerViewport::_draw_3d(Viewport *p_viewport, ARVRInterface::Eyes p_eye) {
+void RenderingServerViewport::_draw_3d(Viewport *p_viewport, ARVRInterface::Eyes p_eye) {
RENDER_TIMESTAMP(">Begin Rendering 3D Scene");
@@ -72,51 +72,51 @@ void VisualServerViewport::_draw_3d(Viewport *p_viewport, ARVRInterface::Eyes p_
}
if (p_viewport->use_arvr && arvr_interface.is_valid()) {
- VSG::scene->render_camera(p_viewport->render_buffers, arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
+ RSG::scene->render_camera(p_viewport->render_buffers, arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
} else {
- VSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
+ RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas);
}
RENDER_TIMESTAMP("<End Rendering 3D Scene");
}
-void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::Eyes p_eye) {
+void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::Eyes p_eye) {
/* Camera should always be BEFORE any other 3D */
bool scenario_draw_canvas_bg = false; //draw canvas, or some layer of it, as BG for 3D instead of in front
int scenario_canvas_max_layer = 0;
- Color bgcolor = VSG::storage->get_default_clear_color();
+ Color bgcolor = RSG::storage->get_default_clear_color();
- if (!p_viewport->hide_canvas && !p_viewport->disable_environment && VSG::scene->scenario_owner.owns(p_viewport->scenario)) {
+ if (!p_viewport->hide_canvas && !p_viewport->disable_environment && RSG::scene->scenario_owner.owns(p_viewport->scenario)) {
- VisualServerScene::Scenario *scenario = VSG::scene->scenario_owner.getornull(p_viewport->scenario);
+ RenderingServerScene::Scenario *scenario = RSG::scene->scenario_owner.getornull(p_viewport->scenario);
ERR_FAIL_COND(!scenario);
- if (VSG::scene_render->is_environment(scenario->environment)) {
- scenario_draw_canvas_bg = VSG::scene_render->environment_get_background(scenario->environment) == VS::ENV_BG_CANVAS;
+ if (RSG::scene_render->is_environment(scenario->environment)) {
+ scenario_draw_canvas_bg = RSG::scene_render->environment_get_background(scenario->environment) == RS::ENV_BG_CANVAS;
- scenario_canvas_max_layer = VSG::scene_render->environment_get_canvas_max_layer(scenario->environment);
+ scenario_canvas_max_layer = RSG::scene_render->environment_get_canvas_max_layer(scenario->environment);
}
}
- bool can_draw_3d = VSG::scene->camera_owner.owns(p_viewport->camera);
+ bool can_draw_3d = RSG::scene->camera_owner.owns(p_viewport->camera);
- if (p_viewport->clear_mode != VS::VIEWPORT_CLEAR_NEVER) {
+ if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
if (p_viewport->transparent_bg) {
bgcolor = Color(0, 0, 0, 0);
}
- if (p_viewport->clear_mode == VS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
- p_viewport->clear_mode = VS::VIEWPORT_CLEAR_NEVER;
+ if (p_viewport->clear_mode == RS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
+ p_viewport->clear_mode = RS::VIEWPORT_CLEAR_NEVER;
}
}
if ((scenario_draw_canvas_bg || can_draw_3d) && !p_viewport->render_buffers.is_valid()) {
//wants to draw 3D but there is no render buffer, create
- p_viewport->render_buffers = VSG::scene_render->render_buffers_create();
- VSG::scene_render->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, p_viewport->size.width, p_viewport->size.height, p_viewport->msaa);
+ p_viewport->render_buffers = RSG::scene_render->render_buffers_create();
+ RSG::scene_render->render_buffers_configure(p_viewport->render_buffers, p_viewport->render_target, p_viewport->size.width, p_viewport->size.height, p_viewport->msaa);
}
- VSG::storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+ RSG::storage->render_target_request_clear(p_viewport->render_target, bgcolor);
if (!scenario_draw_canvas_bg && can_draw_3d) {
_draw_3d(p_viewport, p_eye);
@@ -138,7 +138,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
RENDER_TIMESTAMP("Cull Canvas Lights");
for (Map<RID, Viewport::CanvasData>::Element *E = p_viewport->canvas_map.front(); E; E = E->next()) {
- VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get().canvas);
+ RenderingServerCanvas::Canvas *canvas = static_cast<RenderingServerCanvas::Canvas *>(E->get().canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E->get(), clip_rect.size);
@@ -149,7 +149,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
RasterizerCanvas::Light *cl = F->get();
if (cl->enabled && cl->texture.is_valid()) {
//not super efficient..
- Size2 tsize = VSG::storage->texture_size_with_proxy(cl->texture);
+ Size2 tsize = RSG::storage->texture_size_with_proxy(cl->texture);
tsize *= cl->scale;
Vector2 offset = tsize / 2.0;
@@ -177,7 +177,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
lights_with_shadow = cl;
cl->radius_cache = cl->rect_cache.size.length();
}
- if (cl->mode == VS::CANVAS_LIGHT_MODE_MASK) {
+ if (cl->mode == RS::CANVAS_LIGHT_MODE_MASK) {
cl->mask_next_ptr = lights_with_mask;
lights_with_mask = cl;
}
@@ -186,7 +186,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
}
//guess this is not needed, but keeping because it may be
- //VSG::canvas_render->light_internal_update(cl->light_internal, cl);
+ //RSG::canvas_render->light_internal_update(cl->light_internal, cl);
}
}
@@ -204,7 +204,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
//make list of occluders
for (Map<RID, Viewport::CanvasData>::Element *E = p_viewport->canvas_map.front(); E; E = E->next()) {
- VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get().canvas);
+ RenderingServerCanvas::Canvas *canvas = static_cast<RenderingServerCanvas::Canvas *>(E->get().canvas);
Transform2D xf = _canvas_get_transform(p_viewport, canvas, &E->get(), clip_rect.size);
for (Set<RasterizerCanvas::LightOccluderInstance *>::Element *F = canvas->occluders.front(); F; F = F->next()) {
@@ -226,17 +226,17 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
RENDER_TIMESTAMP("Render Shadow");
- VSG::canvas_render->light_update_shadow(light->light_internal, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders);
+ RSG::canvas_render->light_update_shadow(light->light_internal, light->xform_cache.affine_inverse(), light->item_shadow_mask, light->radius_cache / 1000.0, light->radius_cache * 1.1, occluders);
light = light->shadows_next_ptr;
}
- //VSG::canvas_render->reset_canvas();
+ //RSG::canvas_render->reset_canvas();
RENDER_TIMESTAMP("<End rendering 2D Shadows");
}
if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().get_layer() > scenario_canvas_max_layer) {
if (!can_draw_3d) {
- VSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
+ RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
_draw_3d(p_viewport, p_eye);
}
@@ -245,7 +245,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
for (Map<Viewport::CanvasKey, Viewport::CanvasData *>::Element *E = canvas_map.front(); E; E = E->next()) {
- VisualServerCanvas::Canvas *canvas = static_cast<VisualServerCanvas::Canvas *>(E->get()->canvas);
+ RenderingServerCanvas::Canvas *canvas = static_cast<RenderingServerCanvas::Canvas *>(E->get()->canvas);
Transform2D xform = _canvas_get_transform(p_viewport, canvas, E->get(), clip_rect.size);
@@ -260,12 +260,12 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
ptr = ptr->filter_next_ptr;
}
- VSG::canvas->render_canvas(p_viewport->render_target, canvas, xform, canvas_lights, lights_with_mask, clip_rect);
+ RSG::canvas->render_canvas(p_viewport->render_target, canvas, xform, canvas_lights, lights_with_mask, clip_rect);
i++;
if (scenario_draw_canvas_bg && E->key().get_layer() >= scenario_canvas_max_layer) {
if (!can_draw_3d) {
- VSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
+ RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
_draw_3d(p_viewport, p_eye);
}
@@ -276,22 +276,22 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
if (scenario_draw_canvas_bg) {
if (!can_draw_3d) {
- VSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
+ RSG::scene->render_empty_scene(p_viewport->render_buffers, p_viewport->scenario, p_viewport->shadow_atlas);
} else {
_draw_3d(p_viewport, p_eye);
}
}
- //VSG::canvas_render->canvas_debug_viewport_shadows(lights_with_shadow);
+ //RSG::canvas_render->canvas_debug_viewport_shadows(lights_with_shadow);
}
- if (VSG::storage->render_target_is_clear_requested(p_viewport->render_target)) {
+ if (RSG::storage->render_target_is_clear_requested(p_viewport->render_target)) {
//was never cleared in the end, force clear it
- VSG::storage->render_target_do_clear_request(p_viewport->render_target);
+ RSG::storage->render_target_do_clear_request(p_viewport->render_target);
}
}
-void VisualServerViewport::draw_viewports() {
+void RenderingServerViewport::draw_viewports() {
#if 0
// get our arvr interface in case we need it
@@ -323,7 +323,7 @@ void VisualServerViewport::draw_viewports() {
Viewport *vp = active_viewports[i];
- if (vp->update_mode == VS::VIEWPORT_UPDATE_DISABLED)
+ if (vp->update_mode == RS::VIEWPORT_UPDATE_DISABLED)
continue;
if (!vp->render_target.is_valid()) {
@@ -333,15 +333,15 @@ void VisualServerViewport::draw_viewports() {
bool visible = vp->viewport_to_screen_rect != Rect2();
- if (vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE) {
+ if (vp->update_mode == RS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == RS::VIEWPORT_UPDATE_ONCE) {
visible = true;
}
- if (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_VISIBLE && VSG::storage->render_target_was_used(vp->render_target)) {
+ if (vp->update_mode == RS::VIEWPORT_UPDATE_WHEN_VISIBLE && RSG::storage->render_target_was_used(vp->render_target)) {
visible = true;
}
- if (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE) {
+ if (vp->update_mode == RS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE) {
Viewport *parent = viewport_owner.getornull(vp->parent);
if (parent && parent->last_pass == draw_viewports_pass) {
visible = true;
@@ -365,21 +365,21 @@ void VisualServerViewport::draw_viewports() {
RENDER_TIMESTAMP(">Rendering Viewport " + itos(i));
- VSG::storage->render_target_set_as_unused(vp->render_target);
+ RSG::storage->render_target_set_as_unused(vp->render_target);
#if 0
if (vp->use_arvr && arvr_interface.is_valid()) {
// override our size, make sure it matches our required size
vp->size = arvr_interface->get_render_targetsize();
- VSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y);
+ RSG::storage->render_target_set_size(vp->render_target, vp->size.x, vp->size.y);
// render mono or left eye first
ARVRInterface::Eyes leftOrMono = arvr_interface->is_stereo() ? ARVRInterface::EYE_LEFT : ARVRInterface::EYE_MONO;
// check for an external texture destination for our left eye/mono
- VSG::storage->render_target_set_external_texture(vp->render_target, arvr_interface->get_external_texture_for_eye(leftOrMono));
+ RSG::storage->render_target_set_external_texture(vp->render_target, arvr_interface->get_external_texture_for_eye(leftOrMono));
// set our render target as current
- VSG::rasterizer->set_current_render_target(vp->render_target);
+ RSG::rasterizer->set_current_render_target(vp->render_target);
// and draw left eye/mono
_draw_viewport(vp, leftOrMono);
@@ -388,10 +388,10 @@ void VisualServerViewport::draw_viewports() {
// render right eye
if (leftOrMono == ARVRInterface::EYE_LEFT) {
// check for an external texture destination for our right eye
- VSG::storage->render_target_set_external_texture(vp->render_target, arvr_interface->get_external_texture_for_eye(ARVRInterface::EYE_RIGHT));
+ RSG::storage->render_target_set_external_texture(vp->render_target, arvr_interface->get_external_texture_for_eye(ARVRInterface::EYE_RIGHT));
// commit for eye may have changed the render target
- VSG::rasterizer->set_current_render_target(vp->render_target);
+ RSG::rasterizer->set_current_render_target(vp->render_target);
_draw_viewport(vp, ARVRInterface::EYE_RIGHT);
arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect);
@@ -402,23 +402,23 @@ void VisualServerViewport::draw_viewports() {
} else {
#endif
{
- VSG::storage->render_target_set_external_texture(vp->render_target, 0);
+ RSG::storage->render_target_set_external_texture(vp->render_target, 0);
- VSG::scene_render->set_debug_draw_mode(vp->debug_draw);
- VSG::storage->render_info_begin_capture();
+ RSG::scene_render->set_debug_draw_mode(vp->debug_draw);
+ RSG::storage->render_info_begin_capture();
// render standard mono camera
_draw_viewport(vp);
- VSG::storage->render_info_end_capture();
- vp->render_info[VS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_OBJECTS_IN_FRAME);
- vp->render_info[VS::VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_VERTICES_IN_FRAME);
- vp->render_info[VS::VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_MATERIAL_CHANGES_IN_FRAME);
- vp->render_info[VS::VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_SHADER_CHANGES_IN_FRAME);
- vp->render_info[VS::VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_SURFACE_CHANGES_IN_FRAME);
- vp->render_info[VS::VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME] = VSG::storage->get_captured_render_info(VS::INFO_DRAW_CALLS_IN_FRAME);
+ RSG::storage->render_info_end_capture();
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_OBJECTS_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_VERTICES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_MATERIAL_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_SHADER_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_SURFACE_CHANGES_IN_FRAME);
+ vp->render_info[RS::VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME] = RSG::storage->get_captured_render_info(RS::INFO_DRAW_CALLS_IN_FRAME);
- if (vp->viewport_to_screen != DisplayServer::INVALID_WINDOW_ID && (!vp->viewport_render_direct_to_screen || !VSG::rasterizer->is_low_end())) {
+ if (vp->viewport_to_screen != DisplayServer::INVALID_WINDOW_ID && (!vp->viewport_render_direct_to_screen || !RSG::rasterizer->is_low_end())) {
//copy to screen if set as such
Rasterizer::BlitToScreen blit;
blit.render_target = vp->render_target;
@@ -437,24 +437,24 @@ void VisualServerViewport::draw_viewports() {
}
}
- if (vp->update_mode == VS::VIEWPORT_UPDATE_ONCE) {
- vp->update_mode = VS::VIEWPORT_UPDATE_DISABLED;
+ if (vp->update_mode == RS::VIEWPORT_UPDATE_ONCE) {
+ vp->update_mode = RS::VIEWPORT_UPDATE_DISABLED;
}
RENDER_TIMESTAMP("<Rendering Viewport " + itos(i));
}
- VSG::scene_render->set_debug_draw_mode(VS::VIEWPORT_DEBUG_DRAW_DISABLED);
+ RSG::scene_render->set_debug_draw_mode(RS::VIEWPORT_DEBUG_DRAW_DISABLED);
RENDER_TIMESTAMP("<Render Viewports");
//this needs to be called to make screen swapping more efficient
- VSG::rasterizer->prepare_for_blitting_render_targets();
+ RSG::rasterizer->prepare_for_blitting_render_targets();
for (Map<int, Vector<Rasterizer::BlitToScreen>>::Element *E = blit_to_screen_list.front(); E; E = E->next()) {
- VSG::rasterizer->blit_render_targets_to_screen(E->key(), E->get().ptr(), E->get().size());
+ RSG::rasterizer->blit_render_targets_to_screen(E->key(), E->get().ptr(), E->get().size());
}
}
-RID VisualServerViewport::viewport_create() {
+RID RenderingServerViewport::viewport_create() {
Viewport *viewport = memnew(Viewport);
@@ -463,21 +463,21 @@ RID VisualServerViewport::viewport_create() {
viewport->self = rid;
viewport->hide_scenario = false;
viewport->hide_canvas = false;
- viewport->render_target = VSG::storage->render_target_create();
- viewport->shadow_atlas = VSG::scene_render->shadow_atlas_create();
+ viewport->render_target = RSG::storage->render_target_create();
+ viewport->shadow_atlas = RSG::scene_render->shadow_atlas_create();
viewport->viewport_render_direct_to_screen = false;
return rid;
}
-void VisualServerViewport::viewport_set_use_arvr(RID p_viewport, bool p_use_arvr) {
+void RenderingServerViewport::viewport_set_use_arvr(RID p_viewport, bool p_use_arvr) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->use_arvr = p_use_arvr;
}
-void VisualServerViewport::viewport_set_size(RID p_viewport, int p_width, int p_height) {
+void RenderingServerViewport::viewport_set_size(RID p_viewport, int p_width, int p_height) {
ERR_FAIL_COND(p_width < 0 && p_height < 0);
@@ -485,18 +485,18 @@ void VisualServerViewport::viewport_set_size(RID p_viewport, int p_width, int p_
ERR_FAIL_COND(!viewport);
viewport->size = Size2(p_width, p_height);
- VSG::storage->render_target_set_size(viewport->render_target, p_width, p_height);
+ RSG::storage->render_target_set_size(viewport->render_target, p_width, p_height);
if (viewport->render_buffers.is_valid()) {
if (p_width == 0 || p_height == 0) {
- VSG::scene_render->free(viewport->render_buffers);
+ RSG::scene_render->free(viewport->render_buffers);
viewport->render_buffers = RID();
} else {
- VSG::scene_render->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa);
+ RSG::scene_render->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, viewport->msaa);
}
}
}
-void VisualServerViewport::viewport_set_active(RID p_viewport, bool p_active) {
+void RenderingServerViewport::viewport_set_active(RID p_viewport, bool p_active) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -509,7 +509,7 @@ void VisualServerViewport::viewport_set_active(RID p_viewport, bool p_active) {
}
}
-void VisualServerViewport::viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) {
+void RenderingServerViewport::viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -517,7 +517,7 @@ void VisualServerViewport::viewport_set_parent_viewport(RID p_viewport, RID p_pa
viewport->parent = p_parent_viewport;
}
-void VisualServerViewport::viewport_set_clear_mode(RID p_viewport, VS::ViewportClearMode p_clear_mode) {
+void RenderingServerViewport::viewport_set_clear_mode(RID p_viewport, RS::ViewportClearMode p_clear_mode) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -525,7 +525,7 @@ void VisualServerViewport::viewport_set_clear_mode(RID p_viewport, VS::ViewportC
viewport->clear_mode = p_clear_mode;
}
-void VisualServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect, DisplayServer::WindowID p_screen) {
+void RenderingServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect, DisplayServer::WindowID p_screen) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -533,10 +533,10 @@ void VisualServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2
if (p_screen != DisplayServer::INVALID_WINDOW_ID) {
// If using GLES2 we can optimize this operation by rendering directly to system_fbo
// instead of rendering to fbo and copying to system_fbo after
- if (VSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
+ if (RSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
- VSG::storage->render_target_set_size(viewport->render_target, p_rect.size.x, p_rect.size.y);
- VSG::storage->render_target_set_position(viewport->render_target, p_rect.position.x, p_rect.position.y);
+ RSG::storage->render_target_set_size(viewport->render_target, p_rect.size.x, p_rect.size.y);
+ RSG::storage->render_target_set_position(viewport->render_target, p_rect.position.x, p_rect.position.y);
}
viewport->viewport_to_screen_rect = p_rect;
@@ -544,10 +544,10 @@ void VisualServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2
} else {
// if render_direct_to_screen was used, reset size and position
- if (VSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
+ if (RSG::rasterizer->is_low_end() && viewport->viewport_render_direct_to_screen) {
- VSG::storage->render_target_set_position(viewport->render_target, 0, 0);
- VSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ RSG::storage->render_target_set_position(viewport->render_target, 0, 0);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
}
viewport->viewport_to_screen_rect = Rect2();
@@ -555,7 +555,7 @@ void VisualServerViewport::viewport_attach_to_screen(RID p_viewport, const Rect2
}
}
-void VisualServerViewport::viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) {
+void RenderingServerViewport::viewport_set_render_direct_to_screen(RID p_viewport, bool p_enable) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -565,22 +565,22 @@ void VisualServerViewport::viewport_set_render_direct_to_screen(RID p_viewport,
// if disabled, reset render_target size and position
if (!p_enable) {
- VSG::storage->render_target_set_position(viewport->render_target, 0, 0);
- VSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
+ RSG::storage->render_target_set_position(viewport->render_target, 0, 0);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->size.x, viewport->size.y);
}
- VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN, p_enable);
+ RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_DIRECT_TO_SCREEN, p_enable);
viewport->viewport_render_direct_to_screen = p_enable;
// if attached to screen already, setup screen size and position, this needs to happen after setting flag to avoid an unnecessary buffer allocation
- if (VSG::rasterizer->is_low_end() && viewport->viewport_to_screen_rect != Rect2() && p_enable) {
+ if (RSG::rasterizer->is_low_end() && viewport->viewport_to_screen_rect != Rect2() && p_enable) {
- VSG::storage->render_target_set_size(viewport->render_target, viewport->viewport_to_screen_rect.size.x, viewport->viewport_to_screen_rect.size.y);
- VSG::storage->render_target_set_position(viewport->render_target, viewport->viewport_to_screen_rect.position.x, viewport->viewport_to_screen_rect.position.y);
+ RSG::storage->render_target_set_size(viewport->render_target, viewport->viewport_to_screen_rect.size.x, viewport->viewport_to_screen_rect.size.y);
+ RSG::storage->render_target_set_position(viewport->render_target, viewport->viewport_to_screen_rect.position.x, viewport->viewport_to_screen_rect.position.y);
}
}
-void VisualServerViewport::viewport_set_update_mode(RID p_viewport, VS::ViewportUpdateMode p_mode) {
+void RenderingServerViewport::viewport_set_update_mode(RID p_viewport, RS::ViewportUpdateMode p_mode) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -588,29 +588,29 @@ void VisualServerViewport::viewport_set_update_mode(RID p_viewport, VS::Viewport
viewport->update_mode = p_mode;
}
-RID VisualServerViewport::viewport_get_texture(RID p_viewport) const {
+RID RenderingServerViewport::viewport_get_texture(RID p_viewport) const {
const Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND_V(!viewport, RID());
- return VSG::storage->render_target_get_texture(viewport->render_target);
+ return RSG::storage->render_target_get_texture(viewport->render_target);
}
-void VisualServerViewport::viewport_set_hide_scenario(RID p_viewport, bool p_hide) {
+void RenderingServerViewport::viewport_set_hide_scenario(RID p_viewport, bool p_hide) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->hide_scenario = p_hide;
}
-void VisualServerViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) {
+void RenderingServerViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->hide_canvas = p_hide;
}
-void VisualServerViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) {
+void RenderingServerViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -618,27 +618,27 @@ void VisualServerViewport::viewport_set_disable_environment(RID p_viewport, bool
viewport->disable_environment = p_disable;
}
-void VisualServerViewport::viewport_attach_camera(RID p_viewport, RID p_camera) {
+void RenderingServerViewport::viewport_attach_camera(RID p_viewport, RID p_camera) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->camera = p_camera;
}
-void VisualServerViewport::viewport_set_scenario(RID p_viewport, RID p_scenario) {
+void RenderingServerViewport::viewport_set_scenario(RID p_viewport, RID p_scenario) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->scenario = p_scenario;
}
-void VisualServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas) {
+void RenderingServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
ERR_FAIL_COND(viewport->canvas_map.has(p_canvas));
- VisualServerCanvas::Canvas *canvas = VSG::canvas->canvas_owner.getornull(p_canvas);
+ RenderingServerCanvas::Canvas *canvas = RSG::canvas->canvas_owner.getornull(p_canvas);
ERR_FAIL_COND(!canvas);
canvas->viewports.insert(p_viewport);
@@ -648,18 +648,18 @@ void VisualServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas)
viewport->canvas_map[p_canvas].canvas = canvas;
}
-void VisualServerViewport::viewport_remove_canvas(RID p_viewport, RID p_canvas) {
+void RenderingServerViewport::viewport_remove_canvas(RID p_viewport, RID p_canvas) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
- VisualServerCanvas::Canvas *canvas = VSG::canvas->canvas_owner.getornull(p_canvas);
+ RenderingServerCanvas::Canvas *canvas = RSG::canvas->canvas_owner.getornull(p_canvas);
ERR_FAIL_COND(!canvas);
viewport->canvas_map.erase(p_canvas);
canvas->viewports.erase(p_viewport);
}
-void VisualServerViewport::viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) {
+void RenderingServerViewport::viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -667,23 +667,23 @@ void VisualServerViewport::viewport_set_canvas_transform(RID p_viewport, RID p_c
ERR_FAIL_COND(!viewport->canvas_map.has(p_canvas));
viewport->canvas_map[p_canvas].transform = p_offset;
}
-void VisualServerViewport::viewport_set_transparent_background(RID p_viewport, bool p_enabled) {
+void RenderingServerViewport::viewport_set_transparent_background(RID p_viewport, bool p_enabled) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
- VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_TRANSPARENT, p_enabled);
+ RSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_TRANSPARENT, p_enabled);
viewport->transparent_bg = p_enabled;
}
-void VisualServerViewport::viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) {
+void RenderingServerViewport::viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->global_transform = p_transform;
}
-void VisualServerViewport::viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) {
+void RenderingServerViewport::viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -693,25 +693,25 @@ void VisualServerViewport::viewport_set_canvas_stacking(RID p_viewport, RID p_ca
viewport->canvas_map[p_canvas].sublayer = p_sublayer;
}
-void VisualServerViewport::viewport_set_shadow_atlas_size(RID p_viewport, int p_size) {
+void RenderingServerViewport::viewport_set_shadow_atlas_size(RID p_viewport, int p_size) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
viewport->shadow_atlas_size = p_size;
- VSG::scene_render->shadow_atlas_set_size(viewport->shadow_atlas, viewport->shadow_atlas_size);
+ RSG::scene_render->shadow_atlas_set_size(viewport->shadow_atlas, viewport->shadow_atlas_size);
}
-void VisualServerViewport::viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv) {
+void RenderingServerViewport::viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
- VSG::scene_render->shadow_atlas_set_quadrant_subdivision(viewport->shadow_atlas, p_quadrant, p_subdiv);
+ RSG::scene_render->shadow_atlas_set_quadrant_subdivision(viewport->shadow_atlas, p_quadrant, p_subdiv);
}
-void VisualServerViewport::viewport_set_msaa(RID p_viewport, VS::ViewportMSAA p_msaa) {
+void RenderingServerViewport::viewport_set_msaa(RID p_viewport, RS::ViewportMSAA p_msaa) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -721,13 +721,13 @@ void VisualServerViewport::viewport_set_msaa(RID p_viewport, VS::ViewportMSAA p_
}
viewport->msaa = p_msaa;
if (viewport->render_buffers.is_valid()) {
- VSG::scene_render->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, p_msaa);
+ RSG::scene_render->render_buffers_configure(viewport->render_buffers, viewport->render_target, viewport->size.width, viewport->size.height, p_msaa);
}
}
-int VisualServerViewport::viewport_get_render_info(RID p_viewport, VS::ViewportRenderInfo p_info) {
+int RenderingServerViewport::viewport_get_render_info(RID p_viewport, RS::ViewportRenderInfo p_info) {
- ERR_FAIL_INDEX_V(p_info, VS::VIEWPORT_RENDER_INFO_MAX, -1);
+ ERR_FAIL_INDEX_V(p_info, RS::VIEWPORT_RENDER_INFO_MAX, -1);
Viewport *viewport = viewport_owner.getornull(p_viewport);
if (!viewport)
@@ -736,7 +736,7 @@ int VisualServerViewport::viewport_get_render_info(RID p_viewport, VS::ViewportR
return viewport->render_info[p_info];
}
-void VisualServerViewport::viewport_set_debug_draw(RID p_viewport, VS::ViewportDebugDraw p_draw) {
+void RenderingServerViewport::viewport_set_debug_draw(RID p_viewport, RS::ViewportDebugDraw p_draw) {
Viewport *viewport = viewport_owner.getornull(p_viewport);
ERR_FAIL_COND(!viewport);
@@ -744,16 +744,16 @@ void VisualServerViewport::viewport_set_debug_draw(RID p_viewport, VS::ViewportD
viewport->debug_draw = p_draw;
}
-bool VisualServerViewport::free(RID p_rid) {
+bool RenderingServerViewport::free(RID p_rid) {
if (viewport_owner.owns(p_rid)) {
Viewport *viewport = viewport_owner.getornull(p_rid);
- VSG::storage->free(viewport->render_target);
- VSG::scene_render->free(viewport->shadow_atlas);
+ RSG::storage->free(viewport->render_target);
+ RSG::scene_render->free(viewport->shadow_atlas);
if (viewport->render_buffers.is_valid()) {
- VSG::scene_render->free(viewport->render_buffers);
+ RSG::scene_render->free(viewport->render_buffers);
}
while (viewport->canvas_map.front()) {
@@ -772,9 +772,9 @@ bool VisualServerViewport::free(RID p_rid) {
return false;
}
-void VisualServerViewport::set_default_clear_color(const Color &p_color) {
- VSG::storage->set_default_clear_color(p_color);
+void RenderingServerViewport::set_default_clear_color(const Color &p_color) {
+ RSG::storage->set_default_clear_color(p_color);
}
-VisualServerViewport::VisualServerViewport() {
+RenderingServerViewport::RenderingServerViewport() {
}
diff --git a/servers/visual/visual_server_viewport.h b/servers/rendering/rendering_server_viewport.h
index 06372376f8..4ae7a7f536 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/rendering/rendering_server_viewport.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_viewport.h */
+/* rendering_server_viewport.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -35,9 +35,9 @@
#include "core/self_list.h"
#include "rasterizer.h"
#include "servers/arvr/arvr_interface.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
-class VisualServerViewport {
+class RenderingServerViewport {
public:
struct CanvasBase {
};
@@ -53,12 +53,12 @@ public:
RID camera;
RID scenario;
- VS::ViewportUpdateMode update_mode;
+ RS::ViewportUpdateMode update_mode;
RID render_target;
RID render_target_texture;
RID render_buffers;
- VS::ViewportMSAA msaa;
+ RS::ViewportMSAA msaa;
DisplayServer::WindowID viewport_to_screen;
Rect2 viewport_to_screen_rect;
@@ -75,10 +75,10 @@ public:
uint64_t last_pass = 0;
- int render_info[VS::VIEWPORT_RENDER_INFO_MAX];
- VS::ViewportDebugDraw debug_draw;
+ int render_info[RS::VIEWPORT_RENDER_INFO_MAX];
+ RS::ViewportDebugDraw debug_draw;
- VS::ViewportClearMode clear_mode;
+ RS::ViewportClearMode clear_mode;
bool transparent_bg;
@@ -115,16 +115,16 @@ public:
Map<RID, CanvasData> canvas_map;
Viewport() {
- update_mode = VS::VIEWPORT_UPDATE_WHEN_VISIBLE;
- clear_mode = VS::VIEWPORT_CLEAR_ALWAYS;
+ update_mode = RS::VIEWPORT_UPDATE_WHEN_VISIBLE;
+ clear_mode = RS::VIEWPORT_CLEAR_ALWAYS;
transparent_bg = false;
disable_environment = false;
viewport_to_screen = DisplayServer::INVALID_WINDOW_ID;
shadow_atlas_size = 0;
keep_3d_linear = false;
- debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED;
- msaa = VS::VIEWPORT_MSAA_DISABLED;
- for (int i = 0; i < VS::VIEWPORT_RENDER_INFO_MAX; i++) {
+ debug_draw = RS::VIEWPORT_DEBUG_DRAW_DISABLED;
+ msaa = RS::VIEWPORT_MSAA_DISABLED;
+ for (int i = 0; i < RS::VIEWPORT_RENDER_INFO_MAX; i++) {
render_info[i] = 0;
}
use_arvr = false;
@@ -167,10 +167,10 @@ public:
void viewport_set_active(RID p_viewport, bool p_active);
void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport);
- void viewport_set_update_mode(RID p_viewport, VS::ViewportUpdateMode p_mode);
+ void viewport_set_update_mode(RID p_viewport, RS::ViewportUpdateMode p_mode);
void viewport_set_vflip(RID p_viewport, bool p_enable);
- void viewport_set_clear_mode(RID p_viewport, VS::ViewportClearMode p_clear_mode);
+ void viewport_set_clear_mode(RID p_viewport, RS::ViewportClearMode p_clear_mode);
RID viewport_get_texture(RID p_viewport) const;
@@ -191,18 +191,18 @@ public:
void viewport_set_shadow_atlas_size(RID p_viewport, int p_size);
void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv);
- void viewport_set_msaa(RID p_viewport, VS::ViewportMSAA p_msaa);
+ void viewport_set_msaa(RID p_viewport, RS::ViewportMSAA p_msaa);
- virtual int viewport_get_render_info(RID p_viewport, VS::ViewportRenderInfo p_info);
- virtual void viewport_set_debug_draw(RID p_viewport, VS::ViewportDebugDraw p_draw);
+ virtual int viewport_get_render_info(RID p_viewport, RS::ViewportRenderInfo p_info);
+ virtual void viewport_set_debug_draw(RID p_viewport, RS::ViewportDebugDraw p_draw);
void set_default_clear_color(const Color &p_color);
void draw_viewports();
bool free(RID p_rid);
- VisualServerViewport();
- virtual ~VisualServerViewport() {}
+ RenderingServerViewport();
+ virtual ~RenderingServerViewport() {}
};
#endif // VISUALSERVERVIEWPORT_H
diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/rendering/rendering_server_wrap_mt.cpp
index 4169144fc9..d1bb7b67c6 100644
--- a/servers/visual/visual_server_wrap_mt.cpp
+++ b/servers/rendering/rendering_server_wrap_mt.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_wrap_mt.cpp */
+/* rendering_server_wrap_mt.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,43 +28,43 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server_wrap_mt.h"
+#include "rendering_server_wrap_mt.h"
#include "core/os/os.h"
#include "core/project_settings.h"
#include "servers/display_server.h"
-void VisualServerWrapMT::thread_exit() {
+void RenderingServerWrapMT::thread_exit() {
exit = true;
}
-void VisualServerWrapMT::thread_draw(bool p_swap_buffers, double frame_step) {
+void RenderingServerWrapMT::thread_draw(bool p_swap_buffers, double frame_step) {
if (!atomic_decrement(&draw_pending)) {
- visual_server->draw(p_swap_buffers, frame_step);
+ rendering_server->draw(p_swap_buffers, frame_step);
}
}
-void VisualServerWrapMT::thread_flush() {
+void RenderingServerWrapMT::thread_flush() {
atomic_decrement(&draw_pending);
}
-void VisualServerWrapMT::_thread_callback(void *_instance) {
+void RenderingServerWrapMT::_thread_callback(void *_instance) {
- VisualServerWrapMT *vsmt = reinterpret_cast<VisualServerWrapMT *>(_instance);
+ RenderingServerWrapMT *vsmt = reinterpret_cast<RenderingServerWrapMT *>(_instance);
vsmt->thread_loop();
}
-void VisualServerWrapMT::thread_loop() {
+void RenderingServerWrapMT::thread_loop() {
server_thread = Thread::get_caller_id();
DisplayServer::get_singleton()->make_rendering_thread();
- visual_server->init();
+ rendering_server->init();
exit = false;
draw_thread_up = true;
@@ -75,66 +75,66 @@ void VisualServerWrapMT::thread_loop() {
command_queue.flush_all(); // flush all
- visual_server->finish();
+ rendering_server->finish();
}
/* EVENT QUEUING */
-void VisualServerWrapMT::sync() {
+void RenderingServerWrapMT::sync() {
if (create_thread) {
atomic_increment(&draw_pending);
- command_queue.push_and_sync(this, &VisualServerWrapMT::thread_flush);
+ command_queue.push_and_sync(this, &RenderingServerWrapMT::thread_flush);
} else {
command_queue.flush_all(); //flush all pending from other threads
}
}
-void VisualServerWrapMT::draw(bool p_swap_buffers, double frame_step) {
+void RenderingServerWrapMT::draw(bool p_swap_buffers, double frame_step) {
if (create_thread) {
atomic_increment(&draw_pending);
- command_queue.push(this, &VisualServerWrapMT::thread_draw, p_swap_buffers, frame_step);
+ command_queue.push(this, &RenderingServerWrapMT::thread_draw, p_swap_buffers, frame_step);
} else {
- visual_server->draw(p_swap_buffers, frame_step);
+ rendering_server->draw(p_swap_buffers, frame_step);
}
}
-void VisualServerWrapMT::init() {
+void RenderingServerWrapMT::init() {
if (create_thread) {
- print_verbose("VisualServerWrapMT: Creating render thread");
+ print_verbose("RenderingServerWrapMT: Creating render thread");
DisplayServer::get_singleton()->release_rendering_thread();
if (create_thread) {
thread = Thread::create(_thread_callback, this);
- print_verbose("VisualServerWrapMT: Starting render thread");
+ print_verbose("RenderingServerWrapMT: Starting render thread");
}
while (!draw_thread_up) {
OS::get_singleton()->delay_usec(1000);
}
- print_verbose("VisualServerWrapMT: Finished render thread");
+ print_verbose("RenderingServerWrapMT: Finished render thread");
} else {
- visual_server->init();
+ rendering_server->init();
}
}
-void VisualServerWrapMT::finish() {
+void RenderingServerWrapMT::finish() {
if (thread) {
- command_queue.push(this, &VisualServerWrapMT::thread_exit);
+ command_queue.push(this, &RenderingServerWrapMT::thread_exit);
Thread::wait_to_finish(thread);
memdelete(thread);
thread = NULL;
} else {
- visual_server->finish();
+ rendering_server->finish();
}
sky_free_cached_ids();
@@ -163,20 +163,20 @@ void VisualServerWrapMT::finish() {
canvas_occluder_polygon_free_cached_ids();
}
-void VisualServerWrapMT::set_use_vsync_callback(bool p_enable) {
+void RenderingServerWrapMT::set_use_vsync_callback(bool p_enable) {
singleton_mt->call_set_use_vsync(p_enable);
}
-VisualServerWrapMT *VisualServerWrapMT::singleton_mt = NULL;
+RenderingServerWrapMT *RenderingServerWrapMT::singleton_mt = NULL;
-VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_thread) :
+RenderingServerWrapMT::RenderingServerWrapMT(RenderingServer *p_contained, bool p_create_thread) :
command_queue(p_create_thread) {
singleton_mt = this;
DisplayServer::switch_vsync_function = set_use_vsync_callback; //as this goes to another thread, make sure it goes properly
- visual_server = p_contained;
+ rendering_server = p_contained;
create_thread = p_create_thread;
thread = NULL;
draw_pending = 0;
@@ -190,8 +190,8 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_
}
}
-VisualServerWrapMT::~VisualServerWrapMT() {
+RenderingServerWrapMT::~RenderingServerWrapMT() {
- memdelete(visual_server);
+ memdelete(rendering_server);
//finish();
}
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index e043ac5214..4d449ea913 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server_wrap_mt.h */
+/* rendering_server_wrap_mt.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,17 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUAL_SERVER_WRAP_MT_H
-#define VISUAL_SERVER_WRAP_MT_H
+#ifndef RENDERING_SERVER_WRAP_MT_H
+#define RENDERING_SERVER_WRAP_MT_H
#include "core/command_queue_mt.h"
#include "core/os/thread.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
-class VisualServerWrapMT : public VisualServer {
+class RenderingServerWrapMT : public RenderingServer {
// the real visual server
- mutable VisualServer *visual_server;
+ mutable RenderingServer *rendering_server;
mutable CommandQueueMT command_queue;
@@ -63,7 +63,7 @@ class VisualServerWrapMT : public VisualServer {
//#define DEBUG_SYNC
- static VisualServerWrapMT *singleton_mt;
+ static RenderingServerWrapMT *singleton_mt;
#ifdef DEBUG_SYNC
#define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
@@ -72,28 +72,28 @@ class VisualServerWrapMT : public VisualServer {
#endif
public:
-#define ServerName VisualServer
-#define ServerNameWrapMT VisualServerWrapMT
-#define server_name visual_server
+#define ServerName RenderingServer
+#define ServerNameWrapMT RenderingServerWrapMT
+#define server_name rendering_server
#include "servers/server_wrap_mt_common.h"
//these go pass-through, as they can be called from any thread
- virtual RID texture_2d_create(const Ref<Image> &p_image) { return visual_server->texture_2d_create(p_image); }
- virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, TextureLayeredType p_layered_type) { return visual_server->texture_2d_layered_create(p_layers, p_layered_type); }
- virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices) { return visual_server->texture_3d_create(p_slices); }
- virtual RID texture_proxy_create(RID p_base) { return visual_server->texture_proxy_create(p_base); }
+ virtual RID texture_2d_create(const Ref<Image> &p_image) { return rendering_server->texture_2d_create(p_image); }
+ virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, TextureLayeredType p_layered_type) { return rendering_server->texture_2d_layered_create(p_layers, p_layered_type); }
+ virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices) { return rendering_server->texture_3d_create(p_slices); }
+ virtual RID texture_proxy_create(RID p_base) { return rendering_server->texture_proxy_create(p_base); }
//goes pass-through
- virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) { visual_server->texture_2d_update_immediate(p_texture, p_image, p_layer); }
+ virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) { rendering_server->texture_2d_update_immediate(p_texture, p_image, p_layer); }
//these go through command queue if they are in another thread
FUNC3(texture_2d_update, RID, const Ref<Image> &, int)
FUNC4(texture_3d_update, RID, const Ref<Image> &, int, int)
FUNC2(texture_proxy_update, RID, RID)
//these also go pass-through
- virtual RID texture_2d_placeholder_create() { return visual_server->texture_2d_placeholder_create(); }
- virtual RID texture_2d_layered_placeholder_create() { return visual_server->texture_2d_layered_placeholder_create(); }
- virtual RID texture_3d_placeholder_create() { return visual_server->texture_3d_placeholder_create(); }
+ virtual RID texture_2d_placeholder_create() { return rendering_server->texture_2d_placeholder_create(); }
+ virtual RID texture_2d_layered_placeholder_create() { return rendering_server->texture_2d_layered_placeholder_create(); }
+ virtual RID texture_3d_placeholder_create() { return rendering_server->texture_3d_placeholder_create(); }
FUNC1RC(Ref<Image>, texture_2d_get, RID)
FUNC2RC(Ref<Image>, texture_2d_layer_get, RID, int)
@@ -145,7 +145,7 @@ public:
/* MESH API */
virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces) {
- return visual_server->mesh_create_from_surfaces(p_surfaces);
+ return rendering_server->mesh_create_from_surfaces(p_surfaces);
}
FUNCRID(mesh)
@@ -346,7 +346,7 @@ public:
FUNC1(particles_request_process, RID)
FUNC1(particles_restart, RID)
- FUNC2(particles_set_draw_order, RID, VS::ParticlesDrawOrder)
+ FUNC2(particles_set_draw_order, RID, RS::ParticlesDrawOrder)
FUNC2(particles_set_draw_passes, RID, int)
FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
@@ -406,7 +406,7 @@ public:
//this passes directly to avoid stalling, but it's pretty dangerous, so don't call after freeing a viewport
virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfo p_info) {
- return visual_server->viewport_get_render_info(p_viewport, p_info);
+ return rendering_server->viewport_get_render_info(p_viewport, p_info);
}
FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
@@ -617,15 +617,15 @@ public:
//this passes directly to avoid stalling
virtual int get_render_info(RenderInfo p_info) {
- return visual_server->get_render_info(p_info);
+ return rendering_server->get_render_info(p_info);
}
virtual String get_video_adapter_name() const {
- return visual_server->get_video_adapter_name();
+ return rendering_server->get_video_adapter_name();
}
virtual String get_video_adapter_vendor() const {
- return visual_server->get_video_adapter_vendor();
+ return rendering_server->get_video_adapter_vendor();
}
FUNC4(set_boot_image, const Ref<Image> &, const Color &, bool, bool)
@@ -636,10 +636,10 @@ public:
FUNC1(set_debug_generate_wireframes, bool)
virtual bool has_feature(Features p_feature) const {
- return visual_server->has_feature(p_feature);
+ return rendering_server->has_feature(p_feature);
}
virtual bool has_os_feature(const String &p_feature) const {
- return visual_server->has_os_feature(p_feature);
+ return rendering_server->has_os_feature(p_feature);
}
FUNC1(call_set_use_vsync, bool)
@@ -647,23 +647,23 @@ public:
static void set_use_vsync_callback(bool p_enable);
virtual bool is_low_end() const {
- return visual_server->is_low_end();
+ return rendering_server->is_low_end();
}
virtual uint64_t get_frame_profile_frame() {
- return visual_server->get_frame_profile_frame();
+ return rendering_server->get_frame_profile_frame();
}
virtual void set_frame_profiling_enabled(bool p_enabled) {
- visual_server->set_frame_profiling_enabled(p_enabled);
+ rendering_server->set_frame_profiling_enabled(p_enabled);
}
virtual Vector<FrameProfileArea> get_frame_profile() {
- return visual_server->get_frame_profile();
+ return rendering_server->get_frame_profile();
}
- VisualServerWrapMT(VisualServer *p_contained, bool p_create_thread);
- ~VisualServerWrapMT();
+ RenderingServerWrapMT(RenderingServer *p_contained, bool p_create_thread);
+ ~RenderingServerWrapMT();
#undef ServerName
#undef ServerNameWrapMT
diff --git a/servers/visual/shader_language.cpp b/servers/rendering/shader_language.cpp
index 98786fad3b..cf2a01c07c 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -31,7 +31,7 @@
#include "shader_language.h"
#include "core/os/os.h"
#include "core/print_string.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
static bool _is_text_char(CharType c) {
@@ -2165,7 +2165,7 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const Map<Strin
}
if (!fail) {
- if (VisualServer::get_singleton()->is_low_end()) {
+ if (RenderingServer::get_singleton()->is_low_end()) {
if (builtin_func_defs[idx].high_end) {
fail = true;
unsupported_builtin = true;
@@ -4772,7 +4772,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
if (tk.type == TK_BRACKET_OPEN) {
bool unknown_size = false;
- if (VisualServer::get_singleton()->is_low_end() && is_const) {
+ if (RenderingServer::get_singleton()->is_low_end() && is_const) {
_set_error("Local const arrays are supported only on high-end platform!");
return ERR_PARSE_ERROR;
}
@@ -4818,7 +4818,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
tk = _get_token();
if (tk.type == TK_OP_ASSIGN) {
- if (VisualServer::get_singleton()->is_low_end()) {
+ if (RenderingServer::get_singleton()->is_low_end()) {
_set_error("Array initialization is supported only on high-end platform!");
return ERR_PARSE_ERROR;
}
@@ -5136,7 +5136,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
}
} else if (tk.type == TK_CF_SWITCH) {
- if (VisualServer::get_singleton()->is_low_end()) {
+ if (RenderingServer::get_singleton()->is_low_end()) {
_set_error("\"switch\" operator is supported only on high-end platform!");
return ERR_PARSE_ERROR;
}
@@ -5617,7 +5617,7 @@ String ShaderLanguage::_get_qualifier_str(ArgumentQualifier p_qualifier) const {
}
Error ShaderLanguage::_validate_datatype(DataType p_type) {
- if (VisualServer::get_singleton()->is_low_end()) {
+ if (RenderingServer::get_singleton()->is_low_end()) {
bool invalid_type = false;
switch (p_type) {
@@ -6763,7 +6763,7 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
}
int idx = 0;
- bool low_end = VisualServer::get_singleton()->is_low_end();
+ bool low_end = RenderingServer::get_singleton()->is_low_end();
while (builtin_func_defs[idx].name) {
if (low_end && builtin_func_defs[idx].high_end) {
@@ -6776,7 +6776,7 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
} else { // sub-class
int idx = 0;
- bool low_end = VisualServer::get_singleton()->is_low_end();
+ bool low_end = RenderingServer::get_singleton()->is_low_end();
while (builtin_func_defs[idx].name) {
if (low_end && builtin_func_defs[idx].high_end) {
@@ -6854,7 +6854,7 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
int idx = 0;
String calltip;
- bool low_end = VisualServer::get_singleton()->is_low_end();
+ bool low_end = RenderingServer::get_singleton()->is_low_end();
while (builtin_func_defs[idx].name) {
diff --git a/servers/visual/shader_language.h b/servers/rendering/shader_language.h
index bdc15cc4aa..bdc15cc4aa 100644
--- a/servers/visual/shader_language.h
+++ b/servers/rendering/shader_language.h
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
new file mode 100644
index 0000000000..b144d6d612
--- /dev/null
+++ b/servers/rendering/shader_types.cpp
@@ -0,0 +1,328 @@
+/*************************************************************************/
+/* shader_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "shader_types.h"
+
+const Map<StringName, ShaderLanguage::FunctionInfo> &ShaderTypes::get_functions(RS::ShaderMode p_mode) {
+
+ return shader_modes[p_mode].functions;
+}
+
+const Vector<StringName> &ShaderTypes::get_modes(RS::ShaderMode p_mode) {
+
+ return shader_modes[p_mode].modes;
+}
+
+const Set<String> &ShaderTypes::get_types() {
+ return shader_types;
+}
+
+ShaderTypes *ShaderTypes::singleton = NULL;
+
+static ShaderLanguage::BuiltInInfo constt(ShaderLanguage::DataType p_type) {
+
+ return ShaderLanguage::BuiltInInfo(p_type, true);
+}
+
+ShaderTypes::ShaderTypes() {
+ singleton = this;
+
+ /*************** SPATIAL ***********************/
+
+ shader_modes[RS::SHADER_SPATIAL].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INSTANCE_ID"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].can_discard = false;
+
+ //builtins
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
+
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["FRONT_FACING"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["METALLIC"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SPECULAR"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["RIM"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["RIM_TINT"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CLEARCOAT"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CLEARCOAT_GLOSS"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ANISOTROPY"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["ANISOTROPY_FLOW"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SSS_STRENGTH"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["TRANSMISSION"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["AO"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["AO_LIGHT_AFFECT"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["EMISSION"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
+
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
+
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_NORMAL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].can_discard = true;
+
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["ATTENUATION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["ALBEDO"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["TRANSMISSION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["ROUGHNESS"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["DIFFUSE_LIGHT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["SPECULAR_LIGHT"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
+
+ shader_modes[RS::SHADER_SPATIAL].functions["light"].can_discard = true;
+
+ //order used puts first enum mode (default) first
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("blend_mix");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("blend_add");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("blend_sub");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("blend_mul");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("depth_draw_opaque");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("depth_draw_always");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("depth_draw_never");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("depth_prepass_alpha");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("depth_test_disabled");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("cull_back");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("cull_front");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("cull_disabled");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("unshaded");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("wireframe");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("diffuse_lambert");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("diffuse_lambert_wrap");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("diffuse_oren_nayar");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("diffuse_burley");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("diffuse_toon");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("specular_schlick_ggx");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("specular_blinn");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("specular_phong");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("specular_toon");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("specular_disabled");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("skip_vertex_transform");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("world_vertex_coords");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("ensure_correct_normals");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("shadows_disabled");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("ambient_light_disabled");
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("shadow_to_opacity");
+
+ shader_modes[RS::SHADER_SPATIAL].modes.push_back("vertex_lighting");
+
+ /************ CANVAS ITEM **************************/
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["CANVAS_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["SCREEN_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["AT_LIGHT_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["vertex"].can_discard = false;
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SHADOW_VERTEX"] = ShaderLanguage::TYPE_VEC2;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["LIGHT_VERTEX"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SPECULAR_SHININESS_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SPECULAR_SHININESS"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["AT_LIGHT_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true;
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SPECULAR_SHININESS"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_MODULATE"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_CANVAS_ITEM].functions["light"].can_discard = true;
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("skip_vertex_transform");
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_mix");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_add");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_sub");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_mul");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_premul_alpha");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("blend_disabled");
+
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("unshaded");
+ shader_modes[RS::SHADER_CANVAS_ITEM].modes.push_back("light_only");
+
+ /************ PARTICLES **************************/
+
+ shader_modes[RS::SHADER_PARTICLES].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["VELOCITY"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["MASS"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["ACTIVE"] = ShaderLanguage::TYPE_BOOL;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["RESTART"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["CUSTOM"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["TRANSFORM"] = ShaderLanguage::TYPE_MAT4;
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["LIFETIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["DELTA"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["NUMBER"] = constt(ShaderLanguage::TYPE_UINT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["INDEX"] = constt(ShaderLanguage::TYPE_INT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["EMISSION_TRANSFORM"] = constt(ShaderLanguage::TYPE_MAT4);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].built_ins["RANDOM_SEED"] = constt(ShaderLanguage::TYPE_UINT);
+ shader_modes[RS::SHADER_PARTICLES].functions["vertex"].can_discard = false;
+
+ shader_modes[RS::SHADER_PARTICLES].modes.push_back("disable_force");
+ shader_modes[RS::SHADER_PARTICLES].modes.push_back("disable_velocity");
+ shader_modes[RS::SHADER_PARTICLES].modes.push_back("keep_data");
+
+ /************ SKY **************************/
+
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
+ shader_modes[RS::SHADER_SKY].functions["global"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
+
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["EYEDIR"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["SKY_COORDS"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
+
+ shader_modes[RS::SHADER_SKY].modes.push_back("use_half_res_pass");
+ shader_modes[RS::SHADER_SKY].modes.push_back("use_quarter_res_pass");
+
+ shader_types.insert("spatial");
+ shader_types.insert("canvas_item");
+ shader_types.insert("particles");
+ shader_types.insert("sky");
+}
diff --git a/servers/visual/shader_types.h b/servers/rendering/shader_types.h
index 7d674bfb5c..499a761265 100644
--- a/servers/visual/shader_types.h
+++ b/servers/rendering/shader_types.h
@@ -32,7 +32,7 @@
#define SHADERTYPES_H
#include "core/ordered_hash_map.h"
-#include "servers/visual_server.h"
+#include "servers/rendering_server.h"
#include "shader_language.h"
class ShaderTypes {
@@ -43,7 +43,7 @@ class ShaderTypes {
Vector<StringName> modes;
};
- Map<VS::ShaderMode, Type> shader_modes;
+ Map<RS::ShaderMode, Type> shader_modes;
static ShaderTypes *singleton;
@@ -52,8 +52,8 @@ class ShaderTypes {
public:
static ShaderTypes *get_singleton() { return singleton; }
- const Map<StringName, ShaderLanguage::FunctionInfo> &get_functions(VS::ShaderMode p_mode);
- const Vector<StringName> &get_modes(VS::ShaderMode p_mode);
+ const Map<StringName, ShaderLanguage::FunctionInfo> &get_functions(RS::ShaderMode p_mode);
+ const Vector<StringName> &get_modes(RS::ShaderMode p_mode);
const Set<String> &get_types();
ShaderTypes();
diff --git a/servers/visual_server.cpp b/servers/rendering_server.cpp
index fecaf563db..0c5b9a258f 100644
--- a/servers/visual_server.cpp
+++ b/servers/rendering_server.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server.cpp */
+/* rendering_server.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,20 +28,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "visual_server.h"
+#include "rendering_server.h"
#include "core/method_bind_ext.gen.inc"
#include "core/project_settings.h"
-VisualServer *VisualServer::singleton = NULL;
-VisualServer *(*VisualServer::create_func)() = NULL;
+RenderingServer *RenderingServer::singleton = NULL;
+RenderingServer *(*RenderingServer::create_func)() = NULL;
-VisualServer *VisualServer::get_singleton() {
+RenderingServer *RenderingServer::get_singleton() {
return singleton;
}
-VisualServer *VisualServer::create() {
+RenderingServer *RenderingServer::create() {
ERR_FAIL_COND_V(singleton, NULL);
@@ -51,7 +51,7 @@ VisualServer *VisualServer::create() {
return NULL;
}
-Array VisualServer::_texture_debug_usage_bind() {
+Array RenderingServer::_texture_debug_usage_bind() {
List<TextureInfo> list;
texture_debug_usage(&list);
@@ -71,7 +71,7 @@ Array VisualServer::_texture_debug_usage_bind() {
return arr;
}
-Array VisualServer::_shader_get_param_list_bind(RID p_shader) const {
+Array RenderingServer::_shader_get_param_list_bind(RID p_shader) const {
List<PropertyInfo> l;
shader_get_param_list(p_shader, &l);
@@ -87,19 +87,19 @@ static Array to_array(const Vector<ObjectID> &ids) {
return a;
}
-Array VisualServer::_instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario) const {
+Array RenderingServer::_instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario) const {
Vector<ObjectID> ids = instances_cull_aabb(p_aabb, p_scenario);
return to_array(ids);
}
-Array VisualServer::_instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
+Array RenderingServer::_instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
Vector<ObjectID> ids = instances_cull_ray(p_from, p_to, p_scenario);
return to_array(ids);
}
-Array VisualServer::_instances_cull_convex_bind(const Array &p_convex, RID p_scenario) const {
+Array RenderingServer::_instances_cull_convex_bind(const Array &p_convex, RID p_scenario) const {
Vector<Plane> planes;
for (int i = 0; i < p_convex.size(); ++i) {
@@ -112,7 +112,7 @@ Array VisualServer::_instances_cull_convex_bind(const Array &p_convex, RID p_sce
return to_array(ids);
}
-RID VisualServer::get_test_texture() {
+RID RenderingServer::get_test_texture() {
if (test_texture.is_valid()) {
return test_texture;
@@ -160,7 +160,7 @@ RID VisualServer::get_test_texture() {
return test_texture;
}
-void VisualServer::_free_internal_rids() {
+void RenderingServer::_free_internal_rids() {
if (test_texture.is_valid())
free(test_texture);
@@ -170,7 +170,7 @@ void VisualServer::_free_internal_rids() {
free(test_material);
}
-RID VisualServer::_make_test_cube() {
+RID RenderingServer::_make_test_cube() {
Vector<Vector3> vertices;
Vector<Vector3> normals;
@@ -223,17 +223,17 @@ RID VisualServer::_make_test_cube() {
RID test_cube = mesh_create();
Array d;
- d.resize(VS::ARRAY_MAX);
- d[VisualServer::ARRAY_NORMAL] = normals;
- d[VisualServer::ARRAY_TANGENT] = tangents;
- d[VisualServer::ARRAY_TEX_UV] = uvs;
- d[VisualServer::ARRAY_VERTEX] = vertices;
+ d.resize(RS::ARRAY_MAX);
+ d[RenderingServer::ARRAY_NORMAL] = normals;
+ d[RenderingServer::ARRAY_TANGENT] = tangents;
+ d[RenderingServer::ARRAY_TEX_UV] = uvs;
+ d[RenderingServer::ARRAY_VERTEX] = vertices;
Vector<int> indices;
indices.resize(vertices.size());
for (int i = 0; i < vertices.size(); i++)
indices.set(i, i);
- d[VisualServer::ARRAY_INDEX] = indices;
+ d[RenderingServer::ARRAY_INDEX] = indices;
mesh_add_surface_from_arrays(test_cube, PRIMITIVE_TRIANGLES, d);
@@ -252,7 +252,7 @@ RID VisualServer::_make_test_cube() {
return test_cube;
}
-RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) {
+RID RenderingServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) {
Vector<Vector3> vertices;
Vector<Vector3> normals;
@@ -299,7 +299,7 @@ RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) {
RID mesh = mesh_create();
Array d;
- d.resize(VS::ARRAY_MAX);
+ d.resize(RS::ARRAY_MAX);
d[ARRAY_VERTEX] = vertices;
d[ARRAY_NORMAL] = normals;
@@ -309,7 +309,7 @@ RID VisualServer::make_sphere_mesh(int p_lats, int p_lons, float p_radius) {
return mesh;
}
-RID VisualServer::get_white_texture() {
+RID RenderingServer::get_white_texture() {
if (white_texture.is_valid())
return white_texture;
@@ -329,7 +329,7 @@ RID VisualServer::get_white_texture() {
#define SMALL_VEC2 Vector2(0.00001, 0.00001)
#define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001)
-Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) {
+Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) {
uint8_t *vw = r_vertex_array.ptrw();
@@ -340,16 +340,16 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
int max_bone = 0;
- for (int ai = 0; ai < VS::ARRAY_MAX; ai++) {
+ for (int ai = 0; ai < RS::ARRAY_MAX; ai++) {
if (!(p_format & (1 << ai))) // no array
continue;
switch (ai) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
- if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ if (p_format & RS::ARRAY_FLAG_USE_2D_VERTICES) {
Vector<Vector2> array = p_arrays[ai];
ERR_FAIL_COND_V(array.size() != p_vertex_array_len, ERR_INVALID_PARAMETER);
@@ -408,7 +408,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY, ERR_INVALID_PARAMETER);
@@ -443,7 +443,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_FLOAT32_ARRAY, ERR_INVALID_PARAMETER);
@@ -481,7 +481,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_COLOR_ARRAY, ERR_INVALID_PARAMETER);
@@ -513,7 +513,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER);
@@ -542,7 +542,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_VECTOR3_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_VECTOR2_ARRAY, ERR_INVALID_PARAMETER);
@@ -569,13 +569,13 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
}
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_FLOAT32_ARRAY, ERR_INVALID_PARAMETER);
Vector<real_t> array = p_arrays[ai];
- ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(array.size() != p_vertex_array_len * RS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER);
const real_t *src = array.ptr();
@@ -583,9 +583,9 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
for (int i = 0; i < p_vertex_array_len; i++) {
- uint16_t data[VS::ARRAY_WEIGHTS_SIZE];
- for (int j = 0; j < VS::ARRAY_WEIGHTS_SIZE; j++) {
- data[j] = CLAMP(src[i * VS::ARRAY_WEIGHTS_SIZE + j] * 65535, 0, 65535);
+ uint16_t data[RS::ARRAY_WEIGHTS_SIZE];
+ for (int j = 0; j < RS::ARRAY_WEIGHTS_SIZE; j++) {
+ data[j] = CLAMP(src[i * RS::ARRAY_WEIGHTS_SIZE + j] * 65535, 0, 65535);
}
copymem(&vw[p_offsets[ai] + i * p_stride], data, 2 * 4);
@@ -593,21 +593,21 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
ERR_FAIL_COND_V(p_arrays[ai].get_type() != Variant::PACKED_INT32_ARRAY && p_arrays[ai].get_type() != Variant::PACKED_FLOAT32_ARRAY, ERR_INVALID_PARAMETER);
Vector<int> array = p_arrays[ai];
- ERR_FAIL_COND_V(array.size() != p_vertex_array_len * VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(array.size() != p_vertex_array_len * RS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER);
const int *src = array.ptr();
for (int i = 0; i < p_vertex_array_len; i++) {
- uint16_t data[VS::ARRAY_WEIGHTS_SIZE];
- for (int j = 0; j < VS::ARRAY_WEIGHTS_SIZE; j++) {
- data[j] = src[i * VS::ARRAY_WEIGHTS_SIZE + j];
+ uint16_t data[RS::ARRAY_WEIGHTS_SIZE];
+ for (int j = 0; j < RS::ARRAY_WEIGHTS_SIZE; j++) {
+ data[j] = src[i * RS::ARRAY_WEIGHTS_SIZE + j];
max_bone = MAX(data[j], max_bone);
}
@@ -615,7 +615,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
ERR_FAIL_NULL_V(iw, ERR_INVALID_DATA);
ERR_FAIL_COND_V(p_index_array_len <= 0, ERR_INVALID_DATA);
@@ -648,7 +648,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
}
- if (p_format & VS::ARRAY_FORMAT_BONES) {
+ if (p_format & RS::ARRAY_FORMAT_BONES) {
//create AABBs for each detected bone
int total_bones = max_bone + 1;
@@ -662,9 +662,9 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}
}
- Vector<Vector3> vertices = p_arrays[VS::ARRAY_VERTEX];
- Vector<int> bones = p_arrays[VS::ARRAY_BONES];
- Vector<float> weights = p_arrays[VS::ARRAY_WEIGHTS];
+ Vector<Vector3> vertices = p_arrays[RS::ARRAY_VERTEX];
+ Vector<int> bones = p_arrays[RS::ARRAY_BONES];
+ Vector<float> weights = p_arrays[RS::ARRAY_WEIGHTS];
bool any_valid = false;
@@ -707,22 +707,22 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
return OK;
}
-uint32_t VisualServer::mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const {
+uint32_t RenderingServer::mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const {
uint32_t offsets[ARRAY_MAX];
mesh_surface_make_offsets_from_format(p_format, p_vertex_len, p_index_len, offsets);
return offsets[p_array_index];
}
-uint32_t VisualServer::mesh_surface_get_format_stride(uint32_t p_format, int p_vertex_len, int p_index_len) const {
+uint32_t RenderingServer::mesh_surface_get_format_stride(uint32_t p_format, int p_vertex_len, int p_index_len) const {
uint32_t offsets[ARRAY_MAX];
return mesh_surface_make_offsets_from_format(p_format, p_vertex_len, p_index_len, offsets);
}
-uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets) const {
+uint32_t RenderingServer::mesh_surface_make_offsets_from_format(uint32_t p_format, int p_vertex_len, int p_index_len, uint32_t *r_offsets) const {
int total_elem_size = 0;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
r_offsets[i] = 0; //reset
@@ -733,7 +733,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
if (p_format & ARRAY_FLAG_USE_2D_VERTICES) {
elem_size = 2;
@@ -750,7 +750,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
if (p_format & ARRAY_COMPRESS_NORMAL) {
elem_size = sizeof(uint32_t);
@@ -760,7 +760,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
if (p_format & ARRAY_COMPRESS_TANGENT) {
elem_size = sizeof(uint32_t);
} else {
@@ -768,7 +768,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
if (p_format & ARRAY_COMPRESS_COLOR) {
elem_size = sizeof(uint32_t);
@@ -776,7 +776,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
elem_size = sizeof(float) * 4;
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
if (p_format & ARRAY_COMPRESS_TEX_UV) {
elem_size = sizeof(uint32_t);
} else {
@@ -785,7 +785,7 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
if (p_format & ARRAY_COMPRESS_TEX_UV2) {
elem_size = sizeof(uint32_t);
} else {
@@ -793,17 +793,17 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
}
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
if (p_index_len <= 0) {
ERR_PRINT("index_array_len==NO_INDEX_ARRAY");
@@ -831,10 +831,10 @@ uint32_t VisualServer::mesh_surface_make_offsets_from_format(uint32_t p_format,
return total_elem_size;
}
-Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_data, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) {
+Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_data, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) {
- ERR_FAIL_INDEX_V(p_primitive, VS::PRIMITIVE_MAX, ERR_INVALID_PARAMETER);
- ERR_FAIL_COND_V(p_arrays.size() != VS::ARRAY_MAX, ERR_INVALID_PARAMETER);
+ ERR_FAIL_INDEX_V(p_primitive, RS::PRIMITIVE_MAX, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(p_arrays.size() != RS::ARRAY_MAX, ERR_INVALID_PARAMETER);
uint32_t format = 0;
@@ -849,7 +849,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
format |= (1 << i);
- if (i == VS::ARRAY_VERTEX) {
+ if (i == RS::ARRAY_VERTEX) {
Variant var = p_arrays[i];
switch (var.get_type()) {
@@ -866,13 +866,13 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
array_len = PackedVector3Array(p_arrays[i]).size();
ERR_FAIL_COND_V(array_len == 0, ERR_INVALID_DATA);
- } else if (i == VS::ARRAY_INDEX) {
+ } else if (i == RS::ARRAY_INDEX) {
index_array_len = PackedInt32Array(p_arrays[i]).size();
}
}
- ERR_FAIL_COND_V((format & VS::ARRAY_FORMAT_VERTEX) == 0, ERR_INVALID_PARAMETER); // mandatory
+ ERR_FAIL_COND_V((format & RS::ARRAY_FORMAT_VERTEX) == 0, ERR_INVALID_PARAMETER); // mandatory
if (p_blend_shapes.size()) {
//validate format for morphs
@@ -886,15 +886,15 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
bsformat |= (1 << j);
}
- ERR_FAIL_COND_V((bsformat) != (format & (VS::ARRAY_FORMAT_INDEX - 1)), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V((bsformat) != (format & (RS::ARRAY_FORMAT_INDEX - 1)), ERR_INVALID_PARAMETER);
}
}
- uint32_t offsets[VS::ARRAY_MAX];
+ uint32_t offsets[RS::ARRAY_MAX];
int total_elem_size = 0;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
offsets[i] = 0; //reset
@@ -905,7 +905,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
Variant arr = p_arrays[0];
if (arr.get_type() == Variant::PACKED_VECTOR2_ARRAY) {
@@ -923,7 +923,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
if (p_compress_format & ARRAY_COMPRESS_NORMAL) {
elem_size = sizeof(uint32_t);
@@ -933,7 +933,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
if (p_compress_format & ARRAY_COMPRESS_TANGENT) {
elem_size = sizeof(uint32_t);
} else {
@@ -941,7 +941,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
if (p_compress_format & ARRAY_COMPRESS_COLOR) {
elem_size = sizeof(uint32_t);
@@ -949,7 +949,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
elem_size = sizeof(float) * 4;
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
if (p_compress_format & ARRAY_COMPRESS_TEX_UV) {
elem_size = sizeof(uint32_t);
} else {
@@ -958,7 +958,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
if (p_compress_format & ARRAY_COMPRESS_TEX_UV2) {
elem_size = sizeof(uint32_t);
} else {
@@ -966,17 +966,17 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
}
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
if (index_array_len <= 0) {
ERR_PRINT("index_array_len==NO_INDEX_ARRAY");
@@ -1010,7 +1010,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
Vector<uint8_t> vertex_array;
vertex_array.resize(array_size);
- int index_array_size = offsets[VS::ARRAY_INDEX] * index_array_len;
+ int index_array_size = offsets[RS::ARRAY_INDEX] * index_array_len;
Vector<uint8_t> index_array;
index_array.resize(index_array_size);
@@ -1092,7 +1092,7 @@ Error VisualServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surface_
return OK;
}
-void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) {
+void RenderingServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes, const Dictionary &p_lods, uint32_t p_compress_format) {
SurfaceData sd;
Error err = mesh_create_surface_data_from_arrays(&sd, p_primitive, p_arrays, p_blend_shapes, p_lods, p_compress_format);
@@ -1102,13 +1102,13 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
mesh_add_surface(p_mesh, sd);
}
-Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const {
+Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const {
uint32_t offsets[ARRAY_MAX];
int total_elem_size = 0;
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
offsets[i] = 0; //reset
@@ -1119,7 +1119,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
if (p_format & ARRAY_FLAG_USE_2D_VERTICES) {
elem_size = 2;
@@ -1132,7 +1132,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
if (p_format & ARRAY_COMPRESS_NORMAL) {
elem_size = sizeof(uint32_t);
@@ -1142,7 +1142,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
if (p_format & ARRAY_COMPRESS_TANGENT) {
elem_size = sizeof(uint32_t);
} else {
@@ -1150,7 +1150,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
}
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
if (p_format & ARRAY_COMPRESS_COLOR) {
elem_size = sizeof(uint32_t);
@@ -1158,7 +1158,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
elem_size = sizeof(float) * 4;
}
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
if (p_format & ARRAY_COMPRESS_TEX_UV) {
elem_size = sizeof(uint32_t);
} else {
@@ -1167,7 +1167,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
if (p_format & ARRAY_COMPRESS_TEX_UV2) {
elem_size = sizeof(uint32_t);
} else {
@@ -1175,17 +1175,17 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
}
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
elem_size = sizeof(uint16_t) * 4;
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
if (p_index_len <= 0) {
ERR_PRINT("index_array_len==NO_INDEX_ARRAY");
@@ -1212,18 +1212,18 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
}
Array ret;
- ret.resize(VS::ARRAY_MAX);
+ ret.resize(RS::ARRAY_MAX);
const uint8_t *r = p_vertex_data.ptr();
- for (int i = 0; i < VS::ARRAY_MAX; i++) {
+ for (int i = 0; i < RS::ARRAY_MAX; i++) {
if (!(p_format & (1 << i)))
continue;
switch (i) {
- case VS::ARRAY_VERTEX: {
+ case RS::ARRAY_VERTEX: {
if (p_format & ARRAY_FLAG_USE_2D_VERTICES) {
@@ -1262,7 +1262,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
}
} break;
- case VS::ARRAY_NORMAL: {
+ case RS::ARRAY_NORMAL: {
Vector<Vector3> arr;
arr.resize(p_vertex_len);
@@ -1290,7 +1290,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
} break;
- case VS::ARRAY_TANGENT: {
+ case RS::ARRAY_TANGENT: {
Vector<float> arr;
arr.resize(p_vertex_len * 4);
if (p_format & ARRAY_COMPRESS_TANGENT) {
@@ -1318,7 +1318,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_COLOR: {
+ case RS::ARRAY_COLOR: {
Vector<Color> arr;
arr.resize(p_vertex_len);
@@ -1344,7 +1344,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_TEX_UV: {
+ case RS::ARRAY_TEX_UV: {
Vector<Vector2> arr;
arr.resize(p_vertex_len);
@@ -1372,7 +1372,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_TEX_UV2: {
+ case RS::ARRAY_TEX_UV2: {
Vector<Vector2> arr;
arr.resize(p_vertex_len);
@@ -1399,7 +1399,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_WEIGHTS: {
+ case RS::ARRAY_WEIGHTS: {
Vector<float> arr;
arr.resize(p_vertex_len * 4);
@@ -1418,7 +1418,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_BONES: {
+ case RS::ARRAY_BONES: {
Vector<int> arr;
arr.resize(p_vertex_len * 4);
@@ -1436,7 +1436,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
ret[i] = arr;
} break;
- case VS::ARRAY_INDEX: {
+ case RS::ARRAY_INDEX: {
/* determine whether using 16 or 32 bits indices */
const uint8_t *ir = p_index_data.ptr();
@@ -1472,13 +1472,13 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t> p
return ret;
}
-Array VisualServer::mesh_surface_get_arrays(RID p_mesh, int p_surface) const {
+Array RenderingServer::mesh_surface_get_arrays(RID p_mesh, int p_surface) const {
SurfaceData sd = mesh_get_surface(p_mesh, p_surface);
return mesh_create_arrays_from_surface_data(sd);
}
-Dictionary VisualServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const {
+Dictionary RenderingServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const {
SurfaceData sd = mesh_get_surface(p_mesh, p_surface);
ERR_FAIL_COND_V(sd.vertex_count == 0, Dictionary());
@@ -1513,7 +1513,7 @@ Dictionary VisualServer::mesh_surface_get_lods(RID p_mesh, int p_surface) const
return ret;
}
-Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const {
+Array RenderingServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surface) const {
SurfaceData sd = mesh_get_surface(p_mesh, p_surface);
ERR_FAIL_COND_V(sd.vertex_count == 0, Array());
@@ -1540,7 +1540,7 @@ Array VisualServer::mesh_surface_get_blend_shape_arrays(RID p_mesh, int p_surfac
}
}
-Array VisualServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const {
+Array RenderingServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_data) const {
Vector<uint8_t> vertex_data = p_data.vertex_data;
@@ -1555,9 +1555,9 @@ Array VisualServer::mesh_create_arrays_from_surface_data(const SurfaceData &p_da
return _get_array_from_surface(format, vertex_data, vertex_len, index_data, index_len);
}
#if 0
-Array VisualServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const {
+Array RenderingServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surface) const {
- Vector<AABB> vec = VS::get_singleton()->mesh_surface_get_skeleton_aabb(p_mesh, p_surface);
+ Vector<AABB> vec = RS::get_singleton()->mesh_surface_get_skeleton_aabb(p_mesh, p_surface);
Array arr;
for (int i = 0; i < vec.size(); i++) {
arr[i] = vec[i];
@@ -1565,388 +1565,388 @@ Array VisualServer::_mesh_surface_get_skeleton_aabb_bind(RID p_mesh, int p_surfa
return arr;
}
#endif
-void VisualServer::_bind_methods() {
+void RenderingServer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("force_sync"), &VisualServer::sync);
- ClassDB::bind_method(D_METHOD("force_draw", "swap_buffers", "frame_step"), &VisualServer::draw, DEFVAL(true), DEFVAL(0.0));
+ ClassDB::bind_method(D_METHOD("force_sync"), &RenderingServer::sync);
+ ClassDB::bind_method(D_METHOD("force_draw", "swap_buffers", "frame_step"), &RenderingServer::draw, DEFVAL(true), DEFVAL(0.0));
#ifndef _MSC_VER
#warning TODO all texture methods need re-binding
#endif
- ClassDB::bind_method(D_METHOD("texture_2d_create", "image"), &VisualServer::texture_2d_create);
- ClassDB::bind_method(D_METHOD("texture_2d_get", "texture"), &VisualServer::texture_2d_get);
+ ClassDB::bind_method(D_METHOD("texture_2d_create", "image"), &RenderingServer::texture_2d_create);
+ ClassDB::bind_method(D_METHOD("texture_2d_get", "texture"), &RenderingServer::texture_2d_get);
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("sky_create"), &VisualServer::sky_create);
- ClassDB::bind_method(D_METHOD("sky_set_material", "sky", "material"), &VisualServer::sky_set_material);
+ ClassDB::bind_method(D_METHOD("sky_create"), &RenderingServer::sky_create);
+ ClassDB::bind_method(D_METHOD("sky_set_material", "sky", "material"), &RenderingServer::sky_set_material);
#endif
- ClassDB::bind_method(D_METHOD("shader_create"), &VisualServer::shader_create);
- ClassDB::bind_method(D_METHOD("shader_set_code", "shader", "code"), &VisualServer::shader_set_code);
- ClassDB::bind_method(D_METHOD("shader_get_code", "shader"), &VisualServer::shader_get_code);
- ClassDB::bind_method(D_METHOD("shader_get_param_list", "shader"), &VisualServer::_shader_get_param_list_bind);
- ClassDB::bind_method(D_METHOD("shader_set_default_texture_param", "shader", "name", "texture"), &VisualServer::shader_set_default_texture_param);
- ClassDB::bind_method(D_METHOD("shader_get_default_texture_param", "shader", "name"), &VisualServer::shader_get_default_texture_param);
- ClassDB::bind_method(D_METHOD("shader_get_param_default", "material", "parameter"), &VisualServer::shader_get_param_default);
-
- ClassDB::bind_method(D_METHOD("material_create"), &VisualServer::material_create);
- ClassDB::bind_method(D_METHOD("material_set_shader", "shader_material", "shader"), &VisualServer::material_set_shader);
- ClassDB::bind_method(D_METHOD("material_set_param", "material", "parameter", "value"), &VisualServer::material_set_param);
- ClassDB::bind_method(D_METHOD("material_get_param", "material", "parameter"), &VisualServer::material_get_param);
- ClassDB::bind_method(D_METHOD("material_set_render_priority", "material", "priority"), &VisualServer::material_set_render_priority);
-
- ClassDB::bind_method(D_METHOD("material_set_next_pass", "material", "next_material"), &VisualServer::material_set_next_pass);
-
- ClassDB::bind_method(D_METHOD("mesh_create"), &VisualServer::mesh_create);
- ClassDB::bind_method(D_METHOD("mesh_surface_get_format_offset", "format", "vertex_len", "index_len", "array_index"), &VisualServer::mesh_surface_get_format_offset);
- ClassDB::bind_method(D_METHOD("mesh_surface_get_format_stride", "format", "vertex_len", "index_len"), &VisualServer::mesh_surface_get_format_stride);
- ClassDB::bind_method(D_METHOD("mesh_add_surface_from_arrays", "mesh", "primitive", "arrays", "blend_shapes", "lods", "compress_format"), &VisualServer::mesh_add_surface_from_arrays, DEFVAL(Array()), DEFVAL(Dictionary()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
- ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_count", "mesh"), &VisualServer::mesh_get_blend_shape_count);
- ClassDB::bind_method(D_METHOD("mesh_set_blend_shape_mode", "mesh", "mode"), &VisualServer::mesh_set_blend_shape_mode);
- ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_mode", "mesh"), &VisualServer::mesh_get_blend_shape_mode);
- ClassDB::bind_method(D_METHOD("mesh_surface_update_region", "mesh", "surface", "offset", "data"), &VisualServer::mesh_surface_update_region);
- ClassDB::bind_method(D_METHOD("mesh_surface_set_material", "mesh", "surface", "material"), &VisualServer::mesh_surface_set_material);
- ClassDB::bind_method(D_METHOD("mesh_surface_get_material", "mesh", "surface"), &VisualServer::mesh_surface_get_material);
- ClassDB::bind_method(D_METHOD("mesh_surface_get_arrays", "mesh", "surface"), &VisualServer::mesh_surface_get_arrays);
- ClassDB::bind_method(D_METHOD("mesh_surface_get_blend_shape_arrays", "mesh", "surface"), &VisualServer::mesh_surface_get_blend_shape_arrays);
- ClassDB::bind_method(D_METHOD("mesh_get_surface_count", "mesh"), &VisualServer::mesh_get_surface_count);
- ClassDB::bind_method(D_METHOD("mesh_set_custom_aabb", "mesh", "aabb"), &VisualServer::mesh_set_custom_aabb);
- ClassDB::bind_method(D_METHOD("mesh_get_custom_aabb", "mesh"), &VisualServer::mesh_get_custom_aabb);
- ClassDB::bind_method(D_METHOD("mesh_clear", "mesh"), &VisualServer::mesh_clear);
-
- ClassDB::bind_method(D_METHOD("multimesh_create"), &VisualServer::multimesh_create);
- ClassDB::bind_method(D_METHOD("multimesh_allocate", "multimesh", "instances", "transform_format", "color_format", "custom_data_format"), &VisualServer::multimesh_allocate, DEFVAL(false), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("multimesh_get_instance_count", "multimesh"), &VisualServer::multimesh_get_instance_count);
- ClassDB::bind_method(D_METHOD("multimesh_set_mesh", "multimesh", "mesh"), &VisualServer::multimesh_set_mesh);
- ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform", "multimesh", "index", "transform"), &VisualServer::multimesh_instance_set_transform);
- ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform_2d", "multimesh", "index", "transform"), &VisualServer::multimesh_instance_set_transform_2d);
- ClassDB::bind_method(D_METHOD("multimesh_instance_set_color", "multimesh", "index", "color"), &VisualServer::multimesh_instance_set_color);
- ClassDB::bind_method(D_METHOD("multimesh_instance_set_custom_data", "multimesh", "index", "custom_data"), &VisualServer::multimesh_instance_set_custom_data);
- ClassDB::bind_method(D_METHOD("multimesh_get_mesh", "multimesh"), &VisualServer::multimesh_get_mesh);
- ClassDB::bind_method(D_METHOD("multimesh_get_aabb", "multimesh"), &VisualServer::multimesh_get_aabb);
- ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform", "multimesh", "index"), &VisualServer::multimesh_instance_get_transform);
- ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform_2d", "multimesh", "index"), &VisualServer::multimesh_instance_get_transform_2d);
- ClassDB::bind_method(D_METHOD("multimesh_instance_get_color", "multimesh", "index"), &VisualServer::multimesh_instance_get_color);
- ClassDB::bind_method(D_METHOD("multimesh_instance_get_custom_data", "multimesh", "index"), &VisualServer::multimesh_instance_get_custom_data);
- ClassDB::bind_method(D_METHOD("multimesh_set_visible_instances", "multimesh", "visible"), &VisualServer::multimesh_set_visible_instances);
- ClassDB::bind_method(D_METHOD("multimesh_get_visible_instances", "multimesh"), &VisualServer::multimesh_get_visible_instances);
- ClassDB::bind_method(D_METHOD("multimesh_set_buffer", "multimesh", "buffer"), &VisualServer::multimesh_set_buffer);
- ClassDB::bind_method(D_METHOD("multimesh_get_buffer", "multimesh"), &VisualServer::multimesh_get_buffer);
+ ClassDB::bind_method(D_METHOD("shader_create"), &RenderingServer::shader_create);
+ ClassDB::bind_method(D_METHOD("shader_set_code", "shader", "code"), &RenderingServer::shader_set_code);
+ ClassDB::bind_method(D_METHOD("shader_get_code", "shader"), &RenderingServer::shader_get_code);
+ ClassDB::bind_method(D_METHOD("shader_get_param_list", "shader"), &RenderingServer::_shader_get_param_list_bind);
+ ClassDB::bind_method(D_METHOD("shader_set_default_texture_param", "shader", "name", "texture"), &RenderingServer::shader_set_default_texture_param);
+ ClassDB::bind_method(D_METHOD("shader_get_default_texture_param", "shader", "name"), &RenderingServer::shader_get_default_texture_param);
+ ClassDB::bind_method(D_METHOD("shader_get_param_default", "material", "parameter"), &RenderingServer::shader_get_param_default);
+
+ ClassDB::bind_method(D_METHOD("material_create"), &RenderingServer::material_create);
+ ClassDB::bind_method(D_METHOD("material_set_shader", "shader_material", "shader"), &RenderingServer::material_set_shader);
+ ClassDB::bind_method(D_METHOD("material_set_param", "material", "parameter", "value"), &RenderingServer::material_set_param);
+ ClassDB::bind_method(D_METHOD("material_get_param", "material", "parameter"), &RenderingServer::material_get_param);
+ ClassDB::bind_method(D_METHOD("material_set_render_priority", "material", "priority"), &RenderingServer::material_set_render_priority);
+
+ ClassDB::bind_method(D_METHOD("material_set_next_pass", "material", "next_material"), &RenderingServer::material_set_next_pass);
+
+ ClassDB::bind_method(D_METHOD("mesh_create"), &RenderingServer::mesh_create);
+ ClassDB::bind_method(D_METHOD("mesh_surface_get_format_offset", "format", "vertex_len", "index_len", "array_index"), &RenderingServer::mesh_surface_get_format_offset);
+ ClassDB::bind_method(D_METHOD("mesh_surface_get_format_stride", "format", "vertex_len", "index_len"), &RenderingServer::mesh_surface_get_format_stride);
+ ClassDB::bind_method(D_METHOD("mesh_add_surface_from_arrays", "mesh", "primitive", "arrays", "blend_shapes", "lods", "compress_format"), &RenderingServer::mesh_add_surface_from_arrays, DEFVAL(Array()), DEFVAL(Dictionary()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
+ ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_count", "mesh"), &RenderingServer::mesh_get_blend_shape_count);
+ ClassDB::bind_method(D_METHOD("mesh_set_blend_shape_mode", "mesh", "mode"), &RenderingServer::mesh_set_blend_shape_mode);
+ ClassDB::bind_method(D_METHOD("mesh_get_blend_shape_mode", "mesh"), &RenderingServer::mesh_get_blend_shape_mode);
+ ClassDB::bind_method(D_METHOD("mesh_surface_update_region", "mesh", "surface", "offset", "data"), &RenderingServer::mesh_surface_update_region);
+ ClassDB::bind_method(D_METHOD("mesh_surface_set_material", "mesh", "surface", "material"), &RenderingServer::mesh_surface_set_material);
+ ClassDB::bind_method(D_METHOD("mesh_surface_get_material", "mesh", "surface"), &RenderingServer::mesh_surface_get_material);
+ ClassDB::bind_method(D_METHOD("mesh_surface_get_arrays", "mesh", "surface"), &RenderingServer::mesh_surface_get_arrays);
+ ClassDB::bind_method(D_METHOD("mesh_surface_get_blend_shape_arrays", "mesh", "surface"), &RenderingServer::mesh_surface_get_blend_shape_arrays);
+ ClassDB::bind_method(D_METHOD("mesh_get_surface_count", "mesh"), &RenderingServer::mesh_get_surface_count);
+ ClassDB::bind_method(D_METHOD("mesh_set_custom_aabb", "mesh", "aabb"), &RenderingServer::mesh_set_custom_aabb);
+ ClassDB::bind_method(D_METHOD("mesh_get_custom_aabb", "mesh"), &RenderingServer::mesh_get_custom_aabb);
+ ClassDB::bind_method(D_METHOD("mesh_clear", "mesh"), &RenderingServer::mesh_clear);
+
+ ClassDB::bind_method(D_METHOD("multimesh_create"), &RenderingServer::multimesh_create);
+ ClassDB::bind_method(D_METHOD("multimesh_allocate", "multimesh", "instances", "transform_format", "color_format", "custom_data_format"), &RenderingServer::multimesh_allocate, DEFVAL(false), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("multimesh_get_instance_count", "multimesh"), &RenderingServer::multimesh_get_instance_count);
+ ClassDB::bind_method(D_METHOD("multimesh_set_mesh", "multimesh", "mesh"), &RenderingServer::multimesh_set_mesh);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform", "multimesh", "index", "transform"), &RenderingServer::multimesh_instance_set_transform);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_set_transform_2d", "multimesh", "index", "transform"), &RenderingServer::multimesh_instance_set_transform_2d);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_set_color", "multimesh", "index", "color"), &RenderingServer::multimesh_instance_set_color);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_set_custom_data", "multimesh", "index", "custom_data"), &RenderingServer::multimesh_instance_set_custom_data);
+ ClassDB::bind_method(D_METHOD("multimesh_get_mesh", "multimesh"), &RenderingServer::multimesh_get_mesh);
+ ClassDB::bind_method(D_METHOD("multimesh_get_aabb", "multimesh"), &RenderingServer::multimesh_get_aabb);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform", "multimesh", "index"), &RenderingServer::multimesh_instance_get_transform);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_get_transform_2d", "multimesh", "index"), &RenderingServer::multimesh_instance_get_transform_2d);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_get_color", "multimesh", "index"), &RenderingServer::multimesh_instance_get_color);
+ ClassDB::bind_method(D_METHOD("multimesh_instance_get_custom_data", "multimesh", "index"), &RenderingServer::multimesh_instance_get_custom_data);
+ ClassDB::bind_method(D_METHOD("multimesh_set_visible_instances", "multimesh", "visible"), &RenderingServer::multimesh_set_visible_instances);
+ ClassDB::bind_method(D_METHOD("multimesh_get_visible_instances", "multimesh"), &RenderingServer::multimesh_get_visible_instances);
+ ClassDB::bind_method(D_METHOD("multimesh_set_buffer", "multimesh", "buffer"), &RenderingServer::multimesh_set_buffer);
+ ClassDB::bind_method(D_METHOD("multimesh_get_buffer", "multimesh"), &RenderingServer::multimesh_get_buffer);
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("immediate_create"), &VisualServer::immediate_create);
- ClassDB::bind_method(D_METHOD("immediate_begin", "immediate", "primitive", "texture"), &VisualServer::immediate_begin, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("immediate_vertex", "immediate", "vertex"), &VisualServer::immediate_vertex);
- ClassDB::bind_method(D_METHOD("immediate_vertex_2d", "immediate", "vertex"), &VisualServer::immediate_vertex_2d);
- ClassDB::bind_method(D_METHOD("immediate_normal", "immediate", "normal"), &VisualServer::immediate_normal);
- ClassDB::bind_method(D_METHOD("immediate_tangent", "immediate", "tangent"), &VisualServer::immediate_tangent);
- ClassDB::bind_method(D_METHOD("immediate_color", "immediate", "color"), &VisualServer::immediate_color);
- ClassDB::bind_method(D_METHOD("immediate_uv", "immediate", "tex_uv"), &VisualServer::immediate_uv);
- ClassDB::bind_method(D_METHOD("immediate_uv2", "immediate", "tex_uv"), &VisualServer::immediate_uv2);
- ClassDB::bind_method(D_METHOD("immediate_end", "immediate"), &VisualServer::immediate_end);
- ClassDB::bind_method(D_METHOD("immediate_clear", "immediate"), &VisualServer::immediate_clear);
- ClassDB::bind_method(D_METHOD("immediate_set_material", "immediate", "material"), &VisualServer::immediate_set_material);
- ClassDB::bind_method(D_METHOD("immediate_get_material", "immediate"), &VisualServer::immediate_get_material);
+ ClassDB::bind_method(D_METHOD("immediate_create"), &RenderingServer::immediate_create);
+ ClassDB::bind_method(D_METHOD("immediate_begin", "immediate", "primitive", "texture"), &RenderingServer::immediate_begin, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("immediate_vertex", "immediate", "vertex"), &RenderingServer::immediate_vertex);
+ ClassDB::bind_method(D_METHOD("immediate_vertex_2d", "immediate", "vertex"), &RenderingServer::immediate_vertex_2d);
+ ClassDB::bind_method(D_METHOD("immediate_normal", "immediate", "normal"), &RenderingServer::immediate_normal);
+ ClassDB::bind_method(D_METHOD("immediate_tangent", "immediate", "tangent"), &RenderingServer::immediate_tangent);
+ ClassDB::bind_method(D_METHOD("immediate_color", "immediate", "color"), &RenderingServer::immediate_color);
+ ClassDB::bind_method(D_METHOD("immediate_uv", "immediate", "tex_uv"), &RenderingServer::immediate_uv);
+ ClassDB::bind_method(D_METHOD("immediate_uv2", "immediate", "tex_uv"), &RenderingServer::immediate_uv2);
+ ClassDB::bind_method(D_METHOD("immediate_end", "immediate"), &RenderingServer::immediate_end);
+ ClassDB::bind_method(D_METHOD("immediate_clear", "immediate"), &RenderingServer::immediate_clear);
+ ClassDB::bind_method(D_METHOD("immediate_set_material", "immediate", "material"), &RenderingServer::immediate_set_material);
+ ClassDB::bind_method(D_METHOD("immediate_get_material", "immediate"), &RenderingServer::immediate_get_material);
#endif
- ClassDB::bind_method(D_METHOD("skeleton_create"), &VisualServer::skeleton_create);
- ClassDB::bind_method(D_METHOD("skeleton_allocate", "skeleton", "bones", "is_2d_skeleton"), &VisualServer::skeleton_allocate, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("skeleton_get_bone_count", "skeleton"), &VisualServer::skeleton_get_bone_count);
- ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform", "skeleton", "bone", "transform"), &VisualServer::skeleton_bone_set_transform);
- ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform", "skeleton", "bone"), &VisualServer::skeleton_bone_get_transform);
- ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform_2d", "skeleton", "bone", "transform"), &VisualServer::skeleton_bone_set_transform_2d);
- ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform_2d", "skeleton", "bone"), &VisualServer::skeleton_bone_get_transform_2d);
+ ClassDB::bind_method(D_METHOD("skeleton_create"), &RenderingServer::skeleton_create);
+ ClassDB::bind_method(D_METHOD("skeleton_allocate", "skeleton", "bones", "is_2d_skeleton"), &RenderingServer::skeleton_allocate, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("skeleton_get_bone_count", "skeleton"), &RenderingServer::skeleton_get_bone_count);
+ ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform", "skeleton", "bone", "transform"), &RenderingServer::skeleton_bone_set_transform);
+ ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform", "skeleton", "bone"), &RenderingServer::skeleton_bone_get_transform);
+ ClassDB::bind_method(D_METHOD("skeleton_bone_set_transform_2d", "skeleton", "bone", "transform"), &RenderingServer::skeleton_bone_set_transform_2d);
+ ClassDB::bind_method(D_METHOD("skeleton_bone_get_transform_2d", "skeleton", "bone"), &RenderingServer::skeleton_bone_get_transform_2d);
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("directional_light_create"), &VisualServer::directional_light_create);
- ClassDB::bind_method(D_METHOD("omni_light_create"), &VisualServer::omni_light_create);
- ClassDB::bind_method(D_METHOD("spot_light_create"), &VisualServer::spot_light_create);
-
- ClassDB::bind_method(D_METHOD("light_set_color", "light", "color"), &VisualServer::light_set_color);
- ClassDB::bind_method(D_METHOD("light_set_param", "light", "param", "value"), &VisualServer::light_set_param);
- ClassDB::bind_method(D_METHOD("light_set_shadow", "light", "enabled"), &VisualServer::light_set_shadow);
- ClassDB::bind_method(D_METHOD("light_set_shadow_color", "light", "color"), &VisualServer::light_set_shadow_color);
- ClassDB::bind_method(D_METHOD("light_set_projector", "light", "texture"), &VisualServer::light_set_projector);
- ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &VisualServer::light_set_negative);
- ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &VisualServer::light_set_cull_mask);
- ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &VisualServer::light_set_reverse_cull_face_mode);
- ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &VisualServer::light_set_use_gi);
-
- ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &VisualServer::light_omni_set_shadow_mode);
-
- ClassDB::bind_method(D_METHOD("light_directional_set_shadow_mode", "light", "mode"), &VisualServer::light_directional_set_shadow_mode);
- ClassDB::bind_method(D_METHOD("light_directional_set_blend_splits", "light", "enable"), &VisualServer::light_directional_set_blend_splits);
- ClassDB::bind_method(D_METHOD("light_directional_set_shadow_depth_range_mode", "light", "range_mode"), &VisualServer::light_directional_set_shadow_depth_range_mode);
-
- ClassDB::bind_method(D_METHOD("reflection_probe_create"), &VisualServer::reflection_probe_create);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_update_mode", "probe", "mode"), &VisualServer::reflection_probe_set_update_mode);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_intensity", "probe", "intensity"), &VisualServer::reflection_probe_set_intensity);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient", "probe", "color"), &VisualServer::reflection_probe_set_interior_ambient);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient_energy", "probe", "energy"), &VisualServer::reflection_probe_set_interior_ambient_energy);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient_probe_contribution", "probe", "contrib"), &VisualServer::reflection_probe_set_interior_ambient_probe_contribution);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_max_distance", "probe", "distance"), &VisualServer::reflection_probe_set_max_distance);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_extents", "probe", "extents"), &VisualServer::reflection_probe_set_extents);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_origin_offset", "probe", "offset"), &VisualServer::reflection_probe_set_origin_offset);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_as_interior", "probe", "enable"), &VisualServer::reflection_probe_set_as_interior);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_box_projection", "probe", "enable"), &VisualServer::reflection_probe_set_enable_box_projection);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_shadows", "probe", "enable"), &VisualServer::reflection_probe_set_enable_shadows);
- ClassDB::bind_method(D_METHOD("reflection_probe_set_cull_mask", "probe", "layers"), &VisualServer::reflection_probe_set_cull_mask);
+ ClassDB::bind_method(D_METHOD("directional_light_create"), &RenderingServer::directional_light_create);
+ ClassDB::bind_method(D_METHOD("omni_light_create"), &RenderingServer::omni_light_create);
+ ClassDB::bind_method(D_METHOD("spot_light_create"), &RenderingServer::spot_light_create);
+
+ ClassDB::bind_method(D_METHOD("light_set_color", "light", "color"), &RenderingServer::light_set_color);
+ ClassDB::bind_method(D_METHOD("light_set_param", "light", "param", "value"), &RenderingServer::light_set_param);
+ ClassDB::bind_method(D_METHOD("light_set_shadow", "light", "enabled"), &RenderingServer::light_set_shadow);
+ ClassDB::bind_method(D_METHOD("light_set_shadow_color", "light", "color"), &RenderingServer::light_set_shadow_color);
+ ClassDB::bind_method(D_METHOD("light_set_projector", "light", "texture"), &RenderingServer::light_set_projector);
+ ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &RenderingServer::light_set_negative);
+ ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &RenderingServer::light_set_cull_mask);
+ ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &RenderingServer::light_set_reverse_cull_face_mode);
+ ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &RenderingServer::light_set_use_gi);
+
+ ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &RenderingServer::light_omni_set_shadow_mode);
+
+ ClassDB::bind_method(D_METHOD("light_directional_set_shadow_mode", "light", "mode"), &RenderingServer::light_directional_set_shadow_mode);
+ ClassDB::bind_method(D_METHOD("light_directional_set_blend_splits", "light", "enable"), &RenderingServer::light_directional_set_blend_splits);
+ ClassDB::bind_method(D_METHOD("light_directional_set_shadow_depth_range_mode", "light", "range_mode"), &RenderingServer::light_directional_set_shadow_depth_range_mode);
+
+ ClassDB::bind_method(D_METHOD("reflection_probe_create"), &RenderingServer::reflection_probe_create);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_update_mode", "probe", "mode"), &RenderingServer::reflection_probe_set_update_mode);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_intensity", "probe", "intensity"), &RenderingServer::reflection_probe_set_intensity);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient", "probe", "color"), &RenderingServer::reflection_probe_set_interior_ambient);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient_energy", "probe", "energy"), &RenderingServer::reflection_probe_set_interior_ambient_energy);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_interior_ambient_probe_contribution", "probe", "contrib"), &RenderingServer::reflection_probe_set_interior_ambient_probe_contribution);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_max_distance", "probe", "distance"), &RenderingServer::reflection_probe_set_max_distance);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_extents", "probe", "extents"), &RenderingServer::reflection_probe_set_extents);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_origin_offset", "probe", "offset"), &RenderingServer::reflection_probe_set_origin_offset);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_as_interior", "probe", "enable"), &RenderingServer::reflection_probe_set_as_interior);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_box_projection", "probe", "enable"), &RenderingServer::reflection_probe_set_enable_box_projection);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_shadows", "probe", "enable"), &RenderingServer::reflection_probe_set_enable_shadows);
+ ClassDB::bind_method(D_METHOD("reflection_probe_set_cull_mask", "probe", "layers"), &RenderingServer::reflection_probe_set_cull_mask);
#ifndef _MSC_VER
#warning TODO all giprobe methods need re-binding
#endif
#if 0
- ClassDB::bind_method(D_METHOD("gi_probe_create"), &VisualServer::gi_probe_create);
- ClassDB::bind_method(D_METHOD("gi_probe_set_bounds", "probe", "bounds"), &VisualServer::gi_probe_set_bounds);
- ClassDB::bind_method(D_METHOD("gi_probe_get_bounds", "probe"), &VisualServer::gi_probe_get_bounds);
- ClassDB::bind_method(D_METHOD("gi_probe_set_cell_size", "probe", "range"), &VisualServer::gi_probe_set_cell_size);
- ClassDB::bind_method(D_METHOD("gi_probe_get_cell_size", "probe"), &VisualServer::gi_probe_get_cell_size);
- ClassDB::bind_method(D_METHOD("gi_probe_set_to_cell_xform", "probe", "xform"), &VisualServer::gi_probe_set_to_cell_xform);
- ClassDB::bind_method(D_METHOD("gi_probe_get_to_cell_xform", "probe"), &VisualServer::gi_probe_get_to_cell_xform);
- ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_data", "probe", "data"), &VisualServer::gi_probe_set_dynamic_data);
- ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_data", "probe"), &VisualServer::gi_probe_get_dynamic_data);
- ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_range", "probe", "range"), &VisualServer::gi_probe_set_dynamic_range);
- ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_range", "probe"), &VisualServer::gi_probe_get_dynamic_range);
- ClassDB::bind_method(D_METHOD("gi_probe_set_energy", "probe", "energy"), &VisualServer::gi_probe_set_energy);
- ClassDB::bind_method(D_METHOD("gi_probe_get_energy", "probe"), &VisualServer::gi_probe_get_energy);
- ClassDB::bind_method(D_METHOD("gi_probe_set_bias", "probe", "bias"), &VisualServer::gi_probe_set_bias);
- ClassDB::bind_method(D_METHOD("gi_probe_get_bias", "probe"), &VisualServer::gi_probe_get_bias);
- ClassDB::bind_method(D_METHOD("gi_probe_set_normal_bias", "probe", "bias"), &VisualServer::gi_probe_set_normal_bias);
- ClassDB::bind_method(D_METHOD("gi_probe_get_normal_bias", "probe"), &VisualServer::gi_probe_get_normal_bias);
- ClassDB::bind_method(D_METHOD("gi_probe_set_propagation", "probe", "propagation"), &VisualServer::gi_probe_set_propagation);
- ClassDB::bind_method(D_METHOD("gi_probe_get_propagation", "probe"), &VisualServer::gi_probe_get_propagation);
- ClassDB::bind_method(D_METHOD("gi_probe_set_interior", "probe", "enable"), &VisualServer::gi_probe_set_interior);
- ClassDB::bind_method(D_METHOD("gi_probe_is_interior", "probe"), &VisualServer::gi_probe_is_interior);
- ClassDB::bind_method(D_METHOD("gi_probe_set_compress", "probe", "enable"), &VisualServer::gi_probe_set_compress);
- ClassDB::bind_method(D_METHOD("gi_probe_is_compressed", "probe"), &VisualServer::gi_probe_is_compressed);
+ ClassDB::bind_method(D_METHOD("gi_probe_create"), &RenderingServer::gi_probe_create);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_bounds", "probe", "bounds"), &RenderingServer::gi_probe_set_bounds);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_bounds", "probe"), &RenderingServer::gi_probe_get_bounds);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_cell_size", "probe", "range"), &RenderingServer::gi_probe_set_cell_size);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_cell_size", "probe"), &RenderingServer::gi_probe_get_cell_size);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_to_cell_xform", "probe", "xform"), &RenderingServer::gi_probe_set_to_cell_xform);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_to_cell_xform", "probe"), &RenderingServer::gi_probe_get_to_cell_xform);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_data", "probe", "data"), &RenderingServer::gi_probe_set_dynamic_data);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_data", "probe"), &RenderingServer::gi_probe_get_dynamic_data);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_range", "probe", "range"), &RenderingServer::gi_probe_set_dynamic_range);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_range", "probe"), &RenderingServer::gi_probe_get_dynamic_range);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_energy", "probe", "energy"), &RenderingServer::gi_probe_set_energy);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_energy", "probe"), &RenderingServer::gi_probe_get_energy);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_bias", "probe", "bias"), &RenderingServer::gi_probe_set_bias);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_bias", "probe"), &RenderingServer::gi_probe_get_bias);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_normal_bias", "probe", "bias"), &RenderingServer::gi_probe_set_normal_bias);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_normal_bias", "probe"), &RenderingServer::gi_probe_get_normal_bias);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_propagation", "probe", "propagation"), &RenderingServer::gi_probe_set_propagation);
+ ClassDB::bind_method(D_METHOD("gi_probe_get_propagation", "probe"), &RenderingServer::gi_probe_get_propagation);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_interior", "probe", "enable"), &RenderingServer::gi_probe_set_interior);
+ ClassDB::bind_method(D_METHOD("gi_probe_is_interior", "probe"), &RenderingServer::gi_probe_is_interior);
+ ClassDB::bind_method(D_METHOD("gi_probe_set_compress", "probe", "enable"), &RenderingServer::gi_probe_set_compress);
+ ClassDB::bind_method(D_METHOD("gi_probe_is_compressed", "probe"), &RenderingServer::gi_probe_is_compressed);
#endif
- ClassDB::bind_method(D_METHOD("lightmap_capture_create"), &VisualServer::lightmap_capture_create);
- ClassDB::bind_method(D_METHOD("lightmap_capture_set_bounds", "capture", "bounds"), &VisualServer::lightmap_capture_set_bounds);
- ClassDB::bind_method(D_METHOD("lightmap_capture_get_bounds", "capture"), &VisualServer::lightmap_capture_get_bounds);
- ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree", "capture", "octree"), &VisualServer::lightmap_capture_set_octree);
- ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree_cell_transform", "capture", "xform"), &VisualServer::lightmap_capture_set_octree_cell_transform);
- ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree_cell_transform", "capture"), &VisualServer::lightmap_capture_get_octree_cell_transform);
- ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree_cell_subdiv", "capture", "subdiv"), &VisualServer::lightmap_capture_set_octree_cell_subdiv);
- ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree_cell_subdiv", "capture"), &VisualServer::lightmap_capture_get_octree_cell_subdiv);
- ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree", "capture"), &VisualServer::lightmap_capture_get_octree);
- ClassDB::bind_method(D_METHOD("lightmap_capture_set_energy", "capture", "energy"), &VisualServer::lightmap_capture_set_energy);
- ClassDB::bind_method(D_METHOD("lightmap_capture_get_energy", "capture"), &VisualServer::lightmap_capture_get_energy);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_create"), &RenderingServer::lightmap_capture_create);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_set_bounds", "capture", "bounds"), &RenderingServer::lightmap_capture_set_bounds);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_get_bounds", "capture"), &RenderingServer::lightmap_capture_get_bounds);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree", "capture", "octree"), &RenderingServer::lightmap_capture_set_octree);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree_cell_transform", "capture", "xform"), &RenderingServer::lightmap_capture_set_octree_cell_transform);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree_cell_transform", "capture"), &RenderingServer::lightmap_capture_get_octree_cell_transform);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_set_octree_cell_subdiv", "capture", "subdiv"), &RenderingServer::lightmap_capture_set_octree_cell_subdiv);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree_cell_subdiv", "capture"), &RenderingServer::lightmap_capture_get_octree_cell_subdiv);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_get_octree", "capture"), &RenderingServer::lightmap_capture_get_octree);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_set_energy", "capture", "energy"), &RenderingServer::lightmap_capture_set_energy);
+ ClassDB::bind_method(D_METHOD("lightmap_capture_get_energy", "capture"), &RenderingServer::lightmap_capture_get_energy);
#endif
- ClassDB::bind_method(D_METHOD("particles_create"), &VisualServer::particles_create);
- ClassDB::bind_method(D_METHOD("particles_set_emitting", "particles", "emitting"), &VisualServer::particles_set_emitting);
- ClassDB::bind_method(D_METHOD("particles_get_emitting", "particles"), &VisualServer::particles_get_emitting);
- ClassDB::bind_method(D_METHOD("particles_set_amount", "particles", "amount"), &VisualServer::particles_set_amount);
- ClassDB::bind_method(D_METHOD("particles_set_lifetime", "particles", "lifetime"), &VisualServer::particles_set_lifetime);
- ClassDB::bind_method(D_METHOD("particles_set_one_shot", "particles", "one_shot"), &VisualServer::particles_set_one_shot);
- ClassDB::bind_method(D_METHOD("particles_set_pre_process_time", "particles", "time"), &VisualServer::particles_set_pre_process_time);
- ClassDB::bind_method(D_METHOD("particles_set_explosiveness_ratio", "particles", "ratio"), &VisualServer::particles_set_explosiveness_ratio);
- ClassDB::bind_method(D_METHOD("particles_set_randomness_ratio", "particles", "ratio"), &VisualServer::particles_set_randomness_ratio);
- ClassDB::bind_method(D_METHOD("particles_set_custom_aabb", "particles", "aabb"), &VisualServer::particles_set_custom_aabb);
- ClassDB::bind_method(D_METHOD("particles_set_speed_scale", "particles", "scale"), &VisualServer::particles_set_speed_scale);
- ClassDB::bind_method(D_METHOD("particles_set_use_local_coordinates", "particles", "enable"), &VisualServer::particles_set_use_local_coordinates);
- ClassDB::bind_method(D_METHOD("particles_set_process_material", "particles", "material"), &VisualServer::particles_set_process_material);
- ClassDB::bind_method(D_METHOD("particles_set_fixed_fps", "particles", "fps"), &VisualServer::particles_set_fixed_fps);
- ClassDB::bind_method(D_METHOD("particles_set_fractional_delta", "particles", "enable"), &VisualServer::particles_set_fractional_delta);
- ClassDB::bind_method(D_METHOD("particles_is_inactive", "particles"), &VisualServer::particles_is_inactive);
- ClassDB::bind_method(D_METHOD("particles_request_process", "particles"), &VisualServer::particles_request_process);
- ClassDB::bind_method(D_METHOD("particles_restart", "particles"), &VisualServer::particles_restart);
- ClassDB::bind_method(D_METHOD("particles_set_draw_order", "particles", "order"), &VisualServer::particles_set_draw_order);
- ClassDB::bind_method(D_METHOD("particles_set_draw_passes", "particles", "count"), &VisualServer::particles_set_draw_passes);
- ClassDB::bind_method(D_METHOD("particles_set_draw_pass_mesh", "particles", "pass", "mesh"), &VisualServer::particles_set_draw_pass_mesh);
- ClassDB::bind_method(D_METHOD("particles_get_current_aabb", "particles"), &VisualServer::particles_get_current_aabb);
- ClassDB::bind_method(D_METHOD("particles_set_emission_transform", "particles", "transform"), &VisualServer::particles_set_emission_transform);
-
- ClassDB::bind_method(D_METHOD("camera_create"), &VisualServer::camera_create);
- ClassDB::bind_method(D_METHOD("camera_set_perspective", "camera", "fovy_degrees", "z_near", "z_far"), &VisualServer::camera_set_perspective);
- ClassDB::bind_method(D_METHOD("camera_set_orthogonal", "camera", "size", "z_near", "z_far"), &VisualServer::camera_set_orthogonal);
- ClassDB::bind_method(D_METHOD("camera_set_frustum", "camera", "size", "offset", "z_near", "z_far"), &VisualServer::camera_set_frustum);
- ClassDB::bind_method(D_METHOD("camera_set_transform", "camera", "transform"), &VisualServer::camera_set_transform);
- ClassDB::bind_method(D_METHOD("camera_set_cull_mask", "camera", "layers"), &VisualServer::camera_set_cull_mask);
- ClassDB::bind_method(D_METHOD("camera_set_environment", "camera", "env"), &VisualServer::camera_set_environment);
- ClassDB::bind_method(D_METHOD("camera_set_use_vertical_aspect", "camera", "enable"), &VisualServer::camera_set_use_vertical_aspect);
-
- ClassDB::bind_method(D_METHOD("viewport_create"), &VisualServer::viewport_create);
- ClassDB::bind_method(D_METHOD("viewport_set_use_arvr", "viewport", "use_arvr"), &VisualServer::viewport_set_use_arvr);
- ClassDB::bind_method(D_METHOD("viewport_set_size", "viewport", "width", "height"), &VisualServer::viewport_set_size);
- ClassDB::bind_method(D_METHOD("viewport_set_active", "viewport", "active"), &VisualServer::viewport_set_active);
- ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport", "viewport", "parent_viewport"), &VisualServer::viewport_set_parent_viewport);
- ClassDB::bind_method(D_METHOD("viewport_attach_to_screen", "viewport", "rect", "screen"), &VisualServer::viewport_attach_to_screen, DEFVAL(Rect2()), DEFVAL(DisplayServer::MAIN_WINDOW_ID));
- ClassDB::bind_method(D_METHOD("viewport_set_render_direct_to_screen", "viewport", "enabled"), &VisualServer::viewport_set_render_direct_to_screen);
-
- ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &VisualServer::viewport_set_update_mode);
- ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &VisualServer::viewport_set_clear_mode);
- ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &VisualServer::viewport_get_texture);
- ClassDB::bind_method(D_METHOD("viewport_set_hide_scenario", "viewport", "hidden"), &VisualServer::viewport_set_hide_scenario);
- ClassDB::bind_method(D_METHOD("viewport_set_hide_canvas", "viewport", "hidden"), &VisualServer::viewport_set_hide_canvas);
- ClassDB::bind_method(D_METHOD("viewport_set_disable_environment", "viewport", "disabled"), &VisualServer::viewport_set_disable_environment);
- ClassDB::bind_method(D_METHOD("viewport_attach_camera", "viewport", "camera"), &VisualServer::viewport_attach_camera);
- ClassDB::bind_method(D_METHOD("viewport_set_scenario", "viewport", "scenario"), &VisualServer::viewport_set_scenario);
- ClassDB::bind_method(D_METHOD("viewport_attach_canvas", "viewport", "canvas"), &VisualServer::viewport_attach_canvas);
- ClassDB::bind_method(D_METHOD("viewport_remove_canvas", "viewport", "canvas"), &VisualServer::viewport_remove_canvas);
- ClassDB::bind_method(D_METHOD("viewport_set_canvas_transform", "viewport", "canvas", "offset"), &VisualServer::viewport_set_canvas_transform);
- ClassDB::bind_method(D_METHOD("viewport_set_transparent_background", "viewport", "enabled"), &VisualServer::viewport_set_transparent_background);
- ClassDB::bind_method(D_METHOD("viewport_set_global_canvas_transform", "viewport", "transform"), &VisualServer::viewport_set_global_canvas_transform);
- ClassDB::bind_method(D_METHOD("viewport_set_canvas_stacking", "viewport", "canvas", "layer", "sublayer"), &VisualServer::viewport_set_canvas_stacking);
- ClassDB::bind_method(D_METHOD("viewport_set_shadow_atlas_size", "viewport", "size"), &VisualServer::viewport_set_shadow_atlas_size);
- ClassDB::bind_method(D_METHOD("viewport_set_shadow_atlas_quadrant_subdivision", "viewport", "quadrant", "subdivision"), &VisualServer::viewport_set_shadow_atlas_quadrant_subdivision);
- ClassDB::bind_method(D_METHOD("viewport_set_msaa", "viewport", "msaa"), &VisualServer::viewport_set_msaa);
- ClassDB::bind_method(D_METHOD("viewport_get_render_info", "viewport", "info"), &VisualServer::viewport_get_render_info);
- ClassDB::bind_method(D_METHOD("viewport_set_debug_draw", "viewport", "draw"), &VisualServer::viewport_set_debug_draw);
-
- ClassDB::bind_method(D_METHOD("environment_create"), &VisualServer::environment_create);
- ClassDB::bind_method(D_METHOD("environment_set_background", "env", "bg"), &VisualServer::environment_set_background);
- ClassDB::bind_method(D_METHOD("environment_set_sky", "env", "sky"), &VisualServer::environment_set_sky);
- ClassDB::bind_method(D_METHOD("environment_set_sky_custom_fov", "env", "scale"), &VisualServer::environment_set_sky_custom_fov);
- ClassDB::bind_method(D_METHOD("environment_set_sky_orientation", "env", "orientation"), &VisualServer::environment_set_sky_orientation);
- ClassDB::bind_method(D_METHOD("environment_set_bg_color", "env", "color"), &VisualServer::environment_set_bg_color);
- ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &VisualServer::environment_set_bg_energy);
- ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &VisualServer::environment_set_canvas_max_layer);
- ClassDB::bind_method(D_METHOD("environment_set_ambient_light", "env", "color", "ambient", "energy", "sky_contibution", "reflection_source", "ao_color"), &VisualServer::environment_set_ambient_light, DEFVAL(VS::ENV_AMBIENT_SOURCE_BG), DEFVAL(1.0), DEFVAL(0.0), DEFVAL(VS::ENV_REFLECTION_SOURCE_BG), DEFVAL(Color()));
- ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap", "bicubic_upscale"), &VisualServer::environment_set_glow);
- ClassDB::bind_method(D_METHOD("environment_set_tonemap", "env", "tone_mapper", "exposure", "white", "auto_exposure", "min_luminance", "max_luminance", "auto_exp_speed", "auto_exp_grey"), &VisualServer::environment_set_tonemap);
- ClassDB::bind_method(D_METHOD("environment_set_adjustment", "env", "enable", "brightness", "contrast", "saturation", "ramp"), &VisualServer::environment_set_adjustment);
- ClassDB::bind_method(D_METHOD("environment_set_ssr", "env", "enable", "max_steps", "fade_in", "fade_out", "depth_tolerance", "roughness"), &VisualServer::environment_set_ssr);
- ClassDB::bind_method(D_METHOD("environment_set_ssao", "env", "enable", "radius", "intensity", "bias", "light_affect", "ao_channel_affect", "blur", "bilateral_sharpness"), &VisualServer::environment_set_ssao);
- ClassDB::bind_method(D_METHOD("environment_set_fog", "env", "enable", "color", "sun_color", "sun_amount"), &VisualServer::environment_set_fog);
-
- ClassDB::bind_method(D_METHOD("environment_set_fog_depth", "env", "enable", "depth_begin", "depth_end", "depth_curve", "transmit", "transmit_curve"), &VisualServer::environment_set_fog_depth);
-
- ClassDB::bind_method(D_METHOD("environment_set_fog_height", "env", "enable", "min_height", "max_height", "height_curve"), &VisualServer::environment_set_fog_height);
-
- ClassDB::bind_method(D_METHOD("scenario_create"), &VisualServer::scenario_create);
- ClassDB::bind_method(D_METHOD("scenario_set_debug", "scenario", "debug_mode"), &VisualServer::scenario_set_debug);
- ClassDB::bind_method(D_METHOD("scenario_set_environment", "scenario", "environment"), &VisualServer::scenario_set_environment);
- ClassDB::bind_method(D_METHOD("scenario_set_fallback_environment", "scenario", "environment"), &VisualServer::scenario_set_fallback_environment);
+ ClassDB::bind_method(D_METHOD("particles_create"), &RenderingServer::particles_create);
+ ClassDB::bind_method(D_METHOD("particles_set_emitting", "particles", "emitting"), &RenderingServer::particles_set_emitting);
+ ClassDB::bind_method(D_METHOD("particles_get_emitting", "particles"), &RenderingServer::particles_get_emitting);
+ ClassDB::bind_method(D_METHOD("particles_set_amount", "particles", "amount"), &RenderingServer::particles_set_amount);
+ ClassDB::bind_method(D_METHOD("particles_set_lifetime", "particles", "lifetime"), &RenderingServer::particles_set_lifetime);
+ ClassDB::bind_method(D_METHOD("particles_set_one_shot", "particles", "one_shot"), &RenderingServer::particles_set_one_shot);
+ ClassDB::bind_method(D_METHOD("particles_set_pre_process_time", "particles", "time"), &RenderingServer::particles_set_pre_process_time);
+ ClassDB::bind_method(D_METHOD("particles_set_explosiveness_ratio", "particles", "ratio"), &RenderingServer::particles_set_explosiveness_ratio);
+ ClassDB::bind_method(D_METHOD("particles_set_randomness_ratio", "particles", "ratio"), &RenderingServer::particles_set_randomness_ratio);
+ ClassDB::bind_method(D_METHOD("particles_set_custom_aabb", "particles", "aabb"), &RenderingServer::particles_set_custom_aabb);
+ ClassDB::bind_method(D_METHOD("particles_set_speed_scale", "particles", "scale"), &RenderingServer::particles_set_speed_scale);
+ ClassDB::bind_method(D_METHOD("particles_set_use_local_coordinates", "particles", "enable"), &RenderingServer::particles_set_use_local_coordinates);
+ ClassDB::bind_method(D_METHOD("particles_set_process_material", "particles", "material"), &RenderingServer::particles_set_process_material);
+ ClassDB::bind_method(D_METHOD("particles_set_fixed_fps", "particles", "fps"), &RenderingServer::particles_set_fixed_fps);
+ ClassDB::bind_method(D_METHOD("particles_set_fractional_delta", "particles", "enable"), &RenderingServer::particles_set_fractional_delta);
+ ClassDB::bind_method(D_METHOD("particles_is_inactive", "particles"), &RenderingServer::particles_is_inactive);
+ ClassDB::bind_method(D_METHOD("particles_request_process", "particles"), &RenderingServer::particles_request_process);
+ ClassDB::bind_method(D_METHOD("particles_restart", "particles"), &RenderingServer::particles_restart);
+ ClassDB::bind_method(D_METHOD("particles_set_draw_order", "particles", "order"), &RenderingServer::particles_set_draw_order);
+ ClassDB::bind_method(D_METHOD("particles_set_draw_passes", "particles", "count"), &RenderingServer::particles_set_draw_passes);
+ ClassDB::bind_method(D_METHOD("particles_set_draw_pass_mesh", "particles", "pass", "mesh"), &RenderingServer::particles_set_draw_pass_mesh);
+ ClassDB::bind_method(D_METHOD("particles_get_current_aabb", "particles"), &RenderingServer::particles_get_current_aabb);
+ ClassDB::bind_method(D_METHOD("particles_set_emission_transform", "particles", "transform"), &RenderingServer::particles_set_emission_transform);
+
+ ClassDB::bind_method(D_METHOD("camera_create"), &RenderingServer::camera_create);
+ ClassDB::bind_method(D_METHOD("camera_set_perspective", "camera", "fovy_degrees", "z_near", "z_far"), &RenderingServer::camera_set_perspective);
+ ClassDB::bind_method(D_METHOD("camera_set_orthogonal", "camera", "size", "z_near", "z_far"), &RenderingServer::camera_set_orthogonal);
+ ClassDB::bind_method(D_METHOD("camera_set_frustum", "camera", "size", "offset", "z_near", "z_far"), &RenderingServer::camera_set_frustum);
+ ClassDB::bind_method(D_METHOD("camera_set_transform", "camera", "transform"), &RenderingServer::camera_set_transform);
+ ClassDB::bind_method(D_METHOD("camera_set_cull_mask", "camera", "layers"), &RenderingServer::camera_set_cull_mask);
+ ClassDB::bind_method(D_METHOD("camera_set_environment", "camera", "env"), &RenderingServer::camera_set_environment);
+ ClassDB::bind_method(D_METHOD("camera_set_use_vertical_aspect", "camera", "enable"), &RenderingServer::camera_set_use_vertical_aspect);
+
+ ClassDB::bind_method(D_METHOD("viewport_create"), &RenderingServer::viewport_create);
+ ClassDB::bind_method(D_METHOD("viewport_set_use_arvr", "viewport", "use_arvr"), &RenderingServer::viewport_set_use_arvr);
+ ClassDB::bind_method(D_METHOD("viewport_set_size", "viewport", "width", "height"), &RenderingServer::viewport_set_size);
+ ClassDB::bind_method(D_METHOD("viewport_set_active", "viewport", "active"), &RenderingServer::viewport_set_active);
+ ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport", "viewport", "parent_viewport"), &RenderingServer::viewport_set_parent_viewport);
+ ClassDB::bind_method(D_METHOD("viewport_attach_to_screen", "viewport", "rect", "screen"), &RenderingServer::viewport_attach_to_screen, DEFVAL(Rect2()), DEFVAL(DisplayServer::MAIN_WINDOW_ID));
+ ClassDB::bind_method(D_METHOD("viewport_set_render_direct_to_screen", "viewport", "enabled"), &RenderingServer::viewport_set_render_direct_to_screen);
+
+ ClassDB::bind_method(D_METHOD("viewport_set_update_mode", "viewport", "update_mode"), &RenderingServer::viewport_set_update_mode);
+ ClassDB::bind_method(D_METHOD("viewport_set_clear_mode", "viewport", "clear_mode"), &RenderingServer::viewport_set_clear_mode);
+ ClassDB::bind_method(D_METHOD("viewport_get_texture", "viewport"), &RenderingServer::viewport_get_texture);
+ ClassDB::bind_method(D_METHOD("viewport_set_hide_scenario", "viewport", "hidden"), &RenderingServer::viewport_set_hide_scenario);
+ ClassDB::bind_method(D_METHOD("viewport_set_hide_canvas", "viewport", "hidden"), &RenderingServer::viewport_set_hide_canvas);
+ ClassDB::bind_method(D_METHOD("viewport_set_disable_environment", "viewport", "disabled"), &RenderingServer::viewport_set_disable_environment);
+ ClassDB::bind_method(D_METHOD("viewport_attach_camera", "viewport", "camera"), &RenderingServer::viewport_attach_camera);
+ ClassDB::bind_method(D_METHOD("viewport_set_scenario", "viewport", "scenario"), &RenderingServer::viewport_set_scenario);
+ ClassDB::bind_method(D_METHOD("viewport_attach_canvas", "viewport", "canvas"), &RenderingServer::viewport_attach_canvas);
+ ClassDB::bind_method(D_METHOD("viewport_remove_canvas", "viewport", "canvas"), &RenderingServer::viewport_remove_canvas);
+ ClassDB::bind_method(D_METHOD("viewport_set_canvas_transform", "viewport", "canvas", "offset"), &RenderingServer::viewport_set_canvas_transform);
+ ClassDB::bind_method(D_METHOD("viewport_set_transparent_background", "viewport", "enabled"), &RenderingServer::viewport_set_transparent_background);
+ ClassDB::bind_method(D_METHOD("viewport_set_global_canvas_transform", "viewport", "transform"), &RenderingServer::viewport_set_global_canvas_transform);
+ ClassDB::bind_method(D_METHOD("viewport_set_canvas_stacking", "viewport", "canvas", "layer", "sublayer"), &RenderingServer::viewport_set_canvas_stacking);
+ ClassDB::bind_method(D_METHOD("viewport_set_shadow_atlas_size", "viewport", "size"), &RenderingServer::viewport_set_shadow_atlas_size);
+ ClassDB::bind_method(D_METHOD("viewport_set_shadow_atlas_quadrant_subdivision", "viewport", "quadrant", "subdivision"), &RenderingServer::viewport_set_shadow_atlas_quadrant_subdivision);
+ ClassDB::bind_method(D_METHOD("viewport_set_msaa", "viewport", "msaa"), &RenderingServer::viewport_set_msaa);
+ ClassDB::bind_method(D_METHOD("viewport_get_render_info", "viewport", "info"), &RenderingServer::viewport_get_render_info);
+ ClassDB::bind_method(D_METHOD("viewport_set_debug_draw", "viewport", "draw"), &RenderingServer::viewport_set_debug_draw);
+
+ ClassDB::bind_method(D_METHOD("environment_create"), &RenderingServer::environment_create);
+ ClassDB::bind_method(D_METHOD("environment_set_background", "env", "bg"), &RenderingServer::environment_set_background);
+ ClassDB::bind_method(D_METHOD("environment_set_sky", "env", "sky"), &RenderingServer::environment_set_sky);
+ ClassDB::bind_method(D_METHOD("environment_set_sky_custom_fov", "env", "scale"), &RenderingServer::environment_set_sky_custom_fov);
+ ClassDB::bind_method(D_METHOD("environment_set_sky_orientation", "env", "orientation"), &RenderingServer::environment_set_sky_orientation);
+ ClassDB::bind_method(D_METHOD("environment_set_bg_color", "env", "color"), &RenderingServer::environment_set_bg_color);
+ ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &RenderingServer::environment_set_bg_energy);
+ ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &RenderingServer::environment_set_canvas_max_layer);
+ ClassDB::bind_method(D_METHOD("environment_set_ambient_light", "env", "color", "ambient", "energy", "sky_contibution", "reflection_source", "ao_color"), &RenderingServer::environment_set_ambient_light, DEFVAL(RS::ENV_AMBIENT_SOURCE_BG), DEFVAL(1.0), DEFVAL(0.0), DEFVAL(RS::ENV_REFLECTION_SOURCE_BG), DEFVAL(Color()));
+ ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap", "bicubic_upscale"), &RenderingServer::environment_set_glow);
+ ClassDB::bind_method(D_METHOD("environment_set_tonemap", "env", "tone_mapper", "exposure", "white", "auto_exposure", "min_luminance", "max_luminance", "auto_exp_speed", "auto_exp_grey"), &RenderingServer::environment_set_tonemap);
+ ClassDB::bind_method(D_METHOD("environment_set_adjustment", "env", "enable", "brightness", "contrast", "saturation", "ramp"), &RenderingServer::environment_set_adjustment);
+ ClassDB::bind_method(D_METHOD("environment_set_ssr", "env", "enable", "max_steps", "fade_in", "fade_out", "depth_tolerance", "roughness"), &RenderingServer::environment_set_ssr);
+ ClassDB::bind_method(D_METHOD("environment_set_ssao", "env", "enable", "radius", "intensity", "bias", "light_affect", "ao_channel_affect", "blur", "bilateral_sharpness"), &RenderingServer::environment_set_ssao);
+ ClassDB::bind_method(D_METHOD("environment_set_fog", "env", "enable", "color", "sun_color", "sun_amount"), &RenderingServer::environment_set_fog);
+
+ ClassDB::bind_method(D_METHOD("environment_set_fog_depth", "env", "enable", "depth_begin", "depth_end", "depth_curve", "transmit", "transmit_curve"), &RenderingServer::environment_set_fog_depth);
+
+ ClassDB::bind_method(D_METHOD("environment_set_fog_height", "env", "enable", "min_height", "max_height", "height_curve"), &RenderingServer::environment_set_fog_height);
+
+ ClassDB::bind_method(D_METHOD("scenario_create"), &RenderingServer::scenario_create);
+ ClassDB::bind_method(D_METHOD("scenario_set_debug", "scenario", "debug_mode"), &RenderingServer::scenario_set_debug);
+ ClassDB::bind_method(D_METHOD("scenario_set_environment", "scenario", "environment"), &RenderingServer::scenario_set_environment);
+ ClassDB::bind_method(D_METHOD("scenario_set_fallback_environment", "scenario", "environment"), &RenderingServer::scenario_set_fallback_environment);
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("instance_create2", "base", "scenario"), &VisualServer::instance_create2);
- ClassDB::bind_method(D_METHOD("instance_create"), &VisualServer::instance_create);
- ClassDB::bind_method(D_METHOD("instance_set_base", "instance", "base"), &VisualServer::instance_set_base);
- ClassDB::bind_method(D_METHOD("instance_set_scenario", "instance", "scenario"), &VisualServer::instance_set_scenario);
- ClassDB::bind_method(D_METHOD("instance_set_layer_mask", "instance", "mask"), &VisualServer::instance_set_layer_mask);
- ClassDB::bind_method(D_METHOD("instance_set_transform", "instance", "transform"), &VisualServer::instance_set_transform);
- ClassDB::bind_method(D_METHOD("instance_attach_object_instance_id", "instance", "id"), &VisualServer::instance_attach_object_instance_id);
- ClassDB::bind_method(D_METHOD("instance_set_blend_shape_weight", "instance", "shape", "weight"), &VisualServer::instance_set_blend_shape_weight);
- ClassDB::bind_method(D_METHOD("instance_set_surface_material", "instance", "surface", "material"), &VisualServer::instance_set_surface_material);
- ClassDB::bind_method(D_METHOD("instance_set_visible", "instance", "visible"), &VisualServer::instance_set_visible);
- ClassDB::bind_method(D_METHOD("instance_set_use_lightmap", "instance", "lightmap_instance", "lightmap"), &VisualServer::instance_set_use_lightmap);
- ClassDB::bind_method(D_METHOD("instance_set_custom_aabb", "instance", "aabb"), &VisualServer::instance_set_custom_aabb);
- ClassDB::bind_method(D_METHOD("instance_attach_skeleton", "instance", "skeleton"), &VisualServer::instance_attach_skeleton);
- ClassDB::bind_method(D_METHOD("instance_set_exterior", "instance", "enabled"), &VisualServer::instance_set_exterior);
- ClassDB::bind_method(D_METHOD("instance_set_extra_visibility_margin", "instance", "margin"), &VisualServer::instance_set_extra_visibility_margin);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_flag", "instance", "flag", "enabled"), &VisualServer::instance_geometry_set_flag);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_cast_shadows_setting", "instance", "shadow_casting_setting"), &VisualServer::instance_geometry_set_cast_shadows_setting);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_material_override", "instance", "material"), &VisualServer::instance_geometry_set_material_override);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_draw_range", "instance", "min", "max", "min_margin", "max_margin"), &VisualServer::instance_geometry_set_draw_range);
- ClassDB::bind_method(D_METHOD("instance_geometry_set_as_instance_lod", "instance", "as_lod_of_instance"), &VisualServer::instance_geometry_set_as_instance_lod);
-
- ClassDB::bind_method(D_METHOD("instances_cull_aabb", "aabb", "scenario"), &VisualServer::_instances_cull_aabb_bind, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("instances_cull_ray", "from", "to", "scenario"), &VisualServer::_instances_cull_ray_bind, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("instances_cull_convex", "convex", "scenario"), &VisualServer::_instances_cull_convex_bind, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("instance_create2", "base", "scenario"), &RenderingServer::instance_create2);
+ ClassDB::bind_method(D_METHOD("instance_create"), &RenderingServer::instance_create);
+ ClassDB::bind_method(D_METHOD("instance_set_base", "instance", "base"), &RenderingServer::instance_set_base);
+ ClassDB::bind_method(D_METHOD("instance_set_scenario", "instance", "scenario"), &RenderingServer::instance_set_scenario);
+ ClassDB::bind_method(D_METHOD("instance_set_layer_mask", "instance", "mask"), &RenderingServer::instance_set_layer_mask);
+ ClassDB::bind_method(D_METHOD("instance_set_transform", "instance", "transform"), &RenderingServer::instance_set_transform);
+ ClassDB::bind_method(D_METHOD("instance_attach_object_instance_id", "instance", "id"), &RenderingServer::instance_attach_object_instance_id);
+ ClassDB::bind_method(D_METHOD("instance_set_blend_shape_weight", "instance", "shape", "weight"), &RenderingServer::instance_set_blend_shape_weight);
+ ClassDB::bind_method(D_METHOD("instance_set_surface_material", "instance", "surface", "material"), &RenderingServer::instance_set_surface_material);
+ ClassDB::bind_method(D_METHOD("instance_set_visible", "instance", "visible"), &RenderingServer::instance_set_visible);
+ ClassDB::bind_method(D_METHOD("instance_set_use_lightmap", "instance", "lightmap_instance", "lightmap"), &RenderingServer::instance_set_use_lightmap);
+ ClassDB::bind_method(D_METHOD("instance_set_custom_aabb", "instance", "aabb"), &RenderingServer::instance_set_custom_aabb);
+ ClassDB::bind_method(D_METHOD("instance_attach_skeleton", "instance", "skeleton"), &RenderingServer::instance_attach_skeleton);
+ ClassDB::bind_method(D_METHOD("instance_set_exterior", "instance", "enabled"), &RenderingServer::instance_set_exterior);
+ ClassDB::bind_method(D_METHOD("instance_set_extra_visibility_margin", "instance", "margin"), &RenderingServer::instance_set_extra_visibility_margin);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_flag", "instance", "flag", "enabled"), &RenderingServer::instance_geometry_set_flag);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_cast_shadows_setting", "instance", "shadow_casting_setting"), &RenderingServer::instance_geometry_set_cast_shadows_setting);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_material_override", "instance", "material"), &RenderingServer::instance_geometry_set_material_override);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_draw_range", "instance", "min", "max", "min_margin", "max_margin"), &RenderingServer::instance_geometry_set_draw_range);
+ ClassDB::bind_method(D_METHOD("instance_geometry_set_as_instance_lod", "instance", "as_lod_of_instance"), &RenderingServer::instance_geometry_set_as_instance_lod);
+
+ ClassDB::bind_method(D_METHOD("instances_cull_aabb", "aabb", "scenario"), &RenderingServer::_instances_cull_aabb_bind, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("instances_cull_ray", "from", "to", "scenario"), &RenderingServer::_instances_cull_ray_bind, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("instances_cull_convex", "convex", "scenario"), &RenderingServer::_instances_cull_convex_bind, DEFVAL(RID()));
#endif
- ClassDB::bind_method(D_METHOD("canvas_create"), &VisualServer::canvas_create);
- ClassDB::bind_method(D_METHOD("canvas_set_item_mirroring", "canvas", "item", "mirroring"), &VisualServer::canvas_set_item_mirroring);
- ClassDB::bind_method(D_METHOD("canvas_set_modulate", "canvas", "color"), &VisualServer::canvas_set_modulate);
+ ClassDB::bind_method(D_METHOD("canvas_create"), &RenderingServer::canvas_create);
+ ClassDB::bind_method(D_METHOD("canvas_set_item_mirroring", "canvas", "item", "mirroring"), &RenderingServer::canvas_set_item_mirroring);
+ ClassDB::bind_method(D_METHOD("canvas_set_modulate", "canvas", "color"), &RenderingServer::canvas_set_modulate);
#ifndef _MSC_VER
#warning TODO method bindings need to be fixed
#endif
#if 0
- ClassDB::bind_method(D_METHOD("canvas_item_create"), &VisualServer::canvas_item_create);
- ClassDB::bind_method(D_METHOD("canvas_item_set_parent", "item", "parent"), &VisualServer::canvas_item_set_parent);
- ClassDB::bind_method(D_METHOD("canvas_item_set_visible", "item", "visible"), &VisualServer::canvas_item_set_visible);
- ClassDB::bind_method(D_METHOD("canvas_item_set_light_mask", "item", "mask"), &VisualServer::canvas_item_set_light_mask);
- ClassDB::bind_method(D_METHOD("canvas_item_set_transform", "item", "transform"), &VisualServer::canvas_item_set_transform);
- ClassDB::bind_method(D_METHOD("canvas_item_set_clip", "item", "clip"), &VisualServer::canvas_item_set_clip);
- ClassDB::bind_method(D_METHOD("canvas_item_set_distance_field_mode", "item", "enabled"), &VisualServer::canvas_item_set_distance_field_mode);
- ClassDB::bind_method(D_METHOD("canvas_item_set_custom_rect", "item", "use_custom_rect", "rect"), &VisualServer::canvas_item_set_custom_rect, DEFVAL(Rect2()));
- ClassDB::bind_method(D_METHOD("canvas_item_set_modulate", "item", "color"), &VisualServer::canvas_item_set_modulate);
- ClassDB::bind_method(D_METHOD("canvas_item_set_self_modulate", "item", "color"), &VisualServer::canvas_item_set_self_modulate);
- ClassDB::bind_method(D_METHOD("canvas_item_set_draw_behind_parent", "item", "enabled"), &VisualServer::canvas_item_set_draw_behind_parent);
- ClassDB::bind_method(D_METHOD("canvas_item_add_line", "item", "from", "to", "color", "width", "antialiased"), &VisualServer::canvas_item_add_line, DEFVAL(1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_polyline", "item", "points", "colors", "width", "antialiased"), &VisualServer::canvas_item_add_polyline, DEFVAL(1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_rect", "item", "rect", "color"), &VisualServer::canvas_item_add_rect);
- ClassDB::bind_method(D_METHOD("canvas_item_add_circle", "item", "pos", "radius", "color"), &VisualServer::canvas_item_add_circle);
- ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect", "item", "rect", "texture", "tile", "modulate", "transpose", "normal_map"), &VisualServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect_region", "item", "rect", "texture", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &VisualServer::canvas_item_add_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(RID()), DEFVAL(true));
- ClassDB::bind_method(D_METHOD("canvas_item_add_nine_patch", "item", "rect", "source", "texture", "topleft", "bottomright", "x_axis_mode", "y_axis_mode", "draw_center", "modulate", "normal_map"), &VisualServer::canvas_item_add_nine_patch, DEFVAL(NINE_PATCH_STRETCH), DEFVAL(NINE_PATCH_STRETCH), DEFVAL(true), DEFVAL(Color(1, 1, 1)), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_primitive", "item", "points", "colors", "uvs", "texture", "width", "normal_map"), &VisualServer::canvas_item_add_primitive, DEFVAL(1.0), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_polygon", "item", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &VisualServer::canvas_item_add_polygon, DEFVAL(Vector<Point2>()), DEFVAL(RID()), DEFVAL(RID()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_triangle_array", "item", "indices", "points", "colors", "uvs", "bones", "weights", "texture", "count", "normal_map", "antialiased"), &VisualServer::canvas_item_add_triangle_array, DEFVAL(Vector<Point2>()), DEFVAL(Vector<int>()), DEFVAL(Vector<float>()), DEFVAL(RID()), DEFVAL(-1), DEFVAL(RID()), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("canvas_item_add_mesh", "item", "mesh", "transform", "modulate", "texture", "normal_map"), &VisualServer::canvas_item_add_mesh, DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1)), DEFVAL(RID()), DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_multimesh", "item", "mesh", "texture", "normal_map"), &VisualServer::canvas_item_add_multimesh, DEFVAL(RID()));
- ClassDB::bind_method(D_METHOD("canvas_item_add_particles", "item", "particles", "texture", "normal_map"), &VisualServer::canvas_item_add_particles);
- ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform", "item", "transform"), &VisualServer::canvas_item_add_set_transform);
- ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore", "item", "ignore"), &VisualServer::canvas_item_add_clip_ignore);
- ClassDB::bind_method(D_METHOD("canvas_item_set_sort_children_by_y", "item", "enabled"), &VisualServer::canvas_item_set_sort_children_by_y);
+ ClassDB::bind_method(D_METHOD("canvas_item_create"), &RenderingServer::canvas_item_create);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_parent", "item", "parent"), &RenderingServer::canvas_item_set_parent);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_visible", "item", "visible"), &RenderingServer::canvas_item_set_visible);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_light_mask", "item", "mask"), &RenderingServer::canvas_item_set_light_mask);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_transform", "item", "transform"), &RenderingServer::canvas_item_set_transform);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_clip", "item", "clip"), &RenderingServer::canvas_item_set_clip);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_distance_field_mode", "item", "enabled"), &RenderingServer::canvas_item_set_distance_field_mode);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_custom_rect", "item", "use_custom_rect", "rect"), &RenderingServer::canvas_item_set_custom_rect, DEFVAL(Rect2()));
+ ClassDB::bind_method(D_METHOD("canvas_item_set_modulate", "item", "color"), &RenderingServer::canvas_item_set_modulate);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_self_modulate", "item", "color"), &RenderingServer::canvas_item_set_self_modulate);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_draw_behind_parent", "item", "enabled"), &RenderingServer::canvas_item_set_draw_behind_parent);
+ ClassDB::bind_method(D_METHOD("canvas_item_add_line", "item", "from", "to", "color", "width", "antialiased"), &RenderingServer::canvas_item_add_line, DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_polyline", "item", "points", "colors", "width", "antialiased"), &RenderingServer::canvas_item_add_polyline, DEFVAL(1.0), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_rect", "item", "rect", "color"), &RenderingServer::canvas_item_add_rect);
+ ClassDB::bind_method(D_METHOD("canvas_item_add_circle", "item", "pos", "radius", "color"), &RenderingServer::canvas_item_add_circle);
+ ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect", "item", "rect", "texture", "tile", "modulate", "transpose", "normal_map"), &RenderingServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect_region", "item", "rect", "texture", "src_rect", "modulate", "transpose", "normal_map", "clip_uv"), &RenderingServer::canvas_item_add_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(RID()), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_nine_patch", "item", "rect", "source", "texture", "topleft", "bottomright", "x_axis_mode", "y_axis_mode", "draw_center", "modulate", "normal_map"), &RenderingServer::canvas_item_add_nine_patch, DEFVAL(NINE_PATCH_STRETCH), DEFVAL(NINE_PATCH_STRETCH), DEFVAL(true), DEFVAL(Color(1, 1, 1)), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_primitive", "item", "points", "colors", "uvs", "texture", "width", "normal_map"), &RenderingServer::canvas_item_add_primitive, DEFVAL(1.0), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_polygon", "item", "points", "colors", "uvs", "texture", "normal_map", "antialiased"), &RenderingServer::canvas_item_add_polygon, DEFVAL(Vector<Point2>()), DEFVAL(RID()), DEFVAL(RID()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_triangle_array", "item", "indices", "points", "colors", "uvs", "bones", "weights", "texture", "count", "normal_map", "antialiased"), &RenderingServer::canvas_item_add_triangle_array, DEFVAL(Vector<Point2>()), DEFVAL(Vector<int>()), DEFVAL(Vector<float>()), DEFVAL(RID()), DEFVAL(-1), DEFVAL(RID()), DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_mesh", "item", "mesh", "transform", "modulate", "texture", "normal_map"), &RenderingServer::canvas_item_add_mesh, DEFVAL(Transform2D()), DEFVAL(Color(1, 1, 1)), DEFVAL(RID()), DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_multimesh", "item", "mesh", "texture", "normal_map"), &RenderingServer::canvas_item_add_multimesh, DEFVAL(RID()));
+ ClassDB::bind_method(D_METHOD("canvas_item_add_particles", "item", "particles", "texture", "normal_map"), &RenderingServer::canvas_item_add_particles);
+ ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform", "item", "transform"), &RenderingServer::canvas_item_add_set_transform);
+ ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore", "item", "ignore"), &RenderingServer::canvas_item_add_clip_ignore);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_sort_children_by_y", "item", "enabled"), &RenderingServer::canvas_item_set_sort_children_by_y);
#endif
- ClassDB::bind_method(D_METHOD("canvas_item_set_z_index", "item", "z_index"), &VisualServer::canvas_item_set_z_index);
- ClassDB::bind_method(D_METHOD("canvas_item_set_z_as_relative_to_parent", "item", "enabled"), &VisualServer::canvas_item_set_z_as_relative_to_parent);
- ClassDB::bind_method(D_METHOD("canvas_item_set_copy_to_backbuffer", "item", "enabled", "rect"), &VisualServer::canvas_item_set_copy_to_backbuffer);
- ClassDB::bind_method(D_METHOD("canvas_item_clear", "item"), &VisualServer::canvas_item_clear);
- ClassDB::bind_method(D_METHOD("canvas_item_set_draw_index", "item", "index"), &VisualServer::canvas_item_set_draw_index);
- ClassDB::bind_method(D_METHOD("canvas_item_set_material", "item", "material"), &VisualServer::canvas_item_set_material);
- ClassDB::bind_method(D_METHOD("canvas_item_set_use_parent_material", "item", "enabled"), &VisualServer::canvas_item_set_use_parent_material);
- ClassDB::bind_method(D_METHOD("canvas_light_create"), &VisualServer::canvas_light_create);
- ClassDB::bind_method(D_METHOD("canvas_light_attach_to_canvas", "light", "canvas"), &VisualServer::canvas_light_attach_to_canvas);
- ClassDB::bind_method(D_METHOD("canvas_light_set_enabled", "light", "enabled"), &VisualServer::canvas_light_set_enabled);
- ClassDB::bind_method(D_METHOD("canvas_light_set_scale", "light", "scale"), &VisualServer::canvas_light_set_scale);
- ClassDB::bind_method(D_METHOD("canvas_light_set_transform", "light", "transform"), &VisualServer::canvas_light_set_transform);
- ClassDB::bind_method(D_METHOD("canvas_light_set_texture", "light", "texture"), &VisualServer::canvas_light_set_texture);
- ClassDB::bind_method(D_METHOD("canvas_light_set_texture_offset", "light", "offset"), &VisualServer::canvas_light_set_texture_offset);
- ClassDB::bind_method(D_METHOD("canvas_light_set_color", "light", "color"), &VisualServer::canvas_light_set_color);
- ClassDB::bind_method(D_METHOD("canvas_light_set_height", "light", "height"), &VisualServer::canvas_light_set_height);
- ClassDB::bind_method(D_METHOD("canvas_light_set_energy", "light", "energy"), &VisualServer::canvas_light_set_energy);
- ClassDB::bind_method(D_METHOD("canvas_light_set_z_range", "light", "min_z", "max_z"), &VisualServer::canvas_light_set_z_range);
- ClassDB::bind_method(D_METHOD("canvas_light_set_layer_range", "light", "min_layer", "max_layer"), &VisualServer::canvas_light_set_layer_range);
- ClassDB::bind_method(D_METHOD("canvas_light_set_item_cull_mask", "light", "mask"), &VisualServer::canvas_light_set_item_cull_mask);
- ClassDB::bind_method(D_METHOD("canvas_light_set_item_shadow_cull_mask", "light", "mask"), &VisualServer::canvas_light_set_item_shadow_cull_mask);
- ClassDB::bind_method(D_METHOD("canvas_light_set_mode", "light", "mode"), &VisualServer::canvas_light_set_mode);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_enabled", "light", "enabled"), &VisualServer::canvas_light_set_shadow_enabled);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_buffer_size", "light", "size"), &VisualServer::canvas_light_set_shadow_buffer_size);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_filter", "light", "filter"), &VisualServer::canvas_light_set_shadow_filter);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_color", "light", "color"), &VisualServer::canvas_light_set_shadow_color);
- ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_smooth", "light", "smooth"), &VisualServer::canvas_light_set_shadow_smooth);
-
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_create"), &VisualServer::canvas_light_occluder_create);
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_attach_to_canvas", "occluder", "canvas"), &VisualServer::canvas_light_occluder_attach_to_canvas);
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_enabled", "occluder", "enabled"), &VisualServer::canvas_light_occluder_set_enabled);
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_polygon", "occluder", "polygon"), &VisualServer::canvas_light_occluder_set_polygon);
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_transform", "occluder", "transform"), &VisualServer::canvas_light_occluder_set_transform);
- ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_light_mask", "occluder", "mask"), &VisualServer::canvas_light_occluder_set_light_mask);
-
- ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_create"), &VisualServer::canvas_occluder_polygon_create);
- ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_shape", "occluder_polygon", "shape", "closed"), &VisualServer::canvas_occluder_polygon_set_shape);
- ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_shape_as_lines", "occluder_polygon", "shape"), &VisualServer::canvas_occluder_polygon_set_shape_as_lines);
- ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_cull_mode", "occluder_polygon", "mode"), &VisualServer::canvas_occluder_polygon_set_cull_mode);
-
- ClassDB::bind_method(D_METHOD("black_bars_set_margins", "left", "top", "right", "bottom"), &VisualServer::black_bars_set_margins);
- ClassDB::bind_method(D_METHOD("black_bars_set_images", "left", "top", "right", "bottom"), &VisualServer::black_bars_set_images);
-
- ClassDB::bind_method(D_METHOD("free_rid", "rid"), &VisualServer::free); // shouldn't conflict with Object::free()
-
- ClassDB::bind_method(D_METHOD("request_frame_drawn_callback", "where", "method", "userdata"), &VisualServer::request_frame_drawn_callback);
- ClassDB::bind_method(D_METHOD("has_changed"), &VisualServer::has_changed);
- ClassDB::bind_method(D_METHOD("init"), &VisualServer::init);
- ClassDB::bind_method(D_METHOD("finish"), &VisualServer::finish);
- ClassDB::bind_method(D_METHOD("get_render_info", "info"), &VisualServer::get_render_info);
- ClassDB::bind_method(D_METHOD("get_video_adapter_name"), &VisualServer::get_video_adapter_name);
- ClassDB::bind_method(D_METHOD("get_video_adapter_vendor"), &VisualServer::get_video_adapter_vendor);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_z_index", "item", "z_index"), &RenderingServer::canvas_item_set_z_index);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_z_as_relative_to_parent", "item", "enabled"), &RenderingServer::canvas_item_set_z_as_relative_to_parent);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_copy_to_backbuffer", "item", "enabled", "rect"), &RenderingServer::canvas_item_set_copy_to_backbuffer);
+ ClassDB::bind_method(D_METHOD("canvas_item_clear", "item"), &RenderingServer::canvas_item_clear);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_draw_index", "item", "index"), &RenderingServer::canvas_item_set_draw_index);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_material", "item", "material"), &RenderingServer::canvas_item_set_material);
+ ClassDB::bind_method(D_METHOD("canvas_item_set_use_parent_material", "item", "enabled"), &RenderingServer::canvas_item_set_use_parent_material);
+ ClassDB::bind_method(D_METHOD("canvas_light_create"), &RenderingServer::canvas_light_create);
+ ClassDB::bind_method(D_METHOD("canvas_light_attach_to_canvas", "light", "canvas"), &RenderingServer::canvas_light_attach_to_canvas);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_enabled", "light", "enabled"), &RenderingServer::canvas_light_set_enabled);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_scale", "light", "scale"), &RenderingServer::canvas_light_set_scale);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_transform", "light", "transform"), &RenderingServer::canvas_light_set_transform);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_texture", "light", "texture"), &RenderingServer::canvas_light_set_texture);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_texture_offset", "light", "offset"), &RenderingServer::canvas_light_set_texture_offset);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_color", "light", "color"), &RenderingServer::canvas_light_set_color);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_height", "light", "height"), &RenderingServer::canvas_light_set_height);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_energy", "light", "energy"), &RenderingServer::canvas_light_set_energy);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_z_range", "light", "min_z", "max_z"), &RenderingServer::canvas_light_set_z_range);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_layer_range", "light", "min_layer", "max_layer"), &RenderingServer::canvas_light_set_layer_range);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_item_cull_mask", "light", "mask"), &RenderingServer::canvas_light_set_item_cull_mask);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_item_shadow_cull_mask", "light", "mask"), &RenderingServer::canvas_light_set_item_shadow_cull_mask);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_mode", "light", "mode"), &RenderingServer::canvas_light_set_mode);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_enabled", "light", "enabled"), &RenderingServer::canvas_light_set_shadow_enabled);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_buffer_size", "light", "size"), &RenderingServer::canvas_light_set_shadow_buffer_size);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_filter", "light", "filter"), &RenderingServer::canvas_light_set_shadow_filter);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_color", "light", "color"), &RenderingServer::canvas_light_set_shadow_color);
+ ClassDB::bind_method(D_METHOD("canvas_light_set_shadow_smooth", "light", "smooth"), &RenderingServer::canvas_light_set_shadow_smooth);
+
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_create"), &RenderingServer::canvas_light_occluder_create);
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_attach_to_canvas", "occluder", "canvas"), &RenderingServer::canvas_light_occluder_attach_to_canvas);
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_enabled", "occluder", "enabled"), &RenderingServer::canvas_light_occluder_set_enabled);
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_polygon", "occluder", "polygon"), &RenderingServer::canvas_light_occluder_set_polygon);
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_transform", "occluder", "transform"), &RenderingServer::canvas_light_occluder_set_transform);
+ ClassDB::bind_method(D_METHOD("canvas_light_occluder_set_light_mask", "occluder", "mask"), &RenderingServer::canvas_light_occluder_set_light_mask);
+
+ ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_create"), &RenderingServer::canvas_occluder_polygon_create);
+ ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_shape", "occluder_polygon", "shape", "closed"), &RenderingServer::canvas_occluder_polygon_set_shape);
+ ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_shape_as_lines", "occluder_polygon", "shape"), &RenderingServer::canvas_occluder_polygon_set_shape_as_lines);
+ ClassDB::bind_method(D_METHOD("canvas_occluder_polygon_set_cull_mode", "occluder_polygon", "mode"), &RenderingServer::canvas_occluder_polygon_set_cull_mode);
+
+ ClassDB::bind_method(D_METHOD("black_bars_set_margins", "left", "top", "right", "bottom"), &RenderingServer::black_bars_set_margins);
+ ClassDB::bind_method(D_METHOD("black_bars_set_images", "left", "top", "right", "bottom"), &RenderingServer::black_bars_set_images);
+
+ ClassDB::bind_method(D_METHOD("free_rid", "rid"), &RenderingServer::free); // shouldn't conflict with Object::free()
+
+ ClassDB::bind_method(D_METHOD("request_frame_drawn_callback", "where", "method", "userdata"), &RenderingServer::request_frame_drawn_callback);
+ ClassDB::bind_method(D_METHOD("has_changed"), &RenderingServer::has_changed);
+ ClassDB::bind_method(D_METHOD("init"), &RenderingServer::init);
+ ClassDB::bind_method(D_METHOD("finish"), &RenderingServer::finish);
+ ClassDB::bind_method(D_METHOD("get_render_info", "info"), &RenderingServer::get_render_info);
+ ClassDB::bind_method(D_METHOD("get_video_adapter_name"), &RenderingServer::get_video_adapter_name);
+ ClassDB::bind_method(D_METHOD("get_video_adapter_vendor"), &RenderingServer::get_video_adapter_vendor);
#ifndef _3D_DISABLED
- ClassDB::bind_method(D_METHOD("make_sphere_mesh", "latitudes", "longitudes", "radius"), &VisualServer::make_sphere_mesh);
- ClassDB::bind_method(D_METHOD("get_test_cube"), &VisualServer::get_test_cube);
+ ClassDB::bind_method(D_METHOD("make_sphere_mesh", "latitudes", "longitudes", "radius"), &RenderingServer::make_sphere_mesh);
+ ClassDB::bind_method(D_METHOD("get_test_cube"), &RenderingServer::get_test_cube);
#endif
- ClassDB::bind_method(D_METHOD("get_test_texture"), &VisualServer::get_test_texture);
- ClassDB::bind_method(D_METHOD("get_white_texture"), &VisualServer::get_white_texture);
+ ClassDB::bind_method(D_METHOD("get_test_texture"), &RenderingServer::get_test_texture);
+ ClassDB::bind_method(D_METHOD("get_white_texture"), &RenderingServer::get_white_texture);
- ClassDB::bind_method(D_METHOD("set_boot_image", "image", "color", "scale", "use_filter"), &VisualServer::set_boot_image, DEFVAL(true));
- ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &VisualServer::set_default_clear_color);
+ ClassDB::bind_method(D_METHOD("set_boot_image", "image", "color", "scale", "use_filter"), &RenderingServer::set_boot_image, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &RenderingServer::set_default_clear_color);
- ClassDB::bind_method(D_METHOD("has_feature", "feature"), &VisualServer::has_feature);
- ClassDB::bind_method(D_METHOD("has_os_feature", "feature"), &VisualServer::has_os_feature);
- ClassDB::bind_method(D_METHOD("set_debug_generate_wireframes", "generate"), &VisualServer::set_debug_generate_wireframes);
+ ClassDB::bind_method(D_METHOD("has_feature", "feature"), &RenderingServer::has_feature);
+ ClassDB::bind_method(D_METHOD("has_os_feature", "feature"), &RenderingServer::has_os_feature);
+ ClassDB::bind_method(D_METHOD("set_debug_generate_wireframes", "generate"), &RenderingServer::set_debug_generate_wireframes);
BIND_CONSTANT(NO_INDEX_ARRAY);
BIND_CONSTANT(ARRAY_WEIGHTS_SIZE);
@@ -2227,18 +2227,18 @@ void VisualServer::_bind_methods() {
ADD_SIGNAL(MethodInfo("frame_post_draw"));
}
-void VisualServer::_canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate) {
+void RenderingServer::_canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate) {
ERR_FAIL_COND(p_margins.size() != 4);
//canvas_item_add_style_box(p_item,p_rect,p_source,p_texture,Vector2(p_margins[0],p_margins[1]),Vector2(p_margins[2],p_margins[3]),true,p_modulate);
}
-void VisualServer::_camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) {
+void RenderingServer::_camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) {
camera_set_orthogonal(p_camera, p_size, p_z_near, p_z_far);
}
-void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) {
+void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data) {
Vector<Vector3> vertices;
Vector<Vector3> normals;
@@ -2260,23 +2260,23 @@ void VisualServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::M
}
Array d;
- d.resize(VS::ARRAY_MAX);
+ d.resize(RS::ARRAY_MAX);
d[ARRAY_VERTEX] = vertices;
d[ARRAY_NORMAL] = normals;
mesh_add_surface_from_arrays(p_mesh, PRIMITIVE_TRIANGLES, d);
}
-void VisualServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) {
+void RenderingServer::mesh_add_surface_from_planes(RID p_mesh, const Vector<Plane> &p_planes) {
Geometry::MeshData mdata = Geometry::build_convex_mesh(p_planes);
mesh_add_surface_from_mesh_data(p_mesh, mdata);
}
-void VisualServer::immediate_vertex_2d(RID p_immediate, const Vector2 &p_vertex) {
+void RenderingServer::immediate_vertex_2d(RID p_immediate, const Vector2 &p_vertex) {
immediate_vertex(p_immediate, Vector3(p_vertex.x, p_vertex.y, 0));
}
-RID VisualServer::instance_create2(RID p_base, RID p_scenario) {
+RID RenderingServer::instance_create2(RID p_base, RID p_scenario) {
RID instance = instance_create();
instance_set_base(instance, p_base);
@@ -2284,7 +2284,7 @@ RID VisualServer::instance_create2(RID p_base, RID p_scenario) {
return instance;
}
-VisualServer::VisualServer() {
+RenderingServer::RenderingServer() {
//ERR_FAIL_COND(singleton);
singleton = this;
@@ -2357,7 +2357,7 @@ VisualServer::VisualServer() {
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/screen_space_roughness_limiter_curve", PropertyInfo(Variant::FLOAT, "rendering/quality/filters/screen_space_roughness_limiter_curve", PROPERTY_HINT_EXP_EASING, "0.01,8,0.01"));
}
-VisualServer::~VisualServer() {
+RenderingServer::~RenderingServer() {
singleton = NULL;
}
diff --git a/servers/visual_server.h b/servers/rendering_server.h
index 506800cc7d..92820aca21 100644
--- a/servers/visual_server.h
+++ b/servers/rendering_server.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* visual_server.h */
+/* rendering_server.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VISUAL_SERVER_H
-#define VISUAL_SERVER_H
+#ifndef RENDERING_SERVER_H
+#define RENDERING_SERVER_H
#include "core/image.h"
#include "core/math/geometry.h"
@@ -39,11 +39,11 @@
#include "core/variant.h"
#include "servers/display_server.h"
-class VisualServer : public Object {
+class RenderingServer : public Object {
- GDCLASS(VisualServer, Object);
+ GDCLASS(RenderingServer, Object);
- static VisualServer *singleton;
+ static RenderingServer *singleton;
int mm_policy;
@@ -60,12 +60,12 @@ protected:
Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, Vector<uint8_t> &r_vertex_array, int p_vertex_array_len, Vector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb);
- static VisualServer *(*create_func)();
+ static RenderingServer *(*create_func)();
static void _bind_methods();
public:
- static VisualServer *get_singleton();
- static VisualServer *create();
+ static RenderingServer *get_singleton();
+ static RenderingServer *create();
enum {
NO_INDEX_ARRAY = -1,
@@ -1103,55 +1103,55 @@ public:
virtual bool is_low_end() const = 0;
- VisualServer();
- virtual ~VisualServer();
+ RenderingServer();
+ virtual ~RenderingServer();
};
// make variant understand the enums
-VARIANT_ENUM_CAST(VisualServer::TextureLayeredType);
-VARIANT_ENUM_CAST(VisualServer::CubeMapLayer);
-VARIANT_ENUM_CAST(VisualServer::ShaderMode);
-VARIANT_ENUM_CAST(VisualServer::ArrayType);
-VARIANT_ENUM_CAST(VisualServer::ArrayFormat);
-VARIANT_ENUM_CAST(VisualServer::PrimitiveType);
-VARIANT_ENUM_CAST(VisualServer::BlendShapeMode);
-VARIANT_ENUM_CAST(VisualServer::MultimeshTransformFormat);
-VARIANT_ENUM_CAST(VisualServer::LightType);
-VARIANT_ENUM_CAST(VisualServer::LightParam);
-VARIANT_ENUM_CAST(VisualServer::LightOmniShadowMode);
-VARIANT_ENUM_CAST(VisualServer::LightDirectionalShadowMode);
-VARIANT_ENUM_CAST(VisualServer::LightDirectionalShadowDepthRangeMode);
-VARIANT_ENUM_CAST(VisualServer::ReflectionProbeUpdateMode);
-VARIANT_ENUM_CAST(VisualServer::ParticlesDrawOrder);
-VARIANT_ENUM_CAST(VisualServer::ViewportUpdateMode);
-VARIANT_ENUM_CAST(VisualServer::ViewportClearMode);
-VARIANT_ENUM_CAST(VisualServer::ViewportMSAA);
-VARIANT_ENUM_CAST(VisualServer::ViewportRenderInfo);
-VARIANT_ENUM_CAST(VisualServer::ViewportDebugDraw);
-VARIANT_ENUM_CAST(VisualServer::SkyMode);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentBG);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentAmbientSource);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentReflectionSource);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentGlowBlendMode);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentToneMapper);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentSSAOQuality);
-VARIANT_ENUM_CAST(VisualServer::EnvironmentSSAOBlur);
-VARIANT_ENUM_CAST(VisualServer::DOFBlurQuality);
-VARIANT_ENUM_CAST(VisualServer::DOFBokehShape);
-VARIANT_ENUM_CAST(VisualServer::ScenarioDebugMode);
-VARIANT_ENUM_CAST(VisualServer::InstanceType);
-VARIANT_ENUM_CAST(VisualServer::InstanceFlags);
-VARIANT_ENUM_CAST(VisualServer::ShadowCastingSetting);
-VARIANT_ENUM_CAST(VisualServer::NinePatchAxisMode);
-VARIANT_ENUM_CAST(VisualServer::CanvasItemTextureFilter);
-VARIANT_ENUM_CAST(VisualServer::CanvasItemTextureRepeat);
-VARIANT_ENUM_CAST(VisualServer::CanvasLightMode);
-VARIANT_ENUM_CAST(VisualServer::CanvasLightShadowFilter);
-VARIANT_ENUM_CAST(VisualServer::CanvasOccluderPolygonCullMode);
-VARIANT_ENUM_CAST(VisualServer::RenderInfo);
-VARIANT_ENUM_CAST(VisualServer::Features);
-
-//typedef VisualServer VS; // makes it easier to use
-#define VS VisualServer
+VARIANT_ENUM_CAST(RenderingServer::TextureLayeredType);
+VARIANT_ENUM_CAST(RenderingServer::CubeMapLayer);
+VARIANT_ENUM_CAST(RenderingServer::ShaderMode);
+VARIANT_ENUM_CAST(RenderingServer::ArrayType);
+VARIANT_ENUM_CAST(RenderingServer::ArrayFormat);
+VARIANT_ENUM_CAST(RenderingServer::PrimitiveType);
+VARIANT_ENUM_CAST(RenderingServer::BlendShapeMode);
+VARIANT_ENUM_CAST(RenderingServer::MultimeshTransformFormat);
+VARIANT_ENUM_CAST(RenderingServer::LightType);
+VARIANT_ENUM_CAST(RenderingServer::LightParam);
+VARIANT_ENUM_CAST(RenderingServer::LightOmniShadowMode);
+VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowMode);
+VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowDepthRangeMode);
+VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeUpdateMode);
+VARIANT_ENUM_CAST(RenderingServer::ParticlesDrawOrder);
+VARIANT_ENUM_CAST(RenderingServer::ViewportUpdateMode);
+VARIANT_ENUM_CAST(RenderingServer::ViewportClearMode);
+VARIANT_ENUM_CAST(RenderingServer::ViewportMSAA);
+VARIANT_ENUM_CAST(RenderingServer::ViewportRenderInfo);
+VARIANT_ENUM_CAST(RenderingServer::ViewportDebugDraw);
+VARIANT_ENUM_CAST(RenderingServer::SkyMode);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentBG);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentAmbientSource);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentReflectionSource);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentGlowBlendMode);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentToneMapper);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSAOQuality);
+VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSAOBlur);
+VARIANT_ENUM_CAST(RenderingServer::DOFBlurQuality);
+VARIANT_ENUM_CAST(RenderingServer::DOFBokehShape);
+VARIANT_ENUM_CAST(RenderingServer::ScenarioDebugMode);
+VARIANT_ENUM_CAST(RenderingServer::InstanceType);
+VARIANT_ENUM_CAST(RenderingServer::InstanceFlags);
+VARIANT_ENUM_CAST(RenderingServer::ShadowCastingSetting);
+VARIANT_ENUM_CAST(RenderingServer::NinePatchAxisMode);
+VARIANT_ENUM_CAST(RenderingServer::CanvasItemTextureFilter);
+VARIANT_ENUM_CAST(RenderingServer::CanvasItemTextureRepeat);
+VARIANT_ENUM_CAST(RenderingServer::CanvasLightMode);
+VARIANT_ENUM_CAST(RenderingServer::CanvasLightShadowFilter);
+VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode);
+VARIANT_ENUM_CAST(RenderingServer::RenderInfo);
+VARIANT_ENUM_CAST(RenderingServer::Features);
+
+//typedef RenderingServer VS; // makes it easier to use
+#define RS RenderingServer
#endif
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
deleted file mode 100644
index 041ad799d0..0000000000
--- a/servers/visual/shader_types.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/*************************************************************************/
-/* shader_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "shader_types.h"
-
-const Map<StringName, ShaderLanguage::FunctionInfo> &ShaderTypes::get_functions(VS::ShaderMode p_mode) {
-
- return shader_modes[p_mode].functions;
-}
-
-const Vector<StringName> &ShaderTypes::get_modes(VS::ShaderMode p_mode) {
-
- return shader_modes[p_mode].modes;
-}
-
-const Set<String> &ShaderTypes::get_types() {
- return shader_types;
-}
-
-ShaderTypes *ShaderTypes::singleton = NULL;
-
-static ShaderLanguage::BuiltInInfo constt(ShaderLanguage::DataType p_type) {
-
- return ShaderLanguage::BuiltInInfo(p_type, true);
-}
-
-ShaderTypes::ShaderTypes() {
- singleton = this;
-
- /*************** SPATIAL ***********************/
-
- shader_modes[VS::SHADER_SPATIAL].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
-
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["POSITION"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["UV2"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INSTANCE_ID"] = constt(ShaderLanguage::TYPE_INT);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].can_discard = false;
-
- //builtins
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_MATRIX"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["WORLD_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_NORMAL_MATRIX"] = ShaderLanguage::TYPE_MAT3;
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
-
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["FRONT_FACING"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TANGENT"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["BINORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALBEDO"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["METALLIC"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SPECULAR"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["RIM"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["RIM_TINT"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["CLEARCOAT"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["CLEARCOAT_GLOSS"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ANISOTROPY"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["ANISOTROPY_FLOW"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SSS_STRENGTH"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TRANSMISSION"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO_LIGHT_AFFECT"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["EMISSION"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
-
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
-
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["WORLD_NORMAL_MATRIX"] = constt(ShaderLanguage::TYPE_MAT3);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["fragment"].can_discard = true;
-
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
-
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ATTENUATION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ALBEDO"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["TRANSMISSION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ROUGHNESS"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["DIFFUSE_LIGHT"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["SPECULAR_LIGHT"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
-
- shader_modes[VS::SHADER_SPATIAL].functions["light"].can_discard = true;
-
- //order used puts first enum mode (default) first
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("blend_mix");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("blend_add");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("blend_sub");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("blend_mul");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("depth_draw_opaque");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("depth_draw_always");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("depth_draw_never");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("depth_prepass_alpha");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("depth_test_disabled");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("cull_back");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("cull_front");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("cull_disabled");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("unshaded");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("wireframe");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("diffuse_lambert");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("diffuse_lambert_wrap");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("diffuse_oren_nayar");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("diffuse_burley");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("diffuse_toon");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("specular_schlick_ggx");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("specular_blinn");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("specular_phong");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("specular_toon");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("specular_disabled");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("skip_vertex_transform");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("world_vertex_coords");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("ensure_correct_normals");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("shadows_disabled");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("ambient_light_disabled");
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("shadow_to_opacity");
-
- shader_modes[VS::SHADER_SPATIAL].modes.push_back("vertex_lighting");
-
- /************ CANVAS ITEM **************************/
-
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
-
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["UV"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["POINT_SIZE"] = ShaderLanguage::TYPE_FLOAT;
-
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["WORLD_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["CANVAS_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["SCREEN_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["AT_LIGHT_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"].can_discard = false;
-
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["VERTEX"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SHADOW_VERTEX"] = ShaderLanguage::TYPE_VEC2;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["LIGHT_VERTEX"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMALMAP_DEPTH"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["NORMAL_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SPECULAR_SHININESS_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SPECULAR_SHININESS"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["AT_LIGHT_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true;
-
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SPECULAR_SHININESS"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_VERTEX"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_MODULATE"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TEXTURE_PIXEL_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].can_discard = true;
-
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("skip_vertex_transform");
-
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_mix");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_add");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_sub");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_mul");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_premul_alpha");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("blend_disabled");
-
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("unshaded");
- shader_modes[VS::SHADER_CANVAS_ITEM].modes.push_back("light_only");
-
- /************ PARTICLES **************************/
-
- shader_modes[VS::SHADER_PARTICLES].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["VELOCITY"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["MASS"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["ACTIVE"] = ShaderLanguage::TYPE_BOOL;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["RESTART"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["CUSTOM"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["TRANSFORM"] = ShaderLanguage::TYPE_MAT4;
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["LIFETIME"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["DELTA"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["NUMBER"] = constt(ShaderLanguage::TYPE_UINT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["INDEX"] = constt(ShaderLanguage::TYPE_INT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["EMISSION_TRANSFORM"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["RANDOM_SEED"] = constt(ShaderLanguage::TYPE_UINT);
- shader_modes[VS::SHADER_PARTICLES].functions["vertex"].can_discard = false;
-
- shader_modes[VS::SHADER_PARTICLES].modes.push_back("disable_force");
- shader_modes[VS::SHADER_PARTICLES].modes.push_back("disable_velocity");
- shader_modes[VS::SHADER_PARTICLES].modes.push_back("keep_data");
-
- /************ SKY **************************/
-
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["RADIANCE"] = constt(ShaderLanguage::TYPE_SAMPLERCUBE);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_HALF_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_QUARTER_RES_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["AT_CUBEMAP_PASS"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT0_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT1_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT2_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENABLED"] = constt(ShaderLanguage::TYPE_BOOL);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_DIRECTION"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_ENERGY"] = constt(ShaderLanguage::TYPE_FLOAT);
- shader_modes[VS::SHADER_SKY].functions["global"].built_ins["LIGHT3_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);
-
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["COLOR"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["ALPHA"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["EYEDIR"] = constt(ShaderLanguage::TYPE_VEC3);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["SKY_COORDS"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["HALF_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
- shader_modes[VS::SHADER_SKY].functions["fragment"].built_ins["QUARTER_RES_COLOR"] = constt(ShaderLanguage::TYPE_VEC4);
-
- shader_modes[VS::SHADER_SKY].modes.push_back("use_half_res_pass");
- shader_modes[VS::SHADER_SKY].modes.push_back("use_quarter_res_pass");
-
- shader_types.insert("spatial");
- shader_types.insert("canvas_item");
- shader_types.insert("particles");
- shader_types.insert("sky");
-}