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
use wasm_bindgen::prelude::*;
use web_sys::{WebGl2RenderingContext, WebGlProgram};
use std::rc::Rc;

pub mod prelude{
    pub use crate::app::App;
    pub use crate::util::*;
}
use crate::prelude::*;

pub mod gl;
#[macro_use]
pub mod util;
pub mod app;

#[allow(dead_code)]
#[wasm_bindgen]
pub struct WebGlView {
    app: Rc<App>,
    gl: Rc<WebGl2RenderingContext>,
    program: Option<WebGlProgram>,
}

#[wasm_bindgen]
impl WebGlView {
    #[wasm_bindgen(constructor)]
    pub fn new(gl: WebGl2RenderingContext) -> Self {
        WebGlView {
            app: Rc::new(App::new()),
            gl: Rc::new(gl),
            program: None
        }
    }
    pub fn start(&self) {

    }
    pub fn update(&self){

    }
    pub fn render(&self){

    }
}