1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
use generational_arena::Index; use rin::graphics; use std::fmt::{self, Debug}; #[derive(Clone,Copy,Debug,Component,Eq,PartialEq, Ord, PartialOrd)] #[debug_as_string] pub struct ProgramRef(Index); impl ProgramRef { pub fn new(index: Index) -> ProgramRef { ProgramRef(index) } } #[derive(OneToNComponent)] #[debug_as_string] pub struct RenderPlane{ pub fbo: glin::Fbo, pub camera_ubo: glin::Buffer<graphics::mvp::CameraData> } impl<'a> glin::OffscreenBuffer for &'a RenderPlane{ type ColorAttach = glin::fbo::ColorAttachment; type DepthAttach = glin::fbo::DepthAttachment; fn render_buffer(&self) -> &glin::Fbo{ &self.fbo } fn color_attachment(&self, idx: usize) -> Option<&glin::fbo::ColorAttachment>{ self.fbo.color_attachment(idx) } fn depth_attachment(&self) -> Option<&glin::fbo::DepthAttachment>{ self.fbo.depth_attachment() } } impl Debug for RenderPlane{ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result{ fmt.debug_struct("mutiny::renderer::RenderPlane") .field("fbo", &self.fbo.id()) .field("camera_ubo", &self.camera_ubo.id()) .finish() } }