From 70cc1f5bbf78e595d08c72f39e86075e46013277 Mon Sep 17 00:00:00 2001
From: ofrohn
Date: Sun, 24 Jul 2016 18:03:22 +0200
Subject: [PATCH 01/31] Complete rewrite with new images and adapted display
---
README.md | 10 +-
examples/atmospherematerial.html | 8 +-
examples/earth.html | 8 +-
examples/select.html | 74 +-
examples/vendor/three.js/build/three.min.js | 1656 +++++++++++--------
images/earthbump.jpg | Bin 0 -> 21073 bytes
images/earthbump1k.jpg | Bin 91237 -> 0 bytes
images/earthmap.jpg | Bin 0 -> 55900 bytes
images/earthmap1k.jpg | Bin 344080 -> 0 bytes
images/earthmapclouds.jpg | Bin 0 -> 138926 bytes
images/earthspec.jpg | Bin 0 -> 39544 bytes
images/earthspec1k.jpg | Bin 116543 -> 0 bytes
images/jupitermap.jpg | Bin 157780 -> 43088 bytes
images/jupiterrings.gif | Bin 0 -> 2901 bytes
images/marsbump.jpg | Bin 0 -> 43184 bytes
images/marsbump1k.jpg | Bin 140596 -> 0 bytes
images/marsmap.jpg | Bin 0 -> 73975 bytes
images/marsmap1k.jpg | Bin 525256 -> 0 bytes
images/mercurybump.jpg | Bin 194108 -> 66021 bytes
images/mercurymap.jpg | Bin 285975 -> 136308 bytes
images/moonbump.jpg | Bin 0 -> 79700 bytes
images/moonbump1k.jpg | Bin 385822 -> 0 bytes
images/moonmap.jpg | Bin 0 -> 45697 bytes
images/moonmap1k.jpg | Bin 403689 -> 0 bytes
images/neptunemap.jpg | Bin 48069 -> 85857 bytes
images/neptunerings.gif | Bin 0 -> 3301 bytes
images/plutobump1k.jpg | Bin 226980 -> 0 bytes
images/plutomap.jpg | Bin 0 -> 49361 bytes
images/plutomap1k.jpg | Bin 325111 -> 0 bytes
images/saturnmap.jpg | Bin 70548 -> 115243 bytes
images/saturnringpattern.gif | Bin 27876 -> 0 bytes
images/saturnrings.gif | Bin 0 -> 33634 bytes
images/sunmap.jpg | Bin 281479 -> 21707 bytes
images/sunmap2.jpg | Bin 0 -> 82146 bytes
images/uranusrings.gif | Bin 0 -> 36058 bytes
images/uranusringtrans.gif | Bin 41914 -> 0 bytes
images/venusbump.jpg | Bin 251909 -> 0 bytes
images/venusmap.jpg | Bin 255067 -> 26190 bytes
threex.planets.js | 614 +++----
39 files changed, 1261 insertions(+), 1109 deletions(-)
create mode 100644 images/earthbump.jpg
delete mode 100644 images/earthbump1k.jpg
create mode 100644 images/earthmap.jpg
delete mode 100644 images/earthmap1k.jpg
create mode 100644 images/earthmapclouds.jpg
create mode 100644 images/earthspec.jpg
delete mode 100644 images/earthspec1k.jpg
create mode 100644 images/jupiterrings.gif
create mode 100644 images/marsbump.jpg
delete mode 100644 images/marsbump1k.jpg
create mode 100644 images/marsmap.jpg
delete mode 100644 images/marsmap1k.jpg
create mode 100644 images/moonbump.jpg
delete mode 100644 images/moonbump1k.jpg
create mode 100644 images/moonmap.jpg
delete mode 100644 images/moonmap1k.jpg
create mode 100644 images/neptunerings.gif
delete mode 100644 images/plutobump1k.jpg
create mode 100644 images/plutomap.jpg
delete mode 100644 images/plutomap1k.jpg
delete mode 100644 images/saturnringpattern.gif
create mode 100644 images/saturnrings.gif
create mode 100644 images/sunmap2.jpg
create mode 100644 images/uranusrings.gif
delete mode 100644 images/uranusringtrans.gif
delete mode 100644 images/venusbump.jpg
diff --git a/README.md b/README.md
index 15a8b03..9e1681b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,15 @@ threex.planets.js
=================
It is a three.js extension to display planets
-based on the data from [planetpixelemporium](http://planetpixelemporium.com/planets.html).
+based on the data from
+* [planetpixelemporium](http://planetpixelemporium.com/planets.html) (Sun*, Earth, Saturn Rings*, Uranus)
+* [USGS](http://astrogeology.usgs.gov/solar-system) (Mercury DEM, Moon*, Mars)
+* [NASA/JHUAPL/Carnegie Institution of Washington](http://messenger.jhuapl.edu/Explore/Images.html#global-mosaics) (Mercury Map*)
+* [NASA/JHUAPL/SWRI](http://pluto.jhuapl.edu/Multimedia/Science-Photos/image.php?gallery_id=2&image_id=252) (Pluto*)
+* [Björn Jónsson](http://bjj.mmedia.is/data/planetary_maps.html) (Venus*, Saturn, Neptune)
+* [GSFC](http://svs.gsfc.nasa.gov/cgi-bin/details.cgi?aid=12021) (Jupiter)
+\* Hand adapted by ofrohn, also Jupiter & Neptune ring maps
+
It is a cool site, go check it out.
It provides all the planets from the solar system.
As a cherry on the cake, it has a 'atmosphere material'.
diff --git a/examples/atmospherematerial.html b/examples/atmospherematerial.html
index 064ed5d..a3b08f9 100644
--- a/examples/atmospherematerial.html
+++ b/examples/atmospherematerial.html
@@ -59,17 +59,17 @@
// mesh.visible = false
scene.add(mesh)
- var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+ var geometry = new THREE.SphereGeometry(THREEx.Planets.params.sun.radius, 32, 32)
geometry = mesh.geometry.clone()
var material = THREEx.createAtmosphereMaterial()
material.uniforms.glowColor.value = glowColor
var mesh = new THREE.Mesh(geometry, material );
- mesh.scale.multiplyScalar(1.01);
+ mesh.scale.multiplyScalar(1.005);
scene.add( mesh );
// new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
- var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+ var geometry = new THREE.SphereGeometry(THREEx.Planets.params.sun.radius, 32, 32)
geometry = mesh.geometry.clone()
var material = THREEx.createAtmosphereMaterial()
material.side = THREE.BackSide
@@ -77,7 +77,7 @@
material.uniforms.power.value = 4.0
material.uniforms.glowColor.value = glowColor
var mesh = new THREE.Mesh(geometry, material );
- mesh.scale.multiplyScalar(1.2);
+ mesh.scale.multiplyScalar(1.1);
scene.add( mesh );
new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
diff --git a/examples/earth.html b/examples/earth.html
index 8e4ce19..1c3cc01 100644
--- a/examples/earth.html
+++ b/examples/earth.html
@@ -73,24 +73,24 @@
earthMesh.rotation.y += 1/32 * delta;
})
- var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+ var geometry = new THREE.SphereGeometry(THREEx.Planets.params.earth.radius, 32, 32)
var material = THREEx.createAtmosphereMaterial()
material.uniforms.glowColor.value.set(0x00b3ff)
material.uniforms.coeficient.value = 0.8
material.uniforms.power.value = 2.0
var mesh = new THREE.Mesh(geometry, material );
- mesh.scale.multiplyScalar(1.01);
+ mesh.scale.multiplyScalar(1.005);
containerEarth.add( mesh );
// new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
- var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+ var geometry = new THREE.SphereGeometry(THREEx.Planets.params.earth.radius, 32, 32)
var material = THREEx.createAtmosphereMaterial()
material.side = THREE.BackSide
material.uniforms.glowColor.value.set(0x00b3ff)
material.uniforms.coeficient.value = 0.5
material.uniforms.power.value = 4.0
var mesh = new THREE.Mesh(geometry, material );
- mesh.scale.multiplyScalar(1.15);
+ mesh.scale.multiplyScalar(1.05);
containerEarth.add( mesh );
// new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
diff --git a/examples/select.html b/examples/select.html
index 2ee4e03..0b47405 100644
--- a/examples/select.html
+++ b/examples/select.html
@@ -1,5 +1,6 @@
-
-
+
+
+
@@ -22,37 +23,38 @@
document.body.appendChild( renderer.domElement );
renderer.shadowMapEnabled = true
- var updateFcts = [];
+ // array of functions for the rendering loop
+ var onRenderFcts= [];
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100 );
- camera.position.z = 1.5;
+ camera.position.z = 1.7;
var light = new THREE.AmbientLight( 0x888888 )
- scene.add( light )
+ scene.add( light );
// var light = new THREE.DirectionalLight( 'white', 1)
// light.position.set(5,5,5)
// light.target.position.set( 0, 0, 0 )
// scene.add( light )
- var light = new THREE.DirectionalLight( 0xcccccc, 1 )
- light.position.set(5,5,5)
- scene.add( light )
- light.castShadow = true
- light.shadowCameraNear = 0.01
- light.shadowCameraFar = 15
- light.shadowCameraFov = 45
+ var light = new THREE.DirectionalLight( 0xcccccc, 1 );
+ light.position.set(5,5,5);
+ scene.add( light );
+ light.castShadow = true;
+ light.shadowCameraNear = 0.01;
+ light.shadowCameraFar = 15;
+ light.shadowCameraFov = 45;
- light.shadowCameraLeft = -1
- light.shadowCameraRight = 1
- light.shadowCameraTop = 1
- light.shadowCameraBottom= -1
+ light.shadowCameraLeft = -1;
+ light.shadowCameraRight = 1;
+ light.shadowCameraTop = 1;
+ light.shadowCameraBottom= -1;
// light.shadowCameraVisible = true
- light.shadowBias = 0.001
- light.shadowDarkness = 0.2
+ light.shadowBias = 0.001;
+ light.shadowDarkness = 0.2;
- light.shadowMapWidth = 1024*2
- light.shadowMapHeight = 1024*2
+ light.shadowMapWidth = 1024*2;
+ light.shadowMapHeight = 1024*2;
//////////////////////////////////////////////////////////////////////////////////
@@ -125,13 +127,41 @@
mouse.x = (event.clientX / window.innerWidth ) - 0.5
mouse.y = (event.clientY / window.innerHeight) - 0.5
}, false)
- updateFcts.push(function(delta, now){
+ onRenderFcts.push(function(delta, now){
camera.position.x += (mouse.x*5 - camera.position.x) * (delta*3)
camera.position.y += (mouse.y*5 - camera.position.y) * (delta*3)
camera.lookAt( scene.position )
})
+
+ // handle window resize
+ window.addEventListener('resize', function(){
+ renderer.setSize( window.innerWidth, window.innerHeight )
+ camera.aspect = window.innerWidth / window.innerHeight
+ camera.updateProjectionMatrix()
+ }, false);
+ // render the scene
+ onRenderFcts.push(function(){
+ renderer.render(scene, camera);
+ });
+
+ // run the rendering loop
+ var lastTimeMsec= null;
+ requestAnimationFrame(function animate(nowMsec) {
+ // keep looping
+ requestAnimationFrame(animate);
+ // measure time
+ lastTimeMsec = lastTimeMsec || nowMsec-1000/60;
+ var deltaMsec = Math.min(200, nowMsec - lastTimeMsec);
+ lastTimeMsec = nowMsec;
+ // call each update function
+ onRenderFcts.forEach(function(onRenderFct) {
+ onRenderFct(deltaMsec/1000, nowMsec/1000);
+ })
+ })
+
+/*
//////////////////////////////////////////////////////////////////////////////////
// render the scene //
//////////////////////////////////////////////////////////////////////////////////
@@ -154,5 +184,5 @@
updateFcts.forEach(function(updateFn){
updateFn(deltaMsec/1000, nowMsec/1000)
})
- })
+ })*/