MCPcopy
hub / github.com/widgetti/ipyvolume / render

Method render

js/src/mesh.ts:48–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 length = 1;
47
48 render() {
49 // console.log("created mesh view, parent is")
50 // console.log(this.options.parent)
51
52 this.figure = this.options.parent;
53 if(!this.figure) {
54 throw 'Mesh cannot be displayed, should be added to Figure'
55 }
56 this.figure.model.on('change:_shaders', () => {
57 console.log('updating mesh shader (hot reload)')
58 this._update_materials();
59 }, this);
60 this.previous_values = {};
61 this.attributes_changed = {};
62 (window as any).last_mesh_view = this;
63 this.meshes = [];
64 this.texture_loader = new THREE.TextureLoader();
65 this.textures = null;
66 if (this.model.get("texture")) {
67 this._load_textures();
68 }
69
70 this.uniforms = {
71 domain_x: { type: "2f", value: [0., 1.] },
72 domain_y: { type: "2f", value: [0., 1.] },
73 domain_z: { type: "2f", value: [0., 1.] },
74 domain_color: { type: "2f", value: [0., 1.] },
75 // tslint:disable-next-line: object-literal-sort-keys
76 animation_time_x : { type: "f", value: 1. },
77 animation_time_y : { type: "f", value: 1. },
78 animation_time_z : { type: "f", value: 1. },
79 animation_time_u : { type: "f", value: 1. },
80 animation_time_v : { type: "f", value: 1. },
81 animation_time_color : { type: "f", value: 1. },
82 animation_time_texture : { type: "f", value: 1. },
83 texture: { type: "t", value: null },
84 texture_previous: { type: "t", value: null },
85 colormap: {type: "t", value: null},
86 id_offset : { type: "f", value: 0 },
87 volume_texture: {type: "t", value: null},
88 transfer_function: {type: "t", value: null},
89 position_offset : { type: "3f", value: [0, 0, 0] },
90 volume: {value: null},
91 ...THREE.UniformsUtils.merge([THREE.UniformsLib["common"], THREE.UniformsLib["lights"]])
92 };
93
94 const get_material = (name) => {
95 if (this.model.get(name)) {
96 return this.model.get(name).obj.clone();
97 } else {
98 const mat = new THREE.ShaderMaterial();
99 mat.side = THREE.DoubleSide;
100 mat.needsUpdate = true;
101
102 return mat;
103 }
104
105 };

Callers 2

update_meshesMethod · 0.95
StereoEffect.jsFile · 0.45

Calls 6

_update_materialsMethod · 0.95
_load_texturesMethod · 0.95
_update_color_scaleMethod · 0.95
create_meshMethod · 0.95
add_to_sceneMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected