This repository was archived by the owner on Nov 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
86 lines (73 loc) · 2.5 KB
/
index.html
File metadata and controls
86 lines (73 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="js/Three.js"></script>
<script type="text/javascript" src="js/ShaderTerrain.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
</head>
<body>
<div id="main_map">
</div>
<script type="text/javascript">
var POS_X = 1800;
var POS_Y = 500;
var POS_Z = 1800;
var WIDTH = 1000;
var HEIGHT = 600;
var FOV = 45;
var NEAR = 1;
var FAR = 4000;
// some global variables and initialization code
// simple basic renderer
var renderer = new THREE.WebGLRenderer();
renderer.setSize(WIDTH,HEIGHT);
renderer.setClearColorHex(0x111111);
// add it to the target element
var mapDiv = document.getElementById("globe");
mapDiv.appendChild(renderer.domElement);
// setup a camera that points to the center
var camera = new THREE.PerspectiveCamera(FOV,WIDTH/HEIGHT,NEAR,FAR);
camera.position.set(POS_X,POS_Y, POS_Z);
camera.lookAt(new THREE.Vector3(0,0,0));
// create a basic scene and add the camera
var scene = new THREE.Scene();
scene.add(camera);
// we wait until the document is loaded before loading the
// density data.
$(document).ready(function() {
jQuery.get('data/density.csv', function(data) {
addDensity(CSVToArray(data));
addLights();
addEarth();
addClouds();
render();
});
});
// add the earth
function addEarth() {
var spGeo = new THREE.SphereGeometry(600,50,50);
var planetTexture = THREE.ImageUtils.loadTexture( "world.200412.3x5400x2700.jpg" );
var mat2 = new THREE.MeshPhongMaterial( {
map: planetTexture,
shininess: 0.2 } );
sp = new THREE.Mesh(spGeo,mat2);
scene.add(sp);
}
function addClouds() {
var spGeo = new THREE.SphereGeometry(600,50,50);
var cloudsTexture = THREE.ImageUtils.loadTexture( "" );
var materialClouds = new THREE.MeshPhongMaterial( { color: 0xffffff, map: cloudsTexture, transparent:true, opacity:0.3 } );
meshClouds = new THREE.Mesh( spGeo, materialClouds );
meshClouds.scale.set( 1.015, 1.015, 1.015 );
scene.add( meshClouds );
}
// add a simple light
function addLights() {
light = new THREE.DirectionalLight(0x3333ee, 3.5, 500 );
scene.add( light );
light.position.set(POS_X,POS_Y,POS_Z);
}
</script>
</body>
</html>