-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a stable release of the following: - xrlib: core - instance, session, input - xrlib: thread pool manager (helper class for apps to handle multithreading tailored for xr) - xrlib: essential extensions helper classes (vismask, handtracking, fb passthrough, fb triangle mesh, fb display refresh rate) - xrvk: core: pbr rendering (approx ibl only via spherical harmonics), custom pipeline helpers - xrvk: gltf loading via tinygltf, msaa support, multiview rendering as default - xrvk: renderdoc enable/disable, custom shaders (primitives, pbr, sky, floor)
- Loading branch information
Showing
77 changed files
with
9,310 additions
and
1,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "third_party/openxr"] | ||
path = third_party/openxr | ||
url = https://github.com/1runeberg/OpenXR-SDK-xrlib.git | ||
[submodule "third_party/tinygltf"] | ||
path = third_party/tinygltf | ||
url = https://github.com/syoyo/tinygltf.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,161 @@ | ||
# xrlib | ||
[![android-latest](https://github.com/1runeberg/xrlib/actions/workflows/android_builds.yml/badge.svg)](https://github.com/1runeberg/xrlib/actions/workflows/android_builds.yml) [![ubuntu-latest](https://github.com/1runeberg/xrlib/actions/workflows/ubuntu_builds.yml/badge.svg)](https://github.com/1runeberg/xrlib/actions/workflows/ubuntu_builds.yml) [![windows-latest](https://github.com/1runeberg/xrlib/actions/workflows/windows_builds.yml/badge.svg)](https://github.com/1runeberg/xrlib/actions/workflows/windows_builds.yml) | ||
|
||
C++20 OpenXR wrapper library designed to abstract the complexities of the OpenXR API while retaining its flexibility, allowing developers to focus on creating immersive experiences without getting bogged down by low-level details. The library is Vulkan-native and includes an optional PBR renderer, designed from the ground up with mixed reality in mind. | ||
A modern OpenXR wrapper library written in C++20 that streamlines XR development while maintaining OpenXR's full capabilities. Built with native Vulkan support, it abstracts complex API interactions without sacrificing performance or flexibility. | ||
|
||
## Note | ||
This repository currently hosts a simplified version of an internal, comprehensive rewrite of [OpenXRProvider_v2](https://github.com/1runeberg/OpenXRProvider_v2). | ||
The library features an optional physically-based rendering (PBR) engine specifically optimized for mixed reality applications, enabling developers to create high-fidelity immersive experiences with minimal boilerplate code. | ||
|
||
The internal library is significantly more advanced but is still in active development as the rewrite is in conjunction with development of a full-featured mixed reality application, scheduled for release by [Beyond Reality Labs](https://beyondreality.io). To avoid backward-incompatible changes, only the most stable components of the rewritten library are made available here. | ||
Developers can also quickly bootstrap immersive experiences by inheriting from `XrApp` (link to demos), or leverage the library's individual components for custom implementations. | ||
|
||
## Demos | ||
Explore xrlib's capabilities through a collection of example applications available at [xrlib-demos](https://github.com/1runeberg/xrlib-demos). These demos showcase: | ||
|
||
- [checkxr](https://github.com/1runeberg/xrlib-demos/tree/main/demo-01_checkxr) - Runtime capability querying and inspection | ||
- [displayxr](https://github.com/1runeberg/xrlib-demos/tree/main/demo-02_displayxr) - Basic XR visualization and rendering | ||
- [passthroughxr](https://github.com/1runeberg/xrlib-demos/tree/main/demo-03_passthroughxr) - Meta Quest Passthrough implementation | ||
- [handtrackingxr](https://github.com/1runeberg/xrlib-demos/tree/main/demo-04_handtrackingxr) - Hand tracking visualization | ||
- [inputxr](https://github.com/1runeberg/xrlib-demos/tree/main/demo-05_inputxr) - Full-featured input handling, multi-threading via xrlib's xr dynamic thread pool manager, and PBR rendering | ||
|
||
Each demo provides clear, practical implementation examples designed to highlight specific xrlib features. Desktop (Windows, Linux) and Android builds are supported for all demos. | ||
|
||
## Building | ||
|
||
### Prerequisites | ||
|
||
1. Required Tools | ||
- CMake 3.22 or higher | ||
- C++20 compatible compiler | ||
- Vulkan SDK (from [https://vulkan.lunarg.com/](https://vulkan.lunarg.com/)) | ||
- glslc (Vulkan shader compiler, included in Vulkan SDK) | ||
|
||
2. Optional Tools | ||
- RenderDoc (if building with debug features) | ||
|
||
### Building the Library | ||
|
||
1. Clone the Repository | ||
```bash | ||
git clone [repository-url] | ||
cd xrlib | ||
``` | ||
|
||
2. Configure Build Options | ||
|
||
The following CMake options are available: | ||
|
||
#### Basic Options | ||
- `BUILD_AS_STATIC`: Build as static library (default: OFF) | ||
- `BUILD_SHADERS`: Build shaders in resource directory (default: ON) | ||
- `ENABLE_XRVK`: Compile xrvk - PBR render module (default: ON) | ||
|
||
#### Debug Options (Desktop only) | ||
- `ENABLE_RENDERDOC`: Enable RenderDoc for render debugging (default: ON) | ||
- `ENABLE_VULKAN_DEBUG`: Enable Vulkan debugging (default: OFF) | ||
|
||
#### Extension Exclusion Options | ||
- `EXCLUDE_KHR_VISIBILITY_MASK`: Exclude KHR visibility mask extension (default: OFF) | ||
- `EXCLUDE_EXT_HAND_TRACKING`: Exclude hand tracking extension (default: OFF) | ||
- `EXCLUDE_FB_DISPLAY_REFRESH`: Exclude display refresh rate extension (default: OFF) | ||
- `EXCLUDE_FB_PASSTHROUGH`: Exclude passthrough extension (default: OFF) | ||
|
||
3. Configure and Build | ||
|
||
#### Windows | ||
```bash | ||
# Create build directory | ||
mkdir build | ||
cd build | ||
# Configure with CMake | ||
cmake .. | ||
# Build | ||
cmake --build . --config Release | ||
``` | ||
|
||
#### Linux | ||
```bash | ||
# Create build directory | ||
mkdir build | ||
cd build | ||
# Configure with CMake | ||
cmake .. | ||
# Build | ||
make | ||
``` | ||
|
||
#### Android | ||
Additional requirements: | ||
- Android NDK | ||
- Android native app glue | ||
|
||
```bash | ||
# Create build directory | ||
mkdir build | ||
cd build | ||
# Configure with CMake (adjust paths as needed) | ||
cmake .. -DANDROID=ON -DANDROID_NDK=/path/to/ndk | ||
# Build | ||
cmake --build . | ||
``` | ||
|
||
4. Output Locations | ||
|
||
After successful build, you'll find the outputs in: | ||
- Binaries: `./bin/` | ||
- Libraries: `./lib/` | ||
- Shader binaries (if enabled): `./res/shaders/bin/` | ||
## Advanced Configuration | ||
### Custom Build Configuration Example | ||
```bash | ||
cmake .. \ | ||
-DBUILD_AS_STATIC=ON \ | ||
-DENABLE_VULKAN_DEBUG=ON \ | ||
-DEXCLUDE_FB_PASSTHROUGH=ON | ||
``` | ||
### Debug Build | ||
```bash | ||
# Configure debug build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
# Build | ||
cmake --build . --config Debug | ||
``` | ||
## Verification | ||
To verify your build: | ||
1. Check that the library files exist in the `lib` directory | ||
2. If building with shaders enabled, verify shader `.spv` files exist in `res/shaders/bin` | ||
3. For debug builds, ensure debug symbols are present | ||
## Troubleshooting | ||
### Common Issues | ||
1. **Vulkan SDK Not Found** | ||
- Ensure Vulkan SDK is installed | ||
- Verify `VULKAN_SDK` environment variable is set correctly | ||
2. **Shader Compilation Fails** | ||
- Verify `glslc` is in your PATH | ||
- Check shader source files in `res/shaders/src` | ||
3. **Android Build Issues** | ||
- Verify NDK path is correct | ||
- Ensure native app glue is available in NDK | ||
## Development | ||
When developing with the library: | ||
- Header files are in `include` directory | ||
- Source files are in `src` directory | ||
- Shader sources are in `res/shaders/src` | ||
- Build artifacts are placed in `bin` and `lib` directories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
/* | ||
* xrlib | ||
* Copyright 2024 Rune Berg (http://runeberg.io | https://github.com/1runeberg) | ||
* Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) | ||
* Copyright 2024,2025 Copyright Rune Berg | ||
* https://github.com/1runeberg | http://runeberg.io | https://runeberg.social | https://www.youtube.com/@1RuneBerg | ||
* Licensed under Apache 2.0: https://www.apache.org/licenses/LICENSE-2.0 | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* This work is the next iteration of OpenXRProvider (v1, v2) | ||
* OpenXRProvider (v1): Released 2021 - https://github.com/1runeberg/OpenXRProvider | ||
* OpenXRProvider (v2): Released 2022 - https://github.com/1runeberg/OpenXRProvider_v2/ | ||
* v1 & v2 licensed under MIT: https://opensource.org/license/mit | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
#include <xrlib/session.hpp> | ||
#include <xrlib/input.hpp> | ||
#include <xrlib/vulkan.hpp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.