-
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.
- Loading branch information
Showing
12 changed files
with
310 additions
and
61 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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,5 +1,17 @@ | ||
use bevy::prelude::*; | ||
|
||
#[cfg(feature = "person_matting")] | ||
pub mod matting; | ||
|
||
pub mod materials; | ||
pub mod mp4; | ||
pub mod stream; | ||
|
||
|
||
pub struct LightFieldPlugin; | ||
impl Plugin for LightFieldPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_plugins(materials::StreamMaterialsPlugin); | ||
app.add_plugins(stream::RtspStreamPlugin); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use bevy::{ | ||
prelude::*, | ||
asset::load_internal_asset, | ||
render::render_resource::*, | ||
}; | ||
|
||
|
||
const FOREGROUND_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(5231534123); | ||
|
||
pub struct ForegroundPlugin; | ||
impl Plugin for ForegroundPlugin { | ||
fn build(&self, app: &mut App) { | ||
load_internal_asset!( | ||
app, | ||
FOREGROUND_SHADER_HANDLE, | ||
"foreground.wgsl", | ||
Shader::from_wgsl | ||
); | ||
|
||
app.add_plugins(UiMaterialPlugin::<ForegroundMaterial>::default()); | ||
} | ||
} | ||
|
||
|
||
#[derive(AsBindGroup, Asset, TypePath, Debug, Clone)] | ||
pub struct ForegroundMaterial { | ||
#[texture(0)] | ||
#[sampler(1)] | ||
pub input: Handle<Image>, | ||
|
||
#[texture(2)] | ||
#[sampler(3)] | ||
pub mask: Handle<Image>, | ||
} | ||
|
||
impl UiMaterial for ForegroundMaterial { | ||
fn fragment_shader() -> ShaderRef { | ||
ShaderRef::Handle(FOREGROUND_SHADER_HANDLE) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#import bevy_ui::ui_vertex_output::UiVertexOutput | ||
|
||
|
||
@group(1) @binding(0) var foreground_texture: texture_2d<f32>; | ||
@group(1) @binding(1) var foreground_sampler: sampler; | ||
|
||
@group(1) @binding(2) var mask_texture: texture_2d<f32>; | ||
@group(1) @binding(3) var mask_sampler: sampler; | ||
|
||
|
||
@fragment | ||
fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> { | ||
return textureSample( | ||
foreground_texture, | ||
foreground_sampler, | ||
in.uv, | ||
) * textureSample( | ||
mask_texture, | ||
mask_sampler, | ||
in.uv, | ||
).x; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use bevy::prelude::*; | ||
|
||
pub mod foreground; | ||
|
||
|
||
pub struct StreamMaterialsPlugin; | ||
impl Plugin for StreamMaterialsPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_plugins(foreground::ForegroundPlugin); | ||
} | ||
} |
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.