More import adjusting.
This commit is contained in:
parent
3e600fe775
commit
215e6c95be
4 changed files with 20 additions and 21 deletions
|
|
@ -4,14 +4,12 @@ mod solid;
|
|||
|
||||
use crate::{program, Transformation};
|
||||
use glow::HasContext;
|
||||
use iced_graphics::layer::{attribute_count_of, Mesh};
|
||||
use iced_graphics::layer::{mesh, mesh::attribute_count_of, Mesh};
|
||||
use std::marker::PhantomData;
|
||||
use iced_graphics::layer;
|
||||
|
||||
use crate::triangle::gradient::GradientProgram;
|
||||
use crate::triangle::solid::SolidProgram;
|
||||
pub use iced_graphics::triangle::{Mesh2D, Vertex2D};
|
||||
use layer::mesh;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Pipeline {
|
||||
|
|
@ -144,7 +142,9 @@ impl Pipeline {
|
|||
self.programs.solid.use_program(gl, &color, &transform);
|
||||
}
|
||||
mesh::Style::Gradient(gradient) => {
|
||||
self.programs.gradient.use_program(gl, &gradient, &transform);
|
||||
self.programs
|
||||
.gradient
|
||||
.use_program(gl, &gradient, &transform);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ pub fn set_transform(
|
|||
gl.uniform_matrix_4_f32_slice(
|
||||
Some(&location),
|
||||
false,
|
||||
transform.as_ref()
|
||||
transform.as_ref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,16 +244,4 @@ impl<'a> Layer<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of total vertices & total indices of all [`Mesh`]es.
|
||||
pub fn attribute_count_of<'a>(meshes: &'a [Mesh<'a>]) -> (usize, usize) {
|
||||
meshes
|
||||
.iter()
|
||||
.map(|Mesh { buffers, .. }| {
|
||||
(buffers.vertices.len(), buffers.indices.len())
|
||||
})
|
||||
.fold((0, 0), |(total_v, total_i), (v, i)| {
|
||||
(total_v + v, total_i + i)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -37,3 +37,15 @@ impl <'a> Into<Style> for Gradient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of total vertices & total indices of all [`Mesh`]es.
|
||||
pub fn attribute_count_of<'a>(meshes: &'a [Mesh<'a>]) -> (usize, usize) {
|
||||
meshes
|
||||
.iter()
|
||||
.map(|Mesh { buffers, .. }| {
|
||||
(buffers.vertices.len(), buffers.indices.len())
|
||||
})
|
||||
.fold((0, 0), |(total_v, total_i), (v, i)| {
|
||||
(total_v + v, total_i + i)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@ use crate::{settings, Transformation};
|
|||
use core::fmt;
|
||||
use std::fmt::Formatter;
|
||||
|
||||
use iced_graphics::layer::{attribute_count_of, Mesh};
|
||||
use iced_graphics::{layer, Size};
|
||||
use iced_graphics::layer::{Mesh, mesh, mesh::attribute_count_of};
|
||||
use iced_graphics::Size;
|
||||
|
||||
use crate::buffers::StaticBuffer;
|
||||
use crate::triangle::gradient::GradientPipeline;
|
||||
use crate::triangle::solid::SolidPipeline;
|
||||
pub use iced_graphics::triangle::{Mesh2D, Vertex2D};
|
||||
use layer::mesh;
|
||||
|
||||
mod solid;
|
||||
mod gradient;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue