2014-02-10 02:10:30 +01:00
/*************************************************************************/
/* register_server_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
2017-08-27 14:16:55 +02:00
/* https://godotengine.org */
2014-02-10 02:10:30 +01:00
/*************************************************************************/
2018-01-01 14:40:08 +01:00
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
2014-02-10 02:10:30 +01:00
/* */
/* 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. */
/*************************************************************************/
2018-01-05 00:50:27 +01:00
2014-02-10 02:10:30 +01:00
# include "register_server_types.h"
2017-11-13 21:46:57 +01:00
# include "engine.h"
2017-07-19 22:00:46 +02:00
# include "project_settings.h"
2014-02-10 02:10:30 +01:00
2017-04-23 14:10:41 +02:00
# include "arvr/arvr_interface.h"
# include "arvr/arvr_positional_tracker.h"
# include "arvr_server.h"
2017-01-21 23:00:25 +01:00
# include "audio/audio_effect.h"
2017-03-05 16:44:50 +01:00
# include "audio/audio_stream.h"
2017-01-21 23:00:25 +01:00
# include "audio/effects/audio_effect_amplify.h"
2017-01-22 15:19:56 +01:00
# include "audio/effects/audio_effect_chorus.h"
2017-01-22 22:18:56 +01:00
# include "audio/effects/audio_effect_compressor.h"
2017-03-05 16:44:50 +01:00
# include "audio/effects/audio_effect_delay.h"
# include "audio/effects/audio_effect_distortion.h"
# include "audio/effects/audio_effect_eq.h"
# include "audio/effects/audio_effect_filter.h"
2017-01-23 00:39:53 +01:00
# include "audio/effects/audio_effect_limiter.h"
2017-03-05 16:44:50 +01:00
# include "audio/effects/audio_effect_panner.h"
2017-01-23 22:36:29 +01:00
# include "audio/effects/audio_effect_phaser.h"
2017-03-05 16:44:50 +01:00
# include "audio/effects/audio_effect_pitch_shift.h"
# include "audio/effects/audio_effect_reverb.h"
# include "audio/effects/audio_effect_stereo_enhance.h"
# include "audio_server.h"
2017-10-21 13:02:06 +02:00
# include "physics/physics_server_sw.h"
# include "physics_2d/physics_2d_server_sw.h"
# include "physics_2d/physics_2d_server_wrap_mt.h"
2017-03-05 16:44:50 +01:00
# include "physics_2d_server.h"
# include "physics_server.h"
# include "script_debugger_remote.h"
# include "visual/shader_types.h"
# include "visual_server.h"
2017-01-15 20:06:14 +01:00
2017-03-05 16:44:50 +01:00
static void _debugger_get_resource_usage ( List < ScriptDebuggerRemote : : ResourceUsage > * r_usage ) {
2015-10-21 14:50:44 +02:00
List < VS : : TextureInfo > tinfo ;
VS : : get_singleton ( ) - > texture_debug_usage ( & tinfo ) ;
2017-03-05 16:44:50 +01:00
for ( List < VS : : TextureInfo > : : Element * E = tinfo . front ( ) ; E ; E = E - > next ( ) ) {
2015-10-21 14:50:44 +02:00
ScriptDebuggerRemote : : ResourceUsage usage ;
2017-03-05 16:44:50 +01:00
usage . path = E - > get ( ) . path ;
usage . vram = E - > get ( ) . bytes ;
usage . id = E - > get ( ) . texture ;
usage . type = " Texture " ;
usage . format = itos ( E - > get ( ) . size . width ) + " x " + itos ( E - > get ( ) . size . height ) + " " + Image : : get_format_name ( E - > get ( ) . format ) ;
2015-10-21 14:50:44 +02:00
r_usage - > push_back ( usage ) ;
}
}
2014-02-10 02:10:30 +01:00
2017-03-05 16:44:50 +01:00
ShaderTypes * shader_types = NULL ;
2016-10-07 16:31:18 +02:00
2017-10-21 13:02:06 +02:00
PhysicsServer * _createGodotPhysicsCallback ( ) {
2018-02-26 12:51:30 +01:00
WARN_PRINT ( " The GodotPhysics 3D physics engine is deprecated and will be removed in Godot 3.2. You should use the Bullet physics engine instead (configurable in your project settings). " ) ;
2017-10-21 13:02:06 +02:00
return memnew ( PhysicsServerSW ) ;
}
Physics2DServer * _createGodotPhysics2DCallback ( ) {
return Physics2DServerWrapMT : : init_server < Physics2DServerSW > ( ) ;
}
2014-02-10 02:10:30 +01:00
void register_server_types ( ) {
2017-10-09 23:49:17 +02:00
ClassDB : : register_virtual_class < VisualServer > ( ) ;
ClassDB : : register_class < AudioServer > ( ) ;
ClassDB : : register_virtual_class < PhysicsServer > ( ) ;
ClassDB : : register_virtual_class < Physics2DServer > ( ) ;
ClassDB : : register_class < ARVRServer > ( ) ;
2017-03-05 16:44:50 +01:00
shader_types = memnew ( ShaderTypes ) ;
2016-10-07 16:31:18 +02:00
2017-04-23 14:10:41 +02:00
ClassDB : : register_virtual_class < ARVRInterface > ( ) ;
ClassDB : : register_class < ARVRPositionalTracker > ( ) ;
2017-01-21 23:00:25 +01:00
ClassDB : : register_virtual_class < AudioStream > ( ) ;
ClassDB : : register_virtual_class < AudioStreamPlayback > ( ) ;
2017-07-15 06:23:10 +02:00
ClassDB : : register_class < AudioStreamRandomPitch > ( ) ;
2017-01-21 23:00:25 +01:00
ClassDB : : register_virtual_class < AudioEffect > ( ) ;
2017-10-09 23:49:17 +02:00
ClassDB : : register_class < AudioEffectEQ > ( ) ;
ClassDB : : register_class < AudioEffectFilter > ( ) ;
2017-01-25 18:30:40 +01:00
ClassDB : : register_class < AudioBusLayout > ( ) ;
2017-01-21 23:00:25 +01:00
2017-01-22 15:19:56 +01:00
{
//audio effects
ClassDB : : register_class < AudioEffectAmplify > ( ) ;
2017-01-21 23:00:25 +01:00
2017-01-22 15:19:56 +01:00
ClassDB : : register_class < AudioEffectReverb > ( ) ;
2017-01-21 23:00:25 +01:00
2017-01-22 19:14:45 +01:00
ClassDB : : register_class < AudioEffectLowPassFilter > ( ) ;
ClassDB : : register_class < AudioEffectHighPassFilter > ( ) ;
ClassDB : : register_class < AudioEffectBandPassFilter > ( ) ;
ClassDB : : register_class < AudioEffectNotchFilter > ( ) ;
ClassDB : : register_class < AudioEffectBandLimitFilter > ( ) ;
ClassDB : : register_class < AudioEffectLowShelfFilter > ( ) ;
ClassDB : : register_class < AudioEffectHighShelfFilter > ( ) ;
2017-01-21 23:00:25 +01:00
2017-01-22 15:19:56 +01:00
ClassDB : : register_class < AudioEffectEQ6 > ( ) ;
ClassDB : : register_class < AudioEffectEQ10 > ( ) ;
ClassDB : : register_class < AudioEffectEQ21 > ( ) ;
2017-01-21 23:00:25 +01:00
2017-01-22 15:19:56 +01:00
ClassDB : : register_class < AudioEffectDistortion > ( ) ;
ClassDB : : register_class < AudioEffectStereoEnhance > ( ) ;
ClassDB : : register_class < AudioEffectPanner > ( ) ;
ClassDB : : register_class < AudioEffectChorus > ( ) ;
2017-01-22 19:14:45 +01:00
ClassDB : : register_class < AudioEffectDelay > ( ) ;
2017-01-22 22:18:56 +01:00
ClassDB : : register_class < AudioEffectCompressor > ( ) ;
2017-01-23 00:39:53 +01:00
ClassDB : : register_class < AudioEffectLimiter > ( ) ;
2017-01-23 05:45:43 +01:00
ClassDB : : register_class < AudioEffectPitchShift > ( ) ;
2017-01-23 22:36:29 +01:00
ClassDB : : register_class < AudioEffectPhaser > ( ) ;
2017-01-22 15:19:56 +01:00
}
2014-02-10 02:10:30 +01:00
2017-01-03 03:03:46 +01:00
ClassDB : : register_virtual_class < Physics2DDirectBodyState > ( ) ;
ClassDB : : register_virtual_class < Physics2DDirectSpaceState > ( ) ;
ClassDB : : register_virtual_class < Physics2DShapeQueryResult > ( ) ;
ClassDB : : register_class < Physics2DTestMotionResult > ( ) ;
ClassDB : : register_class < Physics2DShapeQueryParameters > ( ) ;
2014-02-10 02:10:30 +01:00
2017-01-03 03:03:46 +01:00
ClassDB : : register_class < PhysicsShapeQueryParameters > ( ) ;
ClassDB : : register_virtual_class < PhysicsDirectBodyState > ( ) ;
ClassDB : : register_virtual_class < PhysicsDirectSpaceState > ( ) ;
ClassDB : : register_virtual_class < PhysicsShapeQueryResult > ( ) ;
2014-02-10 02:10:30 +01:00
2017-03-05 16:44:50 +01:00
ScriptDebuggerRemote : : resource_usage_func = _debugger_get_resource_usage ;
2017-10-21 13:02:06 +02:00
// 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 " ) ) ;
Physics2DServerManager : : register_server ( " GodotPhysics " , & _createGodotPhysics2DCallback ) ;
Physics2DServerManager : : 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 " ) ) ;
2018-02-26 12:51:30 +01:00
PhysicsServerManager : : register_server ( " GodotPhysics - deprecated " , & _createGodotPhysicsCallback ) ;
PhysicsServerManager : : set_default_server ( " GodotPhysics - deprecated " ) ;
2014-02-10 02:10:30 +01:00
}
2017-03-05 16:44:50 +01:00
void unregister_server_types ( ) {
2014-02-10 02:10:30 +01:00
2017-03-05 16:44:50 +01:00
memdelete ( shader_types ) ;
2014-02-10 02:10:30 +01:00
}
2017-10-21 13:02:06 +02:00
void register_server_singletons ( ) {
2017-11-13 21:46:57 +01:00
Engine : : get_singleton ( ) - > add_singleton ( Engine : : Singleton ( " VisualServer " , VisualServer : : 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 ( " ARVRServer " , ARVRServer : : get_singleton ( ) ) ) ;
2017-10-21 13:02:06 +02:00
}