wrend/framebuffers/
framebuffer_create_context.rs

1use web_sys::{WebGl2RenderingContext, WebGlTexture};
2
3/// Context used when creating a Framebuffer object--passed into the callback as the first argument
4#[derive(Debug, Clone)]
5pub struct FramebufferCreateContext {
6    gl: WebGl2RenderingContext,
7    now: f64,
8    /// This is the texture that was specified in the link
9    /// and which will be associated with the Framebuffer
10    webgl_texture: Option<WebGlTexture>,
11}
12
13impl FramebufferCreateContext {
14    /// @todo: make this into a builder pattern
15    pub fn new(gl: WebGl2RenderingContext, now: f64, webgl_texture: Option<WebGlTexture>) -> Self {
16        Self {
17            gl,
18            now,
19            webgl_texture,
20        }
21    }
22
23    pub fn gl(&self) -> &WebGl2RenderingContext {
24        &self.gl
25    }
26
27    pub fn now(&self) -> f64 {
28        self.now
29    }
30
31    pub fn webgl_texture(&self) -> &Option<WebGlTexture> {
32        &self.webgl_texture
33    }
34}