Skip to content

Commit

Permalink
feat: perftest feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure committed Jan 2, 2024
1 parent 507a28d commit 1166519
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bevy_gaussian_splatting"
description = "bevy gaussian splatting render pipeline plugin"
version = "2.0.0"
version = "2.0.1"
edition = "2021"
authors = ["mosure <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -88,6 +88,8 @@ sort_std = []

tooling = ["byte-unit"]

perftest = []

viewer = [
"bevy-inspector-egui",
"bevy_panorbit_camera",
Expand Down
14 changes: 11 additions & 3 deletions src/render/planar.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
}


#ifdef PLANAR_F16

fn get_color(
index: u32,
ray_direction: vec3<f32>,
Expand All @@ -22,9 +24,6 @@ fn get_color(
return srgb_to_linear(color);
}


#ifdef PLANAR_F16

fn get_position(index: u32) -> vec3<f32> {
return position_visibility[index].xyz;
}
Expand Down Expand Up @@ -73,6 +72,15 @@ fn get_visibility(index: u32) -> f32 {


#ifdef PLANAR_F32
fn get_color(
index: u32,
ray_direction: vec3<f32>,
) -> vec3<f32> {
let sh = get_spherical_harmonics(index);
let color = spherical_harmonics_lookup(ray_direction, sh);
return srgb_to_linear(color);
}

fn get_position(index: u32) -> vec3<f32> {
return position_visibility[index].xyz;
}
Expand Down
1 change: 1 addition & 0 deletions src/render/texture.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
};
#import bevy_gaussian_splatting::spherical_harmonics::{
shc,
spherical_harmonics_lookup,
srgb_to_linear,
}

Expand Down
14 changes: 12 additions & 2 deletions viewer/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,30 @@ fn example_app() {
let primary_window = Some(Window {
fit_canvas_to_parent: true,
mode: bevy::window::WindowMode::Windowed,
present_mode: bevy::window::PresentMode::AutoVsync,
prevent_default_event_handling: true,
title: config.name.clone(),

#[cfg(feature = "perftest")]
present_mode: bevy::window::PresentMode::AutoNoVsync,
#[cfg(not(feature = "perftest"))]
present_mode: bevy::window::PresentMode::AutoVsync,

..default()
});

#[cfg(not(target_arch = "wasm32"))]
let primary_window = Some(Window {
fit_canvas_to_parent: true,
mode: bevy::window::WindowMode::Windowed,
present_mode: bevy::window::PresentMode::AutoVsync,
prevent_default_event_handling: false,
resolution: (config.width, config.height).into(),
title: config.name.clone(),

#[cfg(feature = "perftest")]
present_mode: bevy::window::PresentMode::AutoNoVsync,
#[cfg(not(feature = "perftest"))]
present_mode: bevy::window::PresentMode::AutoVsync,

..default()
});

Expand Down

0 comments on commit 1166519

Please sign in to comment.