diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index d3e244954..0aa1caf0c 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -757,16 +757,6 @@ void EditorExportPlatformAndroid::_get_permissions(const Ref r_permissions.push_back("android.permission.INTERNET"); } } - - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index > XR_HAND_TRACKING_NONE) { - if (r_permissions.find("com.oculus.permission.HAND_TRACKING") == -1) { - r_permissions.push_back("com.oculus.permission.HAND_TRACKING"); - } - } - } } void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref &p_preset, bool p_give_internet, bool p_debug) { @@ -790,7 +780,6 @@ void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref &p 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("xr_features/xr_mode"); - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); - int hand_tracking_frequency_index = p_preset->get("xr_features/hand_tracking_frequency"); - bool backup_allowed = p_preset->get("user_data_backup/allow"); bool classify_as_game = p_preset->get("package/classify_as_game"); bool retain_data_on_uninstall = p_preset->get("package/retain_data_on_uninstall"); @@ -985,32 +970,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p encode_uint32(min_gles3 ? 0x00030000 : 0x00020000, &p_manifest.write[iofs + 16]); } - if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") { - // Update the meta-data 'android:name' attribute based on the selected XR mode. - if (xr_mode_index == XR_MODE_OVR) { - string_table.write[attr_value] = "com.samsung.android.vr.application.mode"; - } - } - - if (tname == "meta-data" && attrname == "value" && value == "xr_mode_metadata_value") { - // Update the meta-data 'android:value' attribute based on the selected XR mode. - if (xr_mode_index == XR_MODE_OVR) { - string_table.write[attr_value] = "vr_only"; - } - } - - if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_metadata_name") { - if ((xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) && hand_tracking_index > XR_HAND_TRACKING_NONE) { - string_table.write[attr_value] = "com.oculus.handtracking.frequency"; - } - } - - if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_metadata_value") { - if ((xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) && hand_tracking_index > XR_HAND_TRACKING_NONE) { - string_table.write[attr_value] = (hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH"); - } - } - iofs += 20; } @@ -1025,30 +984,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p Vector feature_required_list; Vector feature_versions; - if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { - // Set degrees of freedom - feature_names.push_back("android.hardware.vr.headtracking"); - feature_required_list.push_back(true); - feature_versions.push_back(1); - - // Check for hand tracking - if (hand_tracking_index > XR_HAND_TRACKING_NONE) { - feature_names.push_back("oculus.software.handtracking"); - feature_required_list.push_back(hand_tracking_index == XR_HAND_TRACKING_REQUIRED); - feature_versions.push_back(-1); // no version attribute should be added. - } - - if (xr_mode_index == XR_MODE_OPENXR) { - // Check for passthrough - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (passthrough_mode > XR_PASSTHROUGH_NONE) { - feature_names.push_back("com.oculus.feature.PASSTHROUGH"); - feature_required_list.push_back(passthrough_mode == XR_PASSTHROUGH_REQUIRED); - feature_versions.push_back(-1); - } - } - } - if (feature_names.size() > 0) { ofs += 24; // skip over end tag @@ -1729,11 +1664,6 @@ void EditorExportPlatformAndroid::get_export_options(List *r_optio r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/opengl_debug"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VrApi (Deprecated),OpenXR"), XR_MODE_REGULAR)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/hand_tracking", PROPERTY_HINT_ENUM, "None,Optional,Required"), XR_HAND_TRACKING_NONE)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/hand_tracking_frequency", PROPERTY_HINT_ENUM, "Low,High"), XR_HAND_TRACKING_FREQUENCY_LOW)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/passthrough", PROPERTY_HINT_ENUM, "None,Optional,Required"), XR_PASSTHROUGH_NONE)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/immersive_mode"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_small"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_normal"), true)); @@ -2216,26 +2146,6 @@ bool EditorExportPlatformAndroid::can_export(const Ref &p_pr err += "\n"; } - // Validate the Xr features are properly populated - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - int hand_tracking = p_preset->get("xr_features/hand_tracking"); - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (xr_mode_index != XR_MODE_OVR && xr_mode_index != XR_MODE_OPENXR) { - if (hand_tracking > XR_HAND_TRACKING_NONE) { - valid = false; - err += TTR("\"Hand Tracking\" is only valid when \"Xr Mode\" is \"Oculus Mobile VrApi\" or \"OpenXR\"."); - err += "\n"; - } - } - - if (xr_mode_index != XR_MODE_OPENXR) { - if (passthrough_mode > XR_PASSTHROUGH_NONE) { - valid = false; - err += TTR("\"Passthrough\" is only valid when \"Xr Mode\" is \"OpenXR\"."); - err += "\n"; - } - } - if (int(p_preset->get("custom_template/export_format")) == EXPORT_FORMAT_AAB && !custom_build_enabled) { valid = false; @@ -2589,15 +2499,6 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Refget("xr_features/xr_mode"); - if (xr_mode_index == XR_MODE_OVR) { - command_line_strings.push_back("--xr_mode_ovr"); - } else if (xr_mode_index == XR_MODE_OPENXR) { - command_line_strings.push_back("--xr_mode_openxr"); - } else { // XRMode.REGULAR is the default. - command_line_strings.push_back("--xr_mode_regular"); - } - bool immersive = p_preset->get("screen/immersive_mode"); if (immersive) { command_line_strings.push_back("--use_immersive"); diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 418aea84c..0bbbe56f0 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -211,30 +211,6 @@ String _get_screen_sizes_tag(const Ref &p_preset) { return manifest_screen_sizes; } -String _get_xr_features_tag(const Ref &p_preset) { - String manifest_xr_features; - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; - if (uses_xr) { - manifest_xr_features += " \n"; - - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index == XR_HAND_TRACKING_OPTIONAL) { - manifest_xr_features += " \n"; - } else if (hand_tracking_index == XR_HAND_TRACKING_REQUIRED) { - manifest_xr_features += " \n"; - } - - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (passthrough_mode == XR_PASSTHROUGH_OPTIONAL) { - manifest_xr_features += " \n"; - } else if (passthrough_mode == XR_PASSTHROUGH_REQUIRED) { - manifest_xr_features += " \n"; - } - } - return manifest_xr_features; -} - String _get_instrumentation_tag(const Ref &p_preset) { String package_name = p_preset->get("package/unique_name"); String manifest_instrumentation_text = vformat( @@ -249,8 +225,6 @@ String _get_instrumentation_tag(const Ref &p_preset) { } String _get_activity_tag(const Ref &p_preset) { - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; String orientation = _get_android_orientation_label( OS::get_singleton()->get_screen_orientation_from_string(GLOBAL_GET("display/window/handheld/orientation"))); String manifest_activity_text = vformat( @@ -260,18 +234,12 @@ String _get_activity_tag(const Ref &p_preset) { "android:screenOrientation=\"%s\">\n", bool_to_string(p_preset->get("package/exclude_from_recents")), orientation); - if (uses_xr) { - manifest_activity_text += " \n"; - } else { - manifest_activity_text += " \n"; - } + manifest_activity_text += " \n"; manifest_activity_text += " \n"; return manifest_activity_text; } String _get_application_tag(const Ref &p_preset, bool p_has_storage_permission) { - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR; String manifest_application_text = vformat( " &p_preset, bool p_has_ " android:requestLegacyExternalStorage=\"%s\"\n" " tools:replace=\"android:allowBackup,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n" " tools:ignore=\"GoogleAppIndexingWarning\"\n" - " android:icon=\"@mipmap/icon\" >\n\n" - " \n" - " \n", + " android:icon=\"@mipmap/icon\" >\n\n", bool_to_string(p_preset->get("user_data_backup/allow")), bool_to_string(p_preset->get("package/classify_as_game")), bool_to_string(p_preset->get("package/retain_data_on_uninstall")), bool_to_string(p_has_storage_permission)); - if (uses_xr) { - if (xr_mode_index == XR_MODE_OVR) { - manifest_application_text += " \n"; - } - - bool hand_tracking_enabled = (int)(p_preset->get("xr_features/hand_tracking")) > XR_HAND_TRACKING_NONE; - if (hand_tracking_enabled) { - int hand_tracking_frequency_index = p_preset->get("xr_features/hand_tracking_frequency"); - String hand_tracking_frequency = hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH"; - manifest_application_text += vformat( - " \n", - hand_tracking_frequency); - } - } else { - manifest_application_text += " \n"; - } + manifest_application_text += " \n"; manifest_application_text += _get_activity_tag(p_preset); manifest_application_text += " \n"; return manifest_application_text; diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index bc84a1e3a..4b4e0bed5 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -44,26 +44,6 @@ const String godot_project_name_xml_string = R"( )"; -// Supported XR modes. -// This should match the entries in 'platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java' -static const int XR_MODE_REGULAR = 0; -static const int XR_MODE_OVR = 1; -static const int XR_MODE_OPENXR = 2; - -// Supported XR hand tracking modes. -static const int XR_HAND_TRACKING_NONE = 0; -static const int XR_HAND_TRACKING_OPTIONAL = 1; -static const int XR_HAND_TRACKING_REQUIRED = 2; - -// Supported XR hand tracking frequencies. -static const int XR_HAND_TRACKING_FREQUENCY_LOW = 0; -static const int XR_HAND_TRACKING_FREQUENCY_HIGH = 1; - -// Supported XR passthrough modes. -static const int XR_PASSTHROUGH_NONE = 0; -static const int XR_PASSTHROUGH_OPTIONAL = 1; -static const int XR_PASSTHROUGH_REQUIRED = 2; - struct CustomExportData { String assets_directory; bool debug; @@ -101,8 +81,6 @@ String _get_gles_tag(); String _get_screen_sizes_tag(const Ref &p_preset); -String _get_xr_features_tag(const Ref &p_preset); - String _get_instrumentation_tag(const Ref &p_preset); String _get_activity_tag(const Ref &p_preset); diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index 4b2bbd489..32be89d20 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -38,24 +38,6 @@ - - - - - - - - - - - - - - - diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index cb4c7866c..87d8ccae9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -38,7 +38,6 @@ import org.godotengine.godot.plugin.GodotPlugin; import org.godotengine.godot.plugin.GodotPluginRegistry; import org.godotengine.godot.utils.GodotNetUtils; import org.godotengine.godot.utils.PermissionsUtil; -import org.godotengine.godot.xr.XRMode; import android.annotation.SuppressLint; import android.app.Activity; @@ -125,7 +124,6 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC private Button mPauseButton; private Button mWiFiSettingsButton; - private XRMode xrMode = XRMode.REGULAR; private boolean use_immersive = false; private boolean use_debug_opengl = false; private boolean translucent = false; @@ -356,7 +354,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC // ...add to FrameLayout containerLayout.addView(edittext); - mView = new GodotView(activity, this, xrMode, use_gl3, use_debug_opengl, translucent); + mView = new GodotView(activity, this, use_gl3, use_debug_opengl, translucent); containerLayout.addView(mView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); edittext.setView(mView); io.setEdit(edittext); @@ -546,7 +544,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC */ @Keep private String getInputFallbackMapping() { - return xrMode.inputFallbackMapping; + return "Default Android Gamepad"; } String expansion_pack_path; @@ -617,13 +615,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC for (int i = 0; i < command_line.length; i++) { boolean has_extra = i < command_line.length - 1; - if (command_line[i].equals(XRMode.REGULAR.cmdLineArg)) { - xrMode = XRMode.REGULAR; - } else if (command_line[i].equals(XRMode.OVR.cmdLineArg)) { - xrMode = XRMode.OVR; - } else if (command_line[i].equals(XRMode.OPENXR.cmdLineArg)) { - xrMode = XRMode.OPENXR; - } else if (command_line[i].equals("--debug_opengl")) { + if (command_line[i].equals("--debug_opengl")) { use_debug_opengl = true; } else if (command_line[i].equals("--translucent")) { translucent = true; diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java index cb030a5bd..43cca9cc9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotView.java @@ -33,13 +33,9 @@ package org.godotengine.godot; import org.godotengine.godot.input.GodotGestureHandler; import org.godotengine.godot.input.GodotInputHandler; import org.godotengine.godot.utils.GLUtils; -import org.godotengine.godot.xr.XRMode; -import org.godotengine.godot.xr.ovr.OvrConfigChooser; -import org.godotengine.godot.xr.ovr.OvrContextFactory; -import org.godotengine.godot.xr.ovr.OvrWindowSurfaceFactory; -import org.godotengine.godot.xr.regular.RegularConfigChooser; -import org.godotengine.godot.xr.regular.RegularContextFactory; -import org.godotengine.godot.xr.regular.RegularFallbackConfigChooser; +import org.godotengine.godot.config.RegularConfigChooser; +import org.godotengine.godot.config.RegularContextFactory; +import org.godotengine.godot.config.RegularFallbackConfigChooser; import android.annotation.SuppressLint; import android.content.Context; @@ -83,7 +79,7 @@ public class GodotView extends GLSurfaceView { private EGLContextFactory eglContextFactory; private EGLContext eglSecondaryContext; - public GodotView(Context context, Godot godot, XRMode xrMode, boolean p_use_gl3, boolean p_use_debug_opengl, boolean p_translucent) { + public GodotView(Context context, Godot godot, boolean p_use_gl3, boolean p_use_debug_opengl, boolean p_translucent) { super(context); GLUtils.use_gl3 = p_use_gl3; GLUtils.use_debug_opengl = p_use_debug_opengl; @@ -93,7 +89,7 @@ public class GodotView extends GLSurfaceView { this.detector = new GestureDetector(context, new GodotGestureHandler(this)); this.godotRenderer = new GodotRenderer(); - init(xrMode, p_translucent); + init(p_translucent); } public void initInputDevices() { @@ -123,53 +119,38 @@ public class GodotView extends GLSurfaceView { return inputHandler.onGenericMotionEvent(event) || super.onGenericMotionEvent(event); } - private void init(XRMode xrMode, boolean translucent) { + private void init(boolean translucent) { setPreserveEGLContextOnPause(true); setFocusableInTouchMode(true); - switch (xrMode) { - case OVR: - case OPENXR: - // Replace the default egl config chooser. - eglConfigChooser = new OvrConfigChooser(); - // Replace the default context factory. - eglContextFactory = new OvrContextFactory(); - - // Replace the default window surface factory. - setEGLWindowSurfaceFactory(new OvrWindowSurfaceFactory()); - break; - - case REGULAR: - default: - /* By default, GLSurfaceView() creates a RGB_565 opaque surface. - * If we want a translucent one, we should change the surface's - * format here, using PixelFormat.TRANSLUCENT for GL Surfaces - * is interpreted as any 32-bit surface with alpha by SurfaceFlinger. - */ - if (translucent) { - this.setZOrderOnTop(true); - this.getHolder().setFormat(PixelFormat.TRANSLUCENT); - } - - /* Setup the context factory for 2.0 rendering. - * See ContextFactory class definition below - */ - eglContextFactory = new RegularContextFactory(); - - /* We need to choose an EGLConfig that matches the format of - * our surface exactly. This is going to be done in our - * custom config chooser. See ConfigChooser class definition - * below. - */ - - eglConfigChooser = - new RegularFallbackConfigChooser(8, 8, 8, 8, 24, 0, - new RegularFallbackConfigChooser(8, 8, 8, 8, 16, 0, - // Let such a desperate fallback be used if under some circumstances that's the best we can get - // (the translucency flag would be ignored, but that's better than not running at all) - new RegularConfigChooser(5, 6, 5, 0, 16, 0))); - break; + /* By default, GLSurfaceView() creates a RGB_565 opaque surface. + * If we want a translucent one, we should change the surface's + * format here, using PixelFormat.TRANSLUCENT for GL Surfaces + * is interpreted as any 32-bit surface with alpha by SurfaceFlinger. + */ + if (translucent) { + this.setZOrderOnTop(true); + this.getHolder().setFormat(PixelFormat.TRANSLUCENT); } + + /* Setup the context factory for 2.0 rendering. + * See ContextFactory class definition below + */ + eglContextFactory = new RegularContextFactory(); + + /* We need to choose an EGLConfig that matches the format of + * our surface exactly. This is going to be done in our + * custom config chooser. See ConfigChooser class definition + * below. + */ + + eglConfigChooser = + new RegularFallbackConfigChooser(8, 8, 8, 8, 24, 0, + new RegularFallbackConfigChooser(8, 8, 8, 8, 16, 0, + // Let such a desperate fallback be used if under some circumstances that's the best we can get + // (the translucency flag would be ignored, but that's better than not running at all) + new RegularConfigChooser(5, 6, 5, 0, 16, 0))); + setEGLConfigChooser(eglConfigChooser); setEGLContextFactory(eglContextFactory); diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/config/RegularConfigChooser.java similarity index 99% rename from platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java rename to platform/android/java/lib/src/org/godotengine/godot/config/RegularConfigChooser.java index 2fa59c794..367b7927a 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/config/RegularConfigChooser.java @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -package org.godotengine.godot.xr.regular; +package org.godotengine.godot.config; import org.godotengine.godot.utils.GLUtils; diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/config/RegularContextFactory.java similarity index 99% rename from platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java rename to platform/android/java/lib/src/org/godotengine/godot/config/RegularContextFactory.java index 428934e24..8ad06b2d9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java +++ b/platform/android/java/lib/src/org/godotengine/godot/config/RegularContextFactory.java @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -package org.godotengine.godot.xr.regular; +package org.godotengine.godot.config; import org.godotengine.godot.GodotLib; import org.godotengine.godot.utils.GLUtils; diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/config/RegularFallbackConfigChooser.java similarity index 98% rename from platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java rename to platform/android/java/lib/src/org/godotengine/godot/config/RegularFallbackConfigChooser.java index 420dda45a..9cc1a14e8 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java +++ b/platform/android/java/lib/src/org/godotengine/godot/config/RegularFallbackConfigChooser.java @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -package org.godotengine.godot.xr.regular; +package org.godotengine.godot.config; import org.godotengine.godot.utils.GLUtils; diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java b/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java deleted file mode 100644 index 45796d99b..000000000 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************/ -/* XRMode.java */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -package org.godotengine.godot.xr; - -/** - * Godot available XR modes. - */ -public enum XRMode { - REGULAR(0, "Regular", "--xr_mode_regular", "Default Android Gamepad"), // Regular/flatscreen - OVR(1, "Oculus Mobile VrApi (Deprecated)", "--xr_mode_ovr", ""), - OPENXR(2, "OpenXR", "--xr_mode_openxr", ""); - - final int index; - final String label; - public final String cmdLineArg; - public final String inputFallbackMapping; - - XRMode(int index, String label, String cmdLineArg, String inputFallbackMapping) { - this.index = index; - this.label = label; - this.cmdLineArg = cmdLineArg; - this.inputFallbackMapping = inputFallbackMapping; - } -} diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java deleted file mode 100644 index 4c1c84aff..000000000 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************/ -/* OvrConfigChooser.java */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -package org.godotengine.godot.xr.ovr; - -import android.opengl.EGLExt; -import android.opengl.GLSurfaceView; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLDisplay; - -/** - * EGL config chooser for the Oculus Mobile VR SDK. - */ -public class OvrConfigChooser implements GLSurfaceView.EGLConfigChooser { - private static final int[] CONFIG_ATTRIBS = { - EGL10.EGL_RED_SIZE, 8, - EGL10.EGL_GREEN_SIZE, 8, - EGL10.EGL_BLUE_SIZE, 8, - EGL10.EGL_ALPHA_SIZE, 8, // Need alpha for the multi-pass timewarp compositor - EGL10.EGL_DEPTH_SIZE, 0, - EGL10.EGL_STENCIL_SIZE, 0, - EGL10.EGL_SAMPLES, 0, - EGL10.EGL_NONE - }; - - @Override - public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { - // Do NOT use eglChooseConfig, because the Android EGL code pushes in - // multisample flags in eglChooseConfig if the user has selected the "force 4x - // MSAA" option in settings, and that is completely wasted for our warp - // target. - int[] numConfig = new int[1]; - if (!egl.eglGetConfigs(display, null, 0, numConfig)) { - throw new IllegalArgumentException("eglGetConfigs failed."); - } - - int configsCount = numConfig[0]; - if (configsCount <= 0) { - throw new IllegalArgumentException("No configs match configSpec"); - } - - EGLConfig[] configs = new EGLConfig[configsCount]; - if (!egl.eglGetConfigs(display, configs, configsCount, numConfig)) { - throw new IllegalArgumentException("eglGetConfigs #2 failed."); - } - - int[] value = new int[1]; - for (EGLConfig config : configs) { - egl.eglGetConfigAttrib(display, config, EGL10.EGL_RENDERABLE_TYPE, value); - if ((value[0] & EGLExt.EGL_OPENGL_ES3_BIT_KHR) != EGLExt.EGL_OPENGL_ES3_BIT_KHR) { - continue; - } - - // The pbuffer config also needs to be compatible with normal window rendering - // so it can share textures with the window context. - egl.eglGetConfigAttrib(display, config, EGL10.EGL_SURFACE_TYPE, value); - if ((value[0] & (EGL10.EGL_WINDOW_BIT | EGL10.EGL_PBUFFER_BIT)) != (EGL10.EGL_WINDOW_BIT | EGL10.EGL_PBUFFER_BIT)) { - continue; - } - - // Check each attribute in CONFIG_ATTRIBS (which are the attributes we care about) - // and ensure the value in config matches. - int attribIndex = 0; - while (CONFIG_ATTRIBS[attribIndex] != EGL10.EGL_NONE) { - egl.eglGetConfigAttrib(display, config, CONFIG_ATTRIBS[attribIndex], value); - if (value[0] != CONFIG_ATTRIBS[attribIndex + 1]) { - // Attribute key's value does not match the configs value. - // Start checking next config. - break; - } - - // Step by two because CONFIG_ATTRIBS is in key/value pairs. - attribIndex += 2; - } - - if (CONFIG_ATTRIBS[attribIndex] == EGL10.EGL_NONE) { - // All relevant attributes match, set the config and stop checking the rest. - return config; - } - } - return null; - } -} diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java deleted file mode 100644 index 2b4369b8a..000000000 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* OvrContextFactory.java */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -package org.godotengine.godot.xr.ovr; - -import android.opengl.EGL14; -import android.opengl.GLSurfaceView; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; - -/** - * EGL Context factory for the Oculus mobile VR SDK. - */ -public class OvrContextFactory implements GLSurfaceView.EGLContextFactory { - private static final int[] CONTEXT_ATTRIBS = { - EGL14.EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE - }; - - @Override - public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { - return egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, CONTEXT_ATTRIBS); - } - - @Override - public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) { - egl.eglDestroyContext(display, context); - } -} diff --git a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java b/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java deleted file mode 100644 index fbfe0a3a7..000000000 --- a/platform/android/java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* OvrWindowSurfaceFactory.java */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -package org.godotengine.godot.xr.ovr; - -import android.opengl.GLSurfaceView; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; - -/** - * EGL window surface factory for the Oculus mobile VR SDK. - */ -public class OvrWindowSurfaceFactory implements GLSurfaceView.EGLWindowSurfaceFactory { - private final static int[] SURFACE_ATTRIBS = { - EGL10.EGL_WIDTH, 16, - EGL10.EGL_HEIGHT, 16, - EGL10.EGL_NONE - }; - - @Override - public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config, - Object nativeWindow) { - return egl.eglCreatePbufferSurface(display, config, SURFACE_ATTRIBS); - } - - @Override - public void destroySurface(EGL10 egl, EGLDisplay display, EGLSurface surface) { - egl.eglDestroySurface(display, surface); - } -}