function* create_globe() {
let this_width = width;
let height = d3.min([this_width, window.screen.height]);
let container = d3
.create('div')
.style('width', this_width.toString() + 'px')
.style('height', height.toString() + 'px');
let scene = container
.append('x3d')
.attr('width', this_width.toString() + 'px')
.attr('height', height.toString() + 'px')
.append('scene');
let r = (2 * Math.PI) / 3;
r = r.toString();
let d = 1 / Math.sqrt(3);
d = d.toString();
let ddd = d + " " + d + " " + d;
scene
.append('navigationinfo')
.attr('explorationMode','-pan')
.attr('headlight', 'false');
scene
.append('viewpoint')
.attr('position', 4*6370000 + " 0 0")
.attr('orientation', ddd + " " + r);
scene
.append('directionalLight')
.attr('direction', '-1 1 0')
.attr('on', 'TRUE')
.attr('ambientIntensity','0.5')
.attr('intensity', '1.0');
let tilt = scene
.append('transform')
.attr('id', 'tilt')
.attr('rotation', '1 0 0 0.4');
let rotation = tilt.append('transform').attr('id', 'rotation');
let sphere_shape = rotation.append('shape');
sphere_shape
.append('appearance')
.append('material')
.attr('diffuseColor', '0.63 0.73 0.85')
.attr('shininess', '0.1');
sphere_shape
.append('sphere')
.attr('subdivision', '256,256')
.attr('radius', 6350000 + vE*100);
for (let cnt = 0; cnt < land.pts.length; cnt++) {
let pt_string = '';
let color_string = '';
land.pts[cnt].forEach(function(lnglat) {
pt_string += [lnglat[1]*180/Math.PI, lnglat[0]*180/Math.PI, lnglat[2] * vE].join(" ")+", ";
color_string += shade(lnglat[2] / M) + ', ';
});
let index_string = '';
land.triangles[cnt].forEach(function(ijk) {
let i = ijk[0];
let j = ijk[1];
let k = ijk[2];
index_string = index_string + `${i} ${j} ${k} -1 `;
});
let land_shape = rotation.append('shape');
land_shape
.append('appearance')
.append('material');
let indexedFaceSet = land_shape
.append('indexedFaceset')
.attr('coordIndex', index_string)
.attr('creaseAngle', '3.14');
indexedFaceSet.append('geocoordinate').attr('point', pt_string);
indexedFaceSet.append('Color').attr('color', color_string);
let mesh = rotation.append('shape').attr('class', 'mesh');
mesh
.append('appearance')
.append('material')
.attr('transparency', 1);
mesh
.append('IndexedLineSet')
.attr('coordIndex', index_string)
.append('geocoordinate')
.attr('point', pt_string);
}
yield container.node();
x3dom.reload();
}