neo_babylon/
materials.rs

1use crate::prelude::*;
2
3#[wasm_bindgen]
4extern "C" {
5    #[wasm_bindgen(js_namespace = BABYLON)]
6    pub type Material;
7    
8    #[wasm_bindgen(extends = Material, js_namespace = BABYLON)]
9    pub type StandardMaterial;
10
11    #[wasm_bindgen(constructor, js_namespace = BABYLON)]
12    pub fn new(name: &str, scene: &Scene) -> StandardMaterial;
13}
14
15#[wasm_bindgen]
16extern "C" {
17    #[wasm_bindgen(js_namespace = BABYLON)]
18    pub type Texture;
19
20    #[wasm_bindgen(constructor, js_namespace = BABYLON)]
21    pub fn new(url: &str) -> Texture;
22}
23
24impl Texture {
25    get_set_jsvalue!(get_u_scale, set_u_scale, "uScale", f64);
26    get_set_jsvalue!(get_v_scale, set_v_scale, "vScale", f64);
27}
28
29impl StandardMaterial {
30    get_set_jsvalue!(get_diffuse_color, set_diffuse_color, "diffuseColor", Color3);
31    get_set_jsvalue!(get_specular_color, set_specular_color, "specularColor", Color3);
32    get_set_jsvalue!(get_emmisive_color, set_emmisive_color, "emmisiveColor", Color3);
33    get_set_jsvalue!(get_ambient_color, set_ambient_color, "ambientColor", Color3);
34    get_set_jsvalue!(get_diffuse_texture, set_diffuse_texture, "diffuseTexture", Texture);
35    get_set_jsvalue!(get_alpha, set_alpha, "alpha", f64);
36}