diff --git a/imgui-examples/examples/custom_textures.rs b/imgui-examples/examples/custom_textures.rs index e9ce713..b446607 100644 --- a/imgui-examples/examples/custom_textures.rs +++ b/imgui-examples/examples/custom_textures.rs @@ -11,7 +11,7 @@ use glium::{ }; use image::{jpeg::JpegDecoder, ImageDecoder}; use imgui::*; -use imgui_glium_renderer::TextureEntry; +use imgui_glium_renderer::Texture; mod support; @@ -30,7 +30,7 @@ impl CustomTexturesApp { fn register_textures( &mut self, gl_ctx: &F, - textures: &mut Textures, + textures: &mut Textures, ) -> Result<(), Box> where F: Facade, @@ -57,7 +57,7 @@ impl CustomTexturesApp { format: ClientFormat::U8U8U8, }; let gl_texture = Texture2d::new(gl_ctx, raw)?; - let texture = TextureEntry { + let texture = Texture { texture: Rc::new(gl_texture), mag_filter: MagnifySamplerFilter::Linear, min_filter: MinifySamplerFilter::Linear, @@ -93,7 +93,7 @@ impl CustomTexturesApp { } impl Lenna { - fn new(gl_ctx: &F, textures: &mut Textures) -> Result> + fn new(gl_ctx: &F, textures: &mut Textures) -> Result> where F: Facade, { @@ -111,7 +111,7 @@ impl Lenna { format: ClientFormat::U8U8U8, }; let gl_texture = Texture2d::new(gl_ctx, raw)?; - let texture = TextureEntry { + let texture = Texture { texture: Rc::new(gl_texture), mag_filter: MagnifySamplerFilter::Linear, min_filter: MinifySamplerFilter::Linear, diff --git a/imgui-glium-renderer/src/lib.rs b/imgui-glium-renderer/src/lib.rs index cf322e2..4dae2fd 100644 --- a/imgui-glium-renderer/src/lib.rs +++ b/imgui-glium-renderer/src/lib.rs @@ -86,7 +86,7 @@ impl From for RendererError { } } -pub struct TextureEntry { +pub struct Texture { pub texture: Rc, pub mag_filter: MagnifySamplerFilter, pub min_filter: MinifySamplerFilter, @@ -95,8 +95,8 @@ pub struct TextureEntry { pub struct Renderer { ctx: Rc, program: Program, - font_texture: TextureEntry, - textures: Textures, + font_texture: Texture, + textures: Textures, } impl Renderer { @@ -121,10 +121,10 @@ impl Renderer { self.font_texture = upload_font_texture(ctx.fonts(), &self.ctx)?; Ok(()) } - pub fn textures(&mut self) -> &mut Textures { + pub fn textures(&mut self) -> &mut Textures { &mut self.textures } - fn lookup_texture(&self, texture_id: TextureId) -> Result<&TextureEntry, RendererError> { + fn lookup_texture(&self, texture_id: TextureId) -> Result<&Texture, RendererError> { if texture_id.id() == usize::MAX { Ok(&self.font_texture) } else if let Some(texture) = self.textures.get(texture_id) { @@ -238,7 +238,7 @@ impl Renderer { fn upload_font_texture( mut fonts: imgui::FontAtlasRefMut, ctx: &Rc, -) -> Result { +) -> Result { let texture = fonts.build_rgba32_texture(); let data = RawImage2d { data: Cow::Borrowed(texture.data), @@ -248,7 +248,7 @@ fn upload_font_texture( }; let font_texture = Texture2d::with_mipmaps(ctx, data, MipmapsOption::NoMipmap)?; fonts.tex_id = TextureId::from(usize::MAX); - Ok(TextureEntry { + Ok(Texture { texture: Rc::new(font_texture), mag_filter: MagnifySamplerFilter::Linear, min_filter: MinifySamplerFilter::Linear,