Skip to content

Commit

Permalink
Merge branch 'main-avn' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
helifax authored Nov 19, 2024
2 parents 7e1c7af + 50557e3 commit 45750a7
Show file tree
Hide file tree
Showing 39 changed files with 35,986 additions and 767 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Built application files
*.apk
*.ap_
*.aar
#*.aar

# Files for the ART/Dalvik VM
*.dex
Expand Down Expand Up @@ -65,7 +65,7 @@ openwnn/.externalNativeBuild
oculussig_*

# Third Party SDKs
third_party
#third_party
gvr-android-sdk
user.properties*

Expand Down
Binary file added CHROMIUM_PREBUILT_AARS/ChromiumUi.aar
Binary file not shown.
Binary file added CHROMIUM_PREBUILT_AARS/Content.aar
Binary file not shown.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
------------------------
# Importan Information:
------------------------
- In order to build GeckoView (and Firefox) for Android a Linux Machine is required (it doesn't build under Windows. "./mach bootstrap" and "./mach build" fails to work correctly).
- Buidling Wolvic in Android Studio under Windows works fine.
- Building GeckoView is required just once.
- In "moz_external_vr.h" check "static const int32_t kVRExternalVersion = 20;". This is the protocol version used to exchange data with the engine for WebXR and needs to be the same in Wolvic and Gecko.


-------------------
# Wolvic XR Browser
-------------------

The goal of the Wolvic project is to create a full-featured browser exclusively AR and VR headsets.

Expand Down
15 changes: 11 additions & 4 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ if(OPENXR)
${CMAKE_SOURCE_DIR}/../third_party/hvr/${ANDROID_ABI}/libxr_loader.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libxr_loader.so
)
elseif (SPACES)
add_custom_command(TARGET native-lib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../third_party/spaces/libopenxr_loader.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libopenxr_loader.so
)
elseif (PICOXR)
add_custom_command(TARGET native-lib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
Expand Down Expand Up @@ -177,10 +183,11 @@ add_library(picoxr-lib SHARED IMPORTED)
set_target_properties(picoxr-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/picoxr/libs/android.${ANDROID_ABI}/libopenxr_loader.so)

if(SPACES)
find_package(loader REQUIRED CONFIG)
target_link_libraries(native-lib PRIVATE loader::openxr_loader)
endif ()
if (SPACES)
add_library(spaces-lib SHARED IMPORTED)
set_target_properties(spaces-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/spaces/libopenxr_loader.so)
endif()

# Add dependency on tinygltf library, which is used to load hand models
# from .glb assets. Since it is only a single C++ source and header,
Expand Down
11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ android {
namespace 'com.igalia.wolvic'
compileSdkVersion build_versions.compile_sdk
defaultConfig {
applicationId "com.igalia.wolvic"
applicationId "com.avn.wolvic"
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode generatedVersionCode
versionName "1.8"
versionName "1.8.0.AVN"
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
buildConfigField "Boolean", "DISABLE_CRASH_RESTART", getCrashRestartDisabled()
buildConfigField "String", "AMO_COLLECTION", "\"fxr\""
Expand All @@ -124,7 +124,7 @@ android {
buildConfigField "Boolean", "FXA_USE_CHINA_SERVER", "false"
buildConfigField "String[]", "SPEECH_SERVICES", "{ com.igalia.wolvic.speech.SpeechServices.MEETKAI }"
buildConfigField "Boolean", "SUPPORTS_SYSTEM_NOTIFICATIONS", "false"
buildConfigField "Float", "DEFAULT_DENSITY", "1.25f"
buildConfigField "Float", "DEFAULT_DENSITY", "1.6f"
buildConfigField "Float", "DEFAULT_WINDOW_DISTANCE", "0.0f"
buildConfigField "Boolean", "ENABLE_PAGE_ZOOM", "false"

Expand Down Expand Up @@ -270,9 +270,10 @@ android {
externalNativeBuild {
cmake {
cppFlags " -DSPACES -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DSPACES=ON", "-DOPENXR=ON"
arguments "-DVR_SDK_LIB=spaces-lib", "-DSPACES=ON", "-DOPENXR=ON"
}
}
buildConfigField "Float", "DEFAULT_DENSITY", "1.6f"
}

aosp {
Expand Down Expand Up @@ -733,7 +734,7 @@ dependencies {
hvrImplementation 'com.huawei.hms:push:6.5.0.300'

// Snapdragon Spaces
spacesImplementation fileTree(dir: "${project.rootDir}/third_party/spaces", include: ['*.aar'])
//spacesImplementation fileTree(dir: "${project.rootDir}/third_party/spaces", include: ['*.aar'])

// Vision Glass
visionglassImplementation fileTree(dir: "${project.rootDir}/third_party/aliceimu/", include: ['*.aar'])
Expand Down
Binary file added app/src/chromium/assets/icudtl.dat
Binary file not shown.
Binary file added app/src/chromium/assets/snapshot_blob_64.bin
Binary file not shown.
Binary file added app/src/chromium/assets/wolvic.pak
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public void setLoginAutofillEnabled(final boolean enabled) {
boolean mFontInflationEnabled = false;
boolean mInputAutoZoom = true;
boolean mDoubleTapZooming = true;
int mGlMsaaLevel = 0;
int mGlMsaaLevel = 2;
String mLogLevel = "Debug";
boolean mConsoleServiceToLogcat = true;
boolean mDevToolsConsoleToLogcat = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ private void initializeControllers() {
} else if (deviceType == DeviceType.VisionGlass) {
addController(DeviceType.VisionGlass, WebXRInterstitialController.HAND_NONE);
}
else if (deviceType == DeviceType.SkyworthAVN) {
addController(DeviceType.SkyworthAVN, WebXRInterstitialController.HAND_LEFT);
addController(DeviceType.SkyworthAVN, WebXRInterstitialController.HAND_RIGHT);
}
for (UIWidget controller: mControllers) {
controller.getPlacement().parentHandle = getHandle();
mWidgetManager.addWidget(controller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class DeviceType {
// These values need to match those in Device.h
@IntDef(value = {Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2, PicoNeo3, OculusQuest2, HVR3DoF, HVR6DoF, Pico4x, MetaQuestPro, LynxR1, LenovoA3, LenovoVRX, MagicLeap2, MetaQuest3, VisionGlass, Pico4U})
@IntDef(value = {Unknown, OculusGo, OculusQuest, ViveFocus, ViveFocusPlus, PicoNeo2, PicoG2, PicoNeo3, OculusQuest2, HVR3DoF, HVR6DoF, Pico4x, MetaQuestPro, LynxR1, LenovoA3, LenovoVRX, MagicLeap2, MetaQuest3, VisionGlass, Pico4U, SkyworthAVN})
public @interface Type {}
public static final int Unknown = 0;
public static final int OculusGo = 1;
Expand All @@ -33,6 +33,7 @@ public class DeviceType {
public static final int MetaQuest3 = 18;
public static final int VisionGlass = 19;
public static final int Pico4U = 20;
public static final int SkyworthAVN = 21;

private static @Type int mType = Unknown;
private static String mDeviceName = "Unknown Device";
Expand Down Expand Up @@ -87,6 +88,9 @@ public static void setType(@Type int aType) {
case MetaQuest3:
mDeviceName = "Meta Quest 3";
break;
case SkyworthAVN:
mDeviceName = "Skyworth XR2 AVN";
break;
default:
mDeviceName = "Unknown Device";
break;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const DeviceType MagicLeap2 = 17;
const DeviceType MetaQuest3 = 18;
const DeviceType VisionGlass = 19;
const DeviceType Pico4U = 20;
const DeviceType SkyworthAVN = 21;

enum class TargetRayMode : uint8_t { Gaze, TrackedPointer, Screen };

Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/DeviceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ device::DeviceType DeviceUtils::GetDeviceTypeFromSystem() {
deviceNamesMap.emplace("VRX", device::LenovoVRX);
deviceNamesMap.emplace("Magic Leap 2", device::MagicLeap2);
deviceNamesMap.emplace("Pico Neo 3", device::PicoNeo3);
deviceNamesMap.emplace("CVR655128", device::SkyworthAVN);
}

auto device = deviceNamesMap.find(model);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/cpp/ExternalVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ mozilla::gfx::VRControllerType GetVRControllerTypeByDevice(device::DeviceType aT
result = mozilla::gfx::VRControllerType::HTCViveFocus;
break;
// FIXME: Gecko does not support VRX. Controllers look similar to ViveFocusPlus
case device::SkyworthAVN:
case device::LenovoVRX:
case device::ViveFocusPlus:
result = mozilla::gfx::VRControllerType::HTCViveFocusPlus;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/SplashAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SplashAnimation::Load(vrb::RenderContextPtr& aContext, const DeviceDelegatePtr&
return;
}
vrb::CreationContextPtr create = m.context.lock();
#if OCULUSVR || PICOXR
#if OCULUSVR || PICOXR || SPACES
VRB_GL_CHECK(glDisable(GL_FRAMEBUFFER_SRGB_EXT));
#endif
vrb::TextureGLPtr texture = create->LoadTexture("logo.png");
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/cpp/SystemUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
namespace crow {

#define ANDROID_OS_BUILD_ID "ro.build.display.id"
#define ANDROID_OS_MODEL_ID "ro.product.vendor.model"
//#define ANDROID_OS_MODEL_ID "ro.product.vendor.model"
//AVN VARIANT
#define ANDROID_OS_MODEL_ID "ro.product.model"

// Get the Build ID of the current Android system.
inline const char* GetBuildIdString(char* out) {
Expand Down
15 changes: 10 additions & 5 deletions app/src/openxr/cpp/DeviceDelegateOpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@

namespace crow {

const float SUPERSAMPLING_2D_FACTOR = 1.6f;
const float SUPERSAMPLING_XR_FACTOR = 1.2f;

struct HandMeshPropertiesMSFT {
uint32_t indexCount = 0;
uint32_t vertexCount = 0;
Expand Down Expand Up @@ -462,7 +465,9 @@ struct DeviceDelegateOpenXR::State {
CHECK(viewConfig.size() > 0);

immersiveDisplay->SetDeviceName(systemProperties.systemName);
immersiveDisplay->SetEyeResolution(viewConfig.front().recommendedImageRectWidth, viewConfig.front().recommendedImageRectHeight);
immersiveDisplay->SetEyeResolution(
viewConfig.front().recommendedImageRectWidth * SUPERSAMPLING_XR_FACTOR,
viewConfig.front().recommendedImageRectHeight * SUPERSAMPLING_XR_FACTOR);
immersiveDisplay->SetSittingToStandingTransform(vrb::Matrix::Translation(kAverageHeight));
auto toDeviceBlendModes = [](std::vector<XrEnvironmentBlendMode> aOpenXRBlendModes) {
std::vector<device::BlendMode> deviceBlendModes;
Expand Down Expand Up @@ -509,7 +514,7 @@ struct DeviceDelegateOpenXR::State {
}

XrSwapchainCreateInfo GetSwapChainCreateInfo(uint32_t w = 0, uint32_t h = 0) {
#if OCULUSVR
#if OCULUSVR || SPACES
const int64_t colorFormat = GL_SRGB8_ALPHA8;
#else
const int64_t colorFormat = GL_RGBA8;
Expand All @@ -519,8 +524,8 @@ struct DeviceDelegateOpenXR::State {
CHECK(viewConfig.size() > 0);

if (w == 0 || h == 0) {
w = viewConfig.front().recommendedImageRectWidth;
h = viewConfig.front().recommendedImageRectHeight;
w = viewConfig.front().recommendedImageRectWidth * SUPERSAMPLING_2D_FACTOR;
h = viewConfig.front().recommendedImageRectHeight * SUPERSAMPLING_2D_FACTOR;
}

XrSwapchainCreateInfo info{XR_TYPE_SWAPCHAIN_CREATE_INFO};
Expand Down Expand Up @@ -1064,7 +1069,7 @@ DeviceDelegateOpenXR::StartFrame(const FramePrediction aPrediction) {
return;
}

#if OCULUSVR || PICOXR
#if OCULUSVR || PICOXR || SPACES
// Fix brigthness issue.
glDisable(GL_FRAMEBUFFER_SRGB_EXT);
#endif
Expand Down
3 changes: 2 additions & 1 deletion app/src/openxr/cpp/OpenXRExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ void OpenXRExtensions::Initialize() {

// Adding this check here is ugly but required to have a working build for VRX. With the current
// runtime the controller poses freeze (always report same pose) if hand tracking is enabled.
if (DeviceUtils::GetDeviceTypeFromSystem() == device::LenovoVRX)
if (DeviceUtils::GetDeviceTypeFromSystem() == device::LenovoVRX ||
DeviceUtils::GetDeviceTypeFromSystem() == device::SkyworthAVN)
sSupportedExtensions.erase(XR_EXT_HAND_TRACKING_EXTENSION_NAME);

// API layers.
Expand Down
2 changes: 1 addition & 1 deletion app/src/openxr/cpp/OpenXRHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace crow {

// Threshold to consider a trigger value as a click
// Used when devices don't map the click value for triggers;
const float kClickThreshold = 0.91f;
const float kClickThreshold = 0.75f;

#if defined(HVR)
const vrb::Vector kAverageHeight(0.0f, 1.6f, 0.0f);
Expand Down
29 changes: 27 additions & 2 deletions app/src/openxr/cpp/OpenXRInputMappings.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,31 @@ namespace crow {
},
};

const OpenXRInputMapping SkyworthAVN {
"/interaction_profiles/oculus/touch_controller",
"CVR655_left.obj",
"CVR655_right.obj",
device::SkyworthAVN,
std::vector<OpenXRInputProfile> { "oculus-touch-v3", "oculus-touch-v2", "oculus-touch", "generic-trigger-squeeze-thumbstick" },
std::vector<OpenXRButton> {
{ OpenXRButtonType::Trigger, kPathTrigger, OpenXRButtonFlags::ValueTouch, OpenXRHandFlags::Both },
{ OpenXRButtonType::Squeeze, kPathSqueeze, OpenXRButtonFlags::Value, OpenXRHandFlags::Both },
{ OpenXRButtonType::Thumbstick, kPathThumbstick, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Both },
{ OpenXRButtonType::ButtonX, kPathButtonX, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Left },
{ OpenXRButtonType::ButtonY, kPathButtonY, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Left, },
{ OpenXRButtonType::ButtonA, kPathButtonA, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Right },
{ OpenXRButtonType::ButtonB, kPathButtonB, OpenXRButtonFlags::ClickTouch, OpenXRHandFlags::Right },
{ OpenXRButtonType::Thumbrest, kPathThumbrest, OpenXRButtonFlags::Touch, OpenXRHandFlags::Both },
{ OpenXRButtonType::Menu, kPathMenu, OpenXRButtonFlags::Click, OpenXRHandFlags::Left, ControllerDelegate::Button::BUTTON_APP, true }
},
std::vector<OpenXRAxis> {
{ OpenXRAxisType::Thumbstick, kPathThumbstick, OpenXRHandFlags::Both },
},
std::vector<OpenXRHaptic> {
{ kPathHaptic, OpenXRHandFlags::Both },
},
};

const OpenXRInputMapping MagicLeap2 {
"/interaction_profiles/ml/ml2_controller",
"",
Expand Down Expand Up @@ -475,8 +500,8 @@ namespace crow {
},
};

const std::array<OpenXRInputMapping, 15> OpenXRInputMappings {
OculusTouch, OculusTouch2, MetaQuestTouchPro, Pico4U, Pico4x, Pico4xOld, PicoNeo3, Hvr6DOF, Hvr3DOF, LenovoVRX, MagicLeap2, MetaTouchPlus, HandInteraction, MSFTHandInteraction, KHRSimple
const std::array<OpenXRInputMapping, 16> OpenXRInputMappings {
OculusTouch, OculusTouch2, MetaQuestTouchPro, Pico4U, Pico4x, Pico4xOld, PicoNeo3, Hvr6DOF, Hvr3DOF, LenovoVRX, MagicLeap2, MetaTouchPlus, SkyworthAVN, HandInteraction, MSFTHandInteraction, KHRSimple
};

} // namespace crow
Loading

0 comments on commit 45750a7

Please sign in to comment.