Format code

This commit is contained in:
Olivier 'reivilibre' 2021-06-26 19:15:32 +01:00
parent 6472746bd2
commit 701639315e
2 changed files with 8 additions and 17 deletions

View File

@ -9,7 +9,7 @@ mod region;
pub use region::Region; pub use region::Region;
use pipeline::{Vertex, Pipeline}; use pipeline::{Pipeline, Vertex};
pub use builder::GlyphBrushBuilder; pub use builder::GlyphBrushBuilder;
pub use glyph_brush::ab_glyph; pub use glyph_brush::ab_glyph;
@ -24,9 +24,9 @@ use ab_glyph::{Font, FontArc, Rect};
use core::hash::BuildHasher; use core::hash::BuildHasher;
use std::borrow::Cow; use std::borrow::Cow;
use crate::pipeline::VertexGroup;
use glyph_brush::{BrushAction, BrushError, DefaultSectionHasher}; use glyph_brush::{BrushAction, BrushError, DefaultSectionHasher};
use log::{log_enabled, warn}; use log::{log_enabled, warn};
use crate::pipeline::VertexGroup;
/// Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing, /// Object allowing glyph drawing, containing cache state. Manages glyph positioning cacheing,
/// glyph draw caching & efficient GPU texture cache updating and re-sizing on demand. /// glyph draw caching & efficient GPU texture cache updating and re-sizing on demand.

View File

@ -125,9 +125,7 @@ impl Pipeline {
let num = self.current_instances as i32; let num = self.current_instances as i32;
for i in 0..num { for i in 0..num {
gl.draw_arrays(glow::TRIANGLE_STRIP, gl.draw_arrays(glow::TRIANGLE_STRIP, i * 4, 4);
i * 4,
4);
} }
gl.bind_vertex_array(None); gl.bind_vertex_array(None);
@ -278,22 +276,22 @@ impl Vertex {
let vert0 = Vertex { let vert0 = Vertex {
tex_pos: [tex_coords.min.x, tex_coords.max.y], tex_pos: [tex_coords.min.x, tex_coords.max.y],
pos: [left, top, extra.z], pos: [left, top, extra.z],
color: extra.color color: extra.color,
}; };
let vert1 = Vertex { let vert1 = Vertex {
tex_pos: [tex_coords.max.x, tex_coords.max.y], tex_pos: [tex_coords.max.x, tex_coords.max.y],
pos: [right, top, extra.z], pos: [right, top, extra.z],
color: extra.color color: extra.color,
}; };
let vert2 = Vertex { let vert2 = Vertex {
tex_pos: [tex_coords.min.x, tex_coords.min.y], tex_pos: [tex_coords.min.x, tex_coords.min.y],
pos: [left, bottom, extra.z], pos: [left, bottom, extra.z],
color: extra.color color: extra.color,
}; };
let vert3 = Vertex { let vert3 = Vertex {
tex_pos: [tex_coords.max.x, tex_coords.min.y], tex_pos: [tex_coords.max.x, tex_coords.min.y],
pos: [right, bottom, extra.z], pos: [right, bottom, extra.z],
color: extra.color color: extra.color,
}; };
VertexGroup(vert0, vert1, vert2, vert3) VertexGroup(vert0, vert1, vert2, vert3)
@ -365,14 +363,7 @@ unsafe fn create_instance_buffer(
gl.vertex_attrib_pointer_f32(1, 3, glow::FLOAT, false, stride, 4 * 2); gl.vertex_attrib_pointer_f32(1, 3, glow::FLOAT, false, stride, 4 * 2);
gl.enable_vertex_attrib_array(2); gl.enable_vertex_attrib_array(2);
gl.vertex_attrib_pointer_f32( gl.vertex_attrib_pointer_f32(2, 4, glow::FLOAT, false, stride, 4 * (2 + 3));
2,
4,
glow::FLOAT,
false,
stride,
4 * (2 + 3),
);
gl.bind_vertex_array(None); gl.bind_vertex_array(None);
gl.bind_buffer(glow::ARRAY_BUFFER, None); gl.bind_buffer(glow::ARRAY_BUFFER, None);