0.2.0-dev Download ZIP
436 lines ·20.0 KB Raw
| 1 | /**************************************************************************/ |
| 2 | /* register_server_types.cpp */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #include "register_server_types.h" |
| 32 | |
| 33 | #include "core/config/engine.h" |
| 34 | #include "core/config/project_settings.h" |
| 35 | #include "core/object/callable_mp.h" |
| 36 | #include "core/object/class_db.h" |
| 37 | #include "core/os/os.h" |
| 38 | #include "servers/audio/audio_effect.h" |
| 39 | #include "servers/audio/audio_frame.h" |
| 40 | #include "servers/audio/audio_server.h" |
| 41 | #include "servers/audio/effects/audio_effect_amplify.h" |
| 42 | #include "servers/audio/effects/audio_effect_capture.h" |
| 43 | #include "servers/audio/effects/audio_effect_chorus.h" |
| 44 | #include "servers/audio/effects/audio_effect_compressor.h" |
| 45 | #include "servers/audio/effects/audio_effect_delay.h" |
| 46 | #include "servers/audio/effects/audio_effect_distortion.h" |
| 47 | #include "servers/audio/effects/audio_effect_eq.h" |
| 48 | #include "servers/audio/effects/audio_effect_filter.h" |
| 49 | #include "servers/audio/effects/audio_effect_hard_limiter.h" |
| 50 | #include "servers/audio/effects/audio_effect_panner.h" |
| 51 | #include "servers/audio/effects/audio_effect_phaser.h" |
| 52 | #include "servers/audio/effects/audio_effect_pitch_shift.h" |
| 53 | #include "servers/audio/effects/audio_effect_record.h" |
| 54 | #include "servers/audio/effects/audio_effect_reverb.h" |
| 55 | #include "servers/audio/effects/audio_effect_spectrum_analyzer.h" |
| 56 | #include "servers/audio/effects/audio_effect_stereo_enhance.h" |
| 57 | #include "servers/camera/camera_feed.h" |
| 58 | #include "servers/camera/camera_server.h" |
| 59 | #include "servers/debugger/servers_debugger.h" |
| 60 | #include "servers/display/accessibility_server.h" |
| 61 | #include "servers/display/display_server.h" |
| 62 | #include "servers/display/native_menu.h" |
| 63 | #include "servers/movie_writer/movie_writer.h" |
| 64 | #include "servers/movie_writer/movie_writer_pngwav.h" |
| 65 | #ifdef RD_ENABLED |
| 66 | #include "servers/rendering/renderer_rd/framebuffer_cache_rd.h" |
| 67 | #include "servers/rendering/renderer_rd/storage_rd/render_data_rd.h" |
| 68 | #include "servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.h" |
| 69 | #include "servers/rendering/renderer_rd/storage_rd/render_scene_data_rd.h" |
| 70 | #include "servers/rendering/renderer_rd/uniform_set_cache_rd.h" |
| 71 | #include "servers/rendering/rendering_device.h" |
| 72 | #include "servers/rendering/rendering_device_binds.h" |
| 73 | #endif // RD_ENABLED |
| 74 | #include "servers/rendering/rendering_server.h" |
| 75 | #include "servers/rendering/shader_include_db.h" |
| 76 | #include "servers/rendering/shader_types.h" |
| 77 | #include "servers/rendering/storage/render_data.h" |
| 78 | #include "servers/rendering/storage/render_data_extension.h" |
| 79 | #include "servers/rendering/storage/render_scene_buffers.h" |
| 80 | #include "servers/rendering/storage/render_scene_data.h" |
| 81 | #include "servers/text/text_server.h" |
| 82 | #include "servers/text/text_server_dummy.h" |
| 83 | #include "servers/text/text_server_extension.h" |
| 84 | |
| 85 | #ifndef DISABLE_DEPRECATED |
| 86 | #include "servers/audio/effects/audio_effect_limiter.h" |
| 87 | #endif |
| 88 | |
| 89 | // 2D physics and navigation. |
| 90 | #ifndef NAVIGATION_2D_DISABLED |
| 91 | #include "servers/navigation_2d/navigation_path_query_parameters_2d.h" |
| 92 | #include "servers/navigation_2d/navigation_path_query_result_2d.h" |
| 93 | #include "servers/navigation_2d/navigation_server_2d.h" |
| 94 | #include "servers/navigation_2d/navigation_server_2d_manager.h" |
| 95 | #endif // NAVIGATION_2D_DISABLED |
| 96 | #ifndef PHYSICS_2D_DISABLED |
| 97 | #include "servers/physics_2d/physics_server_2d.h" |
| 98 | #include "servers/physics_2d/physics_server_2d_dummy.h" |
| 99 | #include "servers/physics_2d/physics_server_2d_extension.h" |
| 100 | #include "servers/physics_2d/physics_server_2d_manager.h" |
| 101 | #endif // PHYSICS_2D_DISABLED |
| 102 | |
| 103 | // 3D physics and navigation. |
| 104 | #ifndef NAVIGATION_3D_DISABLED |
| 105 | #include "servers/navigation_3d/navigation_path_query_parameters_3d.h" |
| 106 | #include "servers/navigation_3d/navigation_path_query_result_3d.h" |
| 107 | #include "servers/navigation_3d/navigation_server_3d.h" |
| 108 | #include "servers/navigation_3d/navigation_server_3d_manager.h" |
| 109 | #endif // NAVIGATION_3D_DISABLED |
| 110 | #ifndef PHYSICS_3D_DISABLED |
| 111 | #include "servers/physics_3d/physics_server_3d.h" |
| 112 | #include "servers/physics_3d/physics_server_3d_dummy.h" |
| 113 | #include "servers/physics_3d/physics_server_3d_extension.h" |
| 114 | #include "servers/physics_3d/physics_server_3d_manager.h" |
| 115 | #endif // PHYSICS_3D_DISABLED |
| 116 | |
| 117 | // XR |
| 118 | #ifndef XR_DISABLED |
| 119 | #include "servers/xr/xr_body_tracker.h" |
| 120 | #include "servers/xr/xr_controller_tracker.h" |
| 121 | #include "servers/xr/xr_face_tracker.h" |
| 122 | #include "servers/xr/xr_hand_tracker.h" |
| 123 | #include "servers/xr/xr_interface.h" |
| 124 | #include "servers/xr/xr_interface_extension.h" |
| 125 | #include "servers/xr/xr_positional_tracker.h" |
| 126 | #include "servers/xr/xr_server.h" |
| 127 | #include "servers/xr/xr_vrs.h" |
| 128 | #endif // XR_DISABLED |
| 129 | |
| 130 | ShaderTypes *shader_types = nullptr; |
| 131 | |
| 132 | #ifndef PHYSICS_2D_DISABLED |
| 133 | static PhysicsServer2D *_create_dummy_physics_server_2d() { |
| 134 | return memnew(PhysicsServer2DDummy); |
| 135 | } |
| 136 | #endif // PHYSICS_2D_DISABLED |
| 137 | |
| 138 | #ifndef PHYSICS_3D_DISABLED |
| 139 | static PhysicsServer3D *_create_dummy_physics_server_3d() { |
| 140 | return memnew(PhysicsServer3DDummy); |
| 141 | } |
| 142 | #endif // PHYSICS_3D_DISABLED |
| 143 | |
| 144 | static bool has_server_feature_callback(const String &p_feature) { |
| 145 | if (RenderingServer::get_singleton()) { |
| 146 | if (RenderingServer::get_singleton()->has_os_feature(p_feature)) { |
| 147 | return true; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | return false; |
| 152 | } |
| 153 | |
| 154 | static MovieWriterPNGWAV *writer_pngwav = nullptr; |
| 155 | |
| 156 | void register_server_types() { |
| 157 | OS::get_singleton()->benchmark_begin_measure("Servers", "Register Extensions"); |
| 158 | |
| 159 | shader_types = memnew(ShaderTypes); |
| 160 | |
| 161 | GDREGISTER_CLASS(TextServerManager); |
| 162 | GDREGISTER_ABSTRACT_CLASS(TextServer); |
| 163 | GDREGISTER_CLASS(TextServerExtension); |
| 164 | GDREGISTER_CLASS(TextServerDummy); |
| 165 | |
| 166 | GDREGISTER_NATIVE_STRUCT(Glyph, "int start = -1;int end = -1;uint8_t count = 0;uint8_t repeat = 1;uint16_t flags = 0;float x_off = 0.f;float y_off = 0.f;float advance = 0.f;RID font_rid;int font_size = 0;int32_t index = 0;int span_index = -1"); |
| 167 | GDREGISTER_NATIVE_STRUCT(CaretInfo, "Rect2 leading_caret;Rect2 trailing_caret;TextServer::Direction leading_direction;TextServer::Direction trailing_direction"); |
| 168 | |
| 169 | Engine::get_singleton()->add_singleton(Engine::Singleton("TextServerManager", TextServerManager::get_singleton(), "TextServerManager")); |
| 170 | |
| 171 | OS::get_singleton()->set_has_server_feature_callback(has_server_feature_callback); |
| 172 | |
| 173 | GDREGISTER_ABSTRACT_CLASS(AccessibilityServer); |
| 174 | GDREGISTER_ABSTRACT_CLASS(DisplayServer); |
| 175 | GDREGISTER_ABSTRACT_CLASS(RenderingServer); |
| 176 | |
| 177 | GDREGISTER_CLASS(AudioServer); |
| 178 | GDREGISTER_NATIVE_STRUCT(AudioFrame, "float left;float right"); |
| 179 | |
| 180 | GDREGISTER_CLASS(NativeMenu); |
| 181 | |
| 182 | GDREGISTER_CLASS(CameraServer); |
| 183 | |
| 184 | GDREGISTER_CLASS(AudioSample); |
| 185 | GDREGISTER_CLASS(AudioSamplePlayback); |
| 186 | GDREGISTER_VIRTUAL_CLASS(AudioEffect); |
| 187 | GDREGISTER_VIRTUAL_CLASS(AudioEffectInstance); |
| 188 | GDREGISTER_CLASS(AudioEffectEQ); |
| 189 | GDREGISTER_CLASS(AudioEffectFilter); |
| 190 | GDREGISTER_CLASS(AudioBusLayout); |
| 191 | |
| 192 | { |
| 193 | //audio effects |
| 194 | GDREGISTER_CLASS(AudioEffectAmplify); |
| 195 | |
| 196 | GDREGISTER_CLASS(AudioEffectReverb); |
| 197 | |
| 198 | GDREGISTER_CLASS(AudioEffectLowPassFilter); |
| 199 | GDREGISTER_CLASS(AudioEffectHighPassFilter); |
| 200 | GDREGISTER_CLASS(AudioEffectBandPassFilter); |
| 201 | GDREGISTER_CLASS(AudioEffectNotchFilter); |
| 202 | GDREGISTER_CLASS(AudioEffectBandLimitFilter); |
| 203 | GDREGISTER_CLASS(AudioEffectLowShelfFilter); |
| 204 | GDREGISTER_CLASS(AudioEffectHighShelfFilter); |
| 205 | |
| 206 | GDREGISTER_CLASS(AudioEffectEQ6); |
| 207 | GDREGISTER_CLASS(AudioEffectEQ10); |
| 208 | GDREGISTER_CLASS(AudioEffectEQ21); |
| 209 | |
| 210 | GDREGISTER_CLASS(AudioEffectDistortion); |
| 211 | |
| 212 | GDREGISTER_CLASS(AudioEffectStereoEnhance); |
| 213 | |
| 214 | GDREGISTER_CLASS(AudioEffectPanner); |
| 215 | GDREGISTER_CLASS(AudioEffectChorus); |
| 216 | GDREGISTER_CLASS(AudioEffectDelay); |
| 217 | GDREGISTER_CLASS(AudioEffectCompressor); |
| 218 | GDREGISTER_CLASS(AudioEffectHardLimiter); |
| 219 | GDREGISTER_CLASS(AudioEffectPitchShift); |
| 220 | GDREGISTER_CLASS(AudioEffectPhaser); |
| 221 | GDREGISTER_CLASS(AudioEffectRecord); |
| 222 | GDREGISTER_CLASS(AudioEffectSpectrumAnalyzer); |
| 223 | GDREGISTER_ABSTRACT_CLASS(AudioEffectSpectrumAnalyzerInstance); |
| 224 | |
| 225 | GDREGISTER_CLASS(AudioEffectCapture); |
| 226 | |
| 227 | #ifndef DISABLE_DEPRECATED |
| 228 | GDREGISTER_CLASS(AudioEffectLimiter); |
| 229 | #endif |
| 230 | } |
| 231 | |
| 232 | GDREGISTER_ABSTRACT_CLASS(RenderData); |
| 233 | GDREGISTER_CLASS(RenderDataExtension); |
| 234 | GDREGISTER_ABSTRACT_CLASS(RenderSceneData); |
| 235 | GDREGISTER_CLASS(RenderSceneDataExtension); |
| 236 | |
| 237 | GDREGISTER_CLASS(RenderSceneBuffersConfiguration); |
| 238 | GDREGISTER_ABSTRACT_CLASS(RenderSceneBuffers); |
| 239 | GDREGISTER_CLASS(RenderSceneBuffersExtension); |
| 240 | |
| 241 | GDREGISTER_CLASS(ShaderIncludeDB); |
| 242 | |
| 243 | #ifdef RD_ENABLED |
| 244 | GDREGISTER_ABSTRACT_CLASS(RenderingDevice); |
| 245 | GDREGISTER_CLASS(RDTextureFormat); |
| 246 | GDREGISTER_CLASS(RDTextureView); |
| 247 | GDREGISTER_CLASS(RDAttachmentFormat); |
| 248 | GDREGISTER_CLASS(RDFramebufferPass); |
| 249 | GDREGISTER_CLASS(RDSamplerState); |
| 250 | GDREGISTER_CLASS(RDVertexAttribute); |
| 251 | GDREGISTER_CLASS(RDUniform); |
| 252 | GDREGISTER_CLASS(RDPipelineRasterizationState); |
| 253 | GDREGISTER_CLASS(RDPipelineMultisampleState); |
| 254 | GDREGISTER_CLASS(RDPipelineDepthStencilState); |
| 255 | GDREGISTER_CLASS(RDPipelineColorBlendStateAttachment); |
| 256 | GDREGISTER_CLASS(RDPipelineColorBlendState); |
| 257 | GDREGISTER_CLASS(RDShaderSource); |
| 258 | GDREGISTER_CLASS(RDShaderSPIRV); |
| 259 | GDREGISTER_CLASS(RDShaderFile); |
| 260 | GDREGISTER_CLASS(RDPipelineSpecializationConstant); |
| 261 | GDREGISTER_CLASS(RDAccelerationStructureGeometry); |
| 262 | GDREGISTER_CLASS(RDAccelerationStructureInstance); |
| 263 | GDREGISTER_CLASS(RDPipelineShader); |
| 264 | GDREGISTER_CLASS(RDHitGroup); |
| 265 | |
| 266 | GDREGISTER_CLASS(RenderDataRD); |
| 267 | GDREGISTER_CLASS(RenderSceneDataRD); |
| 268 | |
| 269 | GDREGISTER_CLASS(RenderSceneBuffersRD); |
| 270 | GDREGISTER_CLASS(FramebufferCacheRD); |
| 271 | GDREGISTER_CLASS(UniformSetCacheRD); |
| 272 | #endif // RD_ENABLED |
| 273 | |
| 274 | GDREGISTER_CLASS(CameraFeed); |
| 275 | |
| 276 | GDREGISTER_VIRTUAL_CLASS(MovieWriter); |
| 277 | |
| 278 | ServersDebugger::initialize(); |
| 279 | |
| 280 | #ifndef NAVIGATION_2D_DISABLED |
| 281 | GDREGISTER_CLASS(NavigationServer2DManager); |
| 282 | Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2DManager", NavigationServer2DManager::get_singleton(), "NavigationServer2DManager")); |
| 283 | |
| 284 | GDREGISTER_ABSTRACT_CLASS(NavigationServer2D); |
| 285 | GDREGISTER_CLASS(NavigationPathQueryParameters2D); |
| 286 | GDREGISTER_CLASS(NavigationPathQueryResult2D); |
| 287 | |
| 288 | GLOBAL_DEF(PropertyInfo(Variant::STRING, NavigationServer2DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"), "DEFAULT"); |
| 289 | |
| 290 | NavigationServer2DManager::get_singleton()->register_server("Dummy", callable_mp_static(NavigationServer2DManager::create_dummy_server_callback)); |
| 291 | #endif // NAVIGATION_2D_DISABLED |
| 292 | |
| 293 | #ifndef PHYSICS_2D_DISABLED |
| 294 | // Physics 2D |
| 295 | GDREGISTER_CLASS(PhysicsServer2DManager); |
| 296 | Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2DManager", PhysicsServer2DManager::get_singleton(), "PhysicsServer2DManager")); |
| 297 | |
| 298 | GDREGISTER_ABSTRACT_CLASS(PhysicsServer2D); |
| 299 | GDREGISTER_VIRTUAL_CLASS(PhysicsServer2DExtension); |
| 300 | GDREGISTER_ABSTRACT_CLASS(PhysicsDirectBodyState2D); |
| 301 | GDREGISTER_VIRTUAL_CLASS(PhysicsDirectBodyState2DExtension); |
| 302 | GDREGISTER_ABSTRACT_CLASS(PhysicsDirectSpaceState2D); |
| 303 | GDREGISTER_VIRTUAL_CLASS(PhysicsDirectSpaceState2DExtension); |
| 304 | |
| 305 | GDREGISTER_NATIVE_STRUCT(PhysicsServer2DExtensionRayResult, "Vector2 position;Vector2 normal;RID rid;ObjectID collider_id;Object *collider;int shape"); |
| 306 | GDREGISTER_NATIVE_STRUCT(PhysicsServer2DExtensionShapeResult, "RID rid;ObjectID collider_id;Object *collider;int shape"); |
| 307 | GDREGISTER_NATIVE_STRUCT(PhysicsServer2DExtensionShapeRestInfo, "Vector2 point;Vector2 normal;RID rid;ObjectID collider_id;int shape;Vector2 linear_velocity"); |
| 308 | GDREGISTER_NATIVE_STRUCT(PhysicsServer2DExtensionMotionResult, "Vector2 travel;Vector2 remainder;Vector2 collision_point;Vector2 collision_normal;Vector2 collider_velocity;real_t collision_depth;real_t collision_safe_fraction;real_t collision_unsafe_fraction;int collision_local_shape;ObjectID collider_id;RID collider;int collider_shape"); |
| 309 | |
| 310 | GDREGISTER_CLASS(PhysicsRayQueryParameters2D); |
| 311 | GDREGISTER_CLASS(PhysicsIntersectRayResult2D); |
| 312 | GDREGISTER_CLASS(PhysicsPointQueryParameters2D); |
| 313 | GDREGISTER_CLASS(PhysicsIntersectPointResult2D); |
| 314 | GDREGISTER_CLASS(PhysicsShapeQueryParameters2D); |
| 315 | GDREGISTER_CLASS(PhysicsIntersectShapeResult2D); |
| 316 | GDREGISTER_CLASS(PhysicsCastMotionResult2D); |
| 317 | GDREGISTER_CLASS(PhysicsCollideShapeResult2D); |
| 318 | GDREGISTER_CLASS(PhysicsGetRestInfoResult2D); |
| 319 | GDREGISTER_CLASS(PhysicsTestMotionParameters2D); |
| 320 | GDREGISTER_CLASS(PhysicsTestMotionResult2D); |
| 321 | |
| 322 | GLOBAL_DEF(PropertyInfo(Variant::STRING, PhysicsServer2DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"), "DEFAULT"); |
| 323 | |
| 324 | PhysicsServer2DManager::get_singleton()->register_server("Dummy", callable_mp_static(_create_dummy_physics_server_2d)); |
| 325 | #endif // PHYSICS_2D_DISABLED |
| 326 | |
| 327 | #ifndef NAVIGATION_3D_DISABLED |
| 328 | GDREGISTER_CLASS(NavigationServer3DManager); |
| 329 | Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer3DManager", NavigationServer3DManager::get_singleton(), "NavigationServer3DManager")); |
| 330 | |
| 331 | GDREGISTER_ABSTRACT_CLASS(NavigationServer3D); |
| 332 | GDREGISTER_CLASS(NavigationPathQueryParameters3D); |
| 333 | GDREGISTER_CLASS(NavigationPathQueryResult3D); |
| 334 | |
| 335 | GLOBAL_DEF(PropertyInfo(Variant::STRING, NavigationServer3DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"), "DEFAULT"); |
| 336 | |
| 337 | NavigationServer3DManager::get_singleton()->register_server("Dummy", callable_mp_static(NavigationServer3DManager::create_dummy_server_callback)); |
| 338 | #endif // NAVIGATION_3D_DISABLED |
| 339 | |
| 340 | #ifndef PHYSICS_3D_DISABLED |
| 341 | // Physics 3D |
| 342 | GDREGISTER_CLASS(PhysicsServer3DManager); |
| 343 | Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3DManager", PhysicsServer3DManager::get_singleton(), "PhysicsServer3DManager")); |
| 344 | |
| 345 | GDREGISTER_ABSTRACT_CLASS(PhysicsServer3D); |
| 346 | GDREGISTER_VIRTUAL_CLASS(PhysicsServer3DExtension); |
| 347 | GDREGISTER_ABSTRACT_CLASS(PhysicsDirectBodyState3D); |
| 348 | GDREGISTER_VIRTUAL_CLASS(PhysicsDirectBodyState3DExtension); |
| 349 | GDREGISTER_ABSTRACT_CLASS(PhysicsDirectSpaceState3D); |
| 350 | GDREGISTER_VIRTUAL_CLASS(PhysicsDirectSpaceState3DExtension) |
| 351 | GDREGISTER_VIRTUAL_CLASS(PhysicsServer3DRenderingServerHandler) |
| 352 | |
| 353 | GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionRayResult, "Vector3 position;Vector3 normal;RID rid;ObjectID collider_id;Object *collider;int shape;int face_index"); |
| 354 | GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeResult, "RID rid;ObjectID collider_id;Object *collider;int shape"); |
| 355 | GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeRestInfo, "Vector3 point;Vector3 normal;RID rid;ObjectID collider_id;int shape;Vector3 linear_velocity"); |
| 356 | GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionCollision, "Vector3 position;Vector3 normal;Vector3 collider_velocity;Vector3 collider_angular_velocity;real_t depth;int local_shape;ObjectID collider_id;RID collider;int collider_shape"); |
| 357 | GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionResult, "Vector3 travel;Vector3 remainder;real_t collision_depth;real_t collision_safe_fraction;real_t collision_unsafe_fraction;PhysicsServer3DExtensionMotionCollision collisions[32];int collision_count"); |
| 358 | |
| 359 | GDREGISTER_CLASS(PhysicsRayQueryParameters3D); |
| 360 | GDREGISTER_CLASS(PhysicsIntersectRayResult3D); |
| 361 | GDREGISTER_CLASS(PhysicsPointQueryParameters3D); |
| 362 | GDREGISTER_CLASS(PhysicsIntersectPointResult3D); |
| 363 | GDREGISTER_CLASS(PhysicsShapeQueryParameters3D); |
| 364 | GDREGISTER_CLASS(PhysicsIntersectShapeResult3D); |
| 365 | GDREGISTER_CLASS(PhysicsCastMotionResult3D); |
| 366 | GDREGISTER_CLASS(PhysicsCollideShapeResult3D); |
| 367 | GDREGISTER_CLASS(PhysicsGetRestInfoResult3D); |
| 368 | GDREGISTER_CLASS(PhysicsTestMotionParameters3D); |
| 369 | GDREGISTER_CLASS(PhysicsTestMotionResult3D); |
| 370 | |
| 371 | GLOBAL_DEF(PropertyInfo(Variant::STRING, PhysicsServer3DManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"), "DEFAULT"); |
| 372 | |
| 373 | PhysicsServer3DManager::get_singleton()->register_server("Dummy", callable_mp_static(_create_dummy_physics_server_3d)); |
| 374 | #endif // PHYSICS_3D_DISABLED |
| 375 | |
| 376 | #ifndef XR_DISABLED |
| 377 | GDREGISTER_ABSTRACT_CLASS(XRInterface); |
| 378 | GDREGISTER_ABSTRACT_CLASS(XRTracker); |
| 379 | GDREGISTER_CLASS(XRVRS); |
| 380 | GDREGISTER_CLASS(XRPositionalTracker); |
| 381 | GDREGISTER_CLASS(XRBodyTracker); |
| 382 | GDREGISTER_CLASS(XRControllerTracker); |
| 383 | GDREGISTER_CLASS(XRFaceTracker); |
| 384 | GDREGISTER_CLASS(XRHandTracker); |
| 385 | GDREGISTER_CLASS(XRInterfaceExtension); // can't register this as virtual because we need a creation function for our extensions. |
| 386 | GDREGISTER_CLASS(XRPose); |
| 387 | GDREGISTER_CLASS(XRServer); |
| 388 | #endif // XR_DISABLED |
| 389 | |
| 390 | if constexpr (GD_IS_CLASS_ENABLED(MovieWriterPNGWAV)) { |
| 391 | writer_pngwav = memnew(MovieWriterPNGWAV); |
| 392 | MovieWriter::add_writer(writer_pngwav); |
| 393 | } |
| 394 | |
| 395 | OS::get_singleton()->benchmark_end_measure("Servers", "Register Extensions"); |
| 396 | } |
| 397 | |
| 398 | void unregister_server_types() { |
| 399 | OS::get_singleton()->benchmark_begin_measure("Servers", "Unregister Extensions"); |
| 400 | |
| 401 | ServersDebugger::deinitialize(); |
| 402 | memdelete(shader_types); |
| 403 | if constexpr (GD_IS_CLASS_ENABLED(MovieWriterPNGWAV)) { |
| 404 | memdelete(writer_pngwav); |
| 405 | } |
| 406 | |
| 407 | OS::get_singleton()->benchmark_end_measure("Servers", "Unregister Extensions"); |
| 408 | } |
| 409 | |
| 410 | void register_server_singletons() { |
| 411 | OS::get_singleton()->benchmark_begin_measure("Servers", "Register Singletons"); |
| 412 | |
| 413 | Engine::get_singleton()->add_singleton(Engine::Singleton("AccessibilityServer", AccessibilityServer::get_singleton(), "AccessibilityServer")); |
| 414 | Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton(), "AudioServer")); |
| 415 | Engine::get_singleton()->add_singleton(Engine::Singleton("CameraServer", CameraServer::get_singleton(), "CameraServer")); |
| 416 | Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton(), "DisplayServer")); |
| 417 | Engine::get_singleton()->add_singleton(Engine::Singleton("NativeMenu", NativeMenu::get_singleton(), "NativeMenu")); |
| 418 | Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton(), "RenderingServer")); |
| 419 | #ifndef NAVIGATION_2D_DISABLED |
| 420 | Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2D", NavigationServer2D::get_singleton(), "NavigationServer2D")); |
| 421 | #endif // NAVIGATION_2D_DISABLED |
| 422 | #ifndef NAVIGATION_3D_DISABLED |
| 423 | Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer3D", NavigationServer3D::get_singleton(), "NavigationServer3D")); |
| 424 | #endif // NAVIGATION_3D_DISABLED |
| 425 | #ifndef PHYSICS_2D_DISABLED |
| 426 | Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton(), "PhysicsServer2D")); |
| 427 | #endif // PHYSICS_2D_DISABLED |
| 428 | #ifndef PHYSICS_3D_DISABLED |
| 429 | Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton(), "PhysicsServer3D")); |
| 430 | #endif // PHYSICS_3D_DISABLED |
| 431 | #ifndef XR_DISABLED |
| 432 | Engine::get_singleton()->add_singleton(Engine::Singleton("XRServer", XRServer::get_singleton(), "XRServer")); |
| 433 | #endif // XR_DISABLED |
| 434 | |
| 435 | OS::get_singleton()->benchmark_end_measure("Servers", "Register Singletons"); |
| 436 | } |