Compare commits
3 Commits
0bdc962e2c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c6efe1498b | |||
| e43a22931c | |||
| 530fac29dc |
@@ -24,12 +24,12 @@ impl Plugin for MessageLoopPlugin {
|
||||
|
||||
let mut cef_app =
|
||||
BrowserProcessAppBuilder::build(tx, self.config.clone(), self.extensions.clone());
|
||||
let ret = execute_process(
|
||||
let _ = execute_process(
|
||||
Some(args.as_main_args()),
|
||||
Some(&mut cef_app),
|
||||
std::ptr::null_mut(),
|
||||
);
|
||||
assert_eq!(ret, -1, "cannot execute browser process");
|
||||
// assert_eq!(ret, -1, "cannot execute browser process");
|
||||
|
||||
cef_initialize(&args, &mut cef_app);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
}
|
||||
#import webview::util::{
|
||||
surface_color,
|
||||
overlay_color,
|
||||
}
|
||||
|
||||
@fragment
|
||||
@@ -19,14 +20,12 @@ fn fragment(
|
||||
@builtin(front_facing) is_front: bool,
|
||||
) -> FragmentOutput {
|
||||
var out: FragmentOutput;
|
||||
var pbr_input = pbr_input_from_standard_material(in, is_front);
|
||||
|
||||
var alpha = pbr_input.material.base_color.a;
|
||||
pbr_input.material.base_color *= surface_color(in.uv);
|
||||
// pbr_input.material.base_color = alpha_discard(pbr_input.material, pbr_input.material.base_color);
|
||||
var surface = surface_color(in.uv);
|
||||
var overlay = overlay_color(in.uv);
|
||||
var result_rgb = mix(surface.rgb, overlay.rgb, overlay.a);
|
||||
|
||||
out.color = pbr_input.material.base_color * alpha;
|
||||
// out.color.a *= alpha;
|
||||
out.color = vec4(result_rgb, 1.0);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ pub struct WebviewMaterial {
|
||||
#[texture(101)]
|
||||
#[sampler(102)]
|
||||
pub surface: Option<Handle<Image>>,
|
||||
#[texture(103)]
|
||||
#[sampler(104)]
|
||||
pub overlay: Option<Handle<Image>>,
|
||||
}
|
||||
|
||||
impl Material for WebviewMaterial {}
|
||||
|
||||
@@ -8,7 +8,13 @@
|
||||
@group(#{MATERIAL_BIND_GROUP}) @binding(101) var surface_texture: texture_2d<f32>;
|
||||
@group(#{MATERIAL_BIND_GROUP}) @binding(102) var surface_sampler: sampler;
|
||||
|
||||
@group(#{MATERIAL_BIND_GROUP}) @binding(103) var overlay_texture: texture_2d<f32>;
|
||||
@group(#{MATERIAL_BIND_GROUP}) @binding(104) var overlay_sampler: sampler;
|
||||
|
||||
fn surface_color(uv: vec2<f32>) -> vec4<f32> {
|
||||
// let flip = vec2(1.0 - uv.x, uv.y);
|
||||
return textureSampleBias(surface_texture, surface_sampler, uv, view.mip_bias);
|
||||
}
|
||||
|
||||
fn overlay_color(uv: vec2<f32>) -> vec4<f32> {
|
||||
return textureSampleBias(overlay_texture, overlay_sampler, uv, view.mip_bias);
|
||||
}
|
||||
Reference in New Issue
Block a user