Skip to content

mvvvv/stereokit-template

Repository files navigation

Template for a basic stereokit-rust program

There are two other templates (see the branches) if you prefer to use gradle for android or if you do not want to use winit and want to have an android version (gradle then being the only solution available)

If you never used stereokit-rust before, you have to install the prerequisites:

See installation and how to build and test your application

In order to use the build_sk_rs or compile_sks command you have to 'install' the project: cargo install -F event-loop stereokit-rust

Download this template:

Then, go to the Stereokit-template project and transform it to your project:

  • by renaming the name, package and labels in Cargo.toml,
  • and removing the .git in order to create yours,

Run your project on your PC's headset:

  • Make sure you have OpenXR installed with an active runtine.
  • Launch: cargo run (using Wayland on Linux may require to unset temporarily the DISPLAY variable: DISPLAY= cargo run)

Run your project on your PC using the simulator:

  • Launch: cargo run -- --test

if you want to give a more useful name to you executable (i.e.my_main_app), you'll have to use the --bin option: cargo run --bin my_main_app -- --test

If you're using VsCode you'll see two launchers in launch.json to debug the project.

Build and create an exportable repository of your PC VR/MR program:

cargo build_sk_rs --bin main <the path of your exportable repository>

Run the project on your Android headset:

  • Launch: cargo apk run --lib

Build the release versions of your project:

For Android you'll have to set a keystore. See cargo-apk to store the path and keyword

  • Desktop : cargo build --release if you want to give a more useful name to you executable (i.e.my_main_app), you'll have to use the --bin option: cargo build --release --bin my_main_app
  • Android : cargo apk build --lib --release

Binaries and APK archives are produced under ./target/release

Compile shaders

Important: By default build_sk_rs compiles the shaders optimally for the target platform.

compile_sks calls the stereokit binary skshaderc using the following configuration:

  • The shaders (*.hlsl files) must be created inside the shaders_src directory inside the root directory of your project.
  • The result (*.hlsl.sks files) will be produced inside the assets/shaders directory inside the root directory of your project.

To compile the *.hlsl files, go to the root directory of your project then launch cargo compile_sks

Run the documentation tests:

This is the regular way to run the doc tests: cargo test --doc or cargo test but screenshots will fail on Wayland because of the DISPLAY variable. So you have to unset it before running the tests: DISPLAY= cargo test

Troubleshooting

Submit bugs on the Issues tab, and ask questions in the Discussions tab!

The project https://github.com/StereoKit/StereoKit/ will give you many useful links (Discord/Twitter/Blog)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published