Skip to content

Commit

Permalink
rename color_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Aug 30, 2024
1 parent 1d0f293 commit 2cd76b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions sugarloaf/src/components/rich_text/image_cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,7 @@ impl ImageCache {
});

let texture = match atlas.format {
// Mask
PixelFormat::A8 => &self.mask_texture,
// Color
PixelFormat::Rgba8 => &self.color_texture,
};

Expand Down
8 changes: 4 additions & 4 deletions sugarloaf/src/components/rich_text/rich_text.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) f_color: vec4<f32>,
@location(1) f_uv: vec2<f32>,
@location(2) texture_layer: i32,
@location(2) color_layer: i32,
@location(3) mask_layer: i32,
}

Expand All @@ -28,7 +28,7 @@ fn vs_main(input: VertexInput) -> VertexOutput {
var out: VertexOutput;
out.f_color = input.v_color;
out.f_uv = input.v_uv;
out.texture_layer = input.layers.x;
out.color_layer = input.layers.x;
out.mask_layer = input.layers.y;

out.position = globals.transform * vec4<f32>(input.v_pos.xy, 0.0, 1.0);
Expand All @@ -39,8 +39,8 @@ fn vs_main(input: VertexInput) -> VertexOutput {
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
var out: vec4<f32> = input.f_color;

if input.texture_layer > 0 {
out = textureSample(font_color_tex, font_sampler, input.f_uv, input.texture_layer);
if input.color_layer > 0 {
out = textureSample(font_color_tex, font_sampler, input.f_uv, input.color_layer);
}

if input.mask_layer > 0 {
Expand Down

0 comments on commit 2cd76b0

Please sign in to comment.