Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI Materials #9506

Merged
merged 63 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2d37454
Adds UIMaterial Struct
MarkusTheOrt Aug 17, 2023
fb90baa
Adds `MaterialNodeBundle`
MarkusTheOrt Aug 18, 2023
7a98e22
export material::* from bevy_ui
MarkusTheOrt Aug 18, 2023
ccba0a2
reverts UI shader
MarkusTheOrt Aug 18, 2023
4298848
UiMaterial now working as intended
MarkusTheOrt Aug 20, 2023
cbbbd88
fixes compilation warnings
MarkusTheOrt Aug 20, 2023
7ed8914
fix cargo clippy warnings
MarkusTheOrt Aug 20, 2023
e65163e
adds example `ui_material`
MarkusTheOrt Aug 21, 2023
d5e12d4
ran cargo fmt
MarkusTheOrt Aug 21, 2023
bb19f42
Split ui_material pipeline into multiple files
MarkusTheOrt Aug 21, 2023
3b8022a
removes usage of UiPipeline inside UiMaterialPipeline
MarkusTheOrt Aug 21, 2023
ced9292
Use `UiMaterialVertex` without `mode` field.
MarkusTheOrt Aug 22, 2023
62709a0
Apply suggestions from code review
MarkusTheOrt Aug 22, 2023
62a51e0
removes export for UiVertex
MarkusTheOrt Aug 22, 2023
d4327cc
changed example `ui_material` back to single MaterialNodeBundle
MarkusTheOrt Aug 22, 2023
7706744
add `UiVertexOutput` shader export
MarkusTheOrt Aug 23, 2023
493d3cc
move `UiVertexOutput` into its own file (`ui_vertex_output.wgsl`)
MarkusTheOrt Aug 24, 2023
f637d7a
adds UiMaterialNode marker component
MarkusTheOrt Aug 27, 2023
033dee0
Merge branch 'bevyengine:main' into ui_material
MarkusTheOrt Aug 27, 2023
86ae1b8
ran cargo fmt
MarkusTheOrt Aug 27, 2023
66a4cd9
Fix crash where a empty UiBatch spawns
MarkusTheOrt Aug 27, 2023
ac911ba
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Sep 10, 2023
d800744
Fix compiler errors, disables lots of functionality
MarkusTheOrt Sep 10, 2023
4c65b29
change `extract_uinodes` query to `Has<UiMaterialNode>`
MarkusTheOrt Sep 10, 2023
794b722
adds back material rendering capabilities
MarkusTheOrt Sep 10, 2023
4a150cd
ran cargo fmt
MarkusTheOrt Sep 10, 2023
c9fcabe
fix compiler warnings
MarkusTheOrt Sep 10, 2023
193197a
ran cargo fmt
MarkusTheOrt Sep 10, 2023
d2fbd1d
improve docs surrounding `UiMaterial`
MarkusTheOrt Sep 10, 2023
930ec95
fix typo in doc comment
MarkusTheOrt Sep 10, 2023
fef7fac
remove `is_material` from `ExtracedUiNode`
MarkusTheOrt Sep 11, 2023
7eeb644
update example `ui_material`
MarkusTheOrt Sep 11, 2023
6294a17
add `InheritedVisibility` to `MaterialNodeBundle`
MarkusTheOrt Sep 11, 2023
1226bf1
remove `UiMaterialNode` marker component
MarkusTheOrt Sep 11, 2023
301b193
adds description to `ui_material` example
MarkusTheOrt Sep 11, 2023
e77172b
Fix typo in `material_pipeline.rs`
MarkusTheOrt Sep 12, 2023
239faf9
renamed some files to be more descriptive
MarkusTheOrt Sep 14, 2023
1239117
removes vertexcolor from `ui_material_pipeline`
MarkusTheOrt Sep 14, 2023
bc2c029
updated example ui_material
MarkusTheOrt Sep 14, 2023
84ef0ac
removes unused imports
MarkusTheOrt Sep 14, 2023
62b99d6
ci fixes
MarkusTheOrt Sep 14, 2023
1e0727a
fixed wrong comment formatting
MarkusTheOrt Sep 14, 2023
781fb57
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Sep 19, 2023
7988610
Apply suggestions from code review
MarkusTheOrt Oct 6, 2023
b51c143
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Oct 16, 2023
57419c0
Update from main
MarkusTheOrt Oct 16, 2023
4a9bf5f
add missing example in README
MarkusTheOrt Oct 16, 2023
08cf2f3
code review changes
MarkusTheOrt Oct 16, 2023
a978a1e
fix line ending in ui.wgsl
MarkusTheOrt Oct 16, 2023
a3c613e
add border sizes to vertex data
MarkusTheOrt Oct 21, 2023
fb49734
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Oct 21, 2023
83d703a
fix compile error
MarkusTheOrt Oct 21, 2023
b0c6ec9
add docs for UiVertexOutput
MarkusTheOrt Oct 21, 2023
12b6a33
fix error in docs
MarkusTheOrt Oct 21, 2023
3ea88ca
remove doc comment from UiMatreialBatch as suggested
MarkusTheOrt Oct 21, 2023
65ae48a
apply suggestions from code review
MarkusTheOrt Oct 21, 2023
b412839
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Oct 21, 2023
349af3c
fix compile errors, fix wgsl imports
MarkusTheOrt Oct 21, 2023
d5909ba
adopt new bind group API
MarkusTheOrt Oct 21, 2023
c61a2aa
remove old import from example shader
MarkusTheOrt Oct 23, 2023
afe56e5
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Oct 28, 2023
f8267d1
apply suggestions from code review
MarkusTheOrt Oct 28, 2023
2425a10
Merge branch 'main' of github.com:MarkusTheOrt/bevy into ui_material
MarkusTheOrt Nov 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add UiVertexOutput shader export
  • Loading branch information
MarkusTheOrt committed Aug 23, 2023
commit 7706744243c963ac80f4b059a316a8637e2fc94e
9 changes: 2 additions & 7 deletions assets/shaders/circle_shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// This shader draws a circular progress bar
#import bevy_render::view View

struct VertexOutput {
@location(0) uv: vec2<f32>,
@location(1) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
};
#import bevy_ui::ui_vertex_output UiVertexOutput

struct CustomUiMaterial {
@location(0) fill_amount: f32,
Expand All @@ -25,7 +20,7 @@ const PI = 3.141592656;
const TAU = 6.283185312;

@fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
let fill_amount = input.fill_amount;
let fill_angle = fill_amount * TAU;
let uv = in.uv * 2.0 - 1.0;
Expand Down
9 changes: 5 additions & 4 deletions crates/bevy_ui/src/render/material.wgsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#import bevy_render::view View
#define_import_path bevy_ui::ui_vertex_output

@group(0) @binding(0)
var<uniform> view: View;

struct VertexOutput {
struct UiVertexOutput {
@location(0) uv: vec2<f32>,
@location(1) color: vec4<f32>,
@builtin(position) position: vec4<f32>,
Expand All @@ -14,15 +15,15 @@ fn vertex(
@location(0) vertex_position: vec3<f32>,
@location(1) vertex_uv: vec2<f32>,
@location(2) vertex_color: vec4<f32>,
) -> VertexOutput {
var out: VertexOutput;
) -> UiVertexOutput {
var out: UiVertexOutput;
out.uv = vertex_uv;
out.position = view.view_proj * vec4<f32>(vertex_position, 1.0);
out.color = vertex_color;
return out;
}

@fragment
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
fn fragment(in: UiVertexOutput) -> @location(0) vec4<f32> {
return vec4<f32>(1.0);
}
2 changes: 1 addition & 1 deletion examples/ui/ui_material.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This example illustrates how to create a Node that shows a Material and driver parameters from
//! This example illustrates how to create a Node that shows a Material and drives parameters from
//! it

use bevy::prelude::*;
Expand Down