@dcl-regenesislabs/bevy-explorer-web 0.1.0-18354928058.commit-b951631 → 0.1.0-18381724482.commit-d31fa29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -1
- package/index.html +2 -2
- package/main.js +4 -3
- package/package.json +3 -3
- package/pkg/webgpu_build.d.ts +8 -8
- package/pkg/webgpu_build.js +51 -51
- package/pkg/webgpu_build_bg.wasm +0 -0
- package/pkg/webgpu_build_bg.wasm.d.ts +8 -8
- package/assets/animations/Dance_Female.glb +0 -0
- package/assets/animations/Dance_Male.glb +0 -0
- package/assets/animations/F_FistPump.glb +0 -0
- package/assets/animations/F_RobotDance.glb +0 -0
- package/assets/animations/Hands_Air.glb +0 -0
- package/assets/animations/M_FistPump.glb +0 -0
- package/assets/animations/M_RobotDance.glb +0 -0
- package/assets/animations/Raise_Hand.glb +0 -0
- package/assets/animations/Throw Money-Emote.glb +0 -0
- package/assets/animations/Wave_Female.glb +0 -0
- package/assets/animations/Wave_Male.glb +0 -0
- package/assets/animations/clap.glb +0 -0
- package/assets/animations/disco_dance.glb +0 -0
- package/assets/animations/dont_wanna_see.glb +0 -0
- package/assets/animations/f_head_explode.glb +0 -0
- package/assets/animations/idle.glb +0 -0
- package/assets/animations/jump2.glb +0 -0
- package/assets/animations/kiss.glb +0 -0
- package/assets/animations/m_head_explode.glb +0 -0
- package/assets/animations/mchammer-dance.glb +0 -0
- package/assets/animations/run.glb +0 -0
- package/assets/animations/shrug.glb +0 -0
- package/assets/animations/tektonik-dance.glb +0 -0
- package/assets/animations/thumbnails/clap.png +0 -0
- package/assets/animations/thumbnails/dance.png +0 -0
- package/assets/animations/thumbnails/disco.png +0 -0
- package/assets/animations/thumbnails/dontsee.png +0 -0
- package/assets/animations/thumbnails/fistpump.png +0 -0
- package/assets/animations/thumbnails/hammer.png +0 -0
- package/assets/animations/thumbnails/handsair.png +0 -0
- package/assets/animations/thumbnails/headexplode.png +0 -0
- package/assets/animations/thumbnails/kiss.png +0 -0
- package/assets/animations/thumbnails/money.png +0 -0
- package/assets/animations/thumbnails/raisehand.png +0 -0
- package/assets/animations/thumbnails/robot.png +0 -0
- package/assets/animations/thumbnails/shrug.png +0 -0
- package/assets/animations/thumbnails/tektonik.png +0 -0
- package/assets/animations/thumbnails/tik.png +0 -0
- package/assets/animations/thumbnails/wave.png +0 -0
- package/assets/animations/tik-tok-dance.glb +0 -0
- package/assets/animations/walk.glb +0 -0
- package/assets/fonts/NotoSans-Bold.ttf +0 -0
- package/assets/fonts/NotoSans-BoldItalic.ttf +0 -0
- package/assets/fonts/NotoSans-Italic.ttf +0 -0
- package/assets/fonts/NotoSans-Regular.ttf +0 -0
- package/assets/fonts/NotoSansMono-Bold.ttf +0 -0
- package/assets/fonts/NotoSansMono-Regular.ttf +0 -0
- package/assets/fonts/NotoSerif-Bold.ttf +0 -0
- package/assets/fonts/NotoSerif-BoldItalic.ttf +0 -0
- package/assets/fonts/NotoSerif-Italic.ttf +0 -0
- package/assets/fonts/NotoSerif-Regular.ttf +0 -0
- package/assets/fonts/OFL.txt +0 -93
- package/assets/images/FriendsIcon.png +0 -0
- package/assets/images/ask.png +0 -0
- package/assets/images/backpack/Background.jpeg +0 -0
- package/assets/images/backpack/empty.png +0 -0
- package/assets/images/backpack/item_bg.png +0 -0
- package/assets/images/backpack/wearable_categories/body_shape.png +0 -0
- package/assets/images/backpack/wearable_categories/earring.png +0 -0
- package/assets/images/backpack/wearable_categories/eyebrows.png +0 -0
- package/assets/images/backpack/wearable_categories/eyes.png +0 -0
- package/assets/images/backpack/wearable_categories/eyewear.png +0 -0
- package/assets/images/backpack/wearable_categories/facial_hair.png +0 -0
- package/assets/images/backpack/wearable_categories/feet.png +0 -0
- package/assets/images/backpack/wearable_categories/hair.png +0 -0
- package/assets/images/backpack/wearable_categories/hands_wear.png +0 -0
- package/assets/images/backpack/wearable_categories/hat.png +0 -0
- package/assets/images/backpack/wearable_categories/helmet.png +0 -0
- package/assets/images/backpack/wearable_categories/lower_body.png +0 -0
- package/assets/images/backpack/wearable_categories/mask.png +0 -0
- package/assets/images/backpack/wearable_categories/mouth.png +0 -0
- package/assets/images/backpack/wearable_categories/skin.png +0 -0
- package/assets/images/backpack/wearable_categories/tiara.png +0 -0
- package/assets/images/backpack/wearable_categories/top_head.png +0 -0
- package/assets/images/backpack/wearable_categories/upper_body.png +0 -0
- package/assets/images/button copy.png +0 -0
- package/assets/images/button.png +0 -0
- package/assets/images/button_base.png +0 -0
- package/assets/images/chat_button.png +0 -0
- package/assets/images/copy.png +0 -0
- package/assets/images/crosshair.png +0 -0
- package/assets/images/cursor.png +0 -0
- package/assets/images/dao_small.png +0 -0
- package/assets/images/dcl-godot-bevy.png +0 -0
- package/assets/images/discover/art.png +0 -0
- package/assets/images/discover/business.png +0 -0
- package/assets/images/discover/casino.png +0 -0
- package/assets/images/discover/crypto.png +0 -0
- package/assets/images/discover/education.png +0 -0
- package/assets/images/discover/eye.png +0 -0
- package/assets/images/discover/fashion.png +0 -0
- package/assets/images/discover/featured.png +0 -0
- package/assets/images/discover/game.png +0 -0
- package/assets/images/discover/icons.png +0 -0
- package/assets/images/discover/music.png +0 -0
- package/assets/images/discover/point of interest.png +0 -0
- package/assets/images/discover/shop.png +0 -0
- package/assets/images/discover/social.png +0 -0
- package/assets/images/discover/sports.png +0 -0
- package/assets/images/discover/thumbsup.png +0 -0
- package/assets/images/emote-button-background.png +0 -0
- package/assets/images/emote_button.png +0 -0
- package/assets/images/genesis_tx.png +0 -0
- package/assets/images/grid.png +0 -0
- package/assets/images/grip.png +0 -0
- package/assets/images/left-arrow.png +0 -0
- package/assets/images/line.png +0 -0
- package/assets/images/mic_button_inactive.png +0 -0
- package/assets/images/mic_button_off.png +0 -0
- package/assets/images/mic_button_on.png +0 -0
- package/assets/images/next.png +0 -0
- package/assets/images/person.png +0 -0
- package/assets/images/person_button.png +0 -0
- package/assets/images/profile_button.png +0 -0
- package/assets/images/redx.png +0 -0
- package/assets/images/right-arrow.png +0 -0
- package/assets/images/screenshots/montage.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_avatar_attach_1.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_avatar_attach_2.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_avatar_attach_3.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_avatar_attach_4.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_gltfcontainer_avocado.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_gltfcontainer_hev.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_01.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_02.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_03.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_04.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_05.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_06.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_07.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_08.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_09.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_10.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_11.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_12.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_13.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_material_14.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_mesh_renderer_box.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_mesh_renderer_cylinder.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_mesh_renderer_plane.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_mesh_renderer_sphere.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_1.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_2.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_3.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_4.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_5.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_text_shape_6.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_ui_background_all_screen_green.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_ui_background_all_screen_red.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_ui_background_all_screen_rocks.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_ui_text_1.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_ui_text_2.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_video_player_1.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_video_player_2.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_video_player_3.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_video_player_4.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_visibility_false.png.png +0 -0
- package/assets/images/screenshots/screenshot%2Fbevy_snapshot_visibility_true.png.png +0 -0
- package/assets/images/skybox/skybox_cubemap.png +0 -0
- package/assets/images/skybox/skybox_cubemap_original.png +0 -0
- package/assets/images/spinner.png +0 -0
- package/assets/images/spinner_atlas.png +0 -0
- package/assets/images/tick.png +0 -0
- package/assets/images/toggle-off.png +0 -0
- package/assets/images/toggle-on.png +0 -0
- package/assets/images/unknown_person.png +0 -0
- package/assets/images/you_are_here.png +0 -0
- package/assets/nft_shapes/Baroque_Ornament.glb +0 -0
- package/assets/nft_shapes/Blocky.glb +0 -0
- package/assets/nft_shapes/Canvas.glb +0 -0
- package/assets/nft_shapes/Classic.glb +0 -0
- package/assets/nft_shapes/Diamond_Ornament.glb +0 -0
- package/assets/nft_shapes/Floor_Wood01.png +0 -0
- package/assets/nft_shapes/Genesis_TX.png +0 -0
- package/assets/nft_shapes/Gold_Carved.glb +0 -0
- package/assets/nft_shapes/Gold_Edges.glb +0 -0
- package/assets/nft_shapes/Gold_Rounded.glb +0 -0
- package/assets/nft_shapes/Gold_Wide.glb +0 -0
- package/assets/nft_shapes/Metal_Medium.glb +0 -0
- package/assets/nft_shapes/Metal_Rounded.glb +0 -0
- package/assets/nft_shapes/Metal_Slim.glb +0 -0
- package/assets/nft_shapes/Metal_Wide.glb +0 -0
- package/assets/nft_shapes/Minimal_Black.glb +0 -0
- package/assets/nft_shapes/Minimal_Grey.glb +0 -0
- package/assets/nft_shapes/Minimal_White.glb +0 -0
- package/assets/nft_shapes/Minimal_Wide.glb +0 -0
- package/assets/nft_shapes/MulticolorDotsLoading.png +0 -0
- package/assets/nft_shapes/NFTIcon.png +0 -0
- package/assets/nft_shapes/NoneIcon.png +0 -0
- package/assets/nft_shapes/Pins.glb +0 -0
- package/assets/nft_shapes/Tape.glb +0 -0
- package/assets/nft_shapes/Wood_Slim.glb +0 -0
- package/assets/nft_shapes/Wood_Twigs.glb +0 -0
- package/assets/nft_shapes/Wood_Wide.glb +0 -0
- package/assets/shaders/bound_material.wgsl +0 -183
- package/assets/shaders/bound_material_baker.wgsl +0 -145
- package/assets/shaders/bound_node.wgsl +0 -57
- package/assets/shaders/bound_prepass.wgsl +0 -160
- package/assets/shaders/floor_bake.wgsl +0 -30
- package/assets/shaders/floor_fragment.wgsl +0 -74
- package/assets/shaders/floor_vertex.wgsl +0 -47
- package/assets/shaders/loading.wgsl +0 -35
- package/assets/shaders/mask_material.wgsl +0 -117
- package/assets/shaders/nineslice_material.wgsl +0 -47
- package/assets/shaders/nishita_cloud.wgsl +0 -378
- package/assets/shaders/outline.wgsl +0 -69
- package/assets/shaders/simplex.wgsl +0 -77
- package/assets/shaders/stretch_uv_material.wgsl +0 -79
- package/assets/shaders/text_quad_vertex.wgsl +0 -78
- package/assets/sounds/avatar/avatar_footstep_jump01.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_jump02.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_jump03.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_land01.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_land02.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run01.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run02.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run03.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run04.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run05.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run06.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run07.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_run08.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk01.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk02.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk03.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk04.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk05.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk06.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk07.wav +0 -0
- package/assets/sounds/avatar/avatar_footstep_walk08.wav +0 -0
- package/assets/sounds/ui/generic_button_hover.wav +0 -0
- package/assets/sounds/ui/generic_button_press.wav +0 -0
- package/assets/sounds/ui/mainmenu_widget_open.wav +0 -0
- package/assets/sounds/ui/toggle_disable.wav +0 -0
- package/assets/sounds/ui/toggle_enable.wav +0 -0
- package/assets/sounds/ui/voice_chat_mic_off.wav +0 -0
- package/assets/sounds/ui/voice_chat_mic_on.wav +0 -0
- package/assets/sounds/ui/widget_chat_message_private_send.wav +0 -0
- package/assets/sounds/ui/widget_emotes_close.wav +0 -0
- package/assets/sounds/ui/widget_emotes_highlight.wav +0 -0
- package/assets/sounds/ui/widget_emotes_open.wav +0 -0
- package/assets/ui/app_settings.dui +0 -91
- package/assets/ui/avatar.dui +0 -18
- package/assets/ui/button.dui +0 -78
- package/assets/ui/change-realm.dui +0 -46
- package/assets/ui/chat.dui +0 -182
- package/assets/ui/combo.dui +0 -23
- package/assets/ui/dialog.dui +0 -46
- package/assets/ui/discover.dui +0 -139
- package/assets/ui/emote-select.dui +0 -45
- package/assets/ui/emote.dui +0 -116
- package/assets/ui/foreign-profile-dialog.dui +0 -18
- package/assets/ui/fullscreen-block.dui +0 -12
- package/assets/ui/login.dui +0 -72
- package/assets/ui/map.dui +0 -8
- package/assets/ui/minimap.dui +0 -16
- package/assets/ui/motd.dui +0 -25
- package/assets/ui/nft-dialog.dui +0 -29
- package/assets/ui/oow.dui +0 -41
- package/assets/ui/permissions-dialog.dui +0 -39
- package/assets/ui/permissions.dui +0 -54
- package/assets/ui/profile-detail.dui +0 -24
- package/assets/ui/profile.dui +0 -29
- package/assets/ui/spinner.dui +0 -3
- package/assets/ui/toast.dui +0 -27
- package/assets/ui/tracker.dui +0 -21
- package/assets/ui/update.dui +0 -16
- package/assets/ui/utils.dui +0 -40
- package/assets/ui/wearables.dui +0 -134
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#import bevy_ui::ui_vertex_output::UiVertexOutput
|
|
2
|
-
#import bevy_render::view::View
|
|
3
|
-
|
|
4
|
-
@group(0) @binding(0) var<uniform> view: View;
|
|
5
|
-
|
|
6
|
-
struct Bounds {
|
|
7
|
-
bounds: vec4<f32>,
|
|
8
|
-
border_color: vec4<f32>,
|
|
9
|
-
edge_scale: vec4<f32>,
|
|
10
|
-
corner_size: f32,
|
|
11
|
-
corner_blend_size: f32,
|
|
12
|
-
border_size: f32,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@group(1) @binding(0) var image_texture: texture_2d<f32>;
|
|
16
|
-
@group(1) @binding(1) var image_sampler: sampler;
|
|
17
|
-
@group(1) @binding(2) var<uniform> bounds_data: Bounds;
|
|
18
|
-
@group(1) @binding(3) var<uniform> bg_color: vec4<f32>;
|
|
19
|
-
|
|
20
|
-
fn edge_color(uv: vec2<f32>, position: vec4<f32>, in_color: vec4<f32>) -> vec4<f32> {
|
|
21
|
-
let corner_size = bounds_data.corner_size;
|
|
22
|
-
let bounds = bounds_data.bounds;
|
|
23
|
-
let edges = bounds_data.edge_scale;
|
|
24
|
-
|
|
25
|
-
let left = max(0.0, (bounds.x + corner_size) - position.x) * edges.x;
|
|
26
|
-
let right = max(0.0, position.x - (bounds.z - corner_size)) * edges.y;
|
|
27
|
-
let top = max(0.0, (bounds.y + corner_size) - position.y) * edges.z;
|
|
28
|
-
let bottom = max(0.0, position.y - (bounds.w - corner_size)) * edges.w;
|
|
29
|
-
let corner_dist_sq = max(left * left, right * right) + max(top * top, bottom * bottom);
|
|
30
|
-
let corner_end_size_sq = corner_size * corner_size;
|
|
31
|
-
|
|
32
|
-
if corner_dist_sq > corner_end_size_sq {
|
|
33
|
-
discard;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let edge_sq = max(corner_dist_sq, max(max(left * left, right * right), max(top * top, bottom * bottom)));
|
|
37
|
-
var out_color = in_color;
|
|
38
|
-
if bounds_data.border_size > 0.0 {
|
|
39
|
-
let border_start_size_sq = (corner_size - bounds_data.border_size) * (corner_size - bounds_data.border_size);
|
|
40
|
-
let border = 1.0 - clamp((edge_sq - border_start_size_sq) / (corner_end_size_sq - border_start_size_sq), 0.0, 1.0);
|
|
41
|
-
out_color = mix(bounds_data.border_color, out_color, border);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if bounds_data.corner_blend_size > 0.0 {
|
|
45
|
-
let corner_start_size_sq = (corner_size - bounds_data.corner_blend_size) * (corner_size - bounds_data.corner_blend_size);
|
|
46
|
-
let alpha = 1.0 - clamp((edge_sq - corner_start_size_sq) / (corner_end_size_sq - corner_start_size_sq), 0.0, 1.0);
|
|
47
|
-
out_color.a *= alpha;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return out_color;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@fragment
|
|
54
|
-
fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
|
|
55
|
-
var color = textureSample(image_texture, image_sampler, in.uv) * bg_color;
|
|
56
|
-
return edge_color(in.uv, in.position, color);
|
|
57
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#import bevy_pbr::{
|
|
2
|
-
prepass_bindings,
|
|
3
|
-
prepass_io::{Vertex, VertexOutput, FragmentOutput},
|
|
4
|
-
mesh_view_bindings::{view, previous_view_proj},
|
|
5
|
-
pbr_fragment::pbr_input_from_standard_material,
|
|
6
|
-
pbr_prepass_functions::prepass_alpha_discard,
|
|
7
|
-
}
|
|
8
|
-
#import bevy_render::globals::Globals;
|
|
9
|
-
|
|
10
|
-
#import "shaders/simplex.wgsl"::simplex_noise_3d
|
|
11
|
-
|
|
12
|
-
@group(0) @binding(1) var<uniform> globals: Globals;
|
|
13
|
-
|
|
14
|
-
struct Bounds {
|
|
15
|
-
min: u32,
|
|
16
|
-
max: u32,
|
|
17
|
-
height: f32,
|
|
18
|
-
_padding0: u32,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
struct SceneBounds {
|
|
22
|
-
bounds: array<Bounds,8>,
|
|
23
|
-
distance: f32,
|
|
24
|
-
flags: u32,
|
|
25
|
-
num_bounds: u32,
|
|
26
|
-
_pad: u32,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
fn unpack_bounds(packed: u32) -> vec2<f32> {
|
|
30
|
-
let x = i32((packed >> 16) & 0xFFFF);
|
|
31
|
-
let x_signed = select(x, x - 0x10000, (x & 0x8000) != 0);
|
|
32
|
-
let y = i32(packed & 0xFFFF);
|
|
33
|
-
let y_signed = select(y, y - 0x10000, (y & 0x8000) != 0);
|
|
34
|
-
return vec2<f32>(f32((x_signed) * 16), f32((y_signed) * 16));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@group(2) @binding(100)
|
|
38
|
-
var<uniform> bounds: SceneBounds;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
#ifdef PREPASS_FRAGMENT
|
|
42
|
-
@fragment
|
|
43
|
-
fn fragment(
|
|
44
|
-
in: VertexOutput,
|
|
45
|
-
@builtin(front_facing) is_front: bool
|
|
46
|
-
) -> FragmentOutput {
|
|
47
|
-
var out: FragmentOutput;
|
|
48
|
-
|
|
49
|
-
#ifdef NORMAL_PREPASS
|
|
50
|
-
out.normal = vec4(in.world_normal * 0.5 + vec3(0.5), 1.0);
|
|
51
|
-
#endif
|
|
52
|
-
|
|
53
|
-
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
|
|
54
|
-
out.frag_depth = in.unclipped_depth;
|
|
55
|
-
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
|
|
56
|
-
|
|
57
|
-
#ifdef MOTION_VECTOR_PREPASS
|
|
58
|
-
let clip_position_t = view.unjittered_view_proj * in.world_position;
|
|
59
|
-
let clip_position = clip_position_t.xy / clip_position_t.w;
|
|
60
|
-
let previous_clip_position_t = prepass_bindings::previous_view_proj * in.previous_world_position;
|
|
61
|
-
let previous_clip_position = previous_clip_position_t.xy / previous_clip_position_t.w;
|
|
62
|
-
// These motion vectors are used as offsets to UV positions and are stored
|
|
63
|
-
// in the range -1,1 to allow offsetting from the one corner to the
|
|
64
|
-
// diagonally-opposite corner in UV coordinates, in either direction.
|
|
65
|
-
// A difference between diagonally-opposite corners of clip space is in the
|
|
66
|
-
// range -2,2, so this needs to be scaled by 0.5. And the V direction goes
|
|
67
|
-
// down where clip space y goes up, so y needs to be flipped.
|
|
68
|
-
out.motion_vector = (clip_position - previous_clip_position) * vec2(0.5, -0.5);
|
|
69
|
-
#endif // MOTION_VECTOR_PREPASS
|
|
70
|
-
|
|
71
|
-
#ifdef DEFERRED_PREPASS
|
|
72
|
-
// There isn't any material info available for this default prepass shader so we are just writing
|
|
73
|
-
// emissive magenta out to the deferred gbuffer to be rendered by the first deferred lighting pass layer.
|
|
74
|
-
// The is here so if the default prepass fragment is used for deferred magenta will be rendered, and also
|
|
75
|
-
// as an example to show that a user could write to the deferred gbuffer if they were to start from this shader.
|
|
76
|
-
out.deferred = vec4(0u, bevy_pbr::rgb9e5::vec3_to_rgb9e5_(vec3(1.0, 0.0, 1.0)), 0u, 0u);
|
|
77
|
-
out.deferred_lighting_pass_id = 1u;
|
|
78
|
-
#endif
|
|
79
|
-
|
|
80
|
-
let world_position = in.world_position.xyz;
|
|
81
|
-
// check bounds
|
|
82
|
-
var outside_amt: f32 = 9999.0;
|
|
83
|
-
var nearest_region_distance: f32 = 9999.0;
|
|
84
|
-
var nearest_region_height: f32 = 9999.0;
|
|
85
|
-
if bounds.num_bounds > 0 {
|
|
86
|
-
for (var ix = 0u; ix < bounds.num_bounds; ix += 1u) {
|
|
87
|
-
let min_wp = unpack_bounds(bounds.bounds[ix].min);
|
|
88
|
-
let max_wp = unpack_bounds(bounds.bounds[ix].max);
|
|
89
|
-
|
|
90
|
-
let outside_xy = abs(clamp(world_position.xz, min_wp, max_wp) - world_position.xz);
|
|
91
|
-
let distance = max(outside_xy.x, outside_xy.y);
|
|
92
|
-
if distance < nearest_region_distance {
|
|
93
|
-
nearest_region_distance = distance;
|
|
94
|
-
nearest_region_height = bounds.bounds[ix].height;
|
|
95
|
-
}
|
|
96
|
-
outside_amt = min(outside_amt, distance);
|
|
97
|
-
}
|
|
98
|
-
let outside_height = max(world_position.y - nearest_region_height, 0.0);
|
|
99
|
-
outside_amt = max(outside_amt, outside_height);
|
|
100
|
-
} else {
|
|
101
|
-
outside_amt = 0.0;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
var noise = 0.0;
|
|
105
|
-
if outside_amt > 0.0 {
|
|
106
|
-
if outside_amt < bounds.distance {
|
|
107
|
-
noise = simplex_noise_3d(world_position * 2.0 + globals.time * vec3(0.2, 0.16, 0.24)) * 0.5 + 0.55;
|
|
108
|
-
if noise < (outside_amt - 0.125) / 2.0 {
|
|
109
|
-
discard;
|
|
110
|
-
}
|
|
111
|
-
} else if outside_amt > 0.05 {
|
|
112
|
-
discard;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
prepass_alpha_discard(in);
|
|
117
|
-
|
|
118
|
-
return out;
|
|
119
|
-
}
|
|
120
|
-
#else // !PREPASS_FRAGMENT (?)
|
|
121
|
-
@fragment
|
|
122
|
-
fn fragment(in: VertexOutput) {
|
|
123
|
-
let world_position = in.world_position.xyz;
|
|
124
|
-
var outside_amt: f32 = 9999.0;
|
|
125
|
-
var nearest_region_distance: f32 = 9999.0;
|
|
126
|
-
var nearest_region_height: f32 = 9999.0;
|
|
127
|
-
if bounds.num_bounds > 0 {
|
|
128
|
-
for (var ix = 0u; ix < bounds.num_bounds; ix += 1u) {
|
|
129
|
-
let min_wp = unpack_bounds(bounds.bounds[ix].min);
|
|
130
|
-
let max_wp = unpack_bounds(bounds.bounds[ix].max);
|
|
131
|
-
|
|
132
|
-
let outside_xy = abs(clamp(world_position.xz, min_wp, max_wp) - world_position.xz);
|
|
133
|
-
let distance = max(outside_xy.x, outside_xy.y);
|
|
134
|
-
if distance < nearest_region_distance {
|
|
135
|
-
nearest_region_distance = distance;
|
|
136
|
-
nearest_region_height = bounds.bounds[ix].height;
|
|
137
|
-
}
|
|
138
|
-
outside_amt = min(outside_amt, distance);
|
|
139
|
-
}
|
|
140
|
-
let outside_height = max(world_position.y - nearest_region_height, 0.0);
|
|
141
|
-
outside_amt = max(outside_amt, outside_height);
|
|
142
|
-
} else {
|
|
143
|
-
outside_amt = 0.0;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
var noise = 0.0;
|
|
147
|
-
if outside_amt > 0.0 {
|
|
148
|
-
if outside_amt < bounds.distance {
|
|
149
|
-
noise = simplex_noise_3d(world_position * 2.0 + globals.time * vec3(0.2, 0.16, 0.24)) * 0.5 + 0.55;
|
|
150
|
-
if noise < (outside_amt - 0.125) / 2.0 {
|
|
151
|
-
discard;
|
|
152
|
-
}
|
|
153
|
-
} else if outside_amt > 0.05 {
|
|
154
|
-
discard;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
prepass_alpha_discard(in);
|
|
159
|
-
}
|
|
160
|
-
#endif // PREPASS_FRAGMENT
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#import boimp::shared::{ImposterVertexOut, unpack_pbrinput, pack_pbrinput};
|
|
2
|
-
#import boimp::bindings::sample_tile_material;
|
|
3
|
-
|
|
4
|
-
@group(2) @binding(100)
|
|
5
|
-
var<uniform> offset: f32;
|
|
6
|
-
|
|
7
|
-
struct VertexOut {
|
|
8
|
-
@builtin(position) position: vec4<f32>,
|
|
9
|
-
@location(0) inverse_rotation_0c: vec3<f32>,
|
|
10
|
-
@location(1) inverse_rotation_1c: vec3<f32>,
|
|
11
|
-
@location(2) inverse_rotation_2c: vec3<f32>,
|
|
12
|
-
@location(3) uv: vec2<f32>,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@fragment
|
|
16
|
-
fn fragment(in: VertexOut) -> @location(0) vec2<u32> {
|
|
17
|
-
let inv_rot = mat3x3(
|
|
18
|
-
in.inverse_rotation_0c,
|
|
19
|
-
in.inverse_rotation_1c,
|
|
20
|
-
in.inverse_rotation_2c,
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
var props = sample_tile_material(vec4<f32>(clamp(in.uv, vec2(0.0001), vec2(17.0/18.0 - 0.0001)), vec2<f32>(0.0)), vec2(0u,0u), vec2(offset, offset));
|
|
24
|
-
var pbr_input = unpack_pbrinput(props, in.position);
|
|
25
|
-
pbr_input.N = inv_rot * normalize(pbr_input.N);
|
|
26
|
-
pbr_input.world_normal = pbr_input.N;
|
|
27
|
-
|
|
28
|
-
// write the imposter gbuffer
|
|
29
|
-
return pack_pbrinput(pbr_input);
|
|
30
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#import bevy_pbr::{
|
|
2
|
-
pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing},
|
|
3
|
-
pbr_types::{STANDARD_MATERIAL_FLAGS_ALPHA_MODE_ADD, STANDARD_MATERIAL_FLAGS_FOG_ENABLED_BIT},
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
#ifdef PREPASS_PIPELINE
|
|
7
|
-
#import bevy_pbr::prepass_io::FragmentOutput;
|
|
8
|
-
#else
|
|
9
|
-
#import bevy_pbr::forward_io::FragmentOutput;
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
#import boimp::shared::unpack_pbrinput;
|
|
13
|
-
#import boimp::bindings::sample_tile_material;
|
|
14
|
-
|
|
15
|
-
@group(2) @binding(100)
|
|
16
|
-
var<uniform> offset: f32;
|
|
17
|
-
|
|
18
|
-
struct VertexOut {
|
|
19
|
-
@builtin(position) position: vec4<f32>,
|
|
20
|
-
@location(0) inverse_rotation_0c: vec3<f32>,
|
|
21
|
-
@location(1) inverse_rotation_1c: vec3<f32>,
|
|
22
|
-
@location(2) inverse_rotation_2c: vec3<f32>,
|
|
23
|
-
@location(3) uv: vec2<f32>,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@fragment
|
|
27
|
-
fn fragment(in: VertexOut) -> FragmentOutput {
|
|
28
|
-
var out: FragmentOutput;
|
|
29
|
-
|
|
30
|
-
#ifdef PREPASS_PIPELINE
|
|
31
|
-
|
|
32
|
-
#ifdef NORMAL_PREPASS
|
|
33
|
-
out.normal = vec4<f32>(0.0, 1.0, 0.0, 0.0);
|
|
34
|
-
#endif
|
|
35
|
-
// we don't support MOTION_VECTOR or DEFERRED
|
|
36
|
-
#ifdef UNCLIPPED_DEPTH_ORTHO_EMULATION
|
|
37
|
-
out.frag_depth = in.position.z;
|
|
38
|
-
#endif
|
|
39
|
-
|
|
40
|
-
#else
|
|
41
|
-
|
|
42
|
-
let inv_rot = mat3x3(
|
|
43
|
-
in.inverse_rotation_0c,
|
|
44
|
-
in.inverse_rotation_1c,
|
|
45
|
-
in.inverse_rotation_2c,
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
var props = sample_tile_material(vec4<f32>(clamp(in.uv, vec2(0.0001), vec2(17.0/18.0 - 0.0001)), vec2<f32>(0.0)), vec2(0u,0u), vec2(offset, offset));
|
|
49
|
-
|
|
50
|
-
if props.rgba.a == 0.0 {
|
|
51
|
-
// hacky - we are using opaque to ensure imposters render above the floor
|
|
52
|
-
// so we have to put the ground color here
|
|
53
|
-
// todo use some nice
|
|
54
|
-
props.rgba = vec4<f32>(0.07323897, 0.17064494, 0.033104762, 1.0);
|
|
55
|
-
props.roughness = 1.0;
|
|
56
|
-
props.metallic = 0.0;
|
|
57
|
-
props.normal = vec3<f32>(0.0, 1.0, 0.0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
props.rgba.a = 1.0;
|
|
61
|
-
|
|
62
|
-
var pbr_input = unpack_pbrinput(props, in.position);
|
|
63
|
-
pbr_input.N = inv_rot * normalize(pbr_input.N);
|
|
64
|
-
pbr_input.world_normal = pbr_input.N;
|
|
65
|
-
pbr_input.material.flags |= STANDARD_MATERIAL_FLAGS_ALPHA_MODE_ADD;
|
|
66
|
-
out.color = apply_pbr_lighting(pbr_input);
|
|
67
|
-
|
|
68
|
-
pbr_input.material.flags |= STANDARD_MATERIAL_FLAGS_FOG_ENABLED_BIT;
|
|
69
|
-
out.color = main_pass_post_lighting_processing(pbr_input, out.color);
|
|
70
|
-
|
|
71
|
-
#endif
|
|
72
|
-
|
|
73
|
-
return out;
|
|
74
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#import bevy_pbr::{
|
|
2
|
-
mesh_functions,
|
|
3
|
-
view_transformations::{position_world_to_clip, position_view_to_world},
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
#ifdef PREPASS_PIPELINE
|
|
7
|
-
#import bevy_pbr::prepass_io::Vertex;
|
|
8
|
-
#else
|
|
9
|
-
#import bevy_pbr::forward_io::Vertex;
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
#import boimp::shared::ImposterVertexOut;
|
|
13
|
-
#import boimp::bindings::{imposter_data, sample_uvs_unbounded, grid_weights, sample_positions_from_camera_dir};
|
|
14
|
-
|
|
15
|
-
struct VertexOut {
|
|
16
|
-
@builtin(position) position: vec4<f32>,
|
|
17
|
-
@location(0) inverse_rotation_0c: vec3<f32>,
|
|
18
|
-
@location(1) inverse_rotation_1c: vec3<f32>,
|
|
19
|
-
@location(2) inverse_rotation_2c: vec3<f32>,
|
|
20
|
-
@location(3) uv: vec2<f32>,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@vertex
|
|
24
|
-
fn vertex(vertex: Vertex) -> VertexOut {
|
|
25
|
-
var out: VertexOut;
|
|
26
|
-
|
|
27
|
-
var model = mesh_functions::get_world_from_local(vertex.instance_index);
|
|
28
|
-
|
|
29
|
-
let imposter_world_position = mesh_functions::mesh_position_local_to_world(model, vec4<f32>(0.0, 0.0, 0.0, 1.0)).xyz;
|
|
30
|
-
|
|
31
|
-
// extract inverse rotation
|
|
32
|
-
let inv_rot = transpose(mat3x3<f32>(
|
|
33
|
-
normalize(model[0].xyz),
|
|
34
|
-
normalize(model[1].xyz),
|
|
35
|
-
normalize(model[2].xyz)
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
out.inverse_rotation_0c = inv_rot[0];
|
|
39
|
-
out.inverse_rotation_1c = inv_rot[1];
|
|
40
|
-
out.inverse_rotation_2c = inv_rot[2];
|
|
41
|
-
|
|
42
|
-
let world_position = mesh_functions::mesh_position_local_to_world(model, vec4<f32>(vertex.position, 1.0)).xyz;
|
|
43
|
-
out.position = position_world_to_clip(world_position);
|
|
44
|
-
out.uv = vertex.uv;
|
|
45
|
-
|
|
46
|
-
return out;
|
|
47
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#import bevy_pbr::{
|
|
2
|
-
forward_io::{VertexOutput, FragmentOutput},
|
|
3
|
-
mesh_view_bindings::globals,
|
|
4
|
-
}
|
|
5
|
-
#import "shaders/simplex.wgsl"::simplex_noise_3d
|
|
6
|
-
|
|
7
|
-
struct LoadingData {
|
|
8
|
-
player_pos_and_render: vec4<f32>,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@group(2) @binding(0)
|
|
12
|
-
var<uniform> material: LoadingData;
|
|
13
|
-
|
|
14
|
-
@fragment
|
|
15
|
-
fn fragment(
|
|
16
|
-
in: VertexOutput,
|
|
17
|
-
@builtin(front_facing) is_front: bool,
|
|
18
|
-
) -> FragmentOutput {
|
|
19
|
-
if material.player_pos_and_render.a == 0.0 {
|
|
20
|
-
discard;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let world_position = in.world_position.xyz;
|
|
24
|
-
let offset = world_position - material.player_pos_and_render.xyz;
|
|
25
|
-
|
|
26
|
-
let noise = simplex_noise_3d(world_position * 2.0 + globals.time * vec3(0.2, 0.16, 0.24)) * 0.5 + 0.5;
|
|
27
|
-
|
|
28
|
-
if noise > 0.5 {
|
|
29
|
-
discard;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var out: FragmentOutput;
|
|
33
|
-
out.color = vec4<f32>(noise, noise * 10.0, noise, pow((1.0 - clamp(dot(offset, offset) * 0.03, 0.0, 1.0)), 2.0));
|
|
34
|
-
return out;
|
|
35
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#import bevy_pbr::{
|
|
2
|
-
forward_io::{VertexOutput, FragmentOutput},
|
|
3
|
-
pbr_fragment::pbr_input_from_vertex_output,
|
|
4
|
-
pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing},
|
|
5
|
-
mesh_view_bindings::globals,
|
|
6
|
-
}
|
|
7
|
-
#import "shaders/simplex.wgsl"::simplex_noise_3d
|
|
8
|
-
#import "shaders/outline.wgsl"::apply_outline
|
|
9
|
-
|
|
10
|
-
struct Bounds {
|
|
11
|
-
min: u32,
|
|
12
|
-
max: u32,
|
|
13
|
-
height: f32,
|
|
14
|
-
_padding0: u32,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
fn unpack_bounds(packed: u32) -> vec2<f32> {
|
|
18
|
-
let x = i32((packed >> 16) & 0xFFFF);
|
|
19
|
-
let x_signed = select(x, x - 0x10000, (x & 0x8000) != 0);
|
|
20
|
-
let y = i32(packed & 0xFFFF);
|
|
21
|
-
let y_signed = select(y, y - 0x10000, (y & 0x8000) != 0);
|
|
22
|
-
return vec2<f32>(f32((x_signed) * 16), f32((y_signed) * 16));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
struct MaskMaterial {
|
|
26
|
-
bounds: array<Bounds,8>,
|
|
27
|
-
color: vec4<f32>,
|
|
28
|
-
distance: f32,
|
|
29
|
-
num_bounds: u32,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
@group(2) @binding(0)
|
|
33
|
-
var<uniform> material: MaskMaterial;
|
|
34
|
-
@group(2) @binding(1)
|
|
35
|
-
var base_texture: texture_2d<f32>;
|
|
36
|
-
@group(2) @binding(2)
|
|
37
|
-
var base_sampler: sampler;
|
|
38
|
-
@group(2) @binding(3)
|
|
39
|
-
var mask_texture: texture_2d<f32>;
|
|
40
|
-
@group(2) @binding(4)
|
|
41
|
-
var mask_sampler: sampler;
|
|
42
|
-
|
|
43
|
-
@fragment
|
|
44
|
-
fn fragment(
|
|
45
|
-
in: VertexOutput,
|
|
46
|
-
@builtin(front_facing) is_front: bool,
|
|
47
|
-
#ifdef MULTISAMPLED
|
|
48
|
-
@builtin(sample_index) sample_index: u32,
|
|
49
|
-
#endif
|
|
50
|
-
) -> FragmentOutput {
|
|
51
|
-
#ifndef MULTISAMPLED
|
|
52
|
-
let sample_index = 0u;
|
|
53
|
-
#endif
|
|
54
|
-
|
|
55
|
-
var pbr_input = pbr_input_from_vertex_output(in, is_front, false);
|
|
56
|
-
|
|
57
|
-
let world_position = pbr_input.world_position.xyz;
|
|
58
|
-
// check bounds
|
|
59
|
-
var outside_amt: f32 = 9999.0;
|
|
60
|
-
var nearest_region_distance: f32 = 9999.0;
|
|
61
|
-
var nearest_region_height: f32 = 9999.0;
|
|
62
|
-
if material.num_bounds > 0 {
|
|
63
|
-
for (var ix = 0u; ix < material.num_bounds; ix += 1u) {
|
|
64
|
-
let min_wp = unpack_bounds(material.bounds[ix].min);
|
|
65
|
-
let max_wp = unpack_bounds(material.bounds[ix].max);
|
|
66
|
-
|
|
67
|
-
let outside_xy = abs(clamp(world_position.xz, min_wp, max_wp) - world_position.xz);
|
|
68
|
-
let distance = max(outside_xy.x, outside_xy.y);
|
|
69
|
-
if distance < nearest_region_distance {
|
|
70
|
-
nearest_region_distance = distance;
|
|
71
|
-
nearest_region_height = material.bounds[ix].height;
|
|
72
|
-
}
|
|
73
|
-
outside_amt = min(outside_amt, distance);
|
|
74
|
-
}
|
|
75
|
-
let outside_height = max(world_position.y - nearest_region_height, 0.0);
|
|
76
|
-
outside_amt = max(outside_amt, outside_height);
|
|
77
|
-
} else {
|
|
78
|
-
outside_amt = 0.0;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var noise = 0.05;
|
|
82
|
-
if outside_amt > 0.00 {
|
|
83
|
-
if outside_amt < material.distance {
|
|
84
|
-
noise = simplex_noise_3d(world_position * 2.0 + globals.time * vec3(0.2, 0.16, 0.24)) * 0.5 + 0.55;
|
|
85
|
-
if noise < (outside_amt - 0.125) / 2.0 {
|
|
86
|
-
discard;
|
|
87
|
-
}
|
|
88
|
-
} else if outside_amt > 0.05 {
|
|
89
|
-
discard;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let mask = textureSample(mask_texture, mask_sampler, in.uv);
|
|
94
|
-
let base = textureSample(base_texture, base_sampler, in.uv);
|
|
95
|
-
let color_amt = mask.r * mask.a;
|
|
96
|
-
|
|
97
|
-
let color = mix(material.color, vec4<f32>(1.0), color_amt) * base;
|
|
98
|
-
|
|
99
|
-
pbr_input.material.base_color = color;
|
|
100
|
-
|
|
101
|
-
var out: FragmentOutput;
|
|
102
|
-
// apply lighting
|
|
103
|
-
out.color = apply_pbr_lighting(pbr_input);
|
|
104
|
-
|
|
105
|
-
out.color = apply_outline(
|
|
106
|
-
in.position,
|
|
107
|
-
out.color,
|
|
108
|
-
false,
|
|
109
|
-
sample_index,
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// apply in-shader post processing (fog, alpha-premultiply, and also tonemapping, debanding if the camera is non-hdr)
|
|
113
|
-
// note this does not include fullscreen postprocessing effects like bloom.
|
|
114
|
-
out.color = main_pass_post_lighting_processing(pbr_input, out.color);
|
|
115
|
-
|
|
116
|
-
return out;
|
|
117
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#import bevy_ui::ui_vertex_output::UiVertexOutput
|
|
2
|
-
|
|
3
|
-
struct SliceData {
|
|
4
|
-
bounds: vec4<f32>,
|
|
5
|
-
surface: vec4<f32>,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@group(1) @binding(0) var image_texture: texture_2d<f32>;
|
|
9
|
-
@group(1) @binding(1) var image_sampler: sampler;
|
|
10
|
-
@group(1) @binding(2) var<uniform> slice_data: SliceData;
|
|
11
|
-
@group(1) @binding(3) var<uniform> bg_color: vec4<f32>;
|
|
12
|
-
|
|
13
|
-
@fragment
|
|
14
|
-
fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
|
|
15
|
-
var uv = in.uv;
|
|
16
|
-
let image_size = vec2<f32>(textureDimensions(image_texture));
|
|
17
|
-
let border_size = vec2<f32>(slice_data.bounds.x + slice_data.bounds.z, slice_data.bounds.y + slice_data.bounds.z);
|
|
18
|
-
let position = in.uv * slice_data.surface.xy;
|
|
19
|
-
|
|
20
|
-
if slice_data.surface.x > image_size.x {
|
|
21
|
-
let left = slice_data.bounds.x - position.x;
|
|
22
|
-
let right = position.x - (slice_data.surface.x - slice_data.bounds.z);
|
|
23
|
-
|
|
24
|
-
if left > 0.0 && left > right {
|
|
25
|
-
uv.x = position.x / image_size.x;
|
|
26
|
-
} else if right > 0.0 {
|
|
27
|
-
uv.x = 1.0 - (slice_data.surface.x - position.x) / image_size.x;
|
|
28
|
-
} else {
|
|
29
|
-
uv.x = ((position.x - slice_data.bounds.x) / (slice_data.surface.x - border_size.x) * (image_size.x - border_size.x) + slice_data.bounds.x) / image_size.x;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if slice_data.surface.y > image_size.y {
|
|
34
|
-
let top = slice_data.bounds.y - position.y;
|
|
35
|
-
let bottom = position.y - (slice_data.surface.y - slice_data.bounds.w);
|
|
36
|
-
|
|
37
|
-
if top > 0.0 && top > bottom {
|
|
38
|
-
uv.y = position.y / image_size.y;
|
|
39
|
-
} else if bottom > 0.0 {
|
|
40
|
-
uv.y = 1.0 - (slice_data.surface.y - position.y) / image_size.y;
|
|
41
|
-
} else {
|
|
42
|
-
uv.y = ((position.y - slice_data.bounds.y) / (slice_data.surface.y - border_size.y) * (image_size.y - border_size.y) + slice_data.bounds.y) / image_size.y;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return textureSample(image_texture, image_sampler, uv) * bg_color;
|
|
47
|
-
}
|