| <!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 |
| }; |
| 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: 'realistic', |
| realisticMaterial: { |
| roughness: 0.8, |
| metalness: 0 |
| }, |
| |
| postEffect: { |
| enable: true |
| }, |
| temporalSuperSampling: { |
| enable: true |
| }, |
| |
| environment: '#000', |
| |
| light: { |
| ambient: { |
| intensity: 0 |
| }, |
| main: { |
| intensity: 5, |
| shadow: true, |
| time: getTime() |
| }, |
| // TODO |
| // ambientCubemap: { |
| // texture: pisaUrl, |
| // exposure: 2, |
| // diffuseIntensity: 0.05, |
| // specularIntensity: 0.1 |
| // } |
| }, |
| viewControl: { |
| autoRotate: false, |
| targetCoord: [116.46, 39.92] |
| } |
| }, |
| 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 |
| } |
| } |
| }); |
| }); |
| </script> |
| </body> |
| </html> |