Skip to content

Commit

Permalink
Add basic Scene API support (SceneModelProvider)
Browse files Browse the repository at this point in the history
  • Loading branch information
maunvz committed Dec 6, 2023
1 parent 3e0f4e5 commit f24721a
Show file tree
Hide file tree
Showing 14 changed files with 895 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scons target=template_debug -j4
scons target=template_release -j4
./gradlew build
1 change: 1 addition & 0 deletions godotopenxrmeta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ target_include_directories(${CMAKE_PROJECT_NAME}
${GODOT_CPP_INCLUDE_DIRECTORIES}
${OPENXR_HEADERS_DIR}
${OPENXR_MOBILE_HEADERS_DIR}
${CMAKE_SOURCE_DIR}/src/main/cpp/
)

target_link_libraries(${CMAKE_PROJECT_NAME}
Expand Down
3 changes: 3 additions & 0 deletions godotopenxrmeta/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
android:required="true"
android:version="1"/>

<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />
<uses-permission android:name="com.oculus.permission.USE_SCENE" />

<application>
<meta-data
android:name="org.godotengine.plugin.v2.GodotOpenXRMeta"
Expand Down
9 changes: 9 additions & 0 deletions godotopenxrmeta/src/main/cpp/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

#include "include/openxr_fb_scene_capture_extension_wrapper.h"

#include "scene/xr_scene_object.h"
#include "scene/scene_model_provider.h"
#include "scene/openxr_fb_scene_extension_wrapper.h"

using namespace godot;

void initialize_plugin_module(ModuleInitializationLevel p_level)
Expand All @@ -46,6 +50,11 @@ void initialize_plugin_module(ModuleInitializationLevel p_level)
{
ClassDB::register_class<OpenXRFbSceneCaptureExtensionWrapper>();
OpenXRFbSceneCaptureExtensionWrapper::get_singleton()->register_extension_wrapper();

ClassDB::register_class<XrSceneObject>();
ClassDB::register_class<SceneModelProvider>();
ClassDB::register_class<OpenXRFbSceneExtensionWrapper>();
memnew(OpenXRFbSceneExtensionWrapper)->register_extension_wrapper();
}
}

Expand Down
Loading

3 comments on commit f24721a

@maunvz
Copy link
Contributor Author

@maunvz maunvz commented on f24721a Dec 6, 2023

Choose a reason for hiding this comment

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

Copied in basic Scene API support from my private repo for reference, will break this down into more reasonable chunks, adapt to this repo's style, and address a few gaps in functionality. Notably:

  • Manifest changes should be an export plugin, not hardcoded
  • Need to add a demo that shows how to integrate into a scene from gdscript
  • Need to fully support volume and triangle mesh
  • Need to figure out how much to simplify for the gdscript user vs how closely to align with OpenXR practices
  • Do I use signals? callbacks? etc.

Will probably work on this in the coming weeks

@maunvz
Copy link
Contributor Author

@maunvz maunvz commented on f24721a Dec 7, 2023

Choose a reason for hiding this comment

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

oh just remembered another open question... do we have a pattern for stubbing these interfaces to test on mac / linux without a full OpenXR runtime? See xr_scene_provider_fake.h - on mac and linux that gives me sample data so I can iterate quickly without deploying to the headset.

I could fake this at the monado layer on Linux, but not an option on mac...

cc @m4gr3d for this question and the ones in previous comment

@m4gr3d
Copy link
Collaborator

@m4gr3d m4gr3d commented on f24721a Dec 7, 2023

Choose a reason for hiding this comment

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

  • Manifest changes should be an export plugin, not hardcoded

For this, keep an eye on #61. That PR is migrating the export logic from gdscript to c++ via gdextension, so I'd wait until it's submitted before making those changes, or rebase on top of it.

oh just remembered another open question... do we have a pattern for stubbing these interfaces to test on mac / linux without a full OpenXR runtime? See xr_scene_provider_fake.h - on mac and linux that gives me sample data so I can iterate quickly without deploying to the headset.

We don't have a defined pattern but your approach looks good, and we may make this the norm going forward!

I could fake this at the monado layer on Linux, but not an option on mac...

We're planning to integrate the Meta XR simulator so that would be another option as well.

Please sign in to comment.