blob: dd0be911e311a1a25a8b528c8dda6bc332215e84 [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Globe - ECHARTS-GL</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="../common/reset.css">
</head>
<body>
<div id="main"></div>
<script src="../common/echarts.min.js"></script>
<script src="../common/jquery.min.js"></script>
<script src="../common/echarts-gl.js"></script>
<script src="../common/dat.gui.js"></script>
<script src="../texture/world.jpg.js"></script>
<script src="../texture/elev_bump.jpg.js"></script>
<script src="../texture/pisa.hdr.js"></script>
<script>
var chart = echarts.init(document.getElementById('main'));
var config = {
sun: 4,
lightIntensity: 2
};
function getTime() {
var time = Date.parse('2017-05-21');
return new Date(time + 3600 * 1000 * (config.sun - 8));
}
chart.setOption({
globe: {
baseTexture: worldUrl,
heightTexture: elevBumpUrl,
displacementScale: 0.1,
shading: 'lambert',
realisticMaterial: {
roughness: 0.8,
metalness: 0
},
postEffect: {
enable: true
},
temporalSuperSampling: {
enable: true
},
environment: '../texture/starfield.jpg',
light: {
ambient: {
intensity: 0
},
main: {
intensity: 5,
shadow: true,
time: getTime()
}
},
viewControl: {
autoRotate: false,
targetCoord: [116.46, 39.92]
},
layers: [{
type: 'blend',
blendTo: 'emission',
intensity: config.lightIntensity,
texture: '../texture/night.jpg'
}]
},
series: []
});
window.onresize = chart.resize;
var gui = new dat.GUI();
gui.add(config, 'sun', 0, 24).onChange(function () {
chart.setOption({
globe: {
light: {
main: {
time: getTime()
}
},
viewControl: {
targetCoord: null
}
}
});
});
gui.add(config, 'lightIntensity', 0, 3).onChange(function () {
chart.setOption({
globe: {
layers: [{
intensity: config.lightIntensity
}],
viewControl: {
targetCoord: null
}
}
});
});
</script>
</body>
</html>