Add function "render_into" to the ECS system

This is needed for the imgui integration
This commit is contained in:
reo 2025-07-05 20:43:18 +03:00
parent a17a6016b8
commit 111c42a746

View file

@ -1,6 +1,6 @@
use glam::{Mat4, Quat, Vec3}; use glam::{Mat4, Quat, Vec3};
use hecs::{Entity, World}; use hecs::{Entity, World};
use crate::{render::{GliumRenderer, Renderer}, model}; use crate::{render::GliumRenderer, model};
/// This system joins the renderer and ECS, /// This system joins the renderer and ECS,
/// and provides tools to use them together /// and provides tools to use them together
@ -34,6 +34,12 @@ impl ECSRenderer {
pub fn render(&mut self) { pub fn render(&mut self) {
self.renderer.render(&self.world); self.renderer.render(&self.world);
} }
/// Render into an existing glium target surface. Useful for composing with
/// other render passes (e.g. Dear ImGui).
pub fn render_into<S: glium::Surface>(&mut self, target: &mut S) {
self.renderer.render_into(&self.world, target);
}
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone)]