mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
remove field_infos from UniformInfoIter
This commit is contained in:
parent
08cd5964a4
commit
55130bbe1c
1 changed files with 9 additions and 10 deletions
|
@ -36,20 +36,18 @@ pub enum FieldBindType {
|
||||||
Texture,
|
Texture,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct UniformInfoIter<'a, 'b, T: AsUniforms> {
|
pub struct UniformInfoIter<'a, T: AsUniforms> {
|
||||||
pub field_infos: &'a [FieldInfo],
|
pub uniforms: &'a T,
|
||||||
pub uniforms: &'b T,
|
|
||||||
pub index: usize,
|
pub index: usize,
|
||||||
pub add_sampler: bool,
|
pub add_sampler: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, T> UniformInfoIter<'a, 'b, T>
|
impl<'a, T> UniformInfoIter<'a, T>
|
||||||
where
|
where
|
||||||
T: AsUniforms,
|
T: AsUniforms,
|
||||||
{
|
{
|
||||||
pub fn new(field_infos: &'a [FieldInfo], uniforms: &'b T) -> Self {
|
pub fn new(uniforms: &'a T) -> Self {
|
||||||
UniformInfoIter {
|
UniformInfoIter {
|
||||||
field_infos,
|
|
||||||
uniforms,
|
uniforms,
|
||||||
index: 0,
|
index: 0,
|
||||||
add_sampler: false,
|
add_sampler: false,
|
||||||
|
@ -57,25 +55,26 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, T> Iterator for UniformInfoIter<'a, 'b, T>
|
impl<'a, T> Iterator for UniformInfoIter<'a, T>
|
||||||
where
|
where
|
||||||
T: AsUniforms,
|
T: AsUniforms,
|
||||||
{
|
{
|
||||||
type Item = UniformInfo<'a>;
|
type Item = UniformInfo<'a>;
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
let field_infos = T::get_field_infos();
|
||||||
if self.add_sampler {
|
if self.add_sampler {
|
||||||
self.add_sampler = false;
|
self.add_sampler = false;
|
||||||
Some(UniformInfo {
|
Some(UniformInfo {
|
||||||
name: self.field_infos[self.index - 1].sampler_name,
|
name: field_infos[self.index - 1].sampler_name,
|
||||||
bind_type: BindType::Sampler,
|
bind_type: BindType::Sampler,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if self.index >= self.field_infos.len() {
|
if self.index >= field_infos.len() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let index = self.index;
|
let index = self.index;
|
||||||
self.index += 1;
|
self.index += 1;
|
||||||
let ref field_info = self.field_infos[index];
|
let ref field_info = field_infos[index];
|
||||||
let bind_type = self.uniforms.get_field_bind_type(field_info.name);
|
let bind_type = self.uniforms.get_field_bind_type(field_info.name);
|
||||||
if let Some(bind_type) = bind_type {
|
if let Some(bind_type) = bind_type {
|
||||||
Some(match bind_type {
|
Some(match bind_type {
|
||||||
|
|
Loading…
Reference in a new issue