diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-01-16 13:47:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 13:47:01 +0100 |
commit | 0c80bc2579e6d3cc904f71dacde760f1081a9cb1 (patch) | |
tree | 3b79be439fc6a8cd72dfd76fdf0631254693c8ec /platform/iphone/os_iphone.cpp | |
parent | eeea11602240d41c704e540ef2fd3cad422cc01a (diff) | |
parent | 3a02df7739df1ad0003ac7b4dd97a8dca2de4f99 (diff) |
Merge pull request #7457 from BastiaanOlij/glew3-ios
Working on compile issues for iOS
Diffstat (limited to 'platform/iphone/os_iphone.cpp')
-rw-r--r-- | platform/iphone/os_iphone.cpp | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 051c562b6a..e34dbae017 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -30,11 +30,9 @@ #include "os_iphone.h" -#include "drivers/gles2/rasterizer_gles2.h" - - +#include "drivers/gles3/rasterizer_gles3.h" #include "servers/visual/visual_server_raster.h" -#include "servers/visual/visual_server_wrap_mt.h" +//#include "servers/visual/visual_server_wrap_mt.h" #include "main/main.h" #include "audio_driver_iphone.h" @@ -109,16 +107,17 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical", false)?1:0) << PortraitDown); supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical_flipped", false)?1:0) << PortraitUp); - rasterizer_gles22 = memnew( RasterizerGLES2(false, false, false) ); - rasterizer = rasterizer_gles22; - rasterizer_gles22->set_base_framebuffer(gl_view_base_fb); + RasterizerGLES3::register_config(); + RasterizerGLES3::make_current(); + RasterizerStorageGLES3::system_fbo = gl_view_base_fb; - visual_server = memnew( VisualServerRaster(rasterizer) ); + visual_server = memnew( VisualServerRaster() ); + /* + FIXME: Reimplement threaded rendering? Or remove? if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - visual_server = memnew(VisualServerWrapMT(visual_server, false)); }; - visual_server->init(); + */ visual_server->init(); visual_server->cursor_set_visible(false, 0); @@ -127,16 +126,7 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au audio_driver->set_singleton(); audio_driver->init(); - sample_manager = memnew( SampleManagerMallocSW ); - audio_server = memnew( AudioServerSW(sample_manager) ); - audio_server->init(); - spatial_sound_server = memnew( SpatialSoundServerSW ); - spatial_sound_server->init(); - - spatial_sound_2d_server = memnew( SpatialSound2DServerSW ); - spatial_sound_2d_server->init(); - - // + // init physics servers physics_server = memnew( PhysicsServerSW ); physics_server->init(); //physics_2d_server = memnew( Physics2DServerSW ); @@ -148,28 +138,28 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au /* #ifdef IOS_SCORELOOP_ENABLED scoreloop = memnew(ScoreloopIOS); - Globals::get_singleton()->add_singleton(Globals::Singleton("Scoreloop", scoreloop)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Scoreloop", scoreloop)); scoreloop->connect(); #endif */ #ifdef GAME_CENTER_ENABLED game_center = memnew(GameCenter); - Globals::get_singleton()->add_singleton(Globals::Singleton("GameCenter", game_center)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("GameCenter", game_center)); game_center->connect(); #endif #ifdef STOREKIT_ENABLED store_kit = memnew(InAppStore); - Globals::get_singleton()->add_singleton(Globals::Singleton("InAppStore", store_kit)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("InAppStore", store_kit)); #endif #ifdef ICLOUD_ENABLED icloud = memnew(ICloud); - Globals::get_singleton()->add_singleton(Globals::Singleton("ICloud", icloud)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ICloud", icloud)); //icloud->connect(); #endif - Globals::get_singleton()->add_singleton(Globals::Singleton("iOS", memnew(iOS))); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("iOS", memnew(iOS))); }; MainLoop *OSIPhone::get_main_loop() const { @@ -294,8 +284,8 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_ }; input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y)); - ev.mouse_motion.speed_x=input->get_mouse_speed().x; - ev.mouse_motion.speed_y=input->get_mouse_speed().y; + ev.mouse_motion.speed_x=input->get_last_mouse_speed().x; + ev.mouse_motion.speed_y=input->get_last_mouse_speed().y; ev.mouse_motion.button_mask = 1; // pressed queue_event(ev); @@ -394,7 +384,7 @@ void OSIPhone::finalize() { visual_server->finish(); memdelete(visual_server); - memdelete(rasterizer); +// memdelete(rasterizer); physics_server->finish(); memdelete(physics_server); @@ -402,14 +392,8 @@ void OSIPhone::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); - spatial_sound_server->finish(); - memdelete(spatial_sound_server); - memdelete(input); - spatial_sound_2d_server->finish(); - memdelete(spatial_sound_2d_server); - }; void OSIPhone::set_mouse_show(bool p_show) { }; @@ -456,9 +440,8 @@ bool OSIPhone::can_draw() const { int OSIPhone::set_base_framebuffer(int p_fb) { - if (rasterizer_gles22) { - rasterizer_gles22->set_base_framebuffer(p_fb); - }; + RasterizerStorageGLES3::system_fbo = gl_view_base_fb; + return 0; }; @@ -542,7 +525,7 @@ Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_ print("Unable to play %S using the native player as it resides in a .pck file\n", p_path.c_str()); return ERR_INVALID_PARAMETER; } else { - p_path = p_path.replace("res:/", Globals::get_singleton()->get_resource_path()); + p_path = p_path.replace("res:/", GlobalConfig::get_singleton()->get_resource_path()); } } else if (p_path.begins_with("user://")) p_path = p_path.replace("user:/", get_data_dir()); @@ -579,10 +562,8 @@ void OSIPhone::native_video_stop() { OSIPhone::OSIPhone(int width, int height) { - rasterizer_gles22 = NULL; main_loop = NULL; visual_server = NULL; - rasterizer = NULL; VideoMode vm; vm.fullscreen = true; |