Permalink
Browse files

more work

  • Loading branch information...
1 parent 068afef commit 71f2ba8b655e352dfb0170da03f9b8c65685d678 @jeromeetienne committed Dec 15, 2013
Showing with 43,255 additions and 0 deletions.
  1. 0 .preview-mode
  2. +75 −0 source/_posts/2013-09-15-game-tutorial-how-to-make-a-shooting-spaceship.markdown
  3. +285 −0 source/_posts/2013-09-16-how-to-make-the-earth-in-webgl.markdown
  4. +47 −0 source/_posts/2013-12-15-zero-to-nyancat-in-30-seconds-flat.markdown
  5. +13 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/Makefile
  6. +12 −0 ...e/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/.bower.json
  7. +13 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/Makefile
  8. +97 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/README.md
  9. +123 −0 ...-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/atmospherematerial.html
  10. +130 −0 ...013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/basic.html
  11. +143 −0 ...013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/earth.html
  12. BIN ...make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/images/galaxy_starfield.png
  13. +161 −0 ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/select.html
  14. +724 −0 ...e-earth-in-webgl/demo/bower_components/threex.planets/examples/vendor/three.js/build/three.min.js
  15. +94 −0 ...bgl/demo/bower_components/threex.planets/examples/vendor/three.js/examples/js/libs/dat.gui.min.js
  16. BIN ...09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/ash_uvgrid01.jpg
  17. BIN ...-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthbump1k.jpg
  18. BIN ...9-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmap.jpg
  19. BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmaptrans.jpg
  20. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthmap1k.jpg
  21. BIN ...-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthspec1k.jpg
  22. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/jupitermap.jpg
  23. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/marsbump1k.jpg
  24. BIN ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/marsmap1k.jpg
  25. BIN ...-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/mercurybump.jpg
  26. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/mercurymap.jpg
  27. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/moonbump1k.jpg
  28. BIN ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/moonmap1k.jpg
  29. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/neptunemap.jpg
  30. BIN ...-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/plutobump1k.jpg
  31. BIN ...3-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/plutomap1k.jpg
  32. BIN ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnmap.jpg
  33. BIN ...16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnringcolor.jpg
  34. BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnringpattern.gif
  35. BIN .../2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/sunmap.jpg
  36. BIN ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusmap.jpg
  37. BIN ...6-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusringcolour.jpg
  38. BIN ...16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusringtrans.gif
  39. BIN ...13-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/venusbump.jpg
  40. BIN ...013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/venusmap.jpg
  41. +8 −0 ...2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/package.require.js
  42. +42 −0 ...16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/threex.atmospheredatgui.js
  43. +54 −0 ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/threex.atmospherematerial.js
  44. +381 −0 .../2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/threex.planets.js
  45. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/ash_uvgrid01.jpg
  46. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/earthbump1k.jpg
  47. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/earthcloudmap.jpg
  48. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/earthcloudmaptrans.jpg
  49. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/earthmap1k.jpg
  50. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/earthspec1k.jpg
  51. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/jupitermap.jpg
  52. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/marsbump1k.jpg
  53. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/marsmap1k.jpg
  54. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/mercurybump.jpg
  55. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/mercurymap.jpg
  56. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/moonbump1k.jpg
  57. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/moonmap1k.jpg
  58. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/neptunemap.jpg
  59. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/plutobump1k.jpg
  60. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/plutomap1k.jpg
  61. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/saturnmap.jpg
  62. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/saturnringcolor.jpg
  63. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/saturnringpattern.gif
  64. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/sunmap.jpg
  65. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/uranusmap.jpg
  66. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/uranusringcolour.jpg
  67. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/uranusringtrans.gif
  68. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/venusbump.jpg
  69. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/images/venusmap.jpg
  70. +95 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/index.html
  71. +2,019 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/vendor/require.js/require.js
  72. +37,875 −0 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/vendor/three.js/build/three.js
  73. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-bump-small.png
  74. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-bump.png
  75. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-cloud.png
  76. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-color.png
  77. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-diffuse-small.png
  78. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-diffuse.png
  79. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-specular-small.png
  80. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-specular.png
  81. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/galaxy_starfield.png
  82. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-earth.png
  83. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-jupiter.png
  84. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-mars.png
  85. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-mercury.png
  86. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-moon.png
  87. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-neptune.png
  88. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-pluto.png
  89. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-saturn.png
  90. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-sun.png
  91. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-uranus.png
  92. BIN source/data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-venus.png
  93. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide01.png
  94. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide02.png
  95. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide03.png
  96. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide04.png
  97. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide05.png
  98. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide06.png
  99. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide07.png
  100. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide08.png
  101. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide09.png
  102. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide10.png
  103. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide11.png
  104. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide12.png
  105. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide13.png
  106. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide14.png
  107. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide15.png
  108. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide16.png
  109. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide17.png
  110. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide18.png
  111. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide19.png
  112. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide20.png
  113. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide21.png
  114. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide22.png
  115. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide23.png
  116. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide24.png
  117. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide25.png
  118. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide26.png
  119. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide27.png
  120. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide28.png
  121. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide29.png
  122. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide30.png
  123. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide31.png
  124. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide32.png
  125. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide33.png
  126. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide34.png
  127. +8 −0 source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/Makefile
  128. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/boilerplate-nyancat-cube.png
  129. BIN ...ce/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/boilerplate-nyancat-naked.png
  130. BIN ...data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/bower-install-threex.nyancat.png
  131. BIN ...ta/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/screenshot-threejs-boilerplate.png
  132. BIN ...e/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/screenshot-threex-homepage.png
  133. BIN source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/threex.nyancat.png
  134. BIN ...e/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/images/yeoman-threejs-boilerplate.png
  135. +585 −0 source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/index.html
  136. +271 −0 source/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/slides.md
View
0 .preview-mode
No changes.
View
75 source/_posts/2013-09-15-game-tutorial-how-to-make-a-shooting-spaceship.markdown
@@ -0,0 +1,75 @@
+---
+layout: post
+title: "Game Tutorial: How To Make a Shooting SpaceShip"
+date: 2013-09-15 12:27
+comments: true
+published: false
+categories:
+---
+
+
+## How to load a space ship
+
+* We gonna learn how to load a model.
+* Where to get a model
+* how to export a model
+
+```javascript
+// create the loader object - pick the one fitting the file format
+var loader = new THREE.OBJMTLLoader();
+// warn me when the model is loaded
+loader.addEventListener('load', function( event ){
+ // once the model is loaded, add it to our scene
+ var object3d = event.content
+ scene.add(object3d)
+});
+// setup the model urls
+var objUrl = 'models/SpaceFighter01/SpaceFighter01.obj';
+var mtlUrl = 'models/SpaceFighter01/SpaceFighter01.mtl';
+// start loading the model
+loader.load(objUrl, mtlUrl);
+```
+
+## How to make photon missile
+* link to light demo how to
+ ["behind-scenes"](http://www.netmagazine.com/features/behind-scenes-lights-latest-webgl-sensation)
+ for
+ [lights](http://lights.elliegoulding.com/)
+ by
+ [Ellie Goulding](http://en.wikipedia.org/wiki/Ellie_Goulding)
+* make screenshoot to understand it
+
+## How to make the detonation flash
+* when your space ship shoots a photon missile, there is a detonation
+* For that we gonna use an asset from three.js distribution
+* this is only a three.plane
+
+
+
+# Meta
+# Meta
+# Meta
+
+############################################################################## Meta
+############################################################################## Meta
+
+
+## How to animate space ships in webgl
+* user input
+* timer in physics
+* photon missile
+ * emittion rate
+ * translation
+ * attached to world
+ * parent of a point light
+* detonation
+ * point light
+ * detonation Plane with tween.js for animation
+
+## How to include sounds in your space ship
+* use webaudiox.js
+* add detonation sound
+ * localisation of the sound
+* add spaceship reactor sound
+ * granular sound
+* add a electric field sound to each photon missle
View
285 source/_posts/2013-09-16-how-to-make-the-earth-in-webgl.markdown
@@ -0,0 +1,285 @@
+---
+layout: post
+title: "How To Make The Earth In WebGL?"
+date: 2013-09-16 10:13
+comments: true
+published: true
+categories: three.js
+---
+
+So today we gonna learn how to display the earth in webgl.
+That will be a nice introduction to material and textures.
+I got the idea while coding
+[threex.planets](http://github.com/jeromeetienne/threex.planets/),
+a three.js extension to easily display all the planets from the solar system based on
+[planetpixelemporium](http://planetpixelemporium.com/planets.html). With this post, you will be able to feel like astronauts conquering the outer space for the day and creating your own galaxy. :)
+
+<iframe width="425" height="349" src="http://www.youtube.com/embed/-3ZCZUgvmo0" frameborder="0" allowfullscreen></iframe>
+
+<!-- more -->
+
+So we want to render the earth with three.js... It is surprisingly easy to code.
+We gonna use the textures
+from
+[planetpixelemporium](http://planetpixelemporium.com/planets.html)
+and proceed step by step.
+But first let me show you the
+[demo we gonna write](/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/index.html) below.
+
+<iframe width="100%" height="349" src="/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/index.html" frameborder="0" allowfullscreen></iframe>
+
+First the geometry with a sphere, then each texture and their various effects.
+We will even add animations to make it more realistic and put it in context with
+a star field background.
+
+## Let's Do a Plain Sphere
+
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-color.png 320 240 %}
+
+Well we first create a geometry for the sphere, then
+we add a phong material,
+create a mesh from them
+and add it to the scene.
+The first parameter, ```0.5``` is the radius.
+The second parameter, ```32```, is the segments in width
+and
+the third, ```32```, is the segments in height.
+We make it quite detailed for it to be nicer.
+We pick ```THREE.MeshPhongMaterial``` to get
+[phong shading](http://en.wikipedia.org/wiki/Phong_shading).
+It provides [specular reflection](http://en.wikipedia.org/wiki/Specular_reflection)
+which will be used to get a shiny sea.
+
+<br clear='both'/>
+
+```javascript
+var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+var material = new THREE.MeshPhongMaterial()
+var earthMesh = new THREE.Mesh(geometry, material)
+scene.add(earthMesh)
+```
+
+Cool but rather flat... What about a diffuse texture to add some colors to our sphere.
+
+## Let's Add a Diffuse Texture
+
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-diffuse.png 320 240 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthmap1k.jpg 410 240 %}
+
+Above you can see the
+[diffuse texture](http://wiki.splashdamage.com/index.php/Basic_Texture_Overview)
+from
+[planetpixelemporium](http://planetpixelemporium.com/planets.html) to set the main color
+of the surface.
+When we apply it to a sphere, we get the image on the right.
+Here is the code to produce it.
+
+<br clear='both'/>
+
+```javascript
+material.map = THREE.ImageUtils.loadTexture('images/earthmap1k.jpg')
+```
+
+Hmm rather cool but more relief on the earth would be cool. What about a bump texture now ?
+
+## Let's Add a Bump Texture
+
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-bump.png 320 240 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthbump1k.jpg 410 240 %}
+
+Above is the bump map we use.
+According to [wikipedia definition](http://en.wikipedia.org/wiki/Bump_mapping),
+a bump map "perturbates the surface normals of the object
+using the perturbed normal during lighting calculations".
+Each of its pixels acts as a height on the surface.
+See the result on the right.
+The mountains appear more clearly thanks to their shadow.
+
+```javascript
+material.bumpMap = THREE.ImageUtils.loadTexture('images/earthbump1k.jpg')
+material.bumpScale = 0.05
+```
+
+It is possible to change how much the map affects lighting with ```bumpScale``` parameter.
+Play with it to fit your needs. Now that we change the heights on various parts of the
+earth, let's change its shininess with a specular texture.
+
+## Let's Add a Specular Texture
+
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-specular.png 320 240 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthspec1k.jpg 410 240 %}
+
+Above is the [specular map](http://wiki.splashdamage.com/index.php/Specular_Maps) we use.
+Each pixel determines the intensity of
+[specularity](http://en.wikipedia.org/wiki/Specularity).
+In this case, only the sea is specular because water reflects water more than earth.
+You can see it on the left with the white halo in the Gulf of Mexico.
+You can control the specular color with ```.specular``` parameter.
+
+```javascript
+material.specularMap = THREE.ImageUtils.loadTexture('images/earthspec1k.jpg')
+material.specular = new THREE.Color('grey')
+```
+
+Yeah but all this water, where does it go when it is hot ? It evaporates in the sky
+and becomes clouds.
+
+## Let's Add a Cloud Layer
+
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmap.jpg 320 240 %}
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/earth-cloud.png 320 240 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmaptrans.jpg 360 240 %}
+
+<br clear='both'/>
+
+We build ```canvasCloud``` and use it as texture.
+It is based on the jpg images you see above:
+one for the color and the other for the transparency.
+We do that because
+[jpg](http://en.wikipedia.org/wiki/JPEG)
+doesn't handle an alpha channel.
+So you need to make the code to build the texture based on those images.
+
+```javascript
+var geometry = new THREE.SphereGeometry(0.51, 32, 32)
+var material = new THREE.MeshPhongMaterial({
+ map : new THREE.Texture(canvasCloud),
+ side : THREE.DoubleSide,
+ opacity : 0.8,
+ transparent : true,
+ depthWrite : false,
+})
+var cloudMesh = new THREE.Mesh(geometry, material)
+earthMesh.add(cloudMesh)
+```
+
+We attach the cloudMesh to the earthMesh, thus they will move together.
+Notice the parameters of the material.
+We disable ```depthWrite``` and set ```transparent``` to warn three.js the
+cloud mesh is transparent.
+We set ```side``` to ```DoubleSide``` thus both sides will be visible.
+This avoids artefacts to be on the edge of the earth.
+Finaly we set ```opacity``` to make them more translucide.
+The output is quite convincing but rather static. Let's see what we can do about that!
+
+## "And Yet it Moves"
+
+This is what
+[Galileo Galilei](http://en.wikipedia.org/wiki/Galileo_Galilei) said
+about the earth. This sentence has a
+[interesting story](http://en.wikipedia.org/wiki/And_yet_it_moves).
+So i am thinking it would be cool to make our earth move too.
+In your render loop, you simply do this
+
+```javascript
+onRenderFcts.push(function(delta, now){
+ earthMesh.rotation.y += 1/32 * delta
+})
+```
+
+As a last step, we gonna animate the cloud layer too, to make it more realistic.
+
+```javascript
+onRenderFcts.push(function(delta, now){
+ cloudMesh.rotation.y += 1/16 * delta
+})
+```
+
+Definitely better, but still we feel there is something missing.
+What do we see in space ? Stars! duh :)
+
+## Let's Add a Star Field
+
+{% img right /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/galaxy_starfield.png 320 240 %}
+
+We will see how to render the galaxy starfield.
+The star field as you see it in the demo is an "environment sphere",
+aka it is a large sphere, we are in the center and we see what's inside.
+So we ask three.js to show the backside of the faces.
+And we use the texture above as diffuse.
+The above image is smaller than the actual one so you barely see the stars.
+
+<br clear='both'/>
+
+```javascript
+// create the geometry sphere
+var geometry = new THREE.SphereGeometry(90, 32, 32)
+// create the material, using a texture of startfield
+var material = new THREE.MeshBasicMaterial()
+material.map = THREE.ImageUtils.loadTexture('images/galaxy_starfield.png')
+material.side = THREE.BackSide
+// create the mesh based on geometry and material
+var mesh = new THREE.Mesh(geometry, material)
+```
+
+## threex.planets - All Solar System's Planets Done For You
+
+While i was at it, i made
+[threex.planets](https://github.com/jeromeetienne/threex.planets/),
+a
+[threex](http://jeromeetienne.github.io/threex/)
+extension for
+[three.js](http://threejs.org).
+It provides all the planets from the solar system to be easily usable in your own demo or games.
+It is based on
+[planetpixelemporium](http://planetpixelemporium.com/planets.html)
+textures using the same technics described in this post.
+You can see it live
+[here](http://jeromeetienne.github.io/threex.planets/examples/select.html).
+First, the mythical
+[sun](http://jeromeetienne.github.io/threex.planets/examples/select.html#Sun),
+[mercury](http://jeromeetienne.github.io/threex.planets/examples/select.html#Mercury) and
+[venus](http://jeromeetienne.github.io/threex.planets/examples/select.html#Venus).
+
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-sun.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-mercury.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-venus.png 230 172 %}
+
+<br clear='both'/>
+Now the best known, the
+[earth](http://jeromeetienne.github.io/threex.planets/examples/select.html#Earth)
+with its cloud that we previously detailed in this post, the
+[moon](http://jeromeetienne.github.io/threex.planets/examples/select.html#Moon)
+which isn't
+an actual planet but still we could not do without, and
+[mars](http://jeromeetienne.github.io/threex.planets/examples/select.html#Mars)
+with the little green people.
+
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-earth.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-moon.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-mars.png 230 172 %}
+
+<br clear='both'/>
+
+Follow,
+[jupiter](http://jeromeetienne.github.io/threex.planets/examples/select.html#Jupiter),
+[saturn](http://jeromeetienne.github.io/threex.planets/examples/select.html#Saturn) and
+[uranus](http://jeromeetienne.github.io/threex.planets/examples/select.html#Uranus).
+I love the rings there. I added shadow casting to enhance realism.
+
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-jupiter.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-saturn.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-uranus.png 230 172 %}
+
+<br clear='both'/>
+And the last two, the furthest ones,
+[neptune](http://jeromeetienne.github.io/threex.planets/examples/select.html#Neptune)
+and
+[pluto](http://jeromeetienne.github.io/threex.planets/examples/select.html#Pluto)
+
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-neptune.png 230 172 %}
+{% img left /data/2013-09-16-how-to-make-the-earth-in-webgl/screenshots/planets-pluto.png 230 172 %}
+
+<br clear='both'/>
+
+## Conclusion
+
+In this post, we saw how to make a nice looking earth with animated clouds with a star field in
+the background. I think it is a nice result for the amount of work.
+I hope it was useful to discuver the various roles of textures.
+Now you can use this to make even nicer demos, like
+[this one](http://jeromeetienne.github.io/threex.planets/examples/earth.html).
+It shows the same Earth, that we just saw how to do, with the moon close to it.
+We add shadow casting and a nice atmosphere shader and the result is quite convincing.
+
+That's all for today folks. Have Fun!
View
47 source/_posts/2013-12-15-zero-to-nyancat-in-30-seconds-flat.markdown
@@ -0,0 +1,47 @@
+---
+layout: post
+title: "Zero To Nyancat in 30 Seconds Flat!"
+date: 2013-12-15 11:05
+comments: true
+categories: three.js yeoman
+---
+
+<iframe width="425" height="349" src="http://www.youtube.com/embed/AUCJDeBdmbs" frameborder="0" allowfullscreen></iframe>
+
+<iframe width="80%" height="480px" src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/slides/" frameborder="0" allowfullscreen></iframe>
+
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide01.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide02.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide03.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide04.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide05.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide06.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide07.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide08.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide09.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide10.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide11.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide12.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide13.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide14.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide15.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide16.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide17.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide18.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide19.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide20.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide21.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide22.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide23.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide24.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide25.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide26.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide27.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide28.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide29.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide30.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide31.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide32.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide33.png" width="100%">
+<img src="/data/2013-12-15-zero-to-nyancat-in-30-seconds-flat/screenshots/slide34.png" width="100%">
+
View
13 source/data/2013-09-16-how-to-make-the-earth-in-webgl/demo/Makefile
@@ -0,0 +1,13 @@
+# makefile to automatize simple operations
+
+server:
+ python -m SimpleHTTPServer
+
+deploy:
+ # assume there is something to commit
+ # use "git diff --exit-code HEAD" to know if there is something to commit
+ # so two lines: one if no commit, one if something to commit
+ git commit -a -m "New deploy" && git push -f origin HEAD:gh-pages && git reset HEAD~
+
+install:
+ git submodule update --init
View
12 ...013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/.bower.json
@@ -0,0 +1,12 @@
+{
+ "name": "threex.planets",
+ "homepage": "https://github.com/jeromeetienne/threex.planets",
+ "_release": "adce79d103",
+ "_resolution": {
+ "type": "branch",
+ "branch": "master",
+ "commit": "adce79d10346517012f9e37eaa17107ddc5ea623"
+ },
+ "_source": "git://github.com/jeromeetienne/threex.planets.git",
+ "_target": "*"
+}
View
13 ...a/2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/Makefile
@@ -0,0 +1,13 @@
+# makefile to automatize simple operations
+
+server:
+ python -m SimpleHTTPServer
+
+deploy:
+ # assume there is something to commit
+ # use "git diff --exit-code HEAD" to know if there is something to commit
+ # so two lines: one if no commit, one if something to commit
+ git commit -a -m "New deploy" && git push -f origin HEAD:gh-pages && git reset HEAD~
+
+install:
+ git submodule update --init
View
97 .../2013-09-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/README.md
@@ -0,0 +1,97 @@
+threex.planets.js
+=================
+
+It is a three.js extension to display planets
+based on the data from [planetpixelemporium](http://planetpixelemporium.com/).
+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'.
+It is released under MIT license.
+Here is some demos to show off
+
+* [earth demo](http://jeromeetienne.github.io/threex.planets/examples/earth.html)
+and check its
+[source](https://github.com/jeromeetienne/threex.planets/blob/master/examples/earth.html).
+It display a nice earth with cloud and even the moon.
+* [select demo](http://jeromeetienne.github.io/threex.planets/examples/select.html)
+and check its
+[source](https://github.com/jeromeetienne/threex.planets/blob/master/examples/select.html).
+Display all the planets available
+* [atmospherematerial demo](http://jeromeetienne.github.io/threex.planets/examples/atmospherematerial.html)
+and check its
+[source](https://github.com/jeromeetienne/threex.planets/blob/master/examples/atmospherematerial.html). a simple demo to show ```THREEx.createAtmosphereMaterial()```
+* [basic demo](http://jeromeetienne.github.io/threex.planets/examples/basic.html)
+and check its
+[source](https://github.com/jeromeetienne/threex.planets/blob/master/examples/basic.html).
+Good for educational purpose
+
+## How To install it
+
+You can install it manually or with
+[bower](http://bower.io/).
+for the manual version, first include ```threex.planets.js``` with the usual
+
+```html
+<script src='threex.planets.js'></script>
+```
+
+or with
+[bower](http://bower.io/)
+you type the following to install the package.
+
+```bash
+bower install -s threex.planets=https://github.com/jeromeetienne/threex.planets/archive/master.zip
+```
+
+then you add that in your html
+
+```html
+<script src="bower_components/threex.planets/threex.planets.js"></script>
+```
+
+
+## Usage
+
+to create uranus with its ring
+
+```javascript
+var mesh = THREEx.Planets.createUranus()
+scene.add(mesh)
+var mesh = THREEx.Planets.createUranusRing()
+scene.add(mesh)
+```
+
+to create the earth plus the clouds moving around
+
+```javascript
+var mesh = THREEx.Planets.createEarth()
+scene.add(mesh)
+var mesh = THREEx.Planets.createEarthCloud()
+scene.add(mesh)
+updateFcts.push(function(delta, now){
+ mesh.rotation.y += 1/8 * delta;
+})
+```
+
+## API
+
+Here is the list of all the functions.
+They all return a ```THREE.Object3d```.
+You can tune it to fit your need
+
+* ```THREEx.Planets.createSun()``` return the mesh of the Sun
+* ```THREEx.Planets.createMercury()``` return the mesh of Mercury
+* ```THREEx.Planets.createVenus()``` return the mesh of Venus
+* ```THREEx.Planets.createMoon()``` return the mesh of the Moon
+* ```THREEx.Planets.createEarth()``` return the mesh of the Earth
+* ```THREEx.Planets.createEarthCloud()``` return the mesh of the Earth Cloud
+* ```THREEx.Planets.createMars()``` return the mesh of Mars
+* ```THREEx.Planets.createJupiter()``` return the mesh of Jupiter
+* ```THREEx.Planets.createSaturn()``` return the mesh of Saturn
+* ```THREEx.Planets.createSaturnRing()``` return the mesh of Saturn's ring
+* ```THREEx.Planets.createUranus()``` return the mesh of Uranus
+* ```THREEx.Planets.createUranusRing()``` return the mesh of Uranus's ring
+* ```THREEx.Planets.createNeptune()``` return the mesh of Neptune
+* ```THREEx.Planets.createPluto()``` return the mesh of Pluto
+
+
View
123 ...-the-earth-in-webgl/demo/bower_components/threex.planets/examples/atmospherematerial.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<script src='vendor/three.js/build/three.min.js'></script>
+<script src='../threex.planets.js'></script>
+<script src='../threex.atmospherematerial.js'></script>
+<!-- include for threex.glowdatgui -->
+<script src='vendor/three.js/examples/js/libs/dat.gui.min.js'></script>
+<script src="../threex.atmospheredatgui.js"></script>
+
+<body style='margin: 0px; background-color: #000000; overflow: hidden;'><script>
+ var renderer = new THREE.WebGLRenderer({
+ antialias : true
+ });
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
+ renderer.shadowMapEnabled = true
+
+ var updateFcts = [];
+ var scene = new THREE.Scene();
+ var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100 );
+ camera.position.z = 2;
+
+ var light = new THREE.AmbientLight( 0x888888 )
+ 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
+
+ light.shadowCameraLeft = -1
+ light.shadowCameraRight = 1
+ light.shadowCameraTop = 1
+ light.shadowCameraBottom= -1
+ // light.shadowCameraVisible = true
+
+ light.shadowBias = 0.001
+ light.shadowDarkness = 0.2
+
+ light.shadowMapWidth = 1024
+ light.shadowMapHeight = 1024
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // add an object and make it move //
+ //////////////////////////////////////////////////////////////////////////////////
+
+ var datGUI = new dat.GUI()
+ var glowColor = new THREE.Color('cyan')
+ var glowColor = new THREE.Color('yellow')
+ var mesh = THREEx.Planets.createEarth()
+ // var mesh = THREEx.Planets.createMoon()
+ var mesh = THREEx.Planets.createSun()
+ // mesh.visible = false
+ scene.add(mesh)
+
+ var geometry = new THREE.SphereGeometry(0.5, 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);
+ scene.add( mesh );
+
+ // new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
+
+ var geometry = new THREE.SphereGeometry(0.5, 32, 32)
+ geometry = mesh.geometry.clone()
+ var material = THREEx.createAtmosphereMaterial()
+ material.side = THREE.BackSide
+ material.uniforms.coeficient.value = 0.5
+ material.uniforms.power.value = 4.0
+ material.uniforms.glowColor.value = glowColor
+ var mesh = new THREE.Mesh(geometry, material );
+ mesh.scale.multiplyScalar(1.2);
+ scene.add( mesh );
+
+ new THREEx.addAtmosphereMaterial2DatGui(material, datGUI)
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // Camera Controls //
+ //////////////////////////////////////////////////////////////////////////////////
+ var mouse = {x : 0, y : 0}
+ document.addEventListener('mousemove', function(event){
+ mouse.x = (event.clientX / window.innerWidth ) - 0.5
+ mouse.y = (event.clientY / window.innerHeight) - 0.5
+ }, false)
+ updateFcts.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 )
+ })
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // render the scene //
+ //////////////////////////////////////////////////////////////////////////////////
+ updateFcts.push(function(){
+ renderer.render( scene, camera );
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // loop runner //
+ //////////////////////////////////////////////////////////////////////////////////
+ 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
+ updateFcts.forEach(function(updateFn){
+ updateFn(deltaMsec/1000, nowMsec/1000)
+ })
+ })
+</script></body>
View
130 ...6-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/basic.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<script src='vendor/three.js/build/three.min.js'></script>
+<script src='../threex.planets.js'></script>
+<body style='margin: 0px; background-color: #000000; overflow: hidden;'><script>
+ var renderer = new THREE.WebGLRenderer({
+ antialias : true
+ });
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
+ renderer.shadowMapEnabled = true
+
+ var updateFcts = [];
+ var scene = new THREE.Scene();
+ var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100 );
+ camera.position.z = 3;
+
+ var light = new THREE.AmbientLight( 0x888888 )
+ 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
+
+ light.shadowCameraLeft = -1
+ light.shadowCameraRight = 1
+ light.shadowCameraTop = 1
+ light.shadowCameraBottom= -1
+ // light.shadowCameraVisible = true
+
+ light.shadowBias = 0.001
+ light.shadowDarkness = 0.2
+
+ light.shadowMapWidth = 1024
+ light.shadowMapHeight = 1024
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // add an object and make it move //
+ //////////////////////////////////////////////////////////////////////////////////
+ // var mesh = THREEx.Planets.createSun()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createMercury()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createVenus()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createMoon()
+ // scene.add(mesh)
+ var earthMesh = THREEx.Planets.createEarth()
+ scene.add(earthMesh)
+ var mesh = THREEx.Planets.createEarthCloud()
+ scene.add(mesh)
+ updateFcts.push(function(delta, now){
+ mesh.rotation.y += 1/8 * delta;
+ })
+ // var mesh = THREEx.Planets.createMars()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createJupiter()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createSaturn()
+ // mesh.receiveShadow = true
+ // mesh.castShadow = true
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createSaturnRing()
+ // mesh.receiveShadow = true
+ // mesh.castShadow = true
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createUranus()
+ // mesh.receiveShadow = true
+ // mesh.castShadow = true
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createUranusRing()
+ // mesh.receiveShadow = true
+ // mesh.castShadow = true
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createNeptune()
+ // scene.add(mesh)
+ // var mesh = THREEx.Planets.createPluto()
+ // scene.add(mesh)
+
+ updateFcts.push(function(delta, now){
+ //mesh.rotation.x += 1 * delta;
+ //mesh.rotation.y += 1/2 * delta;
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // Camera Controls //
+ //////////////////////////////////////////////////////////////////////////////////
+ var mouse = {x : 0, y : 0}
+ document.addEventListener('mousemove', function(event){
+ mouse.x = (event.clientX / window.innerWidth ) - 0.5
+ mouse.y = (event.clientY / window.innerHeight) - 0.5
+ }, false)
+ updateFcts.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 )
+ })
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // render the scene //
+ //////////////////////////////////////////////////////////////////////////////////
+ updateFcts.push(function(){
+ renderer.render( scene, camera );
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // loop runner //
+ //////////////////////////////////////////////////////////////////////////////////
+ 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
+ updateFcts.forEach(function(updateFn){
+ updateFn(deltaMsec/1000, nowMsec/1000)
+ })
+ })
+</script></body>
View
143 ...6-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/earth.html
@@ -0,0 +1,143 @@
+<!DOCTYPE html>
+<script src='vendor/three.js/build/three.min.js'></script>
+<script src='../threex.planets.js'></script>
+<script src='../threex.atmospherematerial.js'></script>
+<!-- include for threex.glowdatgui -->
+<script src='vendor/three.js/examples/js/libs/dat.gui.min.js'></script>
+<script src="../threex.atmospheredatgui.js"></script>
+<body style='margin: 0px; background-color: #000000; overflow: hidden;'><script>
+ var renderer = new THREE.WebGLRenderer({
+ antialias : true
+ });
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
+ renderer.shadowMapEnabled = true
+
+ var updateFcts = [];
+ var scene = new THREE.Scene();
+ var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100 );
+ camera.position.z = 1;
+
+ var light = new THREE.AmbientLight( 0x222222 )
+ scene.add( light )
+
+ var light = new THREE.DirectionalLight( 0xffffff, 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.shadowCameraVisible = true
+
+ light.shadowBias = 0.001
+ light.shadowDarkness = 0.2
+
+ light.shadowMapWidth = 1024
+ light.shadowMapHeight = 1024
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // added starfield //
+ //////////////////////////////////////////////////////////////////////////////////
+
+ var geometry = new THREE.SphereGeometry(90, 32, 32)
+ var material = new THREE.MeshBasicMaterial({
+ map : THREE.ImageUtils.loadTexture('images/galaxy_starfield.png'),
+ side : THREE.BackSide
+ })
+ var starSphere = new THREE.Mesh(geometry, material)
+ scene.add(starSphere)
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // add an object and make it move //
+ //////////////////////////////////////////////////////////////////////////////////
+
+ var containerEarth = new THREE.Object3D()
+ containerEarth.rotateZ(-23.4 * Math.PI/180)
+ containerEarth.position.z = 0
+ scene.add(containerEarth)
+ var moonMesh = THREEx.Planets.createMoon()
+ moonMesh.position.set(0.5,0.5,0.5)
+ moonMesh.scale.multiplyScalar(1/5)
+ moonMesh.receiveShadow = true
+ moonMesh.castShadow = true
+ containerEarth.add(moonMesh)
+ var earthMesh = THREEx.Planets.createEarth()
+ earthMesh.receiveShadow = true
+ earthMesh.castShadow = true
+ containerEarth.add(earthMesh)
+ updateFcts.push(function(delta, now){
+ earthMesh.rotation.y += 1/32 * delta;
+ })
+
+ var geometry = new THREE.SphereGeometry(0.5, 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);
+ containerEarth.add( mesh );
+
+ var geometry = new THREE.SphereGeometry(0.5, 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);
+ containerEarth.add( mesh );
+
+ var earthCloud = THREEx.Planets.createEarthCloud()
+ earthCloud.receiveShadow = true
+ earthCloud.castShadow = true
+ containerEarth.add(earthCloud)
+ updateFcts.push(function(delta, now){
+ earthCloud.rotation.y += 1/8 * delta;
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // Camera Controls //
+ //////////////////////////////////////////////////////////////////////////////////
+ var mouse = {x : 0, y : 0}
+ document.addEventListener('mousemove', function(event){
+ mouse.x = (event.clientX / window.innerWidth ) - 0.5
+ mouse.y = (event.clientY / window.innerHeight) - 0.5
+ }, false)
+ updateFcts.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 )
+ })
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // render the scene //
+ //////////////////////////////////////////////////////////////////////////////////
+ updateFcts.push(function(){
+ renderer.render( scene, camera );
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // loop runner //
+ //////////////////////////////////////////////////////////////////////////////////
+ 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
+ updateFcts.forEach(function(updateFn){
+ updateFn(deltaMsec/1000, nowMsec/1000)
+ })
+ })
+</script></body>
View
BIN ...-earth-in-webgl/demo/bower_components/threex.planets/examples/images/galaxy_starfield.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
161 ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/examples/select.html
@@ -0,0 +1,161 @@
+<!DOCTYPE html>
+<script src='vendor/three.js/build/three.min.js'></script>
+<script src='../threex.planets.js'></script>
+<div style='position:absolute'>
+ <button onclick='switchValue(this.innerText);'>Sun</button>
+ <button onclick='switchValue(this.innerText);'>Mercury</button>
+ <button onclick='switchValue(this.innerText);'>Venus</button>
+ <button onclick='switchValue(this.innerText);'>Earth</button>
+ <button onclick='switchValue(this.innerText);'>Moon</button>
+ <button onclick='switchValue(this.innerText);'>Mars</button>
+ <button onclick='switchValue(this.innerText);'>Jupiter</button>
+ <button onclick='switchValue(this.innerText);'>Saturn</button>
+ <button onclick='switchValue(this.innerText);'>Uranus</button>
+ <button onclick='switchValue(this.innerText);'>Neptune</button>
+ <button onclick='switchValue(this.innerText);'>Pluto</button>
+</div>
+<body style='margin: 0px; background-color: #000000; overflow: hidden;'><script>
+ var renderer = new THREE.WebGLRenderer({
+ antialias : true
+ });
+ renderer.setSize( window.innerWidth, window.innerHeight );
+ document.body.appendChild( renderer.domElement );
+ renderer.shadowMapEnabled = true
+
+ var updateFcts = [];
+ var scene = new THREE.Scene();
+ var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 100 );
+ camera.position.z = 2;
+
+ var light = new THREE.AmbientLight( 0x888888 )
+ 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
+
+ light.shadowCameraLeft = -1
+ light.shadowCameraRight = 1
+ light.shadowCameraTop = 1
+ light.shadowCameraBottom= -1
+ // light.shadowCameraVisible = true
+
+ light.shadowBias = 0.001
+ light.shadowDarkness = 0.2
+
+ light.shadowMapWidth = 1024*2
+ light.shadowMapHeight = 1024*2
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // added starfield //
+ //////////////////////////////////////////////////////////////////////////////////
+
+ var geometry = new THREE.SphereGeometry(90, 32, 32)
+ var material = new THREE.MeshBasicMaterial({
+ map : THREE.ImageUtils.loadTexture('images/galaxy_starfield.png'),
+ side : THREE.BackSide
+ })
+ var starSphere = new THREE.Mesh(geometry, material)
+ scene.add(starSphere)
+ //////////////////////////////////////////////////////////////////////////////////
+ // comment //
+ //////////////////////////////////////////////////////////////////////////////////
+
+ var currentMesh = null
+ function switchValue(type){
+ currentMesh && scene.remove(currentMesh)
+ if( type === 'Sun' ){
+ var mesh = THREEx.Planets.createSun()
+ }else if( type === 'Mercury' ){
+ var mesh = THREEx.Planets.createMercury()
+ }else if( type === 'Venus' ){
+ var mesh = THREEx.Planets.createVenus()
+ }else if( type === 'Moon' ){
+ var mesh = THREEx.Planets.createMoon()
+ }else if( type === 'Earth' ){
+ var mesh = THREEx.Planets.createEarth()
+ var cloud = THREEx.Planets.createEarthCloud()
+ mesh.add(cloud)
+ }else if( type === 'Moon' ){
+ var mesh = THREEx.Planets.createMoon()
+ }else if( type === 'Mars' ){
+ var mesh = THREEx.Planets.createMars()
+ }else if( type === 'Jupiter' ){
+ var mesh = THREEx.Planets.createJupiter()
+ }else if( type === 'Saturn' ){
+ var mesh = THREEx.Planets.createSaturn()
+ mesh.receiveShadow = true
+ mesh.castShadow = true
+ var ring = THREEx.Planets.createSaturnRing()
+ ring.receiveShadow = true
+ ring.castShadow = true
+ mesh.add(ring)
+ }else if( type === 'Uranus' ){
+ var mesh = THREEx.Planets.createUranus()
+ mesh.receiveShadow = true
+ mesh.castShadow = true
+ var ring = THREEx.Planets.createUranusRing()
+ ring.receiveShadow = true
+ ring.castShadow = true
+ mesh.add(ring)
+ }else if( type === 'Neptune' ){
+ var mesh = THREEx.Planets.createNeptune()
+ }else if( type === 'Pluto' ){
+ var mesh = THREEx.Planets.createPluto()
+ }else console.assert(false)
+ scene.add(mesh)
+ currentMesh = mesh
+ location.hash = type
+ }
+ var initialType = location.hash.substr(1) || 'Earth'
+ switchValue(initialType)
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // Camera Controls //
+ //////////////////////////////////////////////////////////////////////////////////
+ var mouse = {x : 0, y : 0}
+ document.addEventListener('mousemove', function(event){
+ mouse.x = (event.clientX / window.innerWidth ) - 0.5
+ mouse.y = (event.clientY / window.innerHeight) - 0.5
+ }, false)
+ updateFcts.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 )
+ })
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // render the scene //
+ //////////////////////////////////////////////////////////////////////////////////
+ updateFcts.push(function(){
+ renderer.render( scene, camera );
+ })
+
+ //////////////////////////////////////////////////////////////////////////////////
+ // loop runner //
+ //////////////////////////////////////////////////////////////////////////////////
+ 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
+ updateFcts.forEach(function(updateFn){
+ updateFn(deltaMsec/1000, nowMsec/1000)
+ })
+ })
+</script></body>
View
724 ...in-webgl/demo/bower_components/threex.planets/examples/vendor/three.js/build/three.min.js
724 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
94 .../bower_components/threex.planets/examples/vendor/three.js/examples/js/libs/dat.gui.min.js
@@ -0,0 +1,94 @@
+/**
+ * dat-gui JavaScript Controller Library
+ * http://code.google.com/p/dat-gui
+ *
+ * Copyright 2011 Data Arts Team, Google Creative Lab
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
+var dat=dat||{};dat.gui=dat.gui||{};dat.utils=dat.utils||{};dat.controllers=dat.controllers||{};dat.dom=dat.dom||{};dat.color=dat.color||{};dat.utils.css=function(){return{load:function(e,a){var a=a||document,c=a.createElement("link");c.type="text/css";c.rel="stylesheet";c.href=e;a.getElementsByTagName("head")[0].appendChild(c)},inject:function(e,a){var a=a||document,c=document.createElement("style");c.type="text/css";c.innerHTML=e;a.getElementsByTagName("head")[0].appendChild(c)}}}();
+dat.utils.common=function(){var e=Array.prototype.forEach,a=Array.prototype.slice;return{BREAK:{},extend:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(a[f])||(c[f]=a[f])},this);return c},defaults:function(c){this.each(a.call(arguments,1),function(a){for(var f in a)this.isUndefined(c[f])&&(c[f]=a[f])},this);return c},compose:function(){var c=a.call(arguments);return function(){for(var d=a.call(arguments),f=c.length-1;f>=0;f--)d=[c[f].apply(this,d)];return d[0]}},
+each:function(a,d,f){if(e&&a.forEach===e)a.forEach(d,f);else if(a.length===a.length+0)for(var b=0,n=a.length;b<n;b++){if(b in a&&d.call(f,a[b],b)===this.BREAK)break}else for(b in a)if(d.call(f,a[b],b)===this.BREAK)break},defer:function(a){setTimeout(a,0)},toArray:function(c){return c.toArray?c.toArray():a.call(c)},isUndefined:function(a){return a===void 0},isNull:function(a){return a===null},isNaN:function(a){return a!==a},isArray:Array.isArray||function(a){return a.constructor===Array},isObject:function(a){return a===
+Object(a)},isNumber:function(a){return a===a+0},isString:function(a){return a===a+""},isBoolean:function(a){return a===false||a===true},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"}}}();
+dat.controllers.Controller=function(e){var a=function(a,d){this.initialValue=a[d];this.domElement=document.createElement("div");this.object=a;this.property=d;this.__onFinishChange=this.__onChange=void 0};e.extend(a.prototype,{onChange:function(a){this.__onChange=a;return this},onFinishChange:function(a){this.__onFinishChange=a;return this},setValue:function(a){this.object[this.property]=a;this.__onChange&&this.__onChange.call(this,a);this.updateDisplay();return this},getValue:function(){return this.object[this.property]},
+updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}});return a}(dat.utils.common);
+dat.dom.dom=function(e){function a(b){if(b==="0"||e.isUndefined(b))return 0;b=b.match(d);return!e.isNull(b)?parseFloat(b[1]):0}var c={};e.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(b,a){e.each(b,function(b){c[b]=a})});var d=/(\d+(\.\d+)?)px/,f={makeSelectable:function(b,a){if(!(b===void 0||b.style===void 0))b.onselectstart=a?function(){return false}:function(){},b.style.MozUserSelect=a?"auto":"none",b.style.KhtmlUserSelect=
+a?"auto":"none",b.unselectable=a?"on":"off"},makeFullscreen:function(b,a,d){e.isUndefined(a)&&(a=true);e.isUndefined(d)&&(d=true);b.style.position="absolute";if(a)b.style.left=0,b.style.right=0;if(d)b.style.top=0,b.style.bottom=0},fakeEvent:function(b,a,d,f){var d=d||{},m=c[a];if(!m)throw Error("Event type "+a+" not supported.");var l=document.createEvent(m);switch(m){case "MouseEvents":l.initMouseEvent(a,d.bubbles||false,d.cancelable||true,window,d.clickCount||1,0,0,d.x||d.clientX||0,d.y||d.clientY||
+0,false,false,false,false,0,null);break;case "KeyboardEvents":m=l.initKeyboardEvent||l.initKeyEvent;e.defaults(d,{cancelable:true,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,keyCode:void 0,charCode:void 0});m(a,d.bubbles||false,d.cancelable,window,d.ctrlKey,d.altKey,d.shiftKey,d.metaKey,d.keyCode,d.charCode);break;default:l.initEvent(a,d.bubbles||false,d.cancelable||true)}e.defaults(l,f);b.dispatchEvent(l)},bind:function(b,a,d,c){b.addEventListener?b.addEventListener(a,d,c||false):b.attachEvent&&
+b.attachEvent("on"+a,d);return f},unbind:function(b,a,d,c){b.removeEventListener?b.removeEventListener(a,d,c||false):b.detachEvent&&b.detachEvent("on"+a,d);return f},addClass:function(b,a){if(b.className===void 0)b.className=a;else if(b.className!==a){var d=b.className.split(/ +/);if(d.indexOf(a)==-1)d.push(a),b.className=d.join(" ").replace(/^\s+/,"").replace(/\s+$/,"")}return f},removeClass:function(b,a){if(a){if(b.className!==void 0)if(b.className===a)b.removeAttribute("class");else{var d=b.className.split(/ +/),
+c=d.indexOf(a);if(c!=-1)d.splice(c,1),b.className=d.join(" ")}}else b.className=void 0;return f},hasClass:function(a,d){return RegExp("(?:^|\\s+)"+d+"(?:\\s+|$)").test(a.className)||false},getWidth:function(b){b=getComputedStyle(b);return a(b["border-left-width"])+a(b["border-right-width"])+a(b["padding-left"])+a(b["padding-right"])+a(b.width)},getHeight:function(b){b=getComputedStyle(b);return a(b["border-top-width"])+a(b["border-bottom-width"])+a(b["padding-top"])+a(b["padding-bottom"])+a(b.height)},
+getOffset:function(a){var d={left:0,top:0};if(a.offsetParent){do d.left+=a.offsetLeft,d.top+=a.offsetTop;while(a=a.offsetParent)}return d},isActive:function(a){return a===document.activeElement&&(a.type||a.href)}};return f}(dat.utils.common);
+dat.controllers.OptionController=function(e,a,c){var d=function(f,b,e){d.superclass.call(this,f,b);var h=this;this.__select=document.createElement("select");if(c.isArray(e)){var j={};c.each(e,function(a){j[a]=a});e=j}c.each(e,function(a,b){var d=document.createElement("option");d.innerHTML=b;d.setAttribute("value",a);h.__select.appendChild(d)});this.updateDisplay();a.bind(this.__select,"change",function(){h.setValue(this.options[this.selectedIndex].value)});this.domElement.appendChild(this.__select)};
+d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue());return a},updateDisplay:function(){this.__select.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
+dat.controllers.NumberController=function(e,a){var c=function(d,f,b){c.superclass.call(this,d,f);b=b||{};this.__min=b.min;this.__max=b.max;this.__step=b.step;d=this.__impliedStep=a.isUndefined(this.__step)?this.initialValue==0?1:Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__step;d=d.toString();this.__precision=d.indexOf(".")>-1?d.length-d.indexOf(".")-1:0};c.superclass=e;a.extend(c.prototype,e.prototype,{setValue:function(a){if(this.__min!==void 0&&a<this.__min)a=this.__min;
+else if(this.__max!==void 0&&a>this.__max)a=this.__max;this.__step!==void 0&&a%this.__step!=0&&(a=Math.round(a/this.__step)*this.__step);return c.superclass.prototype.setValue.call(this,a)},min:function(a){this.__min=a;return this},max:function(a){this.__max=a;return this},step:function(a){this.__step=a;return this}});return c}(dat.controllers.Controller,dat.utils.common);
+dat.controllers.NumberControllerBox=function(e,a,c){var d=function(f,b,e){function h(){var a=parseFloat(l.__input.value);c.isNaN(a)||l.setValue(a)}function j(a){var b=o-a.clientY;l.setValue(l.getValue()+b*l.__impliedStep);o=a.clientY}function m(){a.unbind(window,"mousemove",j);a.unbind(window,"mouseup",m)}this.__truncationSuspended=false;d.superclass.call(this,f,b,e);var l=this,o;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"change",h);
+a.bind(this.__input,"blur",function(){h();l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())});a.bind(this.__input,"mousedown",function(b){a.bind(window,"mousemove",j);a.bind(window,"mouseup",m);o=b.clientY});a.bind(this.__input,"keydown",function(a){if(a.keyCode===13)l.__truncationSuspended=true,this.blur(),l.__truncationSuspended=false});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype,e.prototype,{updateDisplay:function(){var a=this.__input,
+b;if(this.__truncationSuspended)b=this.getValue();else{b=this.getValue();var c=Math.pow(10,this.__precision);b=Math.round(b*c)/c}a.value=b;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.NumberController,dat.dom.dom,dat.utils.common);
+dat.controllers.NumberControllerSlider=function(e,a,c,d,f){var b=function(d,c,f,e,l){function o(b){b.preventDefault();var d=a.getOffset(g.__background),c=a.getWidth(g.__background);g.setValue(g.__min+(g.__max-g.__min)*((b.clientX-d.left)/(d.left+c-d.left)));return false}function y(){a.unbind(window,"mousemove",o);a.unbind(window,"mouseup",y);g.__onFinishChange&&g.__onFinishChange.call(g,g.getValue())}b.superclass.call(this,d,c,{min:f,max:e,step:l});var g=this;this.__background=document.createElement("div");
+this.__foreground=document.createElement("div");a.bind(this.__background,"mousedown",function(b){a.bind(window,"mousemove",o);a.bind(window,"mouseup",y);o(b)});a.addClass(this.__background,"slider");a.addClass(this.__foreground,"slider-fg");this.updateDisplay();this.__background.appendChild(this.__foreground);this.domElement.appendChild(this.__background)};b.superclass=e;b.useDefaultStyles=function(){c.inject(f)};d.extend(b.prototype,e.prototype,{updateDisplay:function(){this.__foreground.style.width=
+(this.getValue()-this.__min)/(this.__max-this.__min)*100+"%";return b.superclass.prototype.updateDisplay.call(this)}});return b}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}");
+dat.controllers.FunctionController=function(e,a,c){var d=function(c,b,e){d.superclass.call(this,c,b);var h=this;this.__button=document.createElement("div");this.__button.innerHTML=e===void 0?"Fire":e;a.bind(this.__button,"click",function(a){a.preventDefault();h.fire();return false});a.addClass(this.__button,"button");this.domElement.appendChild(this.__button)};d.superclass=e;c.extend(d.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this);this.__onFinishChange&&this.__onFinishChange.call(this,
+this.getValue());this.getValue().call(this.object)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
+dat.controllers.BooleanController=function(e,a,c){var d=function(c,b){d.superclass.call(this,c,b);var e=this;this.__prev=this.getValue();this.__checkbox=document.createElement("input");this.__checkbox.setAttribute("type","checkbox");a.bind(this.__checkbox,"change",function(){e.setValue(!e.__prev)},false);this.domElement.appendChild(this.__checkbox);this.updateDisplay()};d.superclass=e;c.extend(d.prototype,e.prototype,{setValue:function(a){a=d.superclass.prototype.setValue.call(this,a);this.__onFinishChange&&
+this.__onFinishChange.call(this,this.getValue());this.__prev=this.getValue();return a},updateDisplay:function(){this.getValue()===true?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=true):this.__checkbox.checked=false;return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common);
+dat.color.toString=function(e){return function(a){if(a.a==1||e.isUndefined(a.a)){for(a=a.hex.toString(16);a.length<6;)a="0"+a;return"#"+a}else return"rgba("+Math.round(a.r)+","+Math.round(a.g)+","+Math.round(a.b)+","+a.a+")"}}(dat.utils.common);
+dat.color.interpret=function(e,a){var c,d,f=[{litmus:a.isString,conversions:{THREE_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString()+a[1].toString()+a[2].toString()+a[2].toString()+a[3].toString()+a[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(a){a=a.match(/^#([A-F0-9]{6})$/i);return a===null?false:{space:"HEX",hex:parseInt("0x"+a[1].toString())}},write:e},CSS_RGB:{read:function(a){a=a.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
+return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3])}},write:e},CSS_RGBA:{read:function(a){a=a.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return a===null?false:{space:"RGB",r:parseFloat(a[1]),g:parseFloat(a[2]),b:parseFloat(a[3]),a:parseFloat(a[4])}},write:e}}},{litmus:a.isNumber,conversions:{HEX:{read:function(a){return{space:"HEX",hex:a,conversionName:"HEX"}},write:function(a){return a.hex}}}},{litmus:a.isArray,conversions:{RGB_ARRAY:{read:function(a){return a.length!=
+3?false:{space:"RGB",r:a[0],g:a[1],b:a[2]}},write:function(a){return[a.r,a.g,a.b]}},RGBA_ARRAY:{read:function(a){return a.length!=4?false:{space:"RGB",r:a[0],g:a[1],b:a[2],a:a[3]}},write:function(a){return[a.r,a.g,a.b,a.a]}}}},{litmus:a.isObject,conversions:{RGBA_OBJ:{read:function(b){return a.isNumber(b.r)&&a.isNumber(b.g)&&a.isNumber(b.b)&&a.isNumber(b.a)?{space:"RGB",r:b.r,g:b.g,b:b.b,a:b.a}:false},write:function(a){return{r:a.r,g:a.g,b:a.b,a:a.a}}},RGB_OBJ:{read:function(b){return a.isNumber(b.r)&&
+a.isNumber(b.g)&&a.isNumber(b.b)?{space:"RGB",r:b.r,g:b.g,b:b.b}:false},write:function(a){return{r:a.r,g:a.g,b:a.b}}},HSVA_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)&&a.isNumber(b.a)?{space:"HSV",h:b.h,s:b.s,v:b.v,a:b.a}:false},write:function(a){return{h:a.h,s:a.s,v:a.v,a:a.a}}},HSV_OBJ:{read:function(b){return a.isNumber(b.h)&&a.isNumber(b.s)&&a.isNumber(b.v)?{space:"HSV",h:b.h,s:b.s,v:b.v}:false},write:function(a){return{h:a.h,s:a.s,v:a.v}}}}}];return function(){d=
+false;var b=arguments.length>1?a.toArray(arguments):arguments[0];a.each(f,function(e){if(e.litmus(b))return a.each(e.conversions,function(e,f){c=e.read(b);if(d===false&&c!==false)return d=c,c.conversionName=f,c.conversion=e,a.BREAK}),a.BREAK});return d}}(dat.color.toString,dat.utils.common);
+dat.GUI=dat.gui.GUI=function(e,a,c,d,f,b,n,h,j,m,l,o,y,g,i){function q(a,b,r,c){if(b[r]===void 0)throw Error("Object "+b+' has no property "'+r+'"');c.color?b=new l(b,r):(b=[b,r].concat(c.factoryArgs),b=d.apply(a,b));if(c.before instanceof f)c.before=c.before.__li;t(a,b);g.addClass(b.domElement,"c");r=document.createElement("span");g.addClass(r,"property-name");r.innerHTML=b.property;var e=document.createElement("div");e.appendChild(r);e.appendChild(b.domElement);c=s(a,e,c.before);g.addClass(c,k.CLASS_CONTROLLER_ROW);
+g.addClass(c,typeof b.getValue());p(a,c,b);a.__controllers.push(b);return b}function s(a,b,d){var c=document.createElement("li");b&&c.appendChild(b);d?a.__ul.insertBefore(c,params.before):a.__ul.appendChild(c);a.onResize();return c}function p(a,d,c){c.__li=d;c.__gui=a;i.extend(c,{options:function(b){if(arguments.length>1)return c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[i.toArray(arguments)]});if(i.isArray(b)||i.isObject(b))return c.remove(),q(a,c.object,c.property,
+{before:c.__li.nextElementSibling,factoryArgs:[b]})},name:function(a){c.__li.firstElementChild.firstElementChild.innerHTML=a;return c},listen:function(){c.__gui.listen(c);return c},remove:function(){c.__gui.remove(c);return c}});if(c instanceof j){var e=new h(c.object,c.property,{min:c.__min,max:c.__max,step:c.__step});i.each(["updateDisplay","onChange","onFinishChange"],function(a){var b=c[a],H=e[a];c[a]=e[a]=function(){var a=Array.prototype.slice.call(arguments);b.apply(c,a);return H.apply(e,a)}});
+g.addClass(d,"has-slider");c.domElement.insertBefore(e.domElement,c.domElement.firstElementChild)}else if(c instanceof h){var f=function(b){return i.isNumber(c.__min)&&i.isNumber(c.__max)?(c.remove(),q(a,c.object,c.property,{before:c.__li.nextElementSibling,factoryArgs:[c.__min,c.__max,c.__step]})):b};c.min=i.compose(f,c.min);c.max=i.compose(f,c.max)}else if(c instanceof b)g.bind(d,"click",function(){g.fakeEvent(c.__checkbox,"click")}),g.bind(c.__checkbox,"click",function(a){a.stopPropagation()});
+else if(c instanceof n)g.bind(d,"click",function(){g.fakeEvent(c.__button,"click")}),g.bind(d,"mouseover",function(){g.addClass(c.__button,"hover")}),g.bind(d,"mouseout",function(){g.removeClass(c.__button,"hover")});else if(c instanceof l)g.addClass(d,"color"),c.updateDisplay=i.compose(function(a){d.style.borderLeftColor=c.__color.toString();return a},c.updateDisplay),c.updateDisplay();c.setValue=i.compose(function(b){a.getRoot().__preset_select&&c.isModified()&&B(a.getRoot(),true);return b},c.setValue)}
+function t(a,b){var c=a.getRoot(),d=c.__rememberedObjects.indexOf(b.object);if(d!=-1){var e=c.__rememberedObjectIndecesToControllers[d];e===void 0&&(e={},c.__rememberedObjectIndecesToControllers[d]=e);e[b.property]=b;if(c.load&&c.load.remembered){c=c.load.remembered;if(c[a.preset])c=c[a.preset];else if(c[w])c=c[w];else return;if(c[d]&&c[d][b.property]!==void 0)d=c[d][b.property],b.initialValue=d,b.setValue(d)}}}function I(a){var b=a.__save_row=document.createElement("li");g.addClass(a.domElement,
+"has-save");a.__ul.insertBefore(b,a.__ul.firstChild);g.addClass(b,"save-row");var c=document.createElement("span");c.innerHTML="&nbsp;";g.addClass(c,"button gears");var d=document.createElement("span");d.innerHTML="Save";g.addClass(d,"button");g.addClass(d,"save");var e=document.createElement("span");e.innerHTML="New";g.addClass(e,"button");g.addClass(e,"save-as");var f=document.createElement("span");f.innerHTML="Revert";g.addClass(f,"button");g.addClass(f,"revert");var m=a.__preset_select=document.createElement("select");
+a.load&&a.load.remembered?i.each(a.load.remembered,function(b,c){C(a,c,c==a.preset)}):C(a,w,false);g.bind(m,"change",function(){for(var b=0;b<a.__preset_select.length;b++)a.__preset_select[b].innerHTML=a.__preset_select[b].value;a.preset=this.value});b.appendChild(m);b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);if(u){var b=document.getElementById("dg-save-locally"),l=document.getElementById("dg-local-explain");b.style.display="block";b=document.getElementById("dg-local-storage");
+localStorage.getItem(document.location.href+".isLocal")==="true"&&b.setAttribute("checked","checked");var o=function(){l.style.display=a.useLocalStorage?"block":"none"};o();g.bind(b,"change",function(){a.useLocalStorage=!a.useLocalStorage;o()})}var h=document.getElementById("dg-new-constructor");g.bind(h,"keydown",function(a){a.metaKey&&(a.which===67||a.keyCode==67)&&x.hide()});g.bind(c,"click",function(){h.innerHTML=JSON.stringify(a.getSaveObject(),void 0,2);x.show();h.focus();h.select()});g.bind(d,
+"click",function(){a.save()});g.bind(e,"click",function(){var b=prompt("Enter a new preset name.");b&&a.saveAs(b)});g.bind(f,"click",function(){a.revert()})}function J(a){function b(f){f.preventDefault();e=f.clientX;g.addClass(a.__closeButton,k.CLASS_DRAG);g.bind(window,"mousemove",c);g.bind(window,"mouseup",d);return false}function c(b){b.preventDefault();a.width+=e-b.clientX;a.onResize();e=b.clientX;return false}function d(){g.removeClass(a.__closeButton,k.CLASS_DRAG);g.unbind(window,"mousemove",
+c);g.unbind(window,"mouseup",d)}a.__resize_handle=document.createElement("div");i.extend(a.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var e;g.bind(a.__resize_handle,"mousedown",b);g.bind(a.__closeButton,"mousedown",b);a.domElement.insertBefore(a.__resize_handle,a.domElement.firstElementChild)}function D(a,b){a.domElement.style.width=b+"px";if(a.__save_row&&a.autoPlace)a.__save_row.style.width=b+"px";if(a.__closeButton)a.__closeButton.style.width=
+b+"px"}function z(a,b){var c={};i.each(a.__rememberedObjects,function(d,e){var f={};i.each(a.__rememberedObjectIndecesToControllers[e],function(a,c){f[c]=b?a.initialValue:a.getValue()});c[e]=f});return c}function C(a,b,c){var d=document.createElement("option");d.innerHTML=b;d.value=b;a.__preset_select.appendChild(d);if(c)a.__preset_select.selectedIndex=a.__preset_select.length-1}function B(a,b){var c=a.__preset_select[a.__preset_select.selectedIndex];c.innerHTML=b?c.value+"*":c.value}function E(a){a.length!=
+0&&o(function(){E(a)});i.each(a,function(a){a.updateDisplay()})}e.inject(c);var w="Default",u;try{u="localStorage"in window&&window.localStorage!==null}catch(K){u=false}var x,F=true,v,A=false,G=[],k=function(a){function b(){localStorage.setItem(document.location.href+".gui",JSON.stringify(d.getSaveObject()))}function c(){var a=d.getRoot();a.width+=1;i.defer(function(){a.width-=1})}var d=this;this.domElement=document.createElement("div");this.__ul=document.createElement("ul");this.domElement.appendChild(this.__ul);
+g.addClass(this.domElement,"dg");this.__folders={};this.__controllers=[];this.__rememberedObjects=[];this.__rememberedObjectIndecesToControllers=[];this.__listening=[];a=a||{};a=i.defaults(a,{autoPlace:true,width:k.DEFAULT_WIDTH});a=i.defaults(a,{resizable:a.autoPlace,hideable:a.autoPlace});if(i.isUndefined(a.load))a.load={preset:w};else if(a.preset)a.load.preset=a.preset;i.isUndefined(a.parent)&&a.hideable&&G.push(this);a.resizable=i.isUndefined(a.parent)&&a.resizable;if(a.autoPlace&&i.isUndefined(a.scrollable))a.scrollable=
+true;var e=u&&localStorage.getItem(document.location.href+".isLocal")==="true";Object.defineProperties(this,{parent:{get:function(){return a.parent}},scrollable:{get:function(){return a.scrollable}},autoPlace:{get:function(){return a.autoPlace}},preset:{get:function(){return d.parent?d.getRoot().preset:a.load.preset},set:function(b){d.parent?d.getRoot().preset=b:a.load.preset=b;for(b=0;b<this.__preset_select.length;b++)if(this.__preset_select[b].value==this.preset)this.__preset_select.selectedIndex=
+b;d.revert()}},width:{get:function(){return a.width},set:function(b){a.width=b;D(d,b)}},name:{get:function(){return a.name},set:function(b){a.name=b;if(m)m.innerHTML=a.name}},closed:{get:function(){return a.closed},set:function(b){a.closed=b;a.closed?g.addClass(d.__ul,k.CLASS_CLOSED):g.removeClass(d.__ul,k.CLASS_CLOSED);this.onResize();if(d.__closeButton)d.__closeButton.innerHTML=b?k.TEXT_OPEN:k.TEXT_CLOSED}},load:{get:function(){return a.load}},useLocalStorage:{get:function(){return e},set:function(a){u&&
+((e=a)?g.bind(window,"unload",b):g.unbind(window,"unload",b),localStorage.setItem(document.location.href+".isLocal",a))}}});if(i.isUndefined(a.parent)){a.closed=false;g.addClass(this.domElement,k.CLASS_MAIN);g.makeSelectable(this.domElement,false);if(u&&e){d.useLocalStorage=true;var f=localStorage.getItem(document.location.href+".gui");if(f)a.load=JSON.parse(f)}this.__closeButton=document.createElement("div");this.__closeButton.innerHTML=k.TEXT_CLOSED;g.addClass(this.__closeButton,k.CLASS_CLOSE_BUTTON);
+this.domElement.appendChild(this.__closeButton);g.bind(this.__closeButton,"click",function(){d.closed=!d.closed})}else{if(a.closed===void 0)a.closed=true;var m=document.createTextNode(a.name);g.addClass(m,"controller-name");f=s(d,m);g.addClass(this.__ul,k.CLASS_CLOSED);g.addClass(f,"title");g.bind(f,"click",function(a){a.preventDefault();d.closed=!d.closed;return false});if(!a.closed)this.closed=false}a.autoPlace&&(i.isUndefined(a.parent)&&(F&&(v=document.createElement("div"),g.addClass(v,"dg"),g.addClass(v,
+k.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(v),F=false),v.appendChild(this.domElement),g.addClass(this.domElement,k.CLASS_AUTO_PLACE)),this.parent||D(d,a.width));g.bind(window,"resize",function(){d.onResize()});g.bind(this.__ul,"webkitTransitionEnd",function(){d.onResize()});g.bind(this.__ul,"transitionend",function(){d.onResize()});g.bind(this.__ul,"oTransitionEnd",function(){d.onResize()});this.onResize();a.resizable&&J(this);d.getRoot();a.parent||c()};k.toggleHide=function(){A=!A;i.each(G,
+function(a){a.domElement.style.zIndex=A?-999:999;a.domElement.style.opacity=A?0:1})};k.CLASS_AUTO_PLACE="a";k.CLASS_AUTO_PLACE_CONTAINER="ac";k.CLASS_MAIN="main";k.CLASS_CONTROLLER_ROW="cr";k.CLASS_TOO_TALL="taller-than-window";k.CLASS_CLOSED="closed";k.CLASS_CLOSE_BUTTON="close-button";k.CLASS_DRAG="drag";k.DEFAULT_WIDTH=245;k.TEXT_CLOSED="Close Controls";k.TEXT_OPEN="Open Controls";g.bind(window,"keydown",function(a){document.activeElement.type!=="text"&&(a.which===72||a.keyCode==72)&&k.toggleHide()},
+false);i.extend(k.prototype,{add:function(a,b){return q(this,a,b,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(a,b){return q(this,a,b,{color:true})},remove:function(a){this.__ul.removeChild(a.__li);this.__controllers.slice(this.__controllers.indexOf(a),1);var b=this;i.defer(function(){b.onResize()})},destroy:function(){this.autoPlace&&v.removeChild(this.domElement)},addFolder:function(a){if(this.__folders[a]!==void 0)throw Error('You already have a folder in this GUI by the name "'+
+a+'"');var b={name:a,parent:this};b.autoPlace=this.autoPlace;if(this.load&&this.load.folders&&this.load.folders[a])b.closed=this.load.folders[a].closed,b.load=this.load.folders[a];b=new k(b);this.__folders[a]=b;a=s(this,b.domElement);g.addClass(a,"folder");return b},open:function(){this.closed=false},close:function(){this.closed=true},onResize:function(){var a=this.getRoot();if(a.scrollable){var b=g.getOffset(a.__ul).top,c=0;i.each(a.__ul.childNodes,function(b){a.autoPlace&&b===a.__save_row||(c+=
+g.getHeight(b))});window.innerHeight-b-20<c?(g.addClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height=window.innerHeight-b-20+"px"):(g.removeClass(a.domElement,k.CLASS_TOO_TALL),a.__ul.style.height="auto")}a.__resize_handle&&i.defer(function(){a.__resize_handle.style.height=a.__ul.offsetHeight+"px"});if(a.__closeButton)a.__closeButton.style.width=a.width+"px"},remember:function(){if(i.isUndefined(x))x=new y,x.domElement.innerHTML=a;if(this.parent)throw Error("You can only call remember on a top level GUI.");
+var b=this;i.each(Array.prototype.slice.call(arguments),function(a){b.__rememberedObjects.length==0&&I(b);b.__rememberedObjects.indexOf(a)==-1&&b.__rememberedObjects.push(a)});this.autoPlace&&D(this,this.width)},getRoot:function(){for(var a=this;a.parent;)a=a.parent;return a},getSaveObject:function(){var a=this.load;a.closed=this.closed;if(this.__rememberedObjects.length>0){a.preset=this.preset;if(!a.remembered)a.remembered={};a.remembered[this.preset]=z(this)}a.folders={};i.each(this.__folders,function(b,
+c){a.folders[c]=b.getSaveObject()});return a},save:function(){if(!this.load.remembered)this.load.remembered={};this.load.remembered[this.preset]=z(this);B(this,false)},saveAs:function(a){if(!this.load.remembered)this.load.remembered={},this.load.remembered[w]=z(this,true);this.load.remembered[a]=z(this);this.preset=a;C(this,a,true)},revert:function(a){i.each(this.__controllers,function(b){this.getRoot().load.remembered?t(a||this.getRoot(),b):b.setValue(b.initialValue)},this);i.each(this.__folders,
+function(a){a.revert(a)});a||B(this.getRoot(),false)},listen:function(a){var b=this.__listening.length==0;this.__listening.push(a);b&&E(this.__listening)}});return k}(dat.utils.css,'<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>',
+".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n",
+dat.controllers.factory=function(e,a,c,d,f,b,n){return function(h,j,m,l){var o=h[j];if(n.isArray(m)||n.isObject(m))return new e(h,j,m);if(n.isNumber(o))return n.isNumber(m)&&n.isNumber(l)?new c(h,j,m,l):new a(h,j,{min:m,max:l});if(n.isString(o))return new d(h,j);if(n.isFunction(o))return new f(h,j,"");if(n.isBoolean(o))return new b(h,j)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController=function(e,a,c){var d=
+function(c,b){function e(){h.setValue(h.__input.value)}d.superclass.call(this,c,b);var h=this;this.__input=document.createElement("input");this.__input.setAttribute("type","text");a.bind(this.__input,"keyup",e);a.bind(this.__input,"change",e);a.bind(this.__input,"blur",function(){h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())});a.bind(this.__input,"keydown",function(a){a.keyCode===13&&this.blur()});this.updateDisplay();this.domElement.appendChild(this.__input)};d.superclass=e;c.extend(d.prototype,
+e.prototype,{updateDisplay:function(){if(!a.isActive(this.__input))this.__input.value=this.getValue();return d.superclass.prototype.updateDisplay.call(this)}});return d}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.OptionController,
+dat.controllers.ColorController=function(e,a,c,d,f){function b(a,b,c,d){a.style.background="";f.each(j,function(e){a.style.cssText+="background: "+e+"linear-gradient("+b+", "+c+" 0%, "+d+" 100%); "})}function n(a){a.style.background="";a.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";a.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
+a.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";a.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var h=function(e,l){function o(b){q(b);a.bind(window,"mousemove",q);a.bind(window,
+"mouseup",j)}function j(){a.unbind(window,"mousemove",q);a.unbind(window,"mouseup",j)}function g(){var a=d(this.value);a!==false?(p.__color.__state=a,p.setValue(p.__color.toOriginal())):this.value=p.__color.toString()}function i(){a.unbind(window,"mousemove",s);a.unbind(window,"mouseup",i)}function q(b){b.preventDefault();var c=a.getWidth(p.__saturation_field),d=a.getOffset(p.__saturation_field),e=(b.clientX-d.left+document.body.scrollLeft)/c,b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b=
+1:b<0&&(b=0);e>1?e=1:e<0&&(e=0);p.__color.v=b;p.__color.s=e;p.setValue(p.__color.toOriginal());return false}function s(b){b.preventDefault();var c=a.getHeight(p.__hue_field),d=a.getOffset(p.__hue_field),b=1-(b.clientY-d.top+document.body.scrollTop)/c;b>1?b=1:b<0&&(b=0);p.__color.h=b*360;p.setValue(p.__color.toOriginal());return false}h.superclass.call(this,e,l);this.__color=new c(this.getValue());this.__temp=new c(0);var p=this;this.domElement=document.createElement("div");a.makeSelectable(this.domElement,
+false);this.__selector=document.createElement("div");this.__selector.className="selector";this.__saturation_field=document.createElement("div");this.__saturation_field.className="saturation-field";this.__field_knob=document.createElement("div");this.__field_knob.className="field-knob";this.__field_knob_border="2px solid ";this.__hue_knob=document.createElement("div");this.__hue_knob.className="hue-knob";this.__hue_field=document.createElement("div");this.__hue_field.className="hue-field";this.__input=
+document.createElement("input");this.__input.type="text";this.__input_textShadow="0 1px 1px ";a.bind(this.__input,"keydown",function(a){a.keyCode===13&&g.call(this)});a.bind(this.__input,"blur",g);a.bind(this.__selector,"mousedown",function(){a.addClass(this,"drag").bind(window,"mouseup",function(){a.removeClass(p.__selector,"drag")})});var t=document.createElement("div");f.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"});
+f.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<0.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1});f.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1});f.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"});f.extend(t.style,
+{width:"100%",height:"100%",background:"none"});b(t,"top","rgba(0,0,0,0)","#000");f.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"});n(this.__hue_field);f.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"});a.bind(this.__saturation_field,"mousedown",o);a.bind(this.__field_knob,"mousedown",o);a.bind(this.__hue_field,"mousedown",
+function(b){s(b);a.bind(window,"mousemove",s);a.bind(window,"mouseup",i)});this.__saturation_field.appendChild(t);this.__selector.appendChild(this.__field_knob);this.__selector.appendChild(this.__saturation_field);this.__selector.appendChild(this.__hue_field);this.__hue_field.appendChild(this.__hue_knob);this.domElement.appendChild(this.__input);this.domElement.appendChild(this.__selector);this.updateDisplay()};h.superclass=e;f.extend(h.prototype,e.prototype,{updateDisplay:function(){var a=d(this.getValue());
+if(a!==false){var e=false;f.each(c.COMPONENTS,function(b){if(!f.isUndefined(a[b])&&!f.isUndefined(this.__color.__state[b])&&a[b]!==this.__color.__state[b])return e=true,{}},this);e&&f.extend(this.__color.__state,a)}f.extend(this.__temp.__state,this.__color.__state);this.__temp.a=1;var h=this.__color.v<0.5||this.__color.s>0.5?255:0,j=255-h;f.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+
+"rgb("+h+","+h+","+h+")"});this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px";this.__temp.s=1;this.__temp.v=1;b(this.__saturation_field,"left","#fff",this.__temp.toString());f.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+h+","+h+","+h+")",textShadow:this.__input_textShadow+"rgba("+j+","+j+","+j+",.7)"})}});var j=["-moz-","-o-","-webkit-","-ms-",""];return h}(dat.controllers.Controller,dat.dom.dom,dat.color.Color=function(e,a,c,d){function f(a,
+b,c){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="RGB")return this.__state[b];n(this,b,c);return this.__state[b]},set:function(a){if(this.__state.space!=="RGB")n(this,b,c),this.__state.space="RGB";this.__state[b]=a}})}function b(a,b){Object.defineProperty(a,b,{get:function(){if(this.__state.space==="HSV")return this.__state[b];h(this);return this.__state[b]},set:function(a){if(this.__state.space!=="HSV")h(this),this.__state.space="HSV";this.__state[b]=a}})}function n(b,c,e){if(b.__state.space===
+"HEX")b.__state[c]=a.component_from_hex(b.__state.hex,e);else if(b.__state.space==="HSV")d.extend(b.__state,a.hsv_to_rgb(b.__state.h,b.__state.s,b.__state.v));else throw"Corrupted color state";}function h(b){var c=a.rgb_to_hsv(b.r,b.g,b.b);d.extend(b.__state,{s:c.s,v:c.v});if(d.isNaN(c.h)){if(d.isUndefined(b.__state.h))b.__state.h=0}else b.__state.h=c.h}var j=function(){this.__state=e.apply(this,arguments);if(this.__state===false)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||
+1};j.COMPONENTS="r,g,b,h,s,v,hex,a".split(",");d.extend(j.prototype,{toString:function(){return c(this)},toOriginal:function(){return this.__state.conversion.write(this)}});f(j.prototype,"r",2);f(j.prototype,"g",1);f(j.prototype,"b",0);b(j.prototype,"h");b(j.prototype,"s");b(j.prototype,"v");Object.defineProperty(j.prototype,"a",{get:function(){return this.__state.a},set:function(a){this.__state.a=a}});Object.defineProperty(j.prototype,"hex",{get:function(){if(!this.__state.space!=="HEX")this.__state.hex=
+a.rgb_to_hex(this.r,this.g,this.b);return this.__state.hex},set:function(a){this.__state.space="HEX";this.__state.hex=a}});return j}(dat.color.interpret,dat.color.math=function(){var e;return{hsv_to_rgb:function(a,c,d){var e=a/60-Math.floor(a/60),b=d*(1-c),n=d*(1-e*c),c=d*(1-(1-e)*c),a=[[d,c,b],[n,d,b],[b,d,c],[b,n,d],[c,b,d],[d,b,n]][Math.floor(a/60)%6];return{r:a[0]*255,g:a[1]*255,b:a[2]*255}},rgb_to_hsv:function(a,c,d){var e=Math.min(a,c,d),b=Math.max(a,c,d),e=b-e;if(b==0)return{h:NaN,s:0,v:0};
+a=a==b?(c-d)/e:c==b?2+(d-a)/e:4+(a-c)/e;a/=6;a<0&&(a+=1);return{h:a*360,s:e/b,v:b/255}},rgb_to_hex:function(a,c,d){a=this.hex_with_component(0,2,a);a=this.hex_with_component(a,1,c);return a=this.hex_with_component(a,0,d)},component_from_hex:function(a,c){return a>>c*8&255},hex_with_component:function(a,c,d){return d<<(e=c*8)|a&~(255<<e)}}}(),dat.color.toString,dat.utils.common),dat.color.interpret,dat.utils.common),dat.utils.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||
+window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1E3/60)}}(),dat.dom.CenteredDiv=function(e,a){var c=function(){this.backgroundElement=document.createElement("div");a.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear"});e.makeFullscreen(this.backgroundElement);this.backgroundElement.style.position="fixed";this.domElement=
+document.createElement("div");a.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"});document.body.appendChild(this.backgroundElement);document.body.appendChild(this.domElement);var c=this;e.bind(this.backgroundElement,"click",function(){c.hide()})};c.prototype.show=function(){var c=this;this.backgroundElement.style.display="block";this.domElement.style.display="block";this.domElement.style.opacity=
+0;this.domElement.style.webkitTransform="scale(1.1)";this.layout();a.defer(function(){c.backgroundElement.style.opacity=1;c.domElement.style.opacity=1;c.domElement.style.webkitTransform="scale(1)"})};c.prototype.hide=function(){var a=this,c=function(){a.domElement.style.display="none";a.backgroundElement.style.display="none";e.unbind(a.domElement,"webkitTransitionEnd",c);e.unbind(a.domElement,"transitionend",c);e.unbind(a.domElement,"oTransitionEnd",c)};e.bind(this.domElement,"webkitTransitionEnd",
+c);e.bind(this.domElement,"transitionend",c);e.bind(this.domElement,"oTransitionEnd",c);this.backgroundElement.style.opacity=0;this.domElement.style.opacity=0;this.domElement.style.webkitTransform="scale(1.1)"};c.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-e.getWidth(this.domElement)/2+"px";this.domElement.style.top=window.innerHeight/2-e.getHeight(this.domElement)/2+"px"};return c}(dat.dom.dom,dat.utils.common),dat.dom.dom,dat.utils.common);
View
BIN ...w-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/ash_uvgrid01.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...ow-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthbump1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...ake-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthcloudmaptrans.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthmap1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...ow-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/earthspec1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/jupitermap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/marsbump1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/marsmap1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...ow-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/mercurybump.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/mercurymap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/moonbump1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/moonmap1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/neptunemap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...ow-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/plutobump1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/plutomap1k.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnmap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...o-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnringcolor.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...make-the-earth-in-webgl/demo/bower_components/threex.planets/images/saturnringpattern.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/sunmap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusmap.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusringcolour.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...o-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/uranusringtrans.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/venusbump.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ...6-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/images/venusmap.jpg
Diff not rendered.
View
8 ...16-how-to-make-the-earth-in-webgl/demo/bower_components/threex.planets/package.require.js
@@ -0,0 +1,8 @@
+define( [ 'module'
+ , './threex.planets',
+ , './threex.atmospherematerial'
+ , './threex.atmospheredatgui'
+ ], function(module){
+ // set baseUrl for this plugin
+ THREEx.Planets.baseURL = module.uri+'/../';
+});
View
42 ...o-make-the-earth-in-webgl/demo/bower_components/threex.planets/threex.atmospheredatgui.js
@@ -0,0 +1,42 @@
+/**
+ * vendor.js framework definition
+ * @type {Object}
+ */
+var THREEx = THREEx || {};
+
+THREEx.addAtmosphereMaterial2DatGui = function(material, datGui){
+ datGui = datGui || new dat.GUI()
+ var uniforms = material.uniforms
+ // options
+ var options = {
+ coeficient : uniforms['coeficient'].value,
+ power : uniforms['power'].value,
+ glowColor : '#'+uniforms.glowColor.value.getHexString(),
+ presetFront : function(){
+ options.coeficient = 1
+ options.power = 2
+ onChange()
+ },
+ presetBack : function(){
+ options.coeficient = 0.5
+ options.power = 4.0
+ onChange()
+ },
+ }
+ var onChange = function(){
+ uniforms['coeficient'].value = options.coeficient
+ uniforms['power'].value = options.power
+ uniforms.glowColor.value.set( options.glowColor );
+ }
+ onChange()
+
+ // config datGui
+ datGui.add( options, 'coeficient' , 0.0 , 2)
+ .listen().onChange( onChange )
+ datGui.add( options, 'power' , 0.0 , 30)
+ .listen().onChange( onChange )
+ datGui.addColor( options, 'glowColor' )
+ .listen().onChange( onChange )
+ datGui.add( options, 'presetFront' )
+ datGui.add( options, 'presetBack' )
+}
View
54 ...make-the-earth-in-webgl/demo/bower_components/threex.planets/threex.atmospherematerial.js
@@ -0,0 +1,54 @@
+var THREEx = THREEx || {}
+
+/**
+ * from http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
+ * @return {[type]} [description]
+ */
+THREEx.createAtmosphereMaterial = function(){
+ var vertexShader = [
+ 'varying vec3 vNormal;',
+ 'void main(){',