Skip to content

Initial ARCore integration - #203

Merged
bghgary merged 24 commits into
BabylonJS:masterfrom
ryantrem:ARCore2
Apr 7, 2020
Merged

Initial ARCore integration#203
bghgary merged 24 commits into
BabylonJS:masterfrom
ryantrem:ARCore2

Conversation

@ryantrem

@ryantrem ryantrem commented Apr 3, 2020

Copy link
Copy Markdown
Member

This change adds initial support for XR on Android via ARCore.

  • Moves XR.cpp (and some other associated files) into an OpenXR specific directory.
  • Adds a new XR.cpp that is backed by ARCore (instead of OpenXR).
  • Adds ARCore SDK as a submodule, and updates to cmake and gradle files to consume it.
  • Minor updates to Playground app to request camera permissions (this is harder to do inside the XR implementation, so I think making this a requirement of the caller for now is ok).
  • Adds a Platform class for Android with some platform specific stuff, particularly for getting a JNIEnv attached to the JS thread (@bghgary added this).

This all provides initial basic functionality, but there are a bunch of things that still need to be done:

  • Handling surface resizing/screen rotation.
  • Handling suspend resume.
  • Handling devices that don't support ARCore.
  • Checking for ARCore package installation on the device (this might be another thing that the consuming app is required to do, not sure yet).
  • Support for plane detection, hit testing, and anchors (needs to be plumbed through more layers because this is not supported in the pre-existing OpenXR implementation of XR.h).

throw std::runtime_error("Failed to get Java VM");
}

// TODO: This should be cleaned up via env->DeleteGlobalRef

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we fix this before merge?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote is no. I want to stop having to merge cmakelists.txt files :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, maybe we can file an issue on it.

Comment thread Apps/Playground/Android/build.gradle Outdated
Comment thread Apps/Playground/Android/gradle/wrapper/gradle-wrapper.properties Outdated
Comment on lines +14 to +16
# -------------------------------- GSL -----------------------------------
# Dependencies: none
add_subdirectory(arcana.cpp/Source/Submodules/GSL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using gsl::finally in xr.cpp to revert OpenGL state changes I make since we are taking over the gl context every frame (sharing it with Babylon rendering). Ideally we would use our own context that wraps the context used by Babylon rendering, but I never was able to get this to work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I'm a bit concerned about reaching into a dependency's dependency. Not sure what the implications are.

Comment thread Apps/Playground/Android/app/build.gradle Outdated
@bghgary
bghgary merged commit e2a3940 into BabylonJS:master Apr 7, 2020
@ryantrem ryantrem mentioned this pull request Apr 15, 2020
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants