From 12e0dc1b65d3e69206ce64daa461b269c638b944 Mon Sep 17 00:00:00 2001 From: fhuya Date: Sun, 16 Jun 2019 01:58:34 -0700 Subject: Add XR mode selection to the Android export process. --- platform/android/export/export.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'platform/android/export') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 30267aa968..d0907bec74 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -668,6 +668,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { bool screen_support_large = p_preset->get("screen/support_large"); bool screen_support_xlarge = p_preset->get("screen/support_xlarge"); + int xr_mode_index = p_preset->get("graphics/xr_mode"); + Vector perms; const char **aperms = android_perms; @@ -825,6 +827,14 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { encode_uint32(min_gles3 ? 0x00030000 : 0x00020000, &p_manifest.write[iofs + 16]); } + if (tname == "meta-data" && attrname == "value") { + if (xr_mode_index == 1 /* XRMode.OVR */) { + string_table.write[attr_value] = "vr_only"; + } else { + string_table.write[attr_value] = ""; + } + } + iofs += 20; } @@ -1142,6 +1152,7 @@ public: virtual void get_export_options(List *r_options) { + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); @@ -2074,6 +2085,14 @@ public: } } + int xr_mode_index = p_preset->get("graphics/xr_mode"); + if (xr_mode_index == 1 /* XRMode.OVR */) { + cl.push_back("--xr_mode_ovr"); + } else { + // XRMode.REGULAR is the default. + cl.push_back("--xr_mode_regular"); + } + if (use_32_fb) cl.push_back("--use_depth_32"); -- cgit v1.2.3