WIP: move 3d rendering example into egui_demo_lib

This commit is contained in:
Emil Ernerfeldt
2022-03-20 23:01:40 +01:00
parent 4922b1912b
commit 3ff55be4be
11 changed files with 278 additions and 58 deletions
+12 -6
View File
@@ -374,16 +374,22 @@ pub struct IntegrationInfo {
pub native_pixels_per_point: Option<f32>,
}
/// Abstraction for platform dependent texture reference
pub trait NativeTexture {
/// The native texture type.
type Texture;
/// The rendering backend of `eframe`.
///
/// This is a wrapper around [`glow`](https://github.com/grovesNL/glow)
/// that also handles texture allocations.
pub trait Renderer {
/// Access the shared glow context.
fn gl(&self) -> &std::rc::Rc<glow::Context>;
/// Get the [`glow::Texture`] bound to a [`egui::TextureId`].
fn texture(&self, texture_id: egui::TextureId) -> Option<glow::Texture>;
/// Bind native texture to an egui texture id.
fn register_native_texture(&mut self, native: Self::Texture) -> egui::TextureId;
fn register_native_texture(&mut self, native: glow::Texture) -> egui::TextureId;
/// Change what texture the given id refers to.
fn replace_native_texture(&mut self, id: egui::TextureId, replacing: Self::Texture);
fn replace_native_texture(&mut self, id: egui::TextureId, replacing: glow::Texture);
}
// ----------------------------------------------------------------------------