1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Wrap tesselated output in struct ClippedMesh(Rect, Mesh)

This commit is contained in:
Emil Ernerfeldt
2021-01-25 21:43:17 +01:00
parent 75fa77e040
commit b493bc6efc
16 changed files with 89 additions and 71 deletions

View File

@@ -212,7 +212,7 @@ pub fn run(mut app: Box<dyn epi::App>) -> ! {
.build();
app.update(&ctx, &mut frame);
let (egui_output, shapes) = ctx.end_frame();
let paint_jobs = ctx.tessellate(shapes);
let clipped_meshes = ctx.tessellate(shapes);
let frame_time = (Instant::now() - frame_start).as_secs_f64() as f32;
previous_frame_time = Some(frame_time);
@@ -220,7 +220,7 @@ pub fn run(mut app: Box<dyn epi::App>) -> ! {
&display,
ctx.pixels_per_point(),
app.clear_color(),
paint_jobs,
clipped_meshes,
&ctx.texture(),
);

View File

@@ -1,11 +1,7 @@
#![allow(deprecated)] // legacy implement_vertex macro
use {
egui::{
math::clamp,
paint::{Mesh, PaintJobs},
Color32, Rect,
},
egui::{math::clamp, paint::Mesh, Color32, Rect},
glium::{
implement_vertex,
index::PrimitiveType,
@@ -128,7 +124,7 @@ impl Painter {
display: &glium::Display,
pixels_per_point: f32,
clear_color: egui::Rgba,
jobs: PaintJobs,
cipped_meshes: Vec<egui::ClippedMesh>,
egui_texture: &egui::Texture,
) {
self.upload_egui_texture(display, egui_texture);
@@ -142,7 +138,7 @@ impl Painter {
clear_color[2],
clear_color[3],
);
for (clip_rect, mesh) in jobs {
for egui::ClippedMesh(clip_rect, mesh) in cipped_meshes {
self.paint_mesh(&mut target, display, pixels_per_point, clip_rect, &mesh)
}
target.finish().unwrap();