refactor: create OxrSessionConfig and make that the only way to configure things like BlendModes
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,27 +1,28 @@
|
||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||
|
||||
use bevy::{prelude::*, render::pipelined_rendering::PipelinedRenderingPlugin};
|
||||
use bevy_mod_openxr::{add_xr_plugins, init::OxrInitPlugin};
|
||||
use bevy_mod_openxr::{add_xr_plugins, resources::OxrSessionConfig};
|
||||
use openxr::EnvironmentBlendMode;
|
||||
|
||||
fn main() {
|
||||
fn main() -> AppExit {
|
||||
App::new()
|
||||
.add_plugins(
|
||||
add_xr_plugins(DefaultPlugins.build().disable::<PipelinedRenderingPlugin>()).set(
|
||||
OxrInitPlugin {
|
||||
blend_modes: Some(vec![
|
||||
EnvironmentBlendMode::ALPHA_BLEND,
|
||||
EnvironmentBlendMode::ADDITIVE,
|
||||
EnvironmentBlendMode::OPAQUE,
|
||||
]),
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
)
|
||||
.add_plugins(add_xr_plugins(
|
||||
// Disabling Pipelined Rendering should reduce latency a little bit for button inputs
|
||||
// and increase accuracy for hand tracking, controller positions and similar,
|
||||
// the views are updated right before rendering so they are as accurate as possible
|
||||
DefaultPlugins.build().disable::<PipelinedRenderingPlugin>(),
|
||||
))
|
||||
.insert_resource(OxrSessionConfig {
|
||||
blend_modes: Some(vec![
|
||||
EnvironmentBlendMode::ALPHA_BLEND,
|
||||
EnvironmentBlendMode::OPAQUE,
|
||||
]),
|
||||
..default()
|
||||
})
|
||||
.add_plugins(bevy_xr_utils::hand_gizmos::HandGizmosPlugin)
|
||||
.add_systems(Startup, setup)
|
||||
.insert_resource(ClearColor(Color::NONE))
|
||||
.run();
|
||||
.run()
|
||||
}
|
||||
|
||||
/// set up a simple 3D scene
|
||||
|
||||
Reference in New Issue
Block a user