Finish clock example
This commit is contained in:
parent
f34407bfda
commit
578ea4abb8
11 changed files with 200 additions and 76 deletions
|
|
@ -26,7 +26,7 @@ struct Layer<'a> {
|
|||
offset: Vector<u32>,
|
||||
quads: Vec<Quad>,
|
||||
images: Vec<Image>,
|
||||
meshes: Vec<Arc<triangle::Mesh2D>>,
|
||||
meshes: Vec<(Point, Arc<triangle::Mesh2D>)>,
|
||||
text: Vec<wgpu_glyph::Section<'a>>,
|
||||
}
|
||||
|
||||
|
|
@ -229,8 +229,8 @@ impl Renderer {
|
|||
scale: [bounds.width, bounds.height],
|
||||
});
|
||||
}
|
||||
Primitive::Mesh2D(mesh) => {
|
||||
layer.meshes.push(mesh.clone());
|
||||
Primitive::Mesh2D { origin, buffers } => {
|
||||
layer.meshes.push((*origin, buffers.clone()));
|
||||
}
|
||||
Primitive::Clip {
|
||||
bounds,
|
||||
|
|
@ -313,9 +313,10 @@ impl Renderer {
|
|||
|
||||
if layer.meshes.len() > 0 {
|
||||
let translated = transformation
|
||||
* Transformation::scale(scale_factor, scale_factor)
|
||||
* Transformation::translate(
|
||||
-(layer.offset.x as f32) * scale_factor,
|
||||
-(layer.offset.y as f32) * scale_factor,
|
||||
-(layer.offset.x as f32),
|
||||
-(layer.offset.y as f32),
|
||||
);
|
||||
|
||||
self.triangle_pipeline.draw(
|
||||
|
|
@ -323,7 +324,6 @@ impl Renderer {
|
|||
encoder,
|
||||
target,
|
||||
translated,
|
||||
scale_factor,
|
||||
&layer.meshes,
|
||||
bounds,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue