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

Fixed issue with clipping #239

Merged
merged 2 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions src/render/material/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ pub fn queue_material_ui_quads<M: MaterialUI>(
// Vertex buffer indices
let mut index = 0;

let mut previous_clip_rect = Rect::default();
// let mut previous_clip_rect = Rect::default();

let draw_quad = draw_functions.read().get_id::<DrawMaterialUI<M>>().unwrap();
let draw_opacity_quad = draw_functions_opacity
Expand Down Expand Up @@ -382,7 +382,6 @@ pub fn queue_material_ui_quads<M: MaterialUI>(
&mut quad_meta,
&mut quad,
camera_entity,
&mut previous_clip_rect,
*quad_types_offsets,
&mut current_batch,
&mut current_batch_entity,
Expand Down
13 changes: 7 additions & 6 deletions src/render/unified/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,13 @@ pub fn queue_quads(queue_quads: QueueQuads) {
let spec_pipeline = pipelines.specialize(&mut pipeline_cache, &quad_pipeline, key);

for quad in extracted_quads.iter_mut() {
if quad.quad_type == UIQuadType::Clip {
previous_clip_rect = quad.rect;
}

if previous_clip_rect.width() < 1.0 || previous_clip_rect.height() < 1.0 {
continue;
}
queue_quads_inner(
&mut commands,
&render_device,
Expand All @@ -671,7 +678,6 @@ pub fn queue_quads(queue_quads: QueueQuads) {
&mut quad_meta,
quad,
camera_entity,
&mut previous_clip_rect,
*quad_type_offsets,
&mut current_batch,
&mut current_batch_entity,
Expand All @@ -698,7 +704,6 @@ pub fn queue_quads_inner(
quad_meta: &mut QuadMeta,
quad: &mut ExtractedQuad,
camera_entity: Entity,
previous_clip_rect: &mut Rect,
quad_type_offsets: QuadTypeOffsets,
current_batch: &mut QuadBatch,
current_batch_entity: &mut Entity,
Expand All @@ -708,10 +713,6 @@ pub fn queue_quads_inner(
return;
}

if quad.quad_type == UIQuadType::Clip {
*previous_clip_rect = quad.rect;
}

match quad.quad_type {
UIQuadType::Quad => quad.type_index = quad_type_offsets.quad_type_offset,
UIQuadType::Text => quad.type_index = quad_type_offsets.text_type_offset,
Expand Down