瀏覽代碼

Merge branch 'dev' of http://github.com/mrdoob/three.js into nrrdLoader2

Valentin Demeusy 9 年之前
父節點
當前提交
2b4464f114
共有 100 個文件被更改,包括 12414 次插入2490 次删除
  1. 9 8
      .github/CONTRIBUTING.md
  2. 28 0
      .github/ISSUE_TEMPLATE.md
  3. 345 173
      build/three.js
  4. 170 166
      build/three.min.js
  5. 58 0
      docs/api/extras/geometries/BoxBufferGeometry.html
  6. 44 0
      docs/api/extras/geometries/CircleBufferGeometry.html
  7. 4 9
      docs/api/extras/geometries/CircleGeometry.html
  8. 56 0
      docs/api/extras/geometries/CylinderBufferGeometry.html
  9. 50 0
      docs/api/extras/geometries/PlaneBufferGeometry.html
  10. 45 0
      docs/api/extras/geometries/RingBufferGeometry.html
  11. 57 0
      docs/api/extras/geometries/SphereBufferGeometry.html
  12. 51 0
      docs/api/extras/geometries/TorusBufferGeometry.html
  13. 57 0
      docs/api/extras/geometries/TorusKnotBufferGeometry.html
  14. 9 8
      docs/api/extras/geometries/TorusKnotGeometry.html
  15. 14 4
      docs/api/lights/AmbientLight.html
  16. 1 0
      docs/api/lights/DirectionalLight.html
  17. 6 5
      docs/api/lights/HemisphereLight.html
  18. 15 6
      docs/api/lights/PointLight.html
  19. 9 0
      docs/api/lights/SpotLight.html
  20. 4 4
      docs/api/objects/LineSegments.html
  21. 0 5
      docs/api/renderers/WebGLRenderTarget.html
  22. 5 0
      docs/api/textures/Texture.html
  23. 1 1
      docs/index.html
  24. 8 0
      docs/list.js
  25. 7 12
      docs/manual/introduction/Creating-a-scene.html
  26. 1 0
      docs/page.css
  27. 10 10
      docs/scenes/bones-browser.html
  28. 21 19
      docs/scenes/geometry-browser.html
  29. 285 10
      docs/scenes/js/geometry.js
  30. 12 12
      docs/scenes/material-browser.html
  31. 3 4
      editor/js/Menubar.Add.js
  32. 10 2
      editor/js/Sidebar.Geometry.LatheGeometry.js
  33. 12 23
      editor/js/Sidebar.Geometry.TorusKnotGeometry.js
  34. 10 10
      editor/js/libs/app.js
  35. 0 4
      editor/js/libs/tern-threejs/threejs.js
  36. 2 1
      examples/canvas_ascii_effect.html
  37. 2 1
      examples/canvas_camera_orthographic.html
  38. 2 1
      examples/canvas_camera_orthographic2.html
  39. 2 1
      examples/canvas_geometry_birds.html
  40. 2 1
      examples/canvas_geometry_cube.html
  41. 8 3
      examples/files.js
  42. 26 0
      examples/js/Encodings.js
  43. 51 0
      examples/js/Half.js
  44. 0 4
      examples/js/Ocean.js
  45. 6 8
      examples/js/ParametricGeometries.js
  46. 544 0
      examples/js/RollerCoaster.js
  47. 4 10
      examples/js/ShaderSkin.js
  48. 0 2
      examples/js/ShaderTerrain.js
  49. 97 0
      examples/js/WebVR.js
  50. 6 12
      examples/js/controls/EditorControls.js
  51. 21 39
      examples/js/controls/OrbitControls.js
  52. 19 0
      examples/js/controls/TrackballControls.js
  53. 48 18
      examples/js/controls/VRControls.js
  54. 128 32
      examples/js/effects/VREffect.js
  55. 25 19
      examples/js/exporters/STLBinaryExporter.js
  56. 15 0
      examples/js/libs/inflate.min.js
  57. 99 6
      examples/js/loaders/ColladaLoader2.js
  58. 83 0
      examples/js/loaders/HDRCubeTextureLoader.js
  59. 0 2
      examples/js/loaders/MMDLoader.js
  60. 2 2
      examples/js/loaders/OBJLoader.js
  61. 982 147
      examples/js/loaders/VTKLoader.js
  62. 317 307
      examples/js/loaders/gltf/glTF-parser.js
  63. 13 13
      examples/js/loaders/gltf/glTFAnimation.js
  64. 1466 1103
      examples/js/loaders/gltf/glTFLoader.js
  65. 185 106
      examples/js/loaders/gltf/glTFLoaderUtils.js
  66. 145 0
      examples/js/loaders/gltf/glTFShaders.js
  67. 204 0
      examples/js/loaders/gltf/gltfUtilities.js
  68. 1 2
      examples/js/materials/ShadowMaterial.js
  69. 0 2
      examples/js/nodes/materials/PhongNode.js
  70. 0 2
      examples/js/nodes/materials/StandardNode.js
  71. 177 0
      examples/js/pmrem/PMREMCubeUVPacker.js
  72. 261 0
      examples/js/pmrem/PMREMGenerator.js
  73. 12 15
      examples/js/postprocessing/EffectComposer.js
  74. 0 1
      examples/js/shaders/GammaCorrectionShader.js
  75. 1 0
      examples/models/gltf/CesiumMan/README.txt
  76. 二進制
      examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.bin
  77. 2111 0
      examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.gltf
  78. 二進制
      examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.jpg
  79. 二進制
      examples/models/gltf/CesiumMan/glTF/Cesium_Man.bin
  80. 2207 0
      examples/models/gltf/CesiumMan/glTF/Cesium_Man.gltf
  81. 二進制
      examples/models/gltf/CesiumMan/glTF/Cesium_Man.jpg
  82. 25 0
      examples/models/gltf/CesiumMan/glTF/Cesium_Man0FS.glsl
  83. 22 0
      examples/models/gltf/CesiumMan/glTF/Cesium_Man0VS.glsl
  84. 1 0
      examples/models/gltf/CesiumMilkTruck/README.txt
  85. 二進制
      examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.bin
  86. 610 0
      examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.gltf
  87. 二進制
      examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.png
  88. 二進制
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.bin
  89. 705 0
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.gltf
  90. 二進制
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.png
  91. 17 0
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck0FS.glsl
  92. 12 0
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck0VS.glsl
  93. 18 0
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck1FS.glsl
  94. 15 0
      examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck1VS.glsl
  95. 7 13
      examples/models/gltf/duck/README.txt
  96. 二進制
      examples/models/gltf/duck/duck.bin
  97. 0 122
      examples/models/gltf/duck/duck.dae
  98. 二進制
      examples/models/gltf/duck/glTF-MaterialsCommon/duck.bin
  99. 291 0
      examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf
  100. 0 0
      examples/models/gltf/duck/glTF-MaterialsCommon/duckCM.png

+ 9 - 8
CONTRIBUTING.md → .github/CONTRIBUTING.md

@@ -1,27 +1,28 @@
-### The issues section is for bug reports and feature requests only. If you need help, please use [stackoverflow](http://stackoverflow.com/questions/tagged/three.js).
 
-
-Before reporting a bug
+# Help 
+#### The issues section is for bug reports and feature requests only. If you need help, please use [stackoverflow](http://stackoverflow.com/questions/tagged/three.js).
 ---
+# Bugs
+#### Before reporting a bug
+
 1. Search issue tracker for similar issues.
 2. Try the latest dev branch version of three.js.
 3. Refer to the [Migration Guide](https://github.com/mrdoob/three.js/wiki/Migration) when upgrading to the dev version.
 
+#### How to report a bug
 
-How to report a bug
----
 1. Specify the revision number of the three.js library where the bug occurred.
 2. Specify your browser version, operating system, and graphics card. (for example, Chrome 23.0.1271.95, Windows 7, Nvidia Quadro 2000M)
 3. Describe the problem in detail. Explain what happened, and what you expected would happen.
 4. Provide a small test-case (http://jsfiddle.net). [Here is a fiddle](http://jsfiddle.net/akmcv7Lh/) you can edit that runs the current version. [And here is a fiddle](http://jsfiddle.net/hw9rcLL8/) that uses the dev branch. If a test-case is not possible, provide a link to a live version of your application.
 5. If helpful, include a screenshot. Annotate the screenshot for clarity.
 
-
-How to contribute to three.js
 ---
+# Contribution
+#### How to contribute to three.js
+
 1. Make sure you have a GitHub account.
 2. Fork the repository on GitHub.
 3. Check the [Contribution Guidelines](https://github.com/mrdoob/three.js/wiki/How-to-contribute-to-three.js).
 4. Make changes to your clone of the repository.
 5. Submit a pull request.
-

+ 28 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,28 @@
+##### Description of the problem 
+
+...
+
+##### Three.js version
+
+- [ ] Dev
+- [ ] r74
+- [ ] ...
+
+##### Browser
+
+- [x] All of them
+- [ ] Chrome
+- [ ] Firefox
+- [ ] Internet Explorer
+
+##### OS
+
+- [x] All of them
+- [ ] Windows
+- [ ] Linux
+- [ ] Android
+- [ ] IOS
+
+##### Hardware Requirements (graphics card, VR Device, ...)
+
+

File diff suppressed because it is too large
+ 345 - 173
build/three.js


File diff suppressed because it is too large
+ 170 - 166
build/three.min.js


+ 58 - 0
docs/api/extras/geometries/BoxBufferGeometry.html

@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:BoxGeometry].</div>
+
+		<iframe src='scenes/geometry-browser.html#BoxBufferGeometry'></iframe>
+
+		<h2>Example</h2>
+
+		<code>var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
+		var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
+		var cube = new THREE.Mesh( geometry, material );
+		scene.add( cube );
+		</code>
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float width], [page:Float height], [page:Float depth], [page:Integer widthSegments], [page:Integer heightSegments], [page:Integer depthSegments])</h3>
+		<div>
+		width — Width of the sides on the X axis.<br />
+		height — Height of the sides on the Y axis.<br />
+		depth — Depth of the sides on the Z axis.<br />
+		widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.<br />
+		heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.<br />
+		depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1.
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<h3>.parameters</h3>
+ 		<div>
+			<p>Using the above example code above as our basis:</p>
+			<code>
+		geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined}
+		cube.geometry.parameters; // as above
+		cube.geometry.parameters.width; // === 1
+		cube.geometry.parameters.widthSegments // === undefined.
+			</code>
+ 		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 44 - 0
docs/api/extras/geometries/CircleBufferGeometry.html

@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:CircleGeometry].</div>
+
+		<h2>Example</h2>
+
+		<iframe src='scenes/geometry-browser.html#CircleBufferGeometry'></iframe>
+
+		<code>
+		var geometry = new THREE.CircleBufferGeometry( 5, 32 );
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
+		var circle = new THREE.Mesh( geometry, material );
+		scene.add( circle );
+		</code>
+
+
+		<h2>Constructor</h2>
+
+		<h3>[name]([page:Float radius], [page:Integer segments], [page:Float thetaStart], [page:Float thetaLength])</h3>
+		<div>
+		radius — Radius of the circle, default = 50.<br />
+		segments — Number of segments (triangles), minimum = 3, default = 8.<br />
+		thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
+		thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle.
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 4 - 9
docs/api/extras/geometries/CircleGeometry.html

@@ -19,15 +19,10 @@
 
 		<iframe src='scenes/geometry-browser.html#CircleGeometry'></iframe>
 
-		<code>var material = new THREE.MeshBasicMaterial({
-			color: 0x0000ff
-		});
-
-		var radius = 5;
-		var segments = 32;
-
-		var circleGeometry = new THREE.CircleGeometry( radius, segments );
-		var circle = new THREE.Mesh( circleGeometry, material );
+		<code>
+		var geometry = new THREE.CircleGeometry( 5, 32 );
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
+		var circle = new THREE.Mesh( geometry, material );
 		scene.add( circle );
 		</code>
 

+ 56 - 0
docs/api/extras/geometries/CylinderBufferGeometry.html

@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:CylinderGeometry].</div>
+
+
+		<h2>Example</h2>
+
+		<iframe src='scenes/geometry-browser.html#CylinderBufferGeometry'></iframe>
+
+		<code>var geometry = new THREE.CylinderBufferGeometry( 5, 5, 20, 32 );
+		var material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
+		var cylinder = new THREE.Mesh( geometry, material );
+		scene.add( cylinder );
+		</code>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
+		<div>
+		radiusTop — Radius of the cylinder at the top. Default is 20.<br />
+		radiusBottom — Radius of the cylinder at the bottom. Default is 20.<br />
+		height — Height of the cylinder. Default is 100.<br />
+		radiusSegments — Number of segmented faces around the circumference of the cylinder. Default is 8<br />
+		heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.<br />
+		openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.<br />
+		thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
+		thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+		Each of the constructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 50 - 0
docs/api/extras/geometries/PlaneBufferGeometry.html

@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:PlaneGeometry].</div>
+
+		<h2>Example</h2>
+
+		<iframe src='scenes/geometry-browser.html#PlaneBufferGeometry'></iframe>
+
+		<code>var geometry = new THREE.PlaneBufferGeometry( 5, 20, 32 );
+		var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
+		var plane = new THREE.Mesh( geometry, material );
+		scene.add( plane );
+		</code>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float width], [page:Float height], [page:Integer widthSegments], [page:Integer heightSegments])</h3>
+		<div>
+		width — Width along the X axis.<br />
+		height — Height along the Y axis.<br />
+		widthSegments — Optional. Default is 1. <br />
+		heightSegments — Optional. Default is 1.
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+		Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 45 - 0
docs/api/extras/geometries/RingBufferGeometry.html

@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:RingGeometry].</div>
+
+		<iframe src='scenes/geometry-browser.html#RingBufferGeometry'></iframe>
+
+		<h2>Example</h2>
+
+		<code>var geometry = new THREE.RingBufferGeometry( 1, 5, 32 );
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } );
+		var mesh = new THREE.Mesh( geometry, material );
+		scene.add( mesh );
+		</code>
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float innerRadius], [page:Float outerRadius], [page:Integer thetaSegments], [page:Integer phiSegments], [page:Float thetaStart], [page:Float thetaLength])</h3>
+		<div>
+		innerRadius — Default is 0, but it doesn't work right when innerRadius is set to 0.<br />
+		outerRadius — Default is 50. <br />
+		thetaSegments — Number of segments.  A higher number means the ring will be more round.  Minimum is 3.  Default is 8. <br />
+		phiSegments — Minimum is 1.  Default is 8.<br />
+		thetaStart — Starting angle. Default is 0. <br />
+		thetaLength — Central angle.  Default is Math.PI * 2.
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 57 - 0
docs/api/extras/geometries/SphereBufferGeometry.html

@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:SphereGeometry].</div>
+
+		<h2>Example</h2>
+
+		<iframe src='scenes/geometry-browser.html#SphereBufferGeometry'></iframe>
+
+		<code>var geometry = new THREE.SphereBufferGeometry( 5, 32, 32 );
+		var material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
+		var sphere = new THREE.Mesh( geometry, material );
+		scene.add( sphere );
+		</code>
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float radius], [page:Integer widthSegments], [page:Integer heightSegments], [page:Float phiStart], [page:Float phiLength], [page:Float thetaStart], [page:Float thetaLength])</h3>
+
+		<div>
+		radius — sphere radius. Default is 50.<br />
+		widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.<br />
+		heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.<br />
+		phiStart — specify horizontal starting angle. Default is 0.<br />
+		phiLength — specify horizontal sweep angle size. Default is Math.PI * 2.<br />
+		thetaStart — specify vertical starting angle. Default is 0.<br />
+		thetaLength — specify vertical sweep angle size. Default is Math.PI.<br />
+		</div>
+
+		<div>
+		The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to <em>'sphere slices'</em>) can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices.
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+		Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 51 - 0
docs/api/extras/geometries/TorusBufferGeometry.html

@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:TorusGeometry].</div>
+
+		<iframe src='scenes/geometry-browser.html#TorusBufferGeometry'></iframe>
+
+		<h2>Example</h2>
+
+		<code>var geometry = new THREE.TorusBufferGeometry( 10, 3, 16, 100 );
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
+		var torus = new THREE.Mesh( geometry, material );
+		scene.add( torus );
+		</code>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer radialSegments], [page:Integer tubularSegments], [page:Float arc])</h3>
+		<div>
+		radius — Default is 100. <br />
+		tube — Diameter of the tube.  Default is 40. <br />
+		radialSegments — Default is 8 <br />
+		tubularSegments — Default is 6. <br />
+		arc — Central angle.  Default is Math.PI * 2.
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+		Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 57 - 0
docs/api/extras/geometries/TorusKnotBufferGeometry.html

@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:BufferGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This is the [page:BufferGeometry] port of [page:TorusKnotGeometry].</div>
+
+		<iframe src='scenes/geometry-browser.html#TorusKnotBufferGeometry'></iframe>
+
+
+		<h2>Example</h2>
+
+		<code>var geometry = new THREE.TorusKnotBufferGeometry( 10, 3, 100, 16 );
+		var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
+		var torusKnot = new THREE.Mesh( geometry, material );
+		scene.add( torusKnot );
+		</code>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer tubularSegments], [page:Integer radialSegments], [page:Integer p], [page:Integer q])</h3>
+		<div>
+			<ul>
+				<li>radius — Default is 100.</li>
+				<li>tube — Diameter of the tube. Default is 40.</li>
+				<li>tubularSegments — Default is 64.</li>
+				<li>radialSegments — Default is 8.</li>
+				<li>p — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.</li>
+				<li>q — This value determines, how many times the geometry winds around a circle in the interior of the torus. Default is 3.</li>
+			</ul>
+		</div>
+
+
+		<h2>Properties</h2>
+
+
+		<div>
+		Each of the contructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 9 - 8
docs/api/extras/geometries/TorusKnotGeometry.html

@@ -29,15 +29,16 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer radialSegments], [page:Integer tubularSegments], [page:Integer p], [page:Integer q], [page:Float heightScale])</h3>
+		<h3>[name]([page:Float radius], [page:Float tube], [page:Integer tubularSegments], [page:Integer radialSegments], [page:Integer p], [page:Integer q])</h3>
 		<div>
-		radius — Default is 100. <br />
-		tube — Default is 40. <br />
-		radialSegments — Default is 64. <br />
-		tubularSegments — Default is 8. <br />
-		p — Default is 2. <br />
-		q — Default is 3. <br />
-		heightScale — Default is 1.
+			<ul>
+				<li>radius — Default is 100.</li>
+				<li>tube — Diameter of the tube. Default is 40.</li>
+				<li>tubularSegments — Default is 64.</li>
+				<li>radialSegments — Default is 8.</li>
+				<li>p — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.</li>
+				<li>q — This value determines, how many times the geometry winds around a circle in the interior of the torus. Default is 3.</li>
+			</ul>
 		</div>
 
 

+ 14 - 4
docs/api/lights/AmbientLight.html

@@ -24,7 +24,7 @@
 		<div>[example:canvas_sandbox sandbox ]</div>
 		<div>[example:webgl_animation_cloth animation / cloth ]</div>
 		<div>[example:webgl_animation_skinning_blending animation / skinning / blending ]</div>
-		
+
 <code>var light = new THREE.AmbientLight( 0x404040 ); // soft white light
 scene.add( light );</code>
 
@@ -39,19 +39,29 @@ scene.add( light );</code>
 		This creates an Ambientlight with a color.
 		</div>
 
+		<h2>Properties</h2>
+
+		<h3>[property:Float intensity]</h3>
+		<div>
+			Light's intensity.<br />
+			In "physically correct" mode, the product of color * intensity is interpreted as luminous irradiance measured in lux at the material surface.<br/>
+			Default — *1.0*.
+		</div>
+
+
 		<h2>Methods</h2>
-		
+
 		<h3>[method:AmbientLight clone]()</h3>
 		<div>
 		<br />
 		It returns a clone of Ambientlight.
 		</div>
-		
+
 		<h3>[method:JSON toJSON]()</h3>
 		<div>
 		Return Ambientlight data in JSON format.
 		</div>
-		
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 1 - 0
docs/api/lights/DirectionalLight.html

@@ -60,6 +60,7 @@ scene.add( directionalLight );</code>
 		<h3>[property:Float intensity]</h3>
 		<div>
 			Light's intensity.<br />
+			In "physically correct" mode, the product of intensity * color is interpreted as luminous irradiance measured in lux at the material's surface.<br/>
 			Default — *1.0*.
 		</div>
 

+ 6 - 5
docs/api/lights/HemisphereLight.html

@@ -13,16 +13,16 @@
 		<h1>[name]</h1>
 
 		<div class="desc">A light source positioned directly above the scene.</div>
-		
+
 		<h2>Example</h2>
-		
+
 		<div>[example:webgl_lights_hemisphere lights / hemisphere ]</div>
 		<div>[example:misc_controls_pointerlock controls / pointerlock ]</div>
 		<div>[example:webgl_decals decals ]</div>
 		<div>[example:webgl_loader_collada_kinematics loader / collada / kinematics ]</div>
 		<div>[example:webgl_materials_lightmap materials / lightmap ]</div>
 		<div>[example:webgl_shaders_ocean shaders / ocean ]</div>
-		
+
 <code>var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
 scene.add( light );</code>
 
@@ -47,17 +47,18 @@ scene.add( light );</code>
 		<h3>[property:Float intensity]</h3>
 		<div>
 			Light's intensity.<br />
+			In "physically correct" mode, the product of intensity * color (or intensity * groundColor) is interpreted as luminous irradiance measured in lux at the material's surface.<br/>
 			Default — *1.0*.
 		</div>
 
 		<h2>Methods</h2>
-		
+
 		<h3>[method:HemisphereLight clone]()</h3>
 		<div>
 		<br />
 		It returns a clone of HemisphereLight.
 		</div>
-		
+
 		<h3>[method:JSON toJSON]()</h3>
 		<div>
 		Return HemisphereLight data in JSON format.

+ 15 - 6
docs/api/lights/PointLight.html

@@ -28,7 +28,7 @@
 		<div>[example:webgl_geometry_large_mesh geometry / large / mesh ]</div>
 		<div>[example:webgl_geometry_text geometry / text ]</div>
 		<div>[example:webgl_lensflares lensflares ]</div>
-		
+
 		<code>var light = new THREE.PointLight( 0xff0000, 1, 100 );
 light.position.set( 50, 50, 50 );
 scene.add( light );</code>
@@ -46,7 +46,7 @@ scene.add( light );</code>
 		</div>
 		<div>
 		Creates a light at a specific position in the scene.  The light shines in all directions (roughly similar to a light bulb.)
-	
+
 		</div>
 
 
@@ -55,29 +55,38 @@ scene.add( light );</code>
 		<h3>[property:Float intensity]</h3>
 		<div>
 			Light's intensity.<br />
+			In "physically correct" mode, the product of color * intensity is interpreted as luminous intensity measured in candela.<br/>
 			Default - *1.0*.
 		</div>
 
+		<h3>[property:Float power]</h3>
+		<div>
+			Light's power.<br />
+			In "physically correct" mode, the luminous power of the light measured in lumens.<br/>
+			Default - *4PI*.
+		</div>
+
 		<h3>[property:Float distance]</h3>
 		<div>
 			If non-zero, light will attenuate linearly from maximum intensity at light *position* down to zero at *distance*.<br />
 			Default — *0.0*.
 		</div>
-		
+
 		<h3>[property:Float decay]</h3>
 		<div>
 			The amount the light dims along the distance of the light<br />
+			In "physically correct" mode, decay = 2 leads to physically realistic light falloff.<br/>
 			Default — *1*.
 		</div>
-		
+
 		<h2>Methods</h2>
-		
+
 		<h3>[method:PointLight clone]()</h3>
 		<div>
 		<br />
 		It returns a clone of PointLight.
 		</div>
-		
+
 		<h3>[method:JSON toJSON]()</h3>
 		<div>
 		Return PointLight data in JSON format.

+ 9 - 0
docs/api/lights/SpotLight.html

@@ -77,9 +77,17 @@
 		<h3>[property:Float intensity]</h3>
 		<div>
 			Light's intensity.<br />
+			In "physically correct" mode, the product of color * intensity is interpreted as luminous intensity measured in candela.<br/>
 			Default — *1.0*.
 		</div>
 
+		<h3>[property:Float power]</h3>
+		<div>
+			Light's power.<br />
+			In "physically correct" mode, the luminous power of the light measured in lumens.<br/>
+			Default - *4PI*.
+		</div>
+
 		<h3>[property:Float distance]</h3>
 		<div>
 			If non-zero, light will attenuate linearly from maximum intensity at light *position* down to zero at *distance*.<br />
@@ -101,6 +109,7 @@
 		<h3>[property:Float decay]</h3>
 		<div>
 			The amount the light dims along the distance of the light<br />
+			In "physically correct" mode, decay = 2 leads to physically realistic light falloff.<br/>
 			Default — *1*.
 		</div>
 

+ 4 - 4
docs/api/objects/LineSegments.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -12,7 +12,7 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">A series of lines.</div>
+		<div class="desc">A series of lines drawn between pairs of vertices.</div>
 
 
 		<h2>Constructor</h2>
@@ -20,7 +20,7 @@
 		<h3>[name]( [page:Geometry geometry], [page:Material material] )</h3>
 
 		<div>
-		geometry — Vertices representing the line segment(s).<br />
+		geometry — Pair(s) of vertices representing each line segment(s).<br />
 		material — Material for the line. Default is [page:LineBasicMaterial LineBasicMaterial].
 		</div>
 
@@ -31,7 +31,7 @@
 
 		<h3>[property:Geometry geometry]</h3>
 		<div>
-		Vertices representing the line segment(s).
+		Pair(s) of vertices representing the line segment(s).
 		</div>
 
 		<h3>[property:Material material]</h3>

+ 0 - 5
docs/api/renderers/WebGLRenderTarget.html

@@ -88,11 +88,6 @@
 		Whether to generate mipmaps (if possible) for a texture. True by default.
 		</div>
 
-		<h3>[property:WebGLRenderTarget shareDepthFrom]</h3>
-		<div>
-		Shares the depth from another WebGLRenderTarget. Default is null.
-		</div>
-
 		
 		<h2>Methods</h2>
 		

+ 5 - 0
docs/api/textures/Texture.html

@@ -128,6 +128,11 @@
 		False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha.
 		</div>
 
+		<h3>[property:number encoding]</h3>
+		<div>
+		Set to THREE.LinearEncoding by default, but supports sRGB, RGBE, RGBM, RGBD, LogLuv and Gamma corrected encodings.  IMPORTANT: If this value is changed on a texture after the material has been used, it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader.
+		</div>
+
 		<h3>[property:object onUpdate]</h3>
 		<div>
 		A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).

+ 1 - 1
docs/index.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">

+ 8 - 0
docs/list.js

@@ -191,8 +191,11 @@ var list = {
 		],
 
 		"Extras / Geometries": [
+			[ "BoxBufferGeometry", "api/extras/geometries/BoxBufferGeometry" ],
 			[ "BoxGeometry", "api/extras/geometries/BoxGeometry" ],
+			[ "CircleBufferGeometry", "api/extras/geometries/CircleBufferGeometry" ],
 			[ "CircleGeometry", "api/extras/geometries/CircleGeometry" ],
+			[ "CylinderBufferGeometry", "api/extras/geometries/CylinderBufferGeometry" ],
 			[ "CylinderGeometry", "api/extras/geometries/CylinderGeometry" ],
 			[ "DodecahedronGeometry", "api/extras/geometries/DodecahedronGeometry" ],
 			[ "ExtrudeGeometry", "api/extras/geometries/ExtrudeGeometry" ],
@@ -200,14 +203,19 @@ var list = {
 			[ "LatheGeometry", "api/extras/geometries/LatheGeometry" ],
 			[ "OctahedronGeometry", "api/extras/geometries/OctahedronGeometry" ],
 			[ "ParametricGeometry", "api/extras/geometries/ParametricGeometry" ],
+			[ "PlaneBufferGeometry", "api/extras/geometries/PlaneBufferGeometry" ],
 			[ "PlaneGeometry", "api/extras/geometries/PlaneGeometry" ],
 			[ "PolyhedronGeometry", "api/extras/geometries/PolyhedronGeometry" ],
+			[ "RingBufferGeometry", "api/extras/geometries/RingBufferGeometry" ],
 			[ "RingGeometry", "api/extras/geometries/RingGeometry" ],
 			[ "ShapeGeometry", "api/extras/geometries/ShapeGeometry" ],
+			[ "SphereBufferGeometry", "api/extras/geometries/SphereBufferGeometry" ],
 			[ "SphereGeometry", "api/extras/geometries/SphereGeometry" ],
 			[ "TetrahedronGeometry", "api/extras/geometries/TetrahedronGeometry" ],
 			[ "TextGeometry", "api/extras/geometries/TextGeometry" ],
+			[ "TorusBufferGeometry", "api/extras/geometries/TorusBufferGeometry" ],
 			[ "TorusGeometry", "api/extras/geometries/TorusGeometry" ],
+			[ "TorusKnotBufferGeometry", "api/extras/geometries/TorusKnotBufferGeometry" ],
 			[ "TorusKnotGeometry", "api/extras/geometries/TorusKnotGeometry" ],
 			[ "TubeGeometry", "api/extras/geometries/TubeGeometry" ]
 		],

+ 7 - 12
docs/manual/introduction/Creating-a-scene.html

@@ -8,18 +8,13 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	<body>
-		<h1>[name]</h1>
+		<h1>[name]</h1><br />
 
 		<div>The goal of this section is to give a brief introduction to Three.js. We will start by setting up a scene, with a spinning cube. A working example is provided at the bottom of the page in case you get stuck and need help.</div>
 
-		<h2>What is Three.js?</h2>
-
-		<div>Let's try to describe it briefly:</div>
-
-		<div>Three.js is a library that makes WebGL - 3D in the browser - easy to use. While a simple cube in raw WebGL would turn out hundreds of lines of Javascript and shader code, a Three.js equivalent is only a fraction of that.</div>
-
 		<h2>Before we start</h2>
-		<div>Before you can use Three.js, you need somewhere to display it. Save the following HTML to a file on your computer, along with a copy of <a href="http://threejs.org/build/three.min.js">three.min.js</a> in the js/ directory, and open it in your browser.</div>
+
+		<div>Before you can use Three.js, you need somewhere to display it. Save the following HTML to a file on your computer, along with a copy of <a href="http://threejs.org/build/three.js">three.js</a> in the js/ directory, and open it in your browser.</div>
 
 		<code>
 		&lt;!DOCTYPE html&gt;
@@ -33,7 +28,7 @@
 				&lt;/style&gt;
 			&lt;/head&gt;
 			&lt;body&gt;
-				&lt;script src="js/three.min.js"&gt;&lt;/script&gt;
+				&lt;script src="js/three.js"&gt;&lt;/script&gt;
 				&lt;script&gt;
 					// Our Javascript will go here.
 				&lt;/script&gt;
@@ -65,9 +60,9 @@
 		<div>Next up is the renderer. This is where the magic happens. In addition to the WebGLRenderer we use here, Three.js comes with a few others, often used as fallbacks for users with older browsers or for those who don't have WebGL support for some reason.</div>
 
 		<div>In addition to creating the renderer instance, we also need to set the size at which we want it to render our app. It's a good idea to use the width and height of the area we want to fill with our app - in this case, the width and height of the browser window. For performance intensive apps, you can also give <strong>setSize</strong> smaller values, like <strong>window.innerWidth/2</strong> and <strong>window.innerHeight/2</strong>, which will make the app render at half size.</div>
-		
+
 		<div>If you wish to keep the size of your app but render it at a lower resolution, you can do so by calling <strong>setSize</strong> with false as <strong>updateStyle</strong>. For example, <strong>setSize(window.innerWidth/2, window.innerHeight/2, false)</strong> will render your app at half resolution, given that your &lt;canvas&gt; has 100% width and height.</div>
-		
+
 		<div>Last but not least, we add the <strong>renderer</strong> element to our HTML document. This is a &lt;canvas&gt; element the renderer uses to display the scene to us.</div>
 
 		<div><em>"That's all good, but where's that cube you promised?"</em> Let's add it now.</div>
@@ -132,7 +127,7 @@
 				&lt;/style&gt;
 			&lt;/head&gt;
 			&lt;body&gt;
-				&lt;script src="js/three.min.js"&gt;&lt;/script&gt;
+				&lt;script src="js/three.js"&gt;&lt;/script&gt;
 				&lt;script&gt;
 					var scene = new THREE.Scene();
 					var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

+ 1 - 0
docs/page.css

@@ -11,6 +11,7 @@ body {
 	font-family: 'inconsolata';
 	font-size: 15px;
 	line-height: 18px;
+	tab-size: 4;
 	overflow: auto;
 }
 

+ 10 - 10
docs/scenes/bones-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -57,7 +57,7 @@
 				camera.position.y = 30;
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );				
+				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				document.body.appendChild( renderer.domElement );
 
@@ -74,7 +74,7 @@
 
 				lights[ 0 ].position.set( 0, 200, 0 );
 				lights[ 1 ].position.set( 100, 200, 100 );
-				lights[ 2 ].position.set( -100, -200, -100 );
+				lights[ 2 ].position.set( - 100, - 200, - 100 );
 
 				scene.add( lights[ 0 ] );
 				scene.add( lights[ 1 ] );
@@ -128,7 +128,7 @@
 
 				var prevBone = new THREE.Bone();
 				bones.push( prevBone );
-				prevBone.position.y = -sizing.halfHeight;
+				prevBone.position.y = - sizing.halfHeight;
 
 				for ( var i = 0; i < sizing.segmentCount; i ++ ) {
 
@@ -187,13 +187,13 @@
 
 					folder = gui.addFolder( "Bone " + i );
 
-					folder.add( bone.position, 'x', -10 + bone.position.x, 10 + bone.position.x );
-					folder.add( bone.position, 'y', -10 + bone.position.y, 10 + bone.position.y );
-					folder.add( bone.position, 'z', -10 + bone.position.z, 10 + bone.position.z );
+					folder.add( bone.position, 'x', - 10 + bone.position.x, 10 + bone.position.x );
+					folder.add( bone.position, 'y', - 10 + bone.position.y, 10 + bone.position.y );
+					folder.add( bone.position, 'z', - 10 + bone.position.z, 10 + bone.position.z );
 
-					folder.add( bone.rotation, 'x', -Math.PI * 0.5, Math.PI * 0.5 );
-					folder.add( bone.rotation, 'y', -Math.PI * 0.5, Math.PI * 0.5 );
-					folder.add( bone.rotation, 'z', -Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'x', - Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'y', - Math.PI * 0.5, Math.PI * 0.5 );
+					folder.add( bone.rotation, 'z', - Math.PI * 0.5, Math.PI * 0.5 );
 
 					folder.add( bone.scale, 'x', 0, 2 );
 					folder.add( bone.scale, 'y', 0, 2 );

+ 21 - 19
docs/scenes/geometry-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -42,11 +42,11 @@
 
 		<script>
 
-			document.getElementById('newWindow').href += window.location.hash;
+			document.getElementById( 'newWindow' ).href += window.location.hash;
 
 			var gui = new dat.GUI();
 			var scene = new THREE.Scene();
-			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 50 );
+			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 );
 			camera.position.z = 30;
 
 			var renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -61,17 +61,17 @@
 			scene.add( ambientLight );
 
 			var lights = [];
-			lights[0] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[1] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[2] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
 
-			lights[0].position.set( 0, 200, 0 );
-			lights[1].position.set( 100, 200, 100 );
-			lights[2].position.set( -100, -200, -100 );
+			lights[ 0 ].position.set( 0, 200, 0 );
+			lights[ 1 ].position.set( 100, 200, 100 );
+			lights[ 2 ].position.set( - 100, - 200, - 100 );
 
-			scene.add( lights[0] );
-			scene.add( lights[1] );
-			scene.add( lights[2] );
+			scene.add( lights[ 0 ] );
+			scene.add( lights[ 1 ] );
+			scene.add( lights[ 2 ] );
 
 			var mesh = new THREE.Object3D()
 
@@ -79,26 +79,26 @@
 
 				new THREE.Geometry(),
 
-				new THREE.LineBasicMaterial({
+				new THREE.LineBasicMaterial( {
 					color: 0xffffff,
 					transparent: true,
 					opacity: 0.5
-				})
+				} )
 
-			));
+			) );
 
 			mesh.add( new THREE.Mesh(
 
 				new THREE.Geometry(),
 
-				new THREE.MeshPhongMaterial({
+				new THREE.MeshPhongMaterial( {
 					color: 0x156289,
 					emissive: 0x072534,
 					side: THREE.DoubleSide,
 					shading: THREE.FlatShading
-				})
+				} )
 
-			));
+			) );
 
 			var options = chooseFromHash( mesh );
 
@@ -112,9 +112,11 @@
 
 				var time = Date.now() * 0.001;
 
-				if( !options.fixed ) {
+				if ( ! options.fixed ) {
+
 					mesh.rotation.x += 0.005;
 					mesh.rotation.y += 0.005;
+
 				}
 
 				renderer.render( scene, camera );

+ 285 - 10
docs/scenes/js/geometry.js

@@ -93,6 +93,40 @@ function updateGroupGeometry( mesh, geometry ) {
 
 var guis = {
 
+	BoxBufferGeometry : function( mesh ) {
+
+		var data = {
+			width : 15,
+			height : 15,
+			depth : 15,
+			widthSegments : 1,
+			heightSegments : 1,
+			depthSegments : 1
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.BoxBufferGeometry(
+					data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.BoxBufferGeometry' );
+
+		folder.add( data, 'width', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'height', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'depth', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'widthSegments', 1, 10 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'heightSegments', 1, 10 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'depthSegments', 1, 10 ).step( 1 ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	BoxGeometry : function( mesh ) {
 
 		var data = {
@@ -127,6 +161,52 @@ var guis = {
 
 	},
 
+	CylinderBufferGeometry : function( mesh ) {
+
+		var data = {
+			radiusTop : 5,
+			radiusBottom : 5,
+			height : 10,
+			radiusSegments : 8,
+			heightSegments : 1,
+			openEnded : false,
+			thetaStart : 0,
+			thetaLength : twoPi,
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.CylinderBufferGeometry(
+					data.radiusTop,
+					data.radiusBottom,
+					data.height,
+					data.radiusSegments,
+					data.heightSegments,
+					data.openEnded,
+					data.thetaStart,
+					data.thetaLength
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.CylinderBufferGeometry' );
+
+		folder.add( data, 'radiusTop', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'radiusBottom', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'height', 1, 50 ).onChange( generateGeometry );
+		folder.add( data, 'radiusSegments', 3, 64 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'heightSegments', 1, 64 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'openEnded' ).onChange( generateGeometry );
+		folder.add( data, 'thetaStart', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'thetaLength', 0, twoPi ).onChange( generateGeometry );
+
+
+		generateGeometry();
+
+	},
+
 	CylinderGeometry : function( mesh ) {
 
 		var data = {
@@ -173,6 +253,36 @@ var guis = {
 
 	},
 
+	CircleBufferGeometry : function( mesh ) {
+
+		var data = {
+			radius : 10,
+			segments : 32,
+			thetaStart : 0,
+			thetaLength : twoPi,
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.CircleBufferGeometry(
+					data.radius, data.segments, data.thetaStart, data.thetaLength
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.CircleBufferGeometry' );
+
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry );
+		folder.add( data, 'segments', 0, 128 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'thetaStart', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'thetaLength', 0, twoPi ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	CircleGeometry : function( mesh ) {
 
 		var data = {
@@ -281,6 +391,36 @@ var guis = {
 
 	},
 
+	PlaneBufferGeometry : function( mesh ) {
+
+		var data = {
+			width : 10,
+			height : 10,
+			widthSegments : 1,
+			heightSegments : 1
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.PlaneBufferGeometry(
+					data.width, data.height, data.widthSegments, data.heightSegments
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.PlaneBufferGeometry' );
+
+		folder.add( data, 'width', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'height', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'widthSegments', 1, 30 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'heightSegments', 1, 30 ).step( 1 ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	PlaneGeometry : function( mesh ) {
 
 		var data = {
@@ -311,6 +451,40 @@ var guis = {
 
 	},
 
+	RingBufferGeometry : function( mesh ) {
+
+		var data = {
+			innerRadius : 5,
+			outerRadius : 10,
+			thetaSegments : 8,
+			phiSegments : 8,
+			thetaStart : 0,
+			thetaLength : twoPi,
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.RingBufferGeometry(
+					data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.RingBufferGeometry' );
+
+		folder.add( data, 'innerRadius', 0, 30 ).onChange( generateGeometry );
+		folder.add( data, 'outerRadius', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'thetaSegments', 1, 30 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'phiSegments', 1, 30 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'thetaStart', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'thetaLength', 0, twoPi ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	RingGeometry : function( mesh ) {
 
 		var data = {
@@ -345,6 +519,42 @@ var guis = {
 
 	},
 
+	SphereBufferGeometry : function( mesh ) {
+
+		var data = {
+			radius : 15,
+			widthSegments : 8,
+			heightSegments : 6,
+			phiStart : 0,
+			phiLength : twoPi,
+			thetaStart : 0,
+			thetaLength : Math.PI,
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.SphereBufferGeometry(
+					data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.SphereBufferGeometry' );
+
+		folder.add( data, 'radius', 1, 30 ).onChange( generateGeometry );
+		folder.add( data, 'widthSegments', 3, 32 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'heightSegments', 2, 32 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'phiStart', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'phiLength', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'thetaStart', 0, twoPi ).onChange( generateGeometry );
+		folder.add( data, 'thetaLength', 0, twoPi ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	SphereGeometry : function( mesh ) {
 
 		var data = {
@@ -473,6 +683,38 @@ var guis = {
 
 	},
 
+	TorusBufferGeometry : function( mesh ) {
+
+		var data = {
+			radius : 10,
+			tube : 3,
+			radialSegments : 16,
+			tubularSegments : 100,
+			arc : twoPi
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.TorusBufferGeometry(
+					data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.TorusBufferGeometry' );
+
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry );
+		folder.add( data, 'tube', 0.1, 10 ).onChange( generateGeometry );
+		folder.add( data, 'radialSegments', 2, 30 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'tubularSegments', 3, 200 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'arc', 0.1, twoPi ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	TorusGeometry : function( mesh ) {
 
 		var data = {
@@ -505,38 +747,71 @@ var guis = {
 
 	},
 
+	TorusKnotBufferGeometry : function( mesh ) {
+
+		var data = {
+			radius : 10,
+			tube : 3,
+			tubularSegments : 64,
+			radialSegments : 8,
+			p : 2,
+			q : 3
+		};
+
+		function generateGeometry() {
+
+			updateGroupGeometry( mesh,
+				new THREE.TorusKnotBufferGeometry(
+					data.radius, data.tube, data.tubularSegments, data.radialSegments,
+					data.p, data.q
+				)
+			);
+
+		}
+
+		var folder = gui.addFolder( 'THREE.TorusKnotBufferGeometry' );
+
+		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry );
+		folder.add( data, 'tube', 0.1, 10 ).onChange( generateGeometry );
+		folder.add( data, 'tubularSegments', 3, 300 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'radialSegments', 3, 20 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'p', 1, 20 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'q', 1, 20 ).step( 1 ).onChange( generateGeometry );
+
+		generateGeometry();
+
+	},
+
 	TorusKnotGeometry : function( mesh ) {
 
 		var data = {
 			radius : 10,
 			tube : 3,
-			radialSegments : 64,
-			tubularSegments : 8,
+			tubularSegments : 64,
+			radialSegments : 8,
 			p : 2,
-			q : 3,
-			heightScale : 1
+			q : 3
 		};
 
 		function generateGeometry() {
 
 			updateGroupGeometry( mesh,
 				new THREE.TorusKnotGeometry(
-					data.radius, data.tube, data.radialSegments, data.tubularSegments,
-					data.p, data.q, data.heightScale
+					data.radius, data.tube, data.tubularSegments, data.radialSegments,
+					data.p, data.q
 				)
 			);
 
 		}
 
-		var folder = gui.addFolder( 'THREE.TorusGeometry' );
+		var folder = gui.addFolder( 'THREE.TorusKnotGeometry' );
 
 		folder.add( data, 'radius', 1, 20 ).onChange( generateGeometry );
 		folder.add( data, 'tube', 0.1, 10 ).onChange( generateGeometry );
-		folder.add( data, 'radialSegments', 3, 300 ).step( 1 ).onChange( generateGeometry );
-		folder.add( data, 'tubularSegments', 3, 20 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'tubularSegments', 3, 300 ).step( 1 ).onChange( generateGeometry );
+		folder.add( data, 'radialSegments', 3, 20 ).step( 1 ).onChange( generateGeometry );
 		folder.add( data, 'p', 1, 20 ).step( 1 ).onChange( generateGeometry );
 		folder.add( data, 'q', 1, 20 ).step( 1 ).onChange( generateGeometry );
-		folder.add( data, 'heightScale', 1, 20 ).onChange( generateGeometry );
 
 		generateGeometry();
 

+ 12 - 12
docs/scenes/material-browser.html

@@ -1,4 +1,4 @@
-<!doctype html>
+<!DOCTYPE html>
 <html lang="en">
 	<head>
 		<meta charset="utf-8">
@@ -40,11 +40,11 @@
 
 		<script>
 
-			document.getElementById('newWindow').href += window.location.hash;
+			document.getElementById( 'newWindow' ).href += window.location.hash;
 
 			var gui = new dat.GUI();
 			var scene = new THREE.Scene();
-			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 50 );
+			var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 );
 			camera.position.z = 30;
 
 			var renderer = new THREE.WebGLRenderer( { antialias: true } );
@@ -56,17 +56,17 @@
 			scene.add( ambientLight );
 
 			var lights = [];
-			lights[0] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[1] = new THREE.PointLight( 0xffffff, 1, 0 );
-			lights[2] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 0 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 1 ] = new THREE.PointLight( 0xffffff, 1, 0 );
+			lights[ 2 ] = new THREE.PointLight( 0xffffff, 1, 0 );
 
-			lights[0].position.set( 0, 200, 0 );
-			lights[1].position.set( 100, 200, 100 );
-			lights[2].position.set( -100, -200, -100 );
+			lights[ 0 ].position.set( 0, 200, 0 );
+			lights[ 1 ].position.set( 100, 200, 100 );
+			lights[ 2 ].position.set( - 100, - 200, - 100 );
 
-			scene.add( lights[0] );
-			scene.add( lights[1] );
-			scene.add( lights[2] );
+			scene.add( lights[ 0 ] );
+			scene.add( lights[ 1 ] );
+			scene.add( lights[ 2 ] );
 
 			guiScene( gui, scene, camera );
 

+ 3 - 4
editor/js/Menubar.Add.js

@@ -198,13 +198,12 @@ Menubar.Add = function ( editor ) {
 
 		var radius = 2;
 		var tube = 0.8;
-		var radialSegments = 64;
-		var tubularSegments = 12;
+		var tubularSegments = 64;
+		var radialSegments = 12;
 		var p = 2;
 		var q = 3;
-		var heightScale = 1;
 
-		var geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale );
+		var geometry = new THREE.TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'TorusKnot ' + ( ++ meshCount );
 

+ 10 - 2
editor/js/Sidebar.Geometry.LatheGeometry.js

@@ -63,9 +63,17 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
 
 	var addPointButton = new UI.Button( '+' ).onClick( function() {
 
-		var point = pointsUI[ pointsUI.length - 1 ];
+		if( pointsUI.length === 0 ){
 
-		pointsList.add( createPointRow( point.x.getValue(), point.y.getValue() ) );
+			pointsList.add( createPointRow( 0, 0 ) );
+
+		} else {
+
+			var point = pointsUI[ pointsUI.length - 1 ];
+
+			pointsList.add( createPointRow( point.x.getValue(), point.y.getValue() ) );
+
+		}
 
 		update();
 

+ 12 - 23
editor/js/Sidebar.Geometry.TorusKnotGeometry.js

@@ -30,16 +30,6 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	container.add( tubeRow );
 
-	// radialSegments
-
-	var radialSegmentsRow = new UI.Row();
-	var radialSegments = new UI.Integer( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
-
-	radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
-	radialSegmentsRow.add( radialSegments );
-
-	container.add( radialSegmentsRow );
-
 	// tubularSegments
 
 	var tubularSegmentsRow = new UI.Row();
@@ -50,6 +40,16 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	container.add( tubularSegmentsRow );
 
+	// radialSegments
+
+	var radialSegmentsRow = new UI.Row();
+	var radialSegments = new UI.Integer( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
+
+	radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
+	radialSegmentsRow.add( radialSegments );
+
+	container.add( radialSegmentsRow );
+
 	// p
 
 	var pRow = new UI.Row();
@@ -70,16 +70,6 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	container.add( qRow );
 
-	// heightScale
-
-	var heightScaleRow = new UI.Row();
-	var heightScale = new UI.Number( parameters.heightScale ).onChange( update );
-
-	pRow.add( new UI.Text( 'Height scale' ).setWidth( '90px' ) );
-	pRow.add( heightScale );
-
-	container.add( heightScaleRow );
-
 
 	//
 
@@ -88,11 +78,10 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 		editor.execute( new SetGeometryCommand( object, new THREE.TorusKnotGeometry(
 			radius.getValue(),
 			tube.getValue(),
-			radialSegments.getValue(),
 			tubularSegments.getValue(),
+			radialSegments.getValue(),
 			p.getValue(),
-			q.getValue(),
-			heightScale.getValue()
+			q.getValue()
 		) ) );
 
 	}

+ 10 - 10
editor/js/libs/app.js

@@ -177,15 +177,7 @@ var APP = {
 
 			for ( var i = 0, l = array.length; i < l; i ++ ) {
 
-				try {
-
-					array[ i ]( event );
-
-				} catch ( e ) {
-
-					console.error( ( e.message || e ), ( e.stack || "" ) );
-
-				}
+				array[ i ]( event );
 
 			}
 
@@ -197,7 +189,15 @@ var APP = {
 
 			request = requestAnimationFrame( animate );
 
-			dispatch( events.update, { time: time, delta: time - prevTime } );
+			try {
+
+				dispatch( events.update, { time: time, delta: time - prevTime } );
+
+			} catch ( e ) {
+
+				console.error( ( e.message || e ), ( e.stack || "" ) );
+
+			}
 
 			if ( vr === true ) {
 

+ 0 - 4
editor/js/libs/tern-threejs/threejs.js

@@ -5292,10 +5292,6 @@
           "!type": "boolean",
           "!doc": "Whether to generate mipmaps (if possible) for a texture. True by default."
         },
-        "shareDepthFrom": {
-          "!type": "+THREE.WebGLRenderTarget",
-          "!doc": "Shares the depth from another WebGLRenderTarget. Default is null."
-        },
         "setSize": {
           "!type": "fn(width: number, height: number)",
           "!doc": "Sets the size of the renderTarget."

+ 2 - 1
examples/canvas_ascii_effect.html

@@ -116,8 +116,9 @@
 
 				requestAnimationFrame( animate );
 
+				stats.begin();
 				render();
-				stats.update();
+				stats.end();
 
 			}
 

+ 2 - 1
examples/canvas_camera_orthographic.html

@@ -145,8 +145,9 @@
 
 				requestAnimationFrame( animate );
 
+				stats.begin();
 				render();
-				stats.update();
+				stats.end();
 
 			}
 

+ 2 - 1
examples/canvas_camera_orthographic2.html

@@ -208,8 +208,9 @@
 
 				requestAnimationFrame( animate );
 
+				stats.begin();
 				render();
-				stats.update();
+				stats.end();
 
 			}
 

+ 2 - 1
examples/canvas_geometry_birds.html

@@ -420,8 +420,9 @@
 
 				requestAnimationFrame( animate );
 
+				stats.begin();
 				render();
-				stats.update();
+				stats.end();
 
 			}
 

+ 2 - 1
examples/canvas_geometry_cube.html

@@ -193,8 +193,9 @@
 
 				requestAnimationFrame( animate );
 
+				stats.begin();
 				render();
-				stats.update();
+				stats.end();
 
 			}
 

+ 8 - 3
examples/files.js

@@ -57,6 +57,7 @@ var files = {
 		"webgl_kinect",
 		"webgl_lensflares",
 		"webgl_lights_hemisphere",
+		"webgl_lights_physical",
 		"webgl_lights_pointlights",
 		"webgl_lights_pointlights2",
 		"webgl_lines_colors",
@@ -120,6 +121,7 @@ var files = {
 		"webgl_materials_cubemap_refraction",
 		"webgl_materials_displacementmap",
 		"webgl_materials_envmaps",
+		"webgl_materials_envmaps_hdr",
 		"webgl_materials_grass",
 		"webgl_materials_lightmap",
 		"webgl_materials_nodes",
@@ -135,11 +137,11 @@ var files = {
 		"webgl_materials_texture_manualmipmap",
 		"webgl_materials_texture_pvrtc",
 		"webgl_materials_texture_tga",
+		"webgl_materials_transparency",
 		"webgl_materials_variations_basic",
 		"webgl_materials_variations_lambert",
 		"webgl_materials_variations_phong",
 		"webgl_materials_variations_standard",
-		"webgl_materials_variations_standard2",
 		"webgl_materials_video",
 		"webgl_materials_wireframe",
 		"webgl_mirror",
@@ -160,6 +162,7 @@ var files = {
 		"webgl_objects_update",
 		"webgl_octree",
 		"webgl_octree_raycasting",
+		"webgl_panorama_dualfisheye",
 		"webgl_panorama_equirectangular",
 		"webgl_particles_general",
 		"webgl_performance",
@@ -206,6 +209,7 @@ var files = {
 		"webgl_terrain_dynamic",
 		"webgl_test_memory",
 		"webgl_test_memory2",
+		"webgl_tonemapping",
 		"webgl_trails",
 		"webgl_video_panorama_equirectangular"
 	],
@@ -233,8 +237,9 @@ var files = {
 	],
 	"webvr": [
 		"webvr_cubes",
-		"webvr_video",
-		"webvr_stereo_pano"
+		"webvr_panorama",
+		"webvr_rollercoaster",
+		"webvr_video"
 	],
 	"css3d": [
 		"css3d_molecules",

+ 26 - 0
examples/js/Encodings.js

@@ -0,0 +1,26 @@
+/**
+ * @author Ben Houston / http://clara.io / bhouston
+ * @author Prashant Sharma / spidersharma03
+ */
+
+THREE.Encodings = function() {
+  if( THREE.toHalf === undefined ) throw new Error("THREE.Encodings is required for HDRCubeMapLoader when loading half data.");
+}
+
+THREE.Encodings.RGBEByteToRGBFloat = function( sourceArray, sourceOffset, destArray, destOffset ) {
+  var e = sourceArray[sourceOffset+3];
+  var scale = Math.pow(2.0, e - 128.0) / 255.0;
+
+  destArray[destOffset+0] = sourceArray[sourceOffset+0] * scale;
+  destArray[destOffset+1] = sourceArray[sourceOffset+1] * scale;
+  destArray[destOffset+2] = sourceArray[sourceOffset+2] * scale;
+}
+
+THREE.Encodings.RGBEByteToRGBHalf = function( sourceArray, sourceOffset, destArray, destOffset ) {
+  var e = sourceArray[sourceOffset+3];
+  var scale = Math.pow(2.0, e - 128.0) / 255.0;
+
+  destArray[destOffset+0] = THREE.toHalf( sourceArray[sourceOffset+0] * scale );
+  destArray[destOffset+1] = THREE.toHalf( sourceArray[sourceOffset+1] * scale );
+  destArray[destOffset+2] = THREE.toHalf( sourceArray[sourceOffset+2] * scale );
+}

+ 51 - 0
examples/js/Half.js

@@ -0,0 +1,51 @@
+/**
+ * Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410
+ */
+
+THREE.toHalf = (function() {
+  var floatView = new Float32Array(1);
+  var int32View = new Int32Array(floatView.buffer);
+
+  /* This method is faster than the OpenEXR implementation (very often
+   * used, eg. in Ogre), with the additional benefit of rounding, inspired
+   * by James Tursa?s half-precision code. */
+  return function toHalf(val) {
+
+    floatView[0] = val;
+    var x = int32View[0];
+
+    var bits = (x >> 16) & 0x8000; /* Get the sign */
+    var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */
+    var e = (x >> 23) & 0xff; /* Using int is faster here */
+
+    /* If zero, or denormal, or exponent underflows too much for a denormal
+     * half, return signed zero. */
+    if (e < 103) {
+      return bits;
+    }
+
+    /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
+    if (e > 142) {
+      bits |= 0x7c00;
+      /* If exponent was 0xff and one mantissa bit was set, it means NaN,
+           * not Inf, so make sure we set one mantissa bit too. */
+      bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff);
+      return bits;
+    }
+
+    /* If exponent underflows but not too much, return a denormal */
+    if (e < 113) {
+      m |= 0x0800;
+      /* Extra rounding may overflow and set mantissa to 0 and exponent
+       * to 1, which is OK. */
+      bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);
+      return bits;
+    }
+
+    bits |= ((e - 112) << 10) | (m >> 1);
+    /* Extra rounding. An overflow will set mantissa to 0 and increment
+     * the exponent, which is OK. */
+    bits += m & 1;
+    return bits;
+  };
+}());

+ 0 - 4
examples/js/Ocean.js

@@ -12,10 +12,6 @@
 
 	this.scene = new THREE.Scene();
 
-	// Enable necessary extensions
-	this.renderer.context.getExtension( 'OES_texture_float' );
-	this.renderer.context.getExtension( 'OES_texture_float_linear' );
-
 	// Assign optional parameters as variables and object properties
 	function optionalParameter( value, defaultValue ) {
 

+ 6 - 8
examples/js/ParametricGeometries.js

@@ -170,18 +170,16 @@ THREE.ParametricGeometries.TubeGeometry.prototype.constructor = THREE.Parametric
   * Parametric Replacement for TorusKnotGeometry
   *
   *********************************************/
-THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segmentsR, segmentsT, p, q, heightScale ) {
+THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segmentsT, segmentsR, p, q ) {
 
 	var scope = this;
 
 	this.radius = radius || 200;
 	this.tube = tube || 40;
-	this.segmentsR = segmentsR || 64;
-	this.segmentsT = segmentsT || 8;
+	this.segmentsT = segmentsT || 64;
+	this.segmentsR = segmentsR || 8;
 	this.p = p || 2;
 	this.q = q || 3;
-	this.heightScale = heightScale || 1;
-
 
 	var TorusKnotCurve = THREE.Curve.create(
 
@@ -198,13 +196,13 @@ THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segments
 				ty = ( 1 + r * Math.cos( q * t ) ) * Math.sin( p * t ),
 				tz = r * Math.sin( q * t );
 
-			return new THREE.Vector3( tx, ty * heightScale, tz ).multiplyScalar( radius );
+			return new THREE.Vector3( tx, ty, tz ).multiplyScalar( radius );
 
 		}
 
 	);
-	var segments = segmentsR;
-	var radiusSegments = segmentsT;
+	var segments = segmentsT;
+	var radiusSegments = segmentsR;
 	var extrudePath = new TorusKnotCurve();
 
 	THREE.ParametricGeometries.TubeGeometry.call( this, extrudePath, segments, tube, radiusSegments, true, false );

+ 544 - 0
examples/js/RollerCoaster.js

@@ -0,0 +1,544 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+var RollerCoasterGeometry = function ( curve, size ) {
+
+	THREE.BufferGeometry.call( this );
+
+	var vertices = [];
+	var normals = [];
+	var colors = [];
+
+	var color1 = [ 1, 1, 1 ];
+	var color2 = [ 1, 1, 0 ];
+
+	var up = new THREE.Vector3( 0, 1, 0 );
+	var forward = new THREE.Vector3();
+	var right = new THREE.Vector3();
+
+	var quaternion = new THREE.Quaternion();
+	var prevQuaternion = new THREE.Quaternion();
+	prevQuaternion.setFromAxisAngle( up , Math.PI / 2 );
+
+	var point = new THREE.Vector3();
+	var prevPoint = new THREE.Vector3();
+	prevPoint.copy( curve.getPointAt( 0 ) );
+
+	// shapes
+
+	var step = [
+		new THREE.Vector3( -2.25,  0, 0 ),
+		new THREE.Vector3(  0,  -0.5, 0 ),
+		new THREE.Vector3(  0, -1.75, 0 ),
+
+		new THREE.Vector3(  0,  -0.5, 0 ),
+		new THREE.Vector3(  2.25,  0, 0 ),
+		new THREE.Vector3(  0, -1.75, 0 )
+	];
+
+	var PI2 = Math.PI * 2;
+
+	var sides = 5;
+	var tube1 = [];
+
+	for ( var i = 0; i < sides; i ++ ) {
+
+		var angle = ( i / sides ) * PI2;
+		tube1.push( new THREE.Vector3( Math.sin( angle ) * 0.6, Math.cos( angle ) * 0.6, 0 ) );
+
+	}
+
+	var sides = 6;
+	var tube2 = [];
+
+	for ( var i = 0; i < sides; i ++ ) {
+
+		var angle = ( i / sides ) * PI2;
+		tube2.push( new THREE.Vector3( Math.sin( angle ) * 0.25, Math.cos( angle ) * 0.25, 0 ) );
+
+	}
+
+	var vector = new THREE.Vector3();
+	var normal = new THREE.Vector3();
+
+	var drawShape = function ( shape, color ) {
+
+		normal.set( 0, 0, -1 ).applyQuaternion( quaternion );
+
+		for ( var j = 0; j < shape.length; j ++ ) {
+
+			vector.copy( shape[ j ] );
+			vector.applyQuaternion( quaternion );
+			vector.add( point );
+
+			vertices.push( vector.x, vector.y, vector.z );
+			normals.push( normal.x, normal.y, normal.z );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+
+		}
+
+		normal.set( 0, 0, 1 ).applyQuaternion( quaternion );
+
+		for ( var j = shape.length - 1; j >= 0; j -- ) {
+
+			vector.copy( shape[ j ] );
+			vector.applyQuaternion( quaternion );
+			vector.add( point );
+
+			vertices.push( vector.x, vector.y, vector.z );
+			normals.push( normal.x, normal.y, normal.z );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+
+		}
+
+	};
+
+	var vector1 = new THREE.Vector3();
+	var vector2 = new THREE.Vector3();
+	var vector3 = new THREE.Vector3();
+	var vector4 = new THREE.Vector3();
+
+	var normal1 = new THREE.Vector3();
+	var normal2 = new THREE.Vector3();
+	var normal3 = new THREE.Vector3();
+	var normal4 = new THREE.Vector3();
+
+	var extrudeShape = function ( shape, offset, color ) {
+
+		for ( var j = 0, jl = shape.length; j < jl; j ++ ) {
+
+			var point1 = shape[ j ];
+			var point2 = shape[ ( j + 1 ) % jl ];
+
+			vector1.copy( point1 ).add( offset );
+			vector1.applyQuaternion( quaternion );
+			vector1.add( point );
+
+			vector2.copy( point2 ).add( offset );
+			vector2.applyQuaternion( quaternion );
+			vector2.add( point );
+
+			vector3.copy( point2 ).add( offset );
+			vector3.applyQuaternion( prevQuaternion );
+			vector3.add( prevPoint );
+
+			vector4.copy( point1 ).add( offset );
+			vector4.applyQuaternion( prevQuaternion );
+			vector4.add( prevPoint );
+
+			vertices.push( vector1.x, vector1.y, vector1.z );
+			vertices.push( vector2.x, vector2.y, vector2.z );
+			vertices.push( vector4.x, vector4.y, vector4.z );
+
+			vertices.push( vector2.x, vector2.y, vector2.z );
+			vertices.push( vector3.x, vector3.y, vector3.z );
+			vertices.push( vector4.x, vector4.y, vector4.z );
+
+			//
+
+			normal1.copy( point1 );
+			normal1.applyQuaternion( quaternion );
+			normal1.normalize();
+
+			normal2.copy( point2 );
+			normal2.applyQuaternion( quaternion );
+			normal2.normalize();
+
+			normal3.copy( point2 );
+			normal3.applyQuaternion( prevQuaternion );
+			normal3.normalize();
+
+			normal4.copy( point1 );
+			normal4.applyQuaternion( prevQuaternion );
+			normal4.normalize();
+
+			normals.push( normal1.x, normal1.y, normal1.z );
+			normals.push( normal2.x, normal2.y, normal2.z );
+			normals.push( normal4.x, normal4.y, normal4.z );
+
+			normals.push( normal2.x, normal2.y, normal2.z );
+			normals.push( normal3.x, normal3.y, normal3.z );
+			normals.push( normal4.x, normal4.y, normal4.z );
+
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+			colors.push( color[ 0 ], color[ 1 ], color[ 2 ] );
+
+		}
+
+	};
+
+	var offset = new THREE.Vector3();
+
+	for ( var i = 1; i <= size; i ++ ) {
+
+		point.copy( curve.getPointAt( i / size ) );
+
+		up.set( 0, 1, 0 );
+
+		forward.subVectors( point, prevPoint ).normalize();
+		right.crossVectors( up, forward ).normalize();
+		up.crossVectors( forward, right );
+
+		var angle = Math.atan2( forward.x, forward.z );
+
+		quaternion.setFromAxisAngle( up, angle );
+
+		if ( i % 2 === 0 ) {
+
+			drawShape( step, color2 );
+
+		}
+
+		extrudeShape( tube1, offset.set( 0, -1.25, 0 ), color2 );
+		extrudeShape( tube2, offset.set( 2, 0, 0 ), color1 );
+		extrudeShape( tube2, offset.set( -2, 0, 0 ), color1 );
+
+		prevPoint.copy( point );
+		prevQuaternion.copy( quaternion );
+
+	}
+
+	// console.log( vertices.length );
+
+	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+	this.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
+
+};
+
+RollerCoasterGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
+
+var RollerCoasterLiftersGeometry = function ( curve, size ) {
+
+	THREE.BufferGeometry.call( this );
+
+	var vertices = [];
+	var normals = [];
+
+	var quaternion = new THREE.Quaternion();
+
+	var up = new THREE.Vector3( 0, 1, 0 );
+
+	var point = new THREE.Vector3();
+	var tangent = new THREE.Vector3();
+
+	// shapes
+
+	var tube1 = [
+		new THREE.Vector3(  0,  0.5, -0.5 ),
+		new THREE.Vector3(  0,  0.5,  0.5 ),
+		new THREE.Vector3(  0, -0.5,  0 )
+	];
+
+	var tube2 = [
+		new THREE.Vector3( -0.5, 0,  0.5 ),
+		new THREE.Vector3( -0.5, 0, -0.5 ),
+		new THREE.Vector3(  0.5, 0,  0 )
+	];
+
+	var tube3 = [
+		new THREE.Vector3(  0.5, 0, -0.5 ),
+		new THREE.Vector3(  0.5, 0,  0.5 ),
+		new THREE.Vector3( -0.5, 0,  0 )
+	];
+
+	var vector1 = new THREE.Vector3();
+	var vector2 = new THREE.Vector3();
+	var vector3 = new THREE.Vector3();
+	var vector4 = new THREE.Vector3();
+
+	var normal1 = new THREE.Vector3();
+	var normal2 = new THREE.Vector3();
+	var normal3 = new THREE.Vector3();
+	var normal4 = new THREE.Vector3();
+
+	var extrudeShape = function ( shape, fromPoint, toPoint ) {
+
+		for ( var j = 0, jl = shape.length; j < jl; j ++ ) {
+
+			var point1 = shape[ j ];
+			var point2 = shape[ ( j + 1 ) % jl ];
+
+			vector1.copy( point1 )
+			vector1.applyQuaternion( quaternion );
+			vector1.add( fromPoint );
+
+			vector2.copy( point2 )
+			vector2.applyQuaternion( quaternion );
+			vector2.add( fromPoint );
+
+			vector3.copy( point2 )
+			vector3.applyQuaternion( quaternion );
+			vector3.add( toPoint );
+
+			vector4.copy( point1 )
+			vector4.applyQuaternion( quaternion );
+			vector4.add( toPoint );
+
+			vertices.push( vector1.x, vector1.y, vector1.z );
+			vertices.push( vector2.x, vector2.y, vector2.z );
+			vertices.push( vector4.x, vector4.y, vector4.z );
+
+			vertices.push( vector2.x, vector2.y, vector2.z );
+			vertices.push( vector3.x, vector3.y, vector3.z );
+			vertices.push( vector4.x, vector4.y, vector4.z );
+
+			//
+
+			normal1.copy( point1 );
+			normal1.applyQuaternion( quaternion );
+			normal1.normalize();
+
+			normal2.copy( point2 );
+			normal2.applyQuaternion( quaternion );
+			normal2.normalize();
+
+			normal3.copy( point2 );
+			normal3.applyQuaternion( quaternion );
+			normal3.normalize();
+
+			normal4.copy( point1 );
+			normal4.applyQuaternion( quaternion );
+			normal4.normalize();
+
+			normals.push( normal1.x, normal1.y, normal1.z );
+			normals.push( normal2.x, normal2.y, normal2.z );
+			normals.push( normal4.x, normal4.y, normal4.z );
+
+			normals.push( normal2.x, normal2.y, normal2.z );
+			normals.push( normal3.x, normal3.y, normal3.z );
+			normals.push( normal4.x, normal4.y, normal4.z );
+
+		}
+
+	};
+
+	var fromPoint = new THREE.Vector3();
+	var toPoint = new THREE.Vector3();
+
+	for ( var i = 1; i <= size; i ++ ) {
+
+		point.copy( curve.getPointAt( i / size ) );
+		tangent.copy( curve.getTangentAt( i / size ) );
+
+		var angle = Math.atan2( tangent.x, tangent.z );
+
+		quaternion.setFromAxisAngle( up, angle );
+
+		//
+
+		if ( point.y > 100 ) {
+
+			fromPoint.set( -7.5, -3.5, 0 );
+			fromPoint.applyQuaternion( quaternion );
+			fromPoint.add( point );
+
+			toPoint.set( 7.5, -3.5, 0 );
+			toPoint.applyQuaternion( quaternion );
+			toPoint.add( point );
+
+			extrudeShape( tube1, fromPoint, toPoint );
+
+			fromPoint.set( -7, -3, 0 );
+			fromPoint.applyQuaternion( quaternion );
+			fromPoint.add( point );
+
+			toPoint.set( -7, -point.y, 0 );
+			toPoint.applyQuaternion( quaternion );
+			toPoint.add( point );
+
+			extrudeShape( tube2, fromPoint, toPoint );
+
+			fromPoint.set( 7, -3, 0 );
+			fromPoint.applyQuaternion( quaternion );
+			fromPoint.add( point );
+
+			toPoint.set( 7, -point.y, 0 );
+			toPoint.applyQuaternion( quaternion );
+			toPoint.add( point );
+
+			extrudeShape( tube3, fromPoint, toPoint );
+
+		} else {
+
+			fromPoint.set( 0, -2, 0 );
+			fromPoint.applyQuaternion( quaternion );
+			fromPoint.add( point );
+
+			toPoint.set( 0, -point.y, 0 );
+			toPoint.applyQuaternion( quaternion );
+			toPoint.add( point );
+
+			extrudeShape( tube3, fromPoint, toPoint );
+
+		}
+
+	}
+
+	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+
+};
+
+RollerCoasterLiftersGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
+
+var RollerCoasterShadowGeometry = function ( curve, size ) {
+
+	THREE.BufferGeometry.call( this );
+
+	var vertices = [];
+
+	var up = new THREE.Vector3( 0, 1, 0 );
+	var forward = new THREE.Vector3();
+
+	var quaternion = new THREE.Quaternion();
+	var prevQuaternion = new THREE.Quaternion();
+	prevQuaternion.setFromAxisAngle( up , Math.PI / 2 );
+
+	var point = new THREE.Vector3();
+
+	var prevPoint = new THREE.Vector3();
+	prevPoint.copy( curve.getPointAt( 0 ) );
+	prevPoint.y = 0;
+
+	var vector1 = new THREE.Vector3();
+	var vector2 = new THREE.Vector3();
+	var vector3 = new THREE.Vector3();
+	var vector4 = new THREE.Vector3();
+
+	for ( var i = 1; i <= size; i ++ ) {
+
+		point.copy( curve.getPointAt( i / size ) );
+		point.y = 0;
+
+		forward.subVectors( point, prevPoint );
+
+		var angle = Math.atan2( forward.x, forward.z );
+
+		quaternion.setFromAxisAngle( up, angle );
+
+		vector1.set( -3, 0, 0 );
+		vector1.applyQuaternion( quaternion );
+		vector1.add( point );
+
+		vector2.set(  3, 0, 0 );
+		vector2.applyQuaternion( quaternion );
+		vector2.add( point );
+
+		vector3.set(  3, 0, 0 );
+		vector3.applyQuaternion( prevQuaternion );
+		vector3.add( prevPoint );
+
+		vector4.set( -3, 0, 0 );
+		vector4.applyQuaternion( prevQuaternion );
+		vector4.add( prevPoint );
+
+		vertices.push( vector1.x, vector1.y, vector1.z );
+		vertices.push( vector2.x, vector2.y, vector2.z );
+		vertices.push( vector4.x, vector4.y, vector4.z );
+
+		vertices.push( vector2.x, vector2.y, vector2.z );
+		vertices.push( vector3.x, vector3.y, vector3.z );
+		vertices.push( vector4.x, vector4.y, vector4.z );
+
+		prevPoint.copy( point );
+		prevQuaternion.copy( quaternion );
+
+	}
+
+	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+
+};
+
+RollerCoasterShadowGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
+
+var SkyGeometry = function () {
+
+	THREE.BufferGeometry.call( this );
+
+	var vertices = [];
+
+	for ( var i = 0; i < 100; i ++ ) {
+
+		var x = Math.random() * 8000 - 4000;
+		var y = Math.random() * 500 + 500;
+		var z = Math.random() * 8000 - 4000;
+
+		var size = Math.random() * 400 + 200;
+
+		vertices.push( x - size, y, z - size );
+		vertices.push( x + size, y, z - size );
+		vertices.push( x - size, y, z + size );
+
+		vertices.push( x + size, y, z - size );
+		vertices.push( x + size, y, z + size );
+		vertices.push( x - size, y, z + size );
+
+	}
+
+
+	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+
+};
+
+SkyGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
+
+var TreesGeometry = function ( landscape ) {
+
+	THREE.BufferGeometry.call( this );
+
+	var vertices = [];
+	var colors = [];
+
+	var raycaster = new THREE.Raycaster();
+	raycaster.ray.direction.set( 0, -1, 0 );
+
+	for ( var i = 0; i < 2000; i ++ ) {
+
+		var x = Math.random() * 5000 - 2500;
+		var z = Math.random() * 5000 - 2500;
+
+		raycaster.ray.origin.set( x, 500, z );
+
+		var intersections = raycaster.intersectObject( landscape );
+
+		if ( intersections.length === 0 ) continue;
+
+		var y = intersections[ 0 ].point.y;
+
+		var height = Math.random() * 50 + 5;
+
+		var angle = Math.random() * Math.PI * 2;
+
+		vertices.push( x + Math.sin( angle ) * 10, y, z + Math.cos( angle ) * 10 );
+		vertices.push( x, y + height, z );
+		vertices.push( x + Math.sin( angle + Math.PI ) * 10, y, z + Math.cos( angle + Math.PI ) * 10 );
+
+		angle += Math.PI / 2;
+
+		vertices.push( x + Math.sin( angle ) * 10, y, z + Math.cos( angle ) * 10 );
+		vertices.push( x, y + height, z );
+		vertices.push( x + Math.sin( angle + Math.PI ) * 10, y, z + Math.cos( angle + Math.PI ) * 10 );
+
+		var random = Math.random() * 0.1;
+
+		for ( var j = 0; j < 6; j ++ ) {
+
+			colors.push( 0.2 + random, 0.4 + random, 0 );
+
+		}
+
+	}
+
+	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
+
+};
+
+TreesGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );

+ 4 - 10
examples/js/ShaderSkin.js

@@ -25,7 +25,6 @@ THREE.ShaderSkin = {
 		uniforms: THREE.UniformsUtils.merge( [
 
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ],
 
 			{
@@ -84,7 +83,6 @@ THREE.ShaderSkin = {
 
 			THREE.ShaderChunk[ "common" ],
 			THREE.ShaderChunk[ "bsdfs" ],
-			THREE.ShaderChunk[ "ambient_pars" ],
 			THREE.ShaderChunk[ "lights_pars" ],
 			THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
 			THREE.ShaderChunk[ "fog_pars_fragment" ],
@@ -247,11 +245,9 @@ THREE.ShaderSkin = {
 
 				"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor * diffuse ) + totalSpecularLight;",
 
-				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
-				THREE.ShaderChunk[ "fog_fragment" ],
-
-				"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
+				"gl_FragColor = linearToOutputTexel( vec4( outgoingLight, diffuseColor.a ) );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
+				THREE.ShaderChunk[ "fog_fragment" ],
 
 			"}"
 
@@ -311,7 +307,6 @@ THREE.ShaderSkin = {
 		uniforms: THREE.UniformsUtils.merge( [
 
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ],
 
 			{
@@ -370,7 +365,6 @@ THREE.ShaderSkin = {
 			"varying vec3 vViewPosition;",
 
 			THREE.ShaderChunk[ "common" ],
-			THREE.ShaderChunk[ "ambient_pars" ],
 			THREE.ShaderChunk[ "lights_pars" ],
 			THREE.ShaderChunk[ "fog_pars_fragment" ],
 
@@ -550,10 +544,10 @@ THREE.ShaderSkin = {
 
 				"}",
 
-				THREE.ShaderChunk[ "fog_fragment" ],
-
 				"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
+				THREE.ShaderChunk[ "fog_fragment" ],
+
 			"}"
 
 		].join( "\n" ),

+ 0 - 2
examples/js/ShaderTerrain.js

@@ -18,7 +18,6 @@ THREE.ShaderTerrain = {
 		uniforms: THREE.UniformsUtils.merge( [
 
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ],
 
 			{
@@ -88,7 +87,6 @@ THREE.ShaderTerrain = {
 
 			THREE.ShaderChunk[ "common" ],
 			THREE.ShaderChunk[ "bsdfs" ],
-			THREE.ShaderChunk[ "ambient_pars" ],
 			THREE.ShaderChunk[ "lights_pars" ],
 			THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
 			THREE.ShaderChunk[ "fog_pars_fragment" ],

+ 97 - 0
examples/js/WebVR.js

@@ -0,0 +1,97 @@
+/**
+ * @author mrdoob / http://mrdoob.com
+ * Based on @tojiro's vr-samples-utils.js
+ */
+
+var WEBVR = {
+
+	isLatestAvailable: function () {
+
+		return navigator.getVRDisplays !== undefined;
+
+	},
+
+	isAvailable: function () {
+
+		return navigator.getVRDisplays !== undefined || navigator.getVRDevices !== undefined;
+
+	},
+
+	getMessage: function () {
+
+		var message;
+
+		if ( navigator.getVRDisplays ) {
+
+			navigator.getVRDisplays().then( function ( displays ) {
+
+				if ( displays.length === 0 ) message = 'WebVR supported, but no VRDisplays found.';
+
+			} );
+
+		} else if ( navigator.getVRDevices ) {
+
+			message = 'Your browser supports WebVR but not the latest version. See <a href="http://webvr.info">webvr.info</a> for more info.';
+
+		} else {
+
+			message = 'Your browser does not support WebVR. See <a href="http://webvr.info">webvr.info</a> for assistance.';
+
+		}
+
+		if ( message !== undefined ) {
+
+			var container = document.createElement( 'div' );
+			container.style.position = 'absolute';
+			container.style.left = '0';
+			container.style.top = '0';
+			container.style.right = '0';
+			container.style.zIndex = '999';
+			container.align = 'center';
+
+			var error = document.createElement( 'div' );
+			error.style.fontFamily = 'sans-serif';
+			error.style.fontSize = '16px';
+			error.style.fontStyle = 'normal';
+			error.style.lineHeight = '26px';
+			error.style.backgroundColor = '#fff';
+			error.style.color = '#000';
+			error.style.padding = '10px 20px';
+			error.style.margin = '50px';
+			error.style.display = 'inline-block';
+			error.innerHTML = message;
+			container.appendChild( error );
+
+			return container;
+
+		}
+
+	},
+
+	getButton: function ( effect ) {
+
+		var button = document.createElement( 'button' );
+		button.style.position = 'absolute';
+		button.style.left = 'calc(50% - 30px)';
+		button.style.bottom = '20px';
+		button.style.border = '0';
+		button.style.padding = '8px';
+		button.style.cursor = 'pointer';
+		button.style.backgroundColor = '#000';
+		button.style.color = '#fff';
+		button.style.fontFamily = 'sans-serif';
+		button.style.fontSize = '13px';
+		button.style.fontStyle = 'normal';
+		button.style.zIndex = '999';
+		button.textContent = 'ENTER VR';
+		button.onclick = function() {
+
+			effect.setFullScreen( true );
+
+		};
+
+		return button;
+
+	}
+
+};

+ 6 - 12
examples/js/controls/EditorControls.js

@@ -26,6 +26,7 @@ THREE.EditorControls = function ( object, domElement ) {
 	var normalMatrix = new THREE.Matrix3();
 	var pointer = new THREE.Vector2();
 	var pointerOld = new THREE.Vector2();
+	var spherical = new THREE.Spherical();
 
 	// events
 
@@ -86,21 +87,14 @@ THREE.EditorControls = function ( object, domElement ) {
 
 		vector.copy( object.position ).sub( center );
 
-		var theta = Math.atan2( vector.x, vector.z );
-		var phi = Math.atan2( Math.sqrt( vector.x * vector.x + vector.z * vector.z ), vector.y );
+		spherical.setFromVector3( vector );
 
-		theta += delta.x;
-		phi += delta.y;
+		spherical.theta += delta.x;
+		spherical.phi += delta.y;
 
-		var EPS = 0.000001;
+		spherical.makeSafe();
 
-		phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
-
-		var radius = vector.length();
-
-		vector.x = radius * Math.sin( phi ) * Math.sin( theta );
-		vector.y = radius * Math.cos( phi );
-		vector.z = radius * Math.sin( phi ) * Math.cos( theta );
+		vector.setFromSpherical( spherical );
 
 		object.position.copy( center ).add( vector );
 

+ 21 - 39
examples/js/controls/OrbitControls.js

@@ -133,12 +133,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 			offset.applyQuaternion( quat );
 
 			// angle from z-axis around y-axis
-
-			theta = Math.atan2( offset.x, offset.z );
-
-			// angle from y-axis
-
-			phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
+			spherical.setFromVector3( offset );
 
 			if ( scope.autoRotate && state === STATE.NONE ) {
 
@@ -146,29 +141,27 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 			}
 
-			theta += thetaDelta;
-			phi += phiDelta;
+			spherical.theta += sphericalDelta.theta;
+			spherical.phi += sphericalDelta.phi;
 
 			// restrict theta to be between desired limits
-			theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, theta ) );
+			spherical.theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, spherical.theta ) );
 
 			// restrict phi to be between desired limits
-			phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, phi ) );
+			spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
+
+			spherical.makeSafe();
 
-			// restrict phi to be betwee EPS and PI-EPS
-			phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
 
-			var radius = offset.length() * scale;
+			spherical.radius *= scale;
 
 			// restrict radius to be between desired limits
-			radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, radius ) );
+			spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
 
 			// move target to panned location
 			scope.target.add( panOffset );
 
-			offset.x = radius * Math.sin( phi ) * Math.sin( theta );
-			offset.y = radius * Math.cos( phi );
-			offset.z = radius * Math.sin( phi ) * Math.cos( theta );
+			offset.setFromSpherical( spherical );
 
 			// rotate offset back to "camera-up-vector-is-up" space
 			offset.applyQuaternion( quatInverse );
@@ -179,13 +172,12 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 			if ( scope.enableDamping === true ) {
 
-				thetaDelta *= ( 1 - scope.dampingFactor );
-				phiDelta *= ( 1 - scope.dampingFactor );
+				sphericalDelta.theta *= ( 1 - scope.dampingFactor );
+				sphericalDelta.phi *= ( 1 - scope.dampingFactor );
 
 			} else {
 
-				thetaDelta = 0;
-				phiDelta = 0;
+				sphericalDelta.set( 0, 0, 0 );
 
 			}
 
@@ -254,11 +246,9 @@ THREE.OrbitControls = function ( object, domElement ) {
 	var EPS = 0.000001;
 
 	// current position in spherical coordinates
-	var theta;
-	var phi;
+	var spherical = new THREE.Spherical();
+	var sphericalDelta = new THREE.Spherical();
 
-	var phiDelta = 0;
-	var thetaDelta = 0;
 	var scale = 1;
 	var panOffset = new THREE.Vector3();
 	var zoomChanged = false;
@@ -289,13 +279,13 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 	function rotateLeft( angle ) {
 
-		thetaDelta -= angle;
+		sphericalDelta.theta -= angle;
 
 	}
 
 	function rotateUp( angle ) {
 
-		phiDelta -= angle;
+		sphericalDelta.phi -= angle;
 
 	}
 
@@ -305,11 +295,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 		return function panLeft( distance, objectMatrix ) {
 
-			var te = objectMatrix.elements;
-
-			// get X column of objectMatrix
-			v.set( te[ 0 ], te[ 1 ], te[ 2 ] );
-
+			v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
 			v.multiplyScalar( - distance );
 
 			panOffset.add( v );
@@ -324,11 +310,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 		return function panUp( distance, objectMatrix ) {
 
-			var te = objectMatrix.elements;
-
-			// get Y column of objectMatrix
-			v.set( te[ 4 ], te[ 5 ], te[ 6 ] );
-
+			v.setFromMatrixColumn( objectMatrix, 1 ); // get Y column of objectMatrix
 			v.multiplyScalar( distance );
 
 			panOffset.add( v );
@@ -363,8 +345,8 @@ THREE.OrbitControls = function ( object, domElement ) {
 			} else if ( scope.object instanceof THREE.OrthographicCamera ) {
 
 				// orthographic
-				panLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth, scope.object.matrix );
-				panUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight, scope.object.matrix );
+				panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );
+				panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );
 
 			} else {
 

+ 19 - 0
examples/js/controls/TrackballControls.js

@@ -356,6 +356,8 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( _this.enabled === false ) return;
 
+		window.removeEventListener( 'keydown', keydown );
+
 		_prevState = _state;
 
 		if ( _state !== STATE.NONE ) {
@@ -384,12 +386,17 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		_state = _prevState;
 
+		window.addEventListener( 'keydown', keydown, false );
+
 	}
 
 	function mousedown( event ) {
 
 		if ( _this.enabled === false ) return;
 
+		event.preventDefault();
+		event.stopPropagation();
+
 		if ( _state === STATE.NONE ) {
 
 			_state = event.button;
@@ -424,6 +431,9 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( _this.enabled === false ) return;
 
+		event.preventDefault();
+		event.stopPropagation();
+
 		if ( _state === STATE.ROTATE && ! _this.noRotate ) {
 
 			_movePrev.copy( _moveCurr );
@@ -445,6 +455,9 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( _this.enabled === false ) return;
 
+		event.preventDefault();
+		event.stopPropagation();
+
 		_state = STATE.NONE;
 
 		document.removeEventListener( 'mousemove', mousemove );
@@ -457,6 +470,9 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( _this.enabled === false ) return;
 
+		event.preventDefault();
+		event.stopPropagation();
+
 		var delta = 0;
 
 		if ( event.wheelDelta ) {
@@ -513,6 +529,9 @@ THREE.TrackballControls = function ( object, domElement ) {
 
 		if ( _this.enabled === false ) return;
 
+		event.preventDefault();
+		event.stopPropagation();
+
 		switch ( event.touches.length ) {
 
 			case 1:

+ 48 - 18
examples/js/controls/VRControls.js

@@ -7,30 +7,37 @@ THREE.VRControls = function ( object, onError ) {
 
 	var scope = this;
 
-	var vrInputs = [];
+	var vrInput;
 
 	function gotVRDevices( devices ) {
 
 		for ( var i = 0; i < devices.length; i ++ ) {
 
-			if ( devices[ i ] instanceof PositionSensorVRDevice ) {
+			if ( ( 'VRDisplay' in window && devices[ i ] instanceof VRDisplay ) ||
+				 ( 'PositionSensorVRDevice' in window && devices[ i ] instanceof PositionSensorVRDevice ) ) {
 
-				vrInputs.push( devices[ i ] );
+				vrInput = devices[ i ];
+				break;  // We keep the first we encounter
 
 			}
 
 		}
 
-		if ( vrInputs.length === 0 ) {
+		if ( !vrInput ) {
 
-			if ( onError ) onError( 'PositionSensorVRDevice not available' );
+			if ( onError ) onError( 'VR input not available.' );
 
 		}
 
 	}
 
-	if ( navigator.getVRDevices ) {
+	if ( navigator.getVRDisplays ) {
 
+		navigator.getVRDisplays().then( gotVRDevices );
+
+	} else if ( navigator.getVRDevices ) {
+
+		// Deprecated API.
 		navigator.getVRDevices().then( gotVRDevices );
 
 	}
@@ -43,21 +50,40 @@ THREE.VRControls = function ( object, onError ) {
 
 	this.update = function () {
 
-		for ( var i = 0; i < vrInputs.length; i ++ ) {
+		if ( vrInput ) {
 
-			var vrInput = vrInputs[ i ];
+			if ( vrInput.getPose ) {
 
-			var state = vrInput.getState();
+				var pose = vrInput.getPose();
 
-			if ( state.orientation !== null ) {
+				if ( pose.orientation !== null ) {
 
-				object.quaternion.copy( state.orientation );
+					object.quaternion.fromArray( pose.orientation );
 
-			}
+				}
+
+				if ( pose.position !== null ) {
+
+					object.position.fromArray( pose.position ).multiplyScalar( scope.scale );
+
+				}
+
+			} else {
 
-			if ( state.position !== null ) {
+				// Deprecated API.
+				var state = vrInput.getState();
 
-				object.position.copy( state.position ).multiplyScalar( scope.scale );
+				if ( state.orientation !== null ) {
+
+					object.quaternion.copy( state.orientation );
+
+				}
+
+				if ( state.position !== null ) {
+
+					object.position.copy( state.position ).multiplyScalar( scope.scale );
+
+				}
 
 			}
 
@@ -67,16 +93,20 @@ THREE.VRControls = function ( object, onError ) {
 
 	this.resetSensor = function () {
 
-		for ( var i = 0; i < vrInputs.length; i ++ ) {
+		if ( vrInput ) {
+
+			if ( vrInput.resetPose !== undefined ) {
 
-			var vrInput = vrInputs[ i ];
+				vrInput.resetPose();
 
-			if ( vrInput.resetSensor !== undefined ) {
+			} else if ( vrInput.resetSensor !== undefined ) {
 
+				// Deprecated API.
 				vrInput.resetSensor();
 
 			} else if ( vrInput.zeroSensor !== undefined ) {
 
+				// Really deprecated API.
 				vrInput.zeroSensor();
 
 			}
@@ -94,7 +124,7 @@ THREE.VRControls = function ( object, onError ) {
 
 	this.dispose = function () {
 
-		vrInputs = [];
+		vrInput = null;
 
 	};
 

+ 128 - 32
examples/js/effects/VREffect.js

@@ -12,17 +12,26 @@
 THREE.VREffect = function ( renderer, onError ) {
 
 	var vrHMD;
-	var eyeTranslationL, eyeFOVL, renderRectL;
-	var eyeTranslationR, eyeFOVR, renderRectR;
+	var deprecatedAPI = false;
+	var eyeTranslationL = new THREE.Vector3();
+	var eyeTranslationR = new THREE.Vector3();
+	var renderRectL, renderRectR;
+	var eyeFOVL, eyeFOVR;
 
 	function gotVRDevices( devices ) {
 
 		for ( var i = 0; i < devices.length; i ++ ) {
 
-			if ( devices[ i ] instanceof HMDVRDevice ) {
+			if ( 'VRDisplay' in window && devices[ i ] instanceof VRDisplay ) {
 
 				vrHMD = devices[ i ];
+				deprecatedAPI = false;
+				break; // We keep the first we encounter
+
+			} else if ( 'HMDVRDevice' in window && devices[ i ] instanceof HMDVRDevice ) {
 
+				vrHMD = devices[ i ];
+				deprecatedAPI = true;
 				break; // We keep the first we encounter
 
 			}
@@ -37,8 +46,13 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	}
 
-	if ( navigator.getVRDevices ) {
+	if ( navigator.getVRDisplays ) {
+
+		navigator.getVRDisplays().then( gotVRDevices );
+
+	} else if ( navigator.getVRDevices ) {
 
+		// Deprecated API.
 		navigator.getVRDevices().then( gotVRDevices );
 
 	}
@@ -55,31 +69,90 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	// fullscreen
 
-	var isFullscreen = false;
+	var isPresenting = false;
 
 	var canvas = renderer.domElement;
 	var fullscreenchange = canvas.mozRequestFullScreen ? 'mozfullscreenchange' : 'webkitfullscreenchange';
 
-	document.addEventListener( fullscreenchange, function ( event ) {
+	document.addEventListener( fullscreenchange, function () {
 
-		isFullscreen = document.mozFullScreenElement || document.webkitFullscreenElement;
+		if ( vrHMD && deprecatedAPI ) {
+
+			isPresenting = document.mozFullScreenElement || document.webkitFullscreenElement;
+
+		}
+
+	}, false );
+
+	window.addEventListener( 'vrdisplaypresentchange', function () {
+
+		isPresenting = vrHMD && vrHMD.isPresenting;
 
 	}, false );
 
 	this.setFullScreen = function ( boolean ) {
 
-		if ( vrHMD === undefined ) return;
-		if ( isFullscreen === boolean ) return;
+		return new Promise( function ( resolve, reject ) {
+
+			if ( vrHMD === undefined ) {
 
-		if ( canvas.mozRequestFullScreen ) {
+				reject( new Error( 'No VR hardware found.' ) );
+				return;
 
-			canvas.mozRequestFullScreen( { vrDisplay: vrHMD } );
+			}
+			if ( isPresenting === boolean ) {
+
+				resolve();
+				return;
 
-		} else if ( canvas.webkitRequestFullscreen ) {
+			}
 
-			canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } );
+			if ( !deprecatedAPI ) {
 
-		}
+				if ( boolean ) {
+
+					resolve( vrHMD.requestPresent( { source: canvas } ) );
+
+				} else {
+
+					resolve( vrHMD.exitPresent() );
+
+				}
+
+			} else {
+
+				if ( canvas.mozRequestFullScreen ) {
+
+					canvas.mozRequestFullScreen( { vrDisplay: vrHMD } );
+					resolve();
+
+				} else if ( canvas.webkitRequestFullscreen ) {
+
+					canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } );
+					resolve();
+
+				} else {
+
+					console.error( 'No compatible requestFullscreen method found.' );
+					reject( new Error( 'No compatible requestFullscreen method found.' ) );
+
+				}
+
+			}
+
+		});
+
+	};
+
+	this.requestPresent = function () {
+
+		return this.setFullScreen( true );
+
+	};
+
+	this.exitPresent = function () {
+
+		return this.setFullScreen( false );
 
 	};
 
@@ -93,17 +166,35 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	this.render = function ( scene, camera ) {
 
-		if ( vrHMD ) {
+		if ( vrHMD && isPresenting ) {
+
+			var autoUpdate = scene.autoUpdate;
+
+			if ( autoUpdate ) {
+
+				scene.updateMatrixWorld();
+				scene.autoUpdate = false;
+
+			}
 
 			var eyeParamsL = vrHMD.getEyeParameters( 'left' );
 			var eyeParamsR = vrHMD.getEyeParameters( 'right' );
 
-			eyeTranslationL = eyeParamsL.eyeTranslation;
-			eyeTranslationR = eyeParamsR.eyeTranslation;
-			eyeFOVL = eyeParamsL.recommendedFieldOfView;
-			eyeFOVR = eyeParamsR.recommendedFieldOfView;
-			renderRectL = eyeParamsL.renderRect;
-			renderRectR = eyeParamsR.renderRect;
+			if ( !deprecatedAPI ) {
+
+				eyeTranslationL.fromArray( eyeParamsL.offset );
+				eyeTranslationR.fromArray( eyeParamsR.offset );
+				eyeFOVL = eyeParamsL.fieldOfView;
+				eyeFOVR = eyeParamsR.fieldOfView;
+
+			} else {
+
+				eyeTranslationL.copy( eyeParamsL.eyeTranslation );
+				eyeTranslationR.copy( eyeParamsR.eyeTranslation );
+				eyeFOVL = eyeParamsL.recommendedFieldOfView;
+				eyeFOVR = eyeParamsR.recommendedFieldOfView;
+
+			}
 
 			if ( Array.isArray( scene ) ) {
 
@@ -112,7 +203,11 @@ THREE.VREffect = function ( renderer, onError ) {
 
 			}
 
+			// When rendering we don't care what the recommended size is, only what the actual size
+			// of the backbuffer is.
 			var size = renderer.getSize();
+			renderRectL = { x: 0, y: 0, width: size.width / 2, height: size.height };
+			renderRectR = { x: size.width / 2, y: 0, width: size.width / 2, height: size.height };
 
 			renderer.setScissorTest( true );
 			renderer.clear();
@@ -129,28 +224,29 @@ THREE.VREffect = function ( renderer, onError ) {
 			cameraR.translateX( eyeTranslationR.x * this.scale );
 
 			// render left eye
-			if ( renderRectL === undefined ) {
-
-				renderRectL = { x: 0, y: 0, width: size.width / 2, height: size.height };
-
-			}
 			renderer.setViewport( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
 			renderer.setScissor( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
 			renderer.render( scene, cameraL );
 
 			// render right eye
-			if ( renderRectR === undefined ) {
-
-				renderRectR = { x: size.width / 2, y: 0, width: size.width / 2, height: size.height };
-
-			}
-
 			renderer.setViewport( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
 			renderer.setScissor( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
 			renderer.render( scene, cameraR );
 
 			renderer.setScissorTest( false );
 
+			if ( autoUpdate ) {
+
+				scene.autoUpdate = true;
+
+			}
+
+			if ( !deprecatedAPI ) {
+
+				vrHMD.submitFrame();
+
+			}
+
 			return;
 
 		}

+ 25 - 19
examples/js/exporters/STLBinaryExporter.js

@@ -17,11 +17,29 @@ THREE.STLBinaryExporter.prototype = {
 
 		return function parse( scene ) {
 
+			// We collect objects first, as we may need to convert from BufferGeometry to Geometry
+			var objects = [];
 			var triangles = 0;
 			scene.traverse( function ( object ) {
 
 				if ( ! ( object instanceof THREE.Mesh ) ) return;
-				triangles += object.geometry.faces.length;
+
+				var geometry = object.geometry;
+				if ( geometry instanceof THREE.BufferGeometry ) {
+
+					geometry = new THREE.Geometry().fromBufferGeometry( geometry );
+
+				}
+
+				if ( ! ( geometry instanceof THREE.Geometry ) ) return;
+				triangles += geometry.faces.length;
+
+				objects.push( {
+
+					geometry: geometry,
+					matrix: object.matrixWorld
+
+				} );
 
 			} );
 
@@ -31,25 +49,13 @@ THREE.STLBinaryExporter.prototype = {
 			var output = new DataView( arrayBuffer );
 			output.setUint32( offset, triangles, true ); offset += 4;
 
-			scene.traverse( function ( object ) {
-
-				if ( ! ( object instanceof THREE.Mesh ) ) return;
-
-				var geometry = object.geometry;
-				if ( geometry instanceof THREE.BufferGeometry ) {
-                            
-					geometry = new THREE.Geometry().fromBufferGeometry( geometry );
-                            
-				}
-
-				if ( ! ( geometry instanceof THREE.Geometry ) ) return;
-
-				var matrixWorld = object.matrixWorld;
+			// Traversing our collected objects
+			objects.forEach( function ( object ) {
 
-				var vertices = geometry.vertices;
-				var faces = geometry.faces;
+				var vertices = object.geometry.vertices;
+				var faces = object.geometry.faces;
 
-				normalMatrixWorld.getNormalMatrix( matrixWorld );
+				normalMatrixWorld.getNormalMatrix( object.matrix );
 
 				for ( var i = 0, l = faces.length; i < l; i ++ ) {
 
@@ -65,7 +71,7 @@ THREE.STLBinaryExporter.prototype = {
 
 					for ( var j = 0; j < 3; j ++ ) {
 
-						vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( matrixWorld );
+						vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( object.matrix );
 
 						output.setFloat32( offset, vector.x, true ); offset += 4; // vertices
 						output.setFloat32( offset, vector.y, true ); offset += 4;

+ 15 - 0
examples/js/libs/inflate.min.js

@@ -0,0 +1,15 @@
+/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';var m=this;function q(c,d){var a=c.split("."),b=m;!(a[0]in b)&&b.execScript&&b.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)!a.length&&void 0!==d?b[e]=d:b=b[e]?b[e]:b[e]={}};var s="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function t(c){var d=c.length,a=0,b=Number.POSITIVE_INFINITY,e,f,g,h,k,l,p,n,r,K;for(n=0;n<d;++n)c[n]>a&&(a=c[n]),c[n]<b&&(b=c[n]);e=1<<a;f=new (s?Uint32Array:Array)(e);g=1;h=0;for(k=2;g<=a;){for(n=0;n<d;++n)if(c[n]===g){l=0;p=h;for(r=0;r<g;++r)l=l<<1|p&1,p>>=1;K=g<<16|n;for(r=l;r<e;r+=k)f[r]=K;++h}++g;h<<=1;k<<=1}return[f,a,b]};function u(c,d){this.g=[];this.h=32768;this.d=this.f=this.a=this.l=0;this.input=s?new Uint8Array(c):c;this.m=!1;this.i=v;this.s=!1;if(d||!(d={}))d.index&&(this.a=d.index),d.bufferSize&&(this.h=d.bufferSize),d.bufferType&&(this.i=d.bufferType),d.resize&&(this.s=d.resize);switch(this.i){case w:this.b=32768;this.c=new (s?Uint8Array:Array)(32768+this.h+258);break;case v:this.b=0;this.c=new (s?Uint8Array:Array)(this.h);this.e=this.A;this.n=this.w;this.j=this.z;break;default:throw Error("invalid inflate mode");
+}}var w=0,v=1,x={u:w,t:v};
+u.prototype.k=function(){for(;!this.m;){var c=y(this,3);c&1&&(this.m=!0);c>>>=1;switch(c){case 0:var d=this.input,a=this.a,b=this.c,e=this.b,f=d.length,g=void 0,h=void 0,k=b.length,l=void 0;this.d=this.f=0;if(a+1>=f)throw Error("invalid uncompressed block header: LEN");g=d[a++]|d[a++]<<8;if(a+1>=f)throw Error("invalid uncompressed block header: NLEN");h=d[a++]|d[a++]<<8;if(g===~h)throw Error("invalid uncompressed block header: length verify");if(a+g>d.length)throw Error("input buffer is broken");switch(this.i){case w:for(;e+
+g>b.length;){l=k-e;g-=l;if(s)b.set(d.subarray(a,a+l),e),e+=l,a+=l;else for(;l--;)b[e++]=d[a++];this.b=e;b=this.e();e=this.b}break;case v:for(;e+g>b.length;)b=this.e({p:2});break;default:throw Error("invalid inflate mode");}if(s)b.set(d.subarray(a,a+g),e),e+=g,a+=g;else for(;g--;)b[e++]=d[a++];this.a=a;this.b=e;this.c=b;break;case 1:this.j(z,A);break;case 2:B(this);break;default:throw Error("unknown BTYPE: "+c);}}return this.n()};
+var C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=s?new Uint16Array(C):C,E=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],F=s?new Uint16Array(E):E,G=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],H=s?new Uint8Array(G):G,I=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],J=s?new Uint16Array(I):I,L=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,
+13],M=s?new Uint8Array(L):L,N=new (s?Uint8Array:Array)(288),O,P;O=0;for(P=N.length;O<P;++O)N[O]=143>=O?8:255>=O?9:279>=O?7:8;var z=t(N),Q=new (s?Uint8Array:Array)(30),R,S;R=0;for(S=Q.length;R<S;++R)Q[R]=5;var A=t(Q);function y(c,d){for(var a=c.f,b=c.d,e=c.input,f=c.a,g=e.length,h;b<d;){if(f>=g)throw Error("input buffer is broken");a|=e[f++]<<b;b+=8}h=a&(1<<d)-1;c.f=a>>>d;c.d=b-d;c.a=f;return h}
+function T(c,d){for(var a=c.f,b=c.d,e=c.input,f=c.a,g=e.length,h=d[0],k=d[1],l,p;b<k&&!(f>=g);)a|=e[f++]<<b,b+=8;l=h[a&(1<<k)-1];p=l>>>16;c.f=a>>p;c.d=b-p;c.a=f;return l&65535}
+function B(c){function d(a,c,b){var d,e=this.q,f,g;for(g=0;g<a;)switch(d=T(this,c),d){case 16:for(f=3+y(this,2);f--;)b[g++]=e;break;case 17:for(f=3+y(this,3);f--;)b[g++]=0;e=0;break;case 18:for(f=11+y(this,7);f--;)b[g++]=0;e=0;break;default:e=b[g++]=d}this.q=e;return b}var a=y(c,5)+257,b=y(c,5)+1,e=y(c,4)+4,f=new (s?Uint8Array:Array)(D.length),g,h,k,l;for(l=0;l<e;++l)f[D[l]]=y(c,3);if(!s){l=e;for(e=f.length;l<e;++l)f[D[l]]=0}g=t(f);h=new (s?Uint8Array:Array)(a);k=new (s?Uint8Array:Array)(b);c.q=0;
+c.j(t(d.call(c,a,g,h)),t(d.call(c,b,g,k)))}u.prototype.j=function(c,d){var a=this.c,b=this.b;this.o=c;for(var e=a.length-258,f,g,h,k;256!==(f=T(this,c));)if(256>f)b>=e&&(this.b=b,a=this.e(),b=this.b),a[b++]=f;else{g=f-257;k=F[g];0<H[g]&&(k+=y(this,H[g]));f=T(this,d);h=J[f];0<M[f]&&(h+=y(this,M[f]));b>=e&&(this.b=b,a=this.e(),b=this.b);for(;k--;)a[b]=a[b++-h]}for(;8<=this.d;)this.d-=8,this.a--;this.b=b};
+u.prototype.z=function(c,d){var a=this.c,b=this.b;this.o=c;for(var e=a.length,f,g,h,k;256!==(f=T(this,c));)if(256>f)b>=e&&(a=this.e(),e=a.length),a[b++]=f;else{g=f-257;k=F[g];0<H[g]&&(k+=y(this,H[g]));f=T(this,d);h=J[f];0<M[f]&&(h+=y(this,M[f]));b+k>e&&(a=this.e(),e=a.length);for(;k--;)a[b]=a[b++-h]}for(;8<=this.d;)this.d-=8,this.a--;this.b=b};
+u.prototype.e=function(){var c=new (s?Uint8Array:Array)(this.b-32768),d=this.b-32768,a,b,e=this.c;if(s)c.set(e.subarray(32768,c.length));else{a=0;for(b=c.length;a<b;++a)c[a]=e[a+32768]}this.g.push(c);this.l+=c.length;if(s)e.set(e.subarray(d,d+32768));else for(a=0;32768>a;++a)e[a]=e[d+a];this.b=32768;return e};
+u.prototype.A=function(c){var d,a=this.input.length/this.a+1|0,b,e,f,g=this.input,h=this.c;c&&("number"===typeof c.p&&(a=c.p),"number"===typeof c.v&&(a+=c.v));2>a?(b=(g.length-this.a)/this.o[2],f=258*(b/2)|0,e=f<h.length?h.length+f:h.length<<1):e=h.length*a;s?(d=new Uint8Array(e),d.set(h)):d=h;return this.c=d};
+u.prototype.n=function(){var c=0,d=this.c,a=this.g,b,e=new (s?Uint8Array:Array)(this.l+(this.b-32768)),f,g,h,k;if(0===a.length)return s?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);f=0;for(g=a.length;f<g;++f){b=a[f];h=0;for(k=b.length;h<k;++h)e[c++]=b[h]}f=32768;for(g=this.b;f<g;++f)e[c++]=d[f];this.g=[];return this.buffer=e};
+u.prototype.w=function(){var c,d=this.b;s?this.s?(c=new Uint8Array(d),c.set(this.c.subarray(0,d))):c=this.c.subarray(0,d):(this.c.length>d&&(this.c.length=d),c=this.c);return this.buffer=c};function U(c,d){var a,b;this.input=c;this.a=0;if(d||!(d={}))d.index&&(this.a=d.index),d.verify&&(this.B=d.verify);a=c[this.a++];b=c[this.a++];switch(a&15){case V:this.method=V;break;default:throw Error("unsupported compression method");}if(0!==((a<<8)+b)%31)throw Error("invalid fcheck flag:"+((a<<8)+b)%31);if(b&32)throw Error("fdict flag is not supported");this.r=new u(c,{index:this.a,bufferSize:d.bufferSize,bufferType:d.bufferType,resize:d.resize})}
+U.prototype.k=function(){var c=this.input,d,a;d=this.r.k();this.a=this.r.a;if(this.B){a=(c[this.a++]<<24|c[this.a++]<<16|c[this.a++]<<8|c[this.a++])>>>0;var b=d;if("string"===typeof b){var e=b.split(""),f,g;f=0;for(g=e.length;f<g;f++)e[f]=(e[f].charCodeAt(0)&255)>>>0;b=e}for(var h=1,k=0,l=b.length,p,n=0;0<l;){p=1024<l?1024:l;l-=p;do h+=b[n++],k+=h;while(--p);h%=65521;k%=65521}if(a!==(k<<16|h)>>>0)throw Error("invalid adler-32 checksum");}return d};var V=8;q("Zlib.Inflate",U);q("Zlib.Inflate.prototype.decompress",U.prototype.k);var W={ADAPTIVE:x.t,BLOCK:x.u},X,Y,Z,$;if(Object.keys)X=Object.keys(W);else for(Y in X=[],Z=0,W)X[Z++]=Y;Z=0;for($=X.length;Z<$;++Z)Y=X[Z],q("Zlib.Inflate.BufferType."+Y,W[Y]);}).call(this);

+ 99 - 6
examples/js/loaders/ColladaLoader2.js

@@ -420,7 +420,87 @@ THREE.ColladaLoader.prototype = {
 						break;
 
 					case 'texture':
-						data[ child.nodeName ] = child.getAttribute( 'texture' );
+						data[ child.nodeName ] = { id: child.getAttribute( 'texture' ), extra: parseEffectParameterTexture( child ) };
+						break;
+
+				}
+
+			}
+
+			return data;
+
+		}
+
+		function parseEffectParameterTexture( xml ) {
+
+			var data = {};
+
+			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'extra':
+						data = parseEffectParameterTextureExtra( child );
+						break;
+
+				}
+
+			}
+
+			return data;
+
+		}
+
+		function parseEffectParameterTextureExtra( xml ) {
+
+			var data = {};
+
+			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'technique':
+						data[ child.nodeName ] = parseEffectParameterTextureExtraTechnique( child );
+						break;
+
+				}
+
+			}
+
+			return data;
+
+		}
+
+		function parseEffectParameterTextureExtraTechnique( xml ) {
+
+			var data = {};
+
+			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'repeatU':
+					case 'repeatV':
+					case 'offsetU':
+					case 'offsetV':
+						data[ child.nodeName ] = parseFloat( child.textContent );
+						break;
+
+					case 'wrapU':
+					case 'wrapV':
+						data[ child.nodeName ] = parseInt( child.textContent );
 						break;
 
 				}
@@ -497,24 +577,37 @@ THREE.ColladaLoader.prototype = {
 
 			material.name = data.name;
 
-			function getTexture( sid ) {
+			function getTexture( textureObject ) {
 
-				var sampler = effect.profile.samplers[ sid ];
+				var sampler = effect.profile.samplers[ textureObject.id ];
 
 				if ( sampler !== undefined ) {
 
 					var surface = effect.profile.surfaces[ sampler.source ];
 
 					var texture = new THREE.Texture( getImage( surface.init_from ) );
-					texture.wrapS = THREE.RepeatWrapping;
-					texture.wrapT = THREE.RepeatWrapping;
+
+					var extra = textureObject.extra;
+
+					if ( extra !== undefined && extra.technique !== undefined ) {
+
+						var technique = extra.technique;
+
+						texture.wrapS = technique.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
+						texture.wrapT = technique.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
+
+						texture.offset.set( technique.offsetU, technique.offsetV );
+						texture.repeat.set( technique.repeatU, technique.repeatV );
+
+					}
+
 					texture.needsUpdate = true;
 
 					return texture;
 
 				}
 
-				console.error( 'ColladaLoder: Undefined sampler', sid );
+				console.error( 'ColladaLoder: Undefined sampler', textureObject.id );
 
 				return null;
 

+ 83 - 0
examples/js/loaders/HDRCubeTextureLoader.js

@@ -0,0 +1,83 @@
+/**
+* @author Prashant Sharma / spidersharma03
+* @author Ben Houston / http://clara.io / bhouston
+*/
+
+THREE.HDRCubeTextureLoader = function (manager) {
+  this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+  // override in sub classes
+  this.hdrLoader = new THREE.RGBELoader();
+
+  if( THREE.Encodings === undefined ) throw new Error( "HDRCubeMapLoader requires THREE.Encodings" );
+}
+
+THREE.HDRCubeTextureLoader.prototype.load = function(type, urls, onLoad, onProgress, onError) {
+  var texture = new THREE.CubeTexture();
+
+  texture.type = type;
+  texture.encoding = (type === THREE.UnsignedByteType) ? THREE.RGBEEncoding : THREE.LinearEncoding;
+  texture.format = (type === THREE.UnsignedByteType ) ? THREE.RGBAFormat : THREE.RGBFormat;
+  texture.minFilter = (texture.encoding === THREE.RGBEEncoding ) ? THREE.NearestFilter : THREE.LinearFilter;
+  texture.magFilter = (texture.encoding === THREE.RGBEEncoding ) ? THREE.NearestFilter : THREE.LinearFilter;
+  texture.generateMipmaps = (texture.encoding !== THREE.RGBEEncoding );
+  texture.anisotropy = 0;
+
+  var scope = this.hdrLoader;
+
+  var loaded = 0;
+
+  function loadHDRData(i, onLoad, onProgress, onError) {
+    var loader = new THREE.XHRLoader( this.manager );
+    loader.setResponseType( 'arraybuffer' );
+
+    loader.load( urls[i], function ( buffer ) {
+      loaded++;
+
+      var texData = scope._parser( buffer );
+
+      if ( ! texData ) return;
+
+      if(type === THREE.FloatType) {
+        var numElements = ( texData.data.length / 4 )*3;
+        var floatdata = new Float32Array( numElements );
+        for( var j=0; j<numElements; j++) {
+          THREE.Encodings.RGBEByteToRGBFloat( texData.data, j*4, floatdata, j*3 );
+        }
+        texData.data = floatdata;
+      }
+      else if(type === THREE.HalfFloatType) {
+        var numElements = ( texData.data.length / 4 )*3;
+        var halfdata = new Uint16Array( numElements );
+        for( var j=0; j<numElements; j++) {
+          THREE.Encodings.RGBEByteToRGBHalf( texData.data, j*4, halfdata, j*3 );
+        }
+        texData.data = halfdata;
+      }
+
+      if ( undefined !== texData.image ) {
+        texture[i].images = texData.image;
+      }
+      else if ( undefined !== texData.data ) {
+        var dataTexture = new THREE.DataTexture(texData.data, texData.width, texData.height);
+        dataTexture.format = texture.format;
+        dataTexture.type = texture.type;
+        dataTexture.encoding = texture.encoding;
+        dataTexture.minFilter = texture.minFilter;
+        dataTexture.magFilter = texture.magFilter;
+        dataTexture.generateMipmaps = texture.generateMipmaps;
+
+        texture.images[i] = dataTexture;
+      }
+
+      if(loaded === 6) {
+        texture.needsUpdate = true;
+        if ( onLoad ) onLoad( texture );
+      }
+    }, onProgress, onError );
+  }
+
+  for(var i=0; i<urls.length; i++) {
+    loadHDRData(i, onLoad, onProgress, onError);
+  }
+  return texture;
+};

+ 0 - 2
examples/js/loaders/MMDLoader.js

@@ -3634,7 +3634,6 @@ THREE.ShaderLib[ 'mmd' ] = {
 		THREE.UniformsLib[ "normalmap" ],
 		THREE.UniformsLib[ "displacementmap" ],
 		THREE.UniformsLib[ "fog" ],
-		THREE.UniformsLib[ "ambient" ],
 		THREE.UniformsLib[ "lights" ],
 
 		{
@@ -3755,7 +3754,6 @@ THREE.ShaderLib[ 'mmd' ] = {
 		THREE.ShaderChunk[ "envmap_pars_fragment" ],
 		THREE.ShaderChunk[ "fog_pars_fragment" ],
 		THREE.ShaderChunk[ "bsdfs" ],
-		THREE.ShaderChunk[ "ambient_pars" ],
 		THREE.ShaderChunk[ "lights_pars" ],
 		THREE.ShaderChunk[ "lights_phong_pars_fragment" ],
 		THREE.ShaderChunk[ "shadowmap_pars_fragment" ],

+ 2 - 2
examples/js/loaders/OBJLoader.js

@@ -215,7 +215,7 @@ THREE.OBJLoader.prototype = {
 		// f vertex//normal vertex//normal vertex//normal ...
 		var face_pattern4 = /^f\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))(?:\s+((-?\d+)\/\/(-?\d+)))?/;
 
-		var object_pattern = /^[og]\s+(.+)/;
+		var object_pattern = /^[og]\s*(.+)?/;
 
 		var smoothing_pattern = /^s\s+(\d+|on|off)/;
 
@@ -306,7 +306,7 @@ THREE.OBJLoader.prototype = {
 				// or
 				// g group_name
 
-				var name = result[ 1 ].trim();
+				var name = result[ 0 ].substr( 1 ).trim();
 
 				if ( foundObjects === false ) {
 

+ 982 - 147
examples/js/loaders/VTKLoader.js

@@ -3,7 +3,7 @@
  * @author Alex Pletzer
  */
 
-THREE.VTKLoader = function ( manager ) {
+THREE.VTKLoader = function( manager ) {
 
 	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
 
@@ -15,261 +15,1096 @@ THREE.VTKLoader.prototype = {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		// Will we bump into trouble reading the whole file into memory?
 		var scope = this;
+
 		var loader = new THREE.XHRLoader( scope.manager );
-		loader.load( url, function ( text ) {
+		loader.setResponseType( 'arraybuffer' );
+		loader.load( url, function( text ) {
 
 			onLoad( scope.parse( text ) );
 
-		},
-
-		onProgress, onError );
+		}, onProgress, onError );
 
 	},
 
 	parse: function ( data ) {
 
-		// connectivity of the triangles
-		var indices = [];
+		function parseASCII( data ) {
 
-		// triangles vertices
-		var positions = [];
+			// connectivity of the triangles
+			var indices = [];
 
-		// red, green, blue colors in the range 0 to 1
-		var colors = [];
+			// triangles vertices
+			var positions = [];
 
-		// normal vector, one per vertex
-		var normals = [];
+			// red, green, blue colors in the range 0 to 1
+			var colors = [];
 
-		var result;
+			// normal vector, one per vertex
+			var normals = [];
 
-		// pattern for reading vertices, 3 floats or integers
-		var pat3Floats = /(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g;
+			var result;
 
-		// pattern for connectivity, an integer followed by any number of ints
-		// the first integer is the number of polygon nodes
-		var patConnectivity = /^(\d+)\s+([\s\d]*)/;
+			// pattern for reading vertices, 3 floats or integers
+			var pat3Floats = /(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g;
 
-		// indicates start of vertex data section
-		var patPOINTS = /^POINTS /;
+			// pattern for connectivity, an integer followed by any number of ints
+			// the first integer is the number of polygon nodes
+			var patConnectivity = /^(\d+)\s+([\s\d]*)/;
 
-		// indicates start of polygon connectivity section
-		var patPOLYGONS = /^POLYGONS /;
+			// indicates start of vertex data section
+			var patPOINTS = /^POINTS /;
 
-		// POINT_DATA number_of_values
-		var patPOINT_DATA = /^POINT_DATA[ ]+(\d+)/;
+			// indicates start of polygon connectivity section
+			var patPOLYGONS = /^POLYGONS /;
 
-		// CELL_DATA number_of_polys
-		var patCELL_DATA = /^CELL_DATA[ ]+(\d+)/;
+			// indicates start of triangle strips section
+			var patTRIANGLE_STRIPS = /^TRIANGLE_STRIPS /;
 
-		// Start of color section
-		var patCOLOR_SCALARS = /^COLOR_SCALARS[ ]+(\w+)[ ]+3/;
+			// POINT_DATA number_of_values
+			var patPOINT_DATA = /^POINT_DATA[ ]+(\d+)/;
 
-		// NORMALS Normals float
-		var patNORMALS = /^NORMALS[ ]+(\w+)[ ]+(\w+)/;
+			// CELL_DATA number_of_polys
+			var patCELL_DATA = /^CELL_DATA[ ]+(\d+)/;
 
-		var inPointsSection = false;
-		var inPolygonsSection = false;
-		var inPointDataSection = false;
-		var inCellDataSection = false;
-		var inColorSection = false;
-		var inNormalsSection = false;
+			// Start of color section
+			var patCOLOR_SCALARS = /^COLOR_SCALARS[ ]+(\w+)[ ]+3/;
 
-		var lines = data.split( '\n' );
+			// NORMALS Normals float
+			var patNORMALS = /^NORMALS[ ]+(\w+)[ ]+(\w+)/;
 
-		for ( var i in lines ) {
+			var inPointsSection = false;
+			var inPolygonsSection = false;
+			var inTriangleStripSection = false;
+			var inPointDataSection = false;
+			var inCellDataSection = false;
+			var inColorSection = false;
+			var inNormalsSection = false;
 
-			var line = lines[ i ];
+			var lines = data.split( '\n' );
 
-			if ( inPointsSection ) {
+			for ( var i in lines ) {
 
-				// get the vertices
-				while ( ( result = pat3Floats.exec( line ) ) !== null ) {
+				var line = lines[ i ];
 
-					var x = parseFloat( result[ 1 ] );
-					var y = parseFloat( result[ 2 ] );
-					var z = parseFloat( result[ 3 ] );
-					positions.push( x, y, z );
+				if ( inPointsSection ) {
 
-				}
+					// get the vertices
+					while ( ( result = pat3Floats.exec( line ) ) !== null ) {
+
+						var x = parseFloat( result[ 1 ] );
+						var y = parseFloat( result[ 2 ] );
+						var z = parseFloat( result[ 3 ] );
+						positions.push( x, y, z );
+
+					}
 
-			} else if ( inPolygonsSection ) {
+				} else if ( inPolygonsSection ) {
 
-				if ( ( result = patConnectivity.exec( line ) ) !== null ) {
+					if ( ( result = patConnectivity.exec( line ) ) !== null ) {
 
-					// numVertices i0 i1 i2 ...
-					var numVertices = parseInt( result[ 1 ] );
-					var inds = result[ 2 ].split( /\s+/ );
+						// numVertices i0 i1 i2 ...
+						var numVertices = parseInt( result[ 1 ] );
+						var inds = result[ 2 ].split( /\s+/ );
 
-					if ( numVertices >= 3 ) {
+						if ( numVertices >= 3 ) {
 
-						var i0 = parseInt( inds[ 0 ] );
-						var i1, i2;
-						var k = 1;
-						// split the polygon in numVertices - 2 triangles
-						for ( var j = 0; j < numVertices - 2; ++ j ) {
+							var i0 = parseInt( inds[ 0 ] );
+							var i1, i2;
+							var k = 1;
+							// split the polygon in numVertices - 2 triangles
+							for ( var j = 0; j < numVertices - 2; ++ j ) {
 
-							i1 = parseInt( inds[ k ] );
-							i2 = parseInt( inds[ k  + 1 ] );
-							indices.push( i0, i1, i2 );
-							k ++;
+								i1 = parseInt( inds[ k ] );
+								i2 = parseInt( inds[ k + 1 ] );
+								indices.push( i0, i1, i2 );
+								k ++;
+
+							}
 
 						}
 
 					}
 
-				}
+				} else if ( inTriangleStripSection ) {
 
-			} else if ( inPointDataSection || inCellDataSection ) {
+					if ( ( result = patConnectivity.exec( line ) ) !== null ) {
 
-				if ( inColorSection ) {
+						// numVertices i0 i1 i2 ...
+						var numVertices = parseInt( result[ 1 ] );
+						var inds = result[ 2 ].split( /\s+/ );
 
-					// Get the colors
+						if ( numVertices >= 3 ) {
 
-					while ( ( result = pat3Floats.exec( line ) ) !== null ) {
+							var i0, i1, i2;
+							// split the polygon in numVertices - 2 triangles
+							for ( var j = 0; j < numVertices - 2; j ++ ) {
+
+								if ( j % 2 === 1 ) {
+
+									i0 = parseInt( inds[ j ] );
+									i1 = parseInt( inds[ j + 2 ] );
+									i2 = parseInt( inds[ j + 1 ] );
+									indices.push( i0, i1, i2 );
+
+								} else {
 
-						var r = parseFloat( result[ 1 ] );
-						var g = parseFloat( result[ 2 ] );
-						var b = parseFloat( result[ 3 ] );
-						colors.push( r, g, b );
+									i0 = parseInt( inds[ j ] );
+									i1 = parseInt( inds[ j + 1 ] );
+									i2 = parseInt( inds[ j + 2 ] );
+									indices.push( i0, i1, i2 );
+
+								}
+
+							}
+
+						}
 
 					}
 
-				} else if ( inNormalsSection ) {
+				} else if ( inPointDataSection || inCellDataSection ) {
 
-					// Get the normal vectors
+					if ( inColorSection ) {
 
-					while ( ( result = pat3Floats.exec( line ) ) !== null ) {
+						// Get the colors
+
+						while ( ( result = pat3Floats.exec( line ) ) !== null ) {
 
-						var nx = parseFloat( result[ 1 ] );
-						var ny = parseFloat( result[ 2 ] );
-						var nz = parseFloat( result[ 3 ] );
-						normals.push( nx, ny, nz );
+							var r = parseFloat( result[ 1 ] );
+							var g = parseFloat( result[ 2 ] );
+							var b = parseFloat( result[ 3 ] );
+							colors.push( r, g, b );
+
+						}
+
+					} else if ( inNormalsSection ) {
+
+						// Get the normal vectors
+
+						while ( ( result = pat3Floats.exec( line ) ) !== null ) {
+
+							var nx = parseFloat( result[ 1 ] );
+							var ny = parseFloat( result[ 2 ] );
+							var nz = parseFloat( result[ 3 ] );
+							normals.push( nx, ny, nz );
+
+						}
 
 					}
 
 				}
 
+				if ( patPOLYGONS.exec( line ) !== null ) {
+
+					inPolygonsSection = true;
+					inPointsSection = false;
+					inTriangleStripSection = false;
+
+				} else if ( patPOINTS.exec( line ) !== null ) {
+
+					inPolygonsSection = false;
+					inPointsSection = true;
+					inTriangleStripSection = false;
+
+				} else if ( patTRIANGLE_STRIPS.exec( line ) !== null ) {
+
+					inPolygonsSection = false;
+					inPointsSection = false;
+					inTriangleStripSection = true;
+
+				} else if ( patPOINT_DATA.exec( line ) !== null ) {
+
+					inPointDataSection = true;
+					inPointsSection = false;
+					inPolygonsSection = false;
+					inTriangleStripSection = false;
+
+				} else if ( patCELL_DATA.exec( line ) !== null ) {
+
+					inCellDataSection = true;
+					inPointsSection = false;
+					inPolygonsSection = false;
+					inTriangleStripSection = false;
+
+				} else if ( patCOLOR_SCALARS.exec( line ) !== null ) {
+
+					inColorSection = true;
+					inNormalsSection = false;
+					inPointsSection = false;
+					inPolygonsSection = false;
+					inTriangleStripSection = false;
+
+				} else if ( patNORMALS.exec( line ) !== null ) {
+
+					inNormalsSection = true;
+					inColorSection = false;
+					inPointsSection = false;
+					inPolygonsSection = false;
+					inTriangleStripSection = false;
+
+				}
+
+			}
+
+			var geometry;
+			var stagger = 'point';
+
+			if ( colors.length == indices.length ) {
+
+				stagger = 'cell';
+
 			}
 
-			if ( patPOLYGONS.exec( line ) !== null ) {
+			if ( stagger == 'point' ) {
 
-				inPolygonsSection = true;
-				inPointsSection = false;
+				// Nodal. Use BufferGeometry
+				geometry = new THREE.BufferGeometry();
+				geometry.setIndex( new THREE.BufferAttribute( new Uint32Array( indices ), 1 ) );
+				geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( positions ), 3 ) );
 
-			} else if ( patPOINTS.exec( line ) !== null ) {
+				if ( colors.length == positions.length ) {
 
-				inPolygonsSection = false;
-				inPointsSection = true;
+					geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
 
-			} else if ( patPOINT_DATA.exec( line ) !== null ) {
+				}
+
+				if ( normals.length == positions.length ) {
 
-				inPointDataSection = true;
-				inPointsSection = false;
-				inPolygonsSection = false;
+					geometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
 
-			} else if ( patCELL_DATA.exec( line ) !== null ) {
+				}
 
-				inCellDataSection = true;
-				inPointsSection = false;
-				inPolygonsSection = false;
+			} else {
 
-			} else if ( patCOLOR_SCALARS.exec( line ) !== null ) {
+				// Cell centered colors. The only way to attach a solid color to each triangle
+				// is to use Geometry, which is less efficient than BufferGeometry
+				geometry = new THREE.Geometry();
 
-				inColorSection = true;
-				inNormalsSection = false;
-				inPointsSection = false;
-				inPolygonsSection = false;
+				var numTriangles = indices.length / 3;
+				var numPoints = positions.length / 3;
+				var va, vb, vc;
+				var face;
+				var ia, ib, ic;
+				var x, y, z;
+				var r, g, b;
 
-			} else if ( patNORMALS.exec( line ) !== null ) {
+				for ( var j = 0; j < numPoints; ++ j ) {
 
-				inNormalsSection = true;
-				inColorSection = false;
-				inPointsSection = false;
-				inPolygonsSection = false;
+					x = positions[ 3 * j + 0 ];
+					y = positions[ 3 * j + 1 ];
+					z = positions[ 3 * j + 2 ];
+					geometry.vertices.push( new THREE.Vector3( x, y, z ) );
+
+				}
+
+				for ( var i = 0; i < numTriangles; ++ i ) {
+
+					ia = indices[ 3 * i + 0 ];
+					ib = indices[ 3 * i + 1 ];
+					ic = indices[ 3 * i + 2 ];
+					geometry.faces.push( new THREE.Face3( ia, ib, ic ) );
+
+				}
+
+				if ( colors.length == numTriangles * 3 ) {
+
+					for ( var i = 0; i < numTriangles; ++ i ) {
+
+						face = geometry.faces[ i ];
+						r = colors[ 3 * i + 0 ];
+						g = colors[ 3 * i + 1 ];
+						b = colors[ 3 * i + 2 ];
+						face.color = new THREE.Color().setRGB( r, g, b );
+
+					}
+
+				}
 
 			}
 
+			return geometry;
+
 		}
 
-		var geometry;
-		var stagger = 'point';
+		function parseBinary( data ) {
+
+			var count, pointIndex, i, numberOfPoints, pt, s;
+			var buffer = new Uint8Array ( data );
+			var dataView = new DataView ( data );
+
+			// Points and normals, by default, are empty
+			var points = [];
+			var normals = [];
+			var indices = [];
+
+			// Going to make a big array of strings
+			var vtk = [];
+			var index = 0;
+
+			function findString( buffer, start ) {
+
+				var index = start;
+				var c = buffer[ index ];
+				var s = [];
+				while ( c != 10 ) {
+
+					s.push ( String.fromCharCode ( c ) );
+					index ++;
+					c = buffer[ index ];
+
+				}
+
+				return { start: start,
+						end: index,
+						next: index + 1,
+						parsedString: s.join( '' ) };
+
+			}
+
+			var state, line;
+
+			while ( true ) {
+
+				// Get a string
+				state = findString ( buffer, index );
+				line = state.parsedString;
+
+				if ( line.indexOf ( 'POINTS' ) === 0 ) {
+
+					vtk.push ( line );
+					// Add the points
+					numberOfPoints = parseInt ( line.split( ' ' )[ 1 ], 10 );
+
+					// Each point is 3 4-byte floats
+					count = numberOfPoints * 4 * 3;
+
+					points = new Float32Array( numberOfPoints * 3 );
+
+					pointIndex = state.next;
+					for ( i = 0; i < numberOfPoints; i ++ ) {
+
+						points[ 3 * i ] = dataView.getFloat32( pointIndex, false );
+						points[ 3 * i + 1 ] = dataView.getFloat32( pointIndex + 4, false );
+						points[ 3 * i + 2 ] = dataView.getFloat32( pointIndex + 8, false );
+						pointIndex = pointIndex + 12;
+
+					}
+					// increment our next pointer
+					state.next = state.next + count + 1;
+
+				} else if ( line.indexOf ( 'TRIANGLE_STRIPS' ) === 0 ) {
+
+					var numberOfStrips = parseInt ( line.split( ' ' )[ 1 ], 10 );
+					var size = parseInt ( line.split ( ' ' )[ 2 ], 10 );
+					// 4 byte integers
+					count = size * 4;
+
+					indices = new Uint32Array( 3 * size - 9 * numberOfStrips );
+					var indicesIndex = 0;
+
+					pointIndex = state.next;
+					for ( i = 0; i < numberOfStrips; i ++ ) {
+
+						// For each strip, read the first value, then record that many more points
+						var indexCount = dataView.getInt32( pointIndex, false );
+						var strip = [];
+						pointIndex += 4;
+						for ( s = 0; s < indexCount; s ++ ) {
+
+							strip.push ( dataView.getInt32( pointIndex, false ) );
+							pointIndex += 4;
+
+						}
+
+						// retrieves the n-2 triangles from the triangle strip
+						for ( var j = 0; j < indexCount - 2; j ++ ) {
+
+							if ( j % 2 ) {
+
+								indices[ indicesIndex ++ ] = strip[ j ];
+								indices[ indicesIndex ++ ] = strip[ j + 2 ];
+								indices[ indicesIndex ++ ] = strip[ j + 1 ];
+
+							} else {
+
 
-		if ( colors.length == indices.length ) {
+								indices[ indicesIndex ++ ] = strip[ j ];
+								indices[ indicesIndex ++ ] = strip[ j + 1 ];
+								indices[ indicesIndex ++ ] = strip[ j + 2 ];
 
-			stagger = 'cell';
+							}
+
+						}
+
+					}
+					// increment our next pointer
+					state.next = state.next + count + 1;
+
+				} else if ( line.indexOf ( 'POLYGONS' ) === 0 ) {
+
+					var numberOfStrips = parseInt ( line.split( ' ' )[ 1 ], 10 );
+					var size = parseInt ( line.split ( ' ' )[ 2 ], 10 );
+					// 4 byte integers
+					count = size * 4;
+
+					indices = new Uint32Array( 3 * size - 9 * numberOfStrips );
+					var indicesIndex = 0;
+
+					pointIndex = state.next;
+					for ( i = 0; i < numberOfStrips; i ++ ) {
+
+						// For each strip, read the first value, then record that many more points
+						var indexCount = dataView.getInt32( pointIndex, false );
+						var strip = [];
+						pointIndex += 4;
+						for ( s = 0; s < indexCount; s ++ ) {
+
+							strip.push ( dataView.getInt32( pointIndex, false ) );
+							pointIndex += 4;
+
+						}
+						var i0 = strip[ 0 ];
+						// divide the polygon in n-2 triangle
+						for ( var j = 1; j < indexCount - 1; j ++ ) {
+
+							indices[ indicesIndex ++ ] = strip[ 0 ];
+							indices[ indicesIndex ++ ] = strip[ j ];
+							indices[ indicesIndex ++ ] = strip[ j + 1 ];
+
+						}
+
+					}
+					// increment our next pointer
+					state.next = state.next + count + 1;
+
+				} else if ( line.indexOf ( 'POINT_DATA' ) === 0 ) {
+
+					numberOfPoints = parseInt ( line.split( ' ' )[ 1 ], 10 );
+
+					// Grab the next line
+					state = findString ( buffer, state.next );
+
+					// Now grab the binary data
+					count = numberOfPoints * 4 * 3;
+
+					normals = new Float32Array( numberOfPoints * 3 );
+					pointIndex = state.next;
+					for ( i = 0; i < numberOfPoints; i ++ ) {
+
+						normals[ 3 * i ] = dataView.getFloat32( pointIndex, false );
+						normals[ 3 * i + 1 ] = dataView.getFloat32( pointIndex + 4, false );
+						normals[ 3 * i + 2 ] = dataView.getFloat32( pointIndex + 8, false );
+						pointIndex += 12;
+
+					}
+
+					// Increment past our data
+					state.next = state.next + count;
+
+				}
+
+				// Increment index
+				index = state.next;
+
+				if ( index >= buffer.byteLength ) {
+
+					break;
+
+				}
+
+			}
+
+			var geometry = new THREE.BufferGeometry();
+			geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
+			geometry.addAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
+
+			if ( normals.length == points.length ) {
+
+				geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
+
+			}
+
+			return geometry;
 
 		}
 
-		if ( stagger == 'point' ) {
+		function parseXML( stringFile ) {
+
+			// Changes XML to JSON, based on https://davidwalsh.name/convert-xml-json
+
+			function xmlToJson( xml ) {
+
+				// Create the return object
+				var obj = {};
+
+				if ( xml.nodeType == 1 ) { // element
+
+					// do attributes
+
+					if ( xml.attributes ) {
+
+						if ( xml.attributes.length > 0 ) {
+
+							obj[ 'attributes' ] = {};
+
+							for ( var j = 0; j < xml.attributes.length; j ++ ) {
 
-			// Nodal. Use BufferGeometry
-			geometry = new THREE.BufferGeometry();
-			geometry.setIndex( new THREE.BufferAttribute( new ( indices.length > 65535 ? Uint32Array : Uint16Array )( indices ), 1 ) );
-			geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( positions ), 3 ) );
+								var attribute = xml.attributes.item( j );
+								obj[ 'attributes' ][ attribute.nodeName ] = attribute.nodeValue.trim();
 
-			if ( colors.length == positions.length ) {
+							}
 
-				geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
+						}
+
+					}
+
+				} else if ( xml.nodeType == 3 ) { // text
+
+					obj = xml.nodeValue.trim();
+
+				}
+
+				// do children
+				if ( xml.hasChildNodes() ) {
+
+					for ( var i = 0; i < xml.childNodes.length; i ++ ) {
+
+						var item = xml.childNodes.item( i );
+						var nodeName = item.nodeName;
+
+						if ( typeof( obj[ nodeName ] ) === 'undefined' ) {
+
+							var tmp = xmlToJson( item );
+
+							if ( tmp !== '' ) obj[ nodeName ] = tmp;
+
+						} else {
+
+							if ( typeof( obj[ nodeName ].push ) === 'undefined' ) {
+
+								var old = obj[ nodeName ];
+								obj[ nodeName ] = [ old ];
+
+							}
+
+							var tmp = xmlToJson( item );
+
+							if ( tmp !== '' ) obj[ nodeName ].push( tmp );
+
+						}
+
+					}
+
+				}
+
+				return obj;
 
 			}
 
-			if ( normals.length == positions.length ) {
+			// Taken from Base64-js
+			function Base64toByteArray( b64 ) {
+
+				var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
+				var i;
+				var lookup = [];
+				var revLookup = [];
+				var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+				var len = code.length;
+
+				for ( i = 0; i < len; i ++ ) {
+
+					lookup[ i ] = code[ i ];
+
+				}
+
+				for ( i = 0; i < len; ++ i ) {
+
+					revLookup[ code.charCodeAt( i ) ] = i;
+
+				}
+
+				revLookup[ '-'.charCodeAt( 0 ) ] = 62;
+				revLookup[ '_'.charCodeAt( 0 ) ] = 63;
+
+				var j, l, tmp, placeHolders, arr;
+				var len = b64.length;
+
+				if ( len % 4 > 0 ) {
+
+					throw new Error( 'Invalid string. Length must be a multiple of 4' );
+
+				}
+
+				placeHolders = b64[ len - 2 ] === '=' ? 2 : b64[ len - 1 ] === '=' ? 1 : 0;
+				arr = new Arr( len * 3 / 4 - placeHolders );
+				l = placeHolders > 0 ? len - 4 : len;
+
+				var L = 0;
+
+				for ( i = 0, j = 0; i < l; i += 4, j += 3 ) {
+
+					tmp = ( revLookup[ b64.charCodeAt( i ) ] << 18 ) | ( revLookup[ b64.charCodeAt( i + 1 ) ] << 12 ) | ( revLookup[ b64.charCodeAt( i + 2 ) ] << 6 ) | revLookup[ b64.charCodeAt( i + 3 ) ];
+					arr[ L ++ ] = ( tmp & 0xFF0000 ) >> 16;
+					arr[ L ++ ] = ( tmp & 0xFF00 ) >> 8;
+					arr[ L ++ ] = tmp & 0xFF;
+
+				}
+
+				if ( placeHolders === 2 ) {
+
+					tmp = ( revLookup[ b64.charCodeAt( i ) ] << 2 ) | ( revLookup[ b64.charCodeAt( i + 1 ) ] >> 4 );
+					arr[ L ++ ] = tmp & 0xFF;
+
+				} else if ( placeHolders === 1 ) {
 
-				geometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+					tmp = ( revLookup[ b64.charCodeAt( i ) ] << 10 ) | ( revLookup[ b64.charCodeAt( i + 1 ) ] << 4 ) | ( revLookup[ b64.charCodeAt( i + 2 ) ] >> 2 );
+					arr[ L ++ ] = ( tmp >> 8 ) & 0xFF;
+					arr[ L ++ ] = tmp & 0xFF;
+
+				}
+
+				return arr;
 
 			}
 
-		} else {
+			function parseDataArray( ele, compressed ) {
+
+				// Check the format
+
+				if ( ele.attributes.format == 'binary' ) {
+
+					if ( compressed ) {
+
+						// Split the blob_header and compressed Data
+						if ( ele[ '#text' ].indexOf( '==' ) != - 1 ) {
+
+							var data = ele[ '#text' ].split( '==' );
+
+							// console.log( data );
+
+							if ( data.length == 2 ) {
+
+								var blob = data.shift();
+								var content = data.shift();
+
+								if ( content === '' ) {
+
+									content = blob + '==';
+
+								}
+
+							} else if ( data.length > 2 ) {
+
+								var blob = data.shift();
+								var content = data.shift();
+								content = content + '==';
+
+							} else if ( data.length < 2 ) {
+
+								var content = data.shift();
+								content = content + '==';
+
+							}
+
+							// Convert to bytearray
+							var arr = Base64toByteArray( content );
+
+							// decompress
+							var inflate = new Zlib.Inflate( arr, { resize: true, verify: true } );
+							var content = inflate.decompress();
+
+						} else {
+
+							var content = Base64toByteArray( ele[ '#text' ] );
+
+						}
+
+					} else {
+
+						var content = Base64toByteArray( ele[ '#text' ] );
+
+					}
+
+					var content = content.buffer;
+
+				} else {
+
+					if ( ele[ '#text' ] ) {
+
+						var content = ele[ '#text' ].replace( /\n/g, ' ' ).split( ' ' ).filter( function ( el, idx, arr ) {
+
+							if ( el !== '' ) return el;
+
+						} );
+
+					} else {
+
+						var content = new Int32Array( 0 ).buffer;
+
+					}
+
+				}
+
+				delete ele[ '#text' ];
+
+				// Get the content and optimize it
+
+				if ( ele.attributes.type == 'Float32' ) {
+
+					var txt = new Float32Array( content );
+
+					if ( ele.attributes.format == 'binary' ) {
+
+						if ( ! compressed ) {
+
+							txt = txt.filter( function( el, idx, arr ) {
+
+								if ( idx !== 0 ) return true;
 
-			// Cell centered colors. The only way to attach a solid color to each triangle
-			// is to use Geometry, which is less efficient than BufferGeometry
-			geometry = new THREE.Geometry();
+							} );
 
-			var numTriangles = indices.length / 3;
-			var numPoints = positions.length / 3;
-			var va, vb, vc;
-			var face;
-			var ia, ib, ic;
-			var x, y, z;
-			var r, g, b;
+						}
+
+					}
+
+				} else if ( ele.attributes.type === 'Int64' ) {
+
+					var txt = new Int32Array( content );
+
+					if ( ele.attributes.format == 'binary' ) {
+
+						if ( ! compressed ) {
+
+							txt = txt.filter( function ( el, idx, arr ) {
+
+								if ( idx !== 0 ) return true;
+
+							} );
+
+						}
+
+						txt = txt.filter( function ( el, idx, arr ) {
 
-			for ( var j = 0; j < numPoints; ++ j ) {
+							if ( idx % 2 !== 1 ) return true;
 
-				x = positions[ 3 * j + 0 ];
-				y = positions[ 3 * j + 1 ];
-				z = positions[ 3 * j + 2 ];
-				geometry.vertices.push( new THREE.Vector3( x, y, z ) );
+						} );
+
+					}
+
+				}
+
+				// console.log( txt );
+
+				return txt;
 
 			}
 
-			for ( var i = 0; i < numTriangles; ++ i ) {
+			// Main part
+			// Get Dom
+			var dom = null;
+
+			if ( window.DOMParser ) {
+
+				try {
+
+					dom = ( new DOMParser() ).parseFromString( stringFile, 'text/xml' );
+
+				} catch ( e ) {
+
+					dom = null;
+
+				}
+
+			} else if ( window.ActiveXObject ) {
+
+				try {
+
+					dom = new ActiveXObject( 'Microsoft.XMLDOM' );
+					dom.async = false;
+
+					if ( ! dom.loadXML( xml ) ) {
+
+						throw new Error( dom.parseError.reason + dom.parseError.srcText );
+
+					}
+
+				} catch ( e ) {
+
+					dom = null;
+
+				}
+
+			} else {
 
-				ia = indices[ 3 * i + 0 ];
-				ib = indices[ 3 * i + 1 ];
-				ic = indices[ 3 * i + 2 ];
-				geometry.faces.push( new THREE.Face3( ia, ib, ic ) );
+				throw new Error( 'Cannot parse xml string!' );
 
 			}
 
-			if ( colors.length == numTriangles * 3 ) {
+			// Get the doc
+			var doc = dom.documentElement;
+			// Convert to json
+			var json = xmlToJson( doc );
+			var points = [];
+			var normals = [];
+			var indices = [];
 
-				for ( var i = 0; i < numTriangles; ++ i ) {
+			if ( json.PolyData ) {
+
+				var piece = json.PolyData.Piece;
+				var compressed = json.attributes.hasOwnProperty( 'compressor' );
+
+				// Can be optimized
+				// Loop through the sections
+				var sections = [ 'PointData', 'Points', 'Strips', 'Polys' ];// +['CellData', 'Verts', 'Lines'];
+				var sectionIndex = 0, numberOfSections = sections.length;
+
+				while ( sectionIndex < numberOfSections ) {
+
+					var section = piece[ sections[ sectionIndex ] ];
+
+					// If it has a DataArray in it
+
+					if ( section.DataArray ) {
+
+						// Depending on the number of DataArrays
+
+						if ( Object.prototype.toString.call( section.DataArray ) === '[object Array]' ) {
+
+							var arr = section.DataArray;
+
+						} else {
+
+							var arr = [ section.DataArray ];
 
-					face = geometry.faces[ i ];
-					r = colors[ 3 * i + 0 ];
-					g = colors[ 3 * i + 1 ];
-					b = colors[ 3 * i + 2 ];
-					face.color = new THREE.Color().setRGB( r, g, b );
+						}
+
+						var dataArrayIndex = 0, numberOfDataArrays = arr.length;
+
+						while ( dataArrayIndex < numberOfDataArrays ) {
+
+							// Parse the DataArray
+							arr[ dataArrayIndex ].text = parseDataArray( arr[ dataArrayIndex ], compressed );
+							dataArrayIndex ++;
+
+						}
+
+						switch ( sections[ sectionIndex ] ) {
+
+							// if iti is point data
+							case 'PointData':
+
+								var numberOfPoints = parseInt( piece.attributes.NumberOfPoints );
+								var normalsName = section.attributes.Normals;
+
+								if ( numberOfPoints > 0 ) {
+
+									for ( var i = 0, len = arr.length; i < len; i ++ ) {
+
+										if ( normalsName == arr[ i ].attributes.Name ) {
+
+											var components = arr[ i ].attributes.NumberOfComponents;
+											normals = new Float32Array( numberOfPoints * components );
+											normals.set( arr[ i ].text, 0 );
+
+										}
+
+									}
+
+								}
+
+								// console.log('Normals', normals);
+
+								break;
+
+							// if it is points
+							case 'Points':
+
+								var numberOfPoints = parseInt( piece.attributes.NumberOfPoints );
+
+								if ( numberOfPoints > 0 ) {
+
+									var components = section.DataArray.attributes.NumberOfComponents;
+									points = new Float32Array( numberOfPoints * components );
+									points.set( section.DataArray.text, 0 );
+
+								}
+
+								// console.log('Points', points);
+
+								break;
+
+							// if it is strips
+							case 'Strips':
+
+								var numberOfStrips = parseInt( piece.attributes.NumberOfStrips );
+
+								if ( numberOfStrips > 0 ) {
+
+									var connectivity = new Int32Array( section.DataArray[ 0 ].text.length );
+									var offset = new Int32Array( section.DataArray[ 1 ].text.length );
+									connectivity.set( section.DataArray[ 0 ].text, 0 );
+									offset.set( section.DataArray[ 1 ].text, 0 );
+
+									var size = numberOfStrips + connectivity.length;
+									indices = new Uint32Array( 3 * size - 9 * numberOfStrips );
+
+									var indicesIndex = 0;
+
+									for ( var i = 0,len = numberOfStrips; i < len; i ++ ) {
+
+										var strip = [];
+
+										for ( var s = 0, len1 = offset[ i ], len0 = 0; s < len1 - len0; s ++ ) {
+
+											strip.push ( connectivity[ s ] );
+
+											if ( i > 0 ) len0 = offset[ i - 1 ];
+
+										}
+
+										for ( var j = 0, len1 = offset[ i ], len0 = 0; j < len1 - len0 - 2; j ++ ) {
+
+											if ( j % 2 ) {
+
+												indices[ indicesIndex ++ ] = strip[ j ];
+												indices[ indicesIndex ++ ] = strip[ j + 2 ];
+												indices[ indicesIndex ++ ] = strip[ j + 1 ];
+
+											} else {
+
+												indices[ indicesIndex ++ ] = strip[ j ];
+												indices[ indicesIndex ++ ] = strip[ j + 1 ];
+												indices[ indicesIndex ++ ] = strip[ j + 2 ];
+
+											}
+
+											if ( i > 0 ) len0 = offset[ i - 1 ];
+
+										}
+
+									}
+
+								}
+
+								//console.log('Strips', indices);
+
+								break;
+
+							// if it is polys
+							case 'Polys':
+
+								var numberOfPolys = parseInt( piece.attributes.NumberOfPolys );
+
+								if ( numberOfPolys > 0 ) {
+
+									var connectivity = new Int32Array( section.DataArray[ 0 ].text.length );
+									var offset = new Int32Array( section.DataArray[ 1 ].text.length );
+									connectivity.set( section.DataArray[ 0 ].text, 0 );
+									offset.set( section.DataArray[ 1 ].text, 0 );
+
+									var size = numberOfPolys + connectivity.length;
+									indices = new Uint32Array( 3 * size - 9 * numberOfPolys );
+									var indicesIndex = 0, connectivityIndex = 0;
+									var i = 0,len = numberOfPolys, len0 = 0;
+
+									while ( i < len ) {
+
+										var poly = [];
+										var s = 0, len1 = offset[ i ];
+
+										while ( s < len1 - len0 ) {
+
+											poly.push( connectivity[ connectivityIndex ++ ] );
+											s ++;
+
+										}
+
+										var j = 1;
+
+										while ( j < len1 - len0 - 1 ) {
+
+											indices[ indicesIndex ++ ] = poly[ 0 ];
+											indices[ indicesIndex ++ ] = poly[ j ];
+											indices[ indicesIndex ++ ] = poly[ j + 1 ];
+											j ++;
+
+										}
+
+										i ++;
+										len0 = offset[ i - 1 ];
+
+									}
+
+								}
+								//console.log('Polys', indices);
+								break;
+
+							default:
+								break;
+
+						}
+
+					}
+
+					sectionIndex ++;
+
+				}
+
+				var geometry = new THREE.BufferGeometry();
+				geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
+				geometry.addAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
+
+				if ( normals.length == points.length ) {
+
+					geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
 
 				}
 
-			 }
+				// console.log( json );
+
+				return geometry;
+
+			} else {
+
+				// TODO for vtu,vti,and other xml formats
+
+			}
 
 		}
 
-		return geometry;
+		function getStringFile( data ) {
+
+			var stringFile = '';
+			var charArray = new Uint8Array( data );
+			var i = 0;
+			var len = charArray.length;
+
+			while ( len -- ) {
+
+				stringFile += String.fromCharCode( charArray[ i ++ ] );
+
+			}
+
+			return stringFile;
+
+		}
+
+		// get the 5 first lines of the files to check if there is the key word binary
+		var meta = String.fromCharCode.apply( null, new Uint8Array( data, 0, 250 ) ).split( '\n' );
+
+		if ( meta[ 0 ].indexOf( 'xml' ) !== - 1 ) {
+
+			return parseXML( getStringFile( data ) );
+
+		} else if ( meta[ 2 ].includes( 'ASCII' ) ) {
+
+			return parseASCII( getStringFile( data ) );
+
+		} else {
+
+			return parseBinary( data );
+
+		}
 
 	}
 

+ 317 - 307
examples/js/loaders/gltf/glTF-parser.js

@@ -22,364 +22,374 @@
 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /*
-    The Abstract Loader has two modes:
-        #1: [static] load all the JSON at once [as of now]
-        #2: [stream] stream and parse JSON progressively [not yet supported]
+	The Abstract Loader has two modes:
+		#1: [static] load all the JSON at once [as of now]
+		#2: [stream] stream and parse JSON progressively [not yet supported]
 
-    Whatever is the mechanism used to parse the JSON (#1 or #2),
-    The loader starts by resolving the paths to binaries and referenced json files (by replace the value of the path property with an absolute path if it was relative).
+	Whatever is the mechanism used to parse the JSON (#1 or #2),
+	The loader starts by resolving the paths to binaries and referenced json files (by replace the value of the path property with an absolute path if it was relative).
 
-    In case #1: it is guaranteed to call the concrete loader implementation methods in a order that solves the dependencies between the entries.
-    only the nodes requires an extra pass to set up the hirerarchy.
-    In case #2: the concrete implementation will have to solve the dependencies. no order is guaranteed.
+	In case #1: it is guaranteed to call the concrete loader implementation methods in a order that solves the dependencies between the entries.
+	only the nodes requires an extra pass to set up the hirerarchy.
+	In case #2: the concrete implementation will have to solve the dependencies. no order is guaranteed.
 
-    When case #1 is used the followed dependency order is:
+	When case #1 is used the followed dependency order is:
 
-    scenes -> nodes -> meshes -> materials -> techniques -> shaders
-                    -> buffers
-                    -> cameras
-                    -> lights
+	scenes -> nodes -> meshes -> materials -> techniques -> shaders
+					-> buffers
+					-> cameras
+					-> lights
 
-    The readers starts with the leafs, i.e:
-        shaders, techniques, materials, meshes, buffers, cameras, lights, nodes, scenes
+	The readers starts with the leafs, i.e:
+		shaders, techniques, materials, meshes, buffers, cameras, lights, nodes, scenes
 
-    For each called handle method called the client should return true if the next handle can be call right after returning,
-    or false if a callback on client side will notify the loader that the next handle method can be called.
+	For each called handle method called the client should return true if the next handle can be call right after returning,
+	or false if a callback on client side will notify the loader that the next handle method can be called.
 
 */
 var global = window;
 (function (root, factory) {
 	if (typeof exports === 'object') {
-        // Node. Does not work with strict CommonJS, but
-        // only CommonJS-like enviroments that support module.exports,
-        // like Node.
+		// Node. Does not work with strict CommonJS, but
+		// only CommonJS-like enviroments that support module.exports,
+		// like Node.
 		factory(module.exports);
 	} else if (typeof define === 'function' && define.amd) {
-        // AMD. Register as an anonymous module.
+		// AMD. Register as an anonymous module.
 		define([], function () {
 			return factory(root);
 		});
 	} else {
-        // Browser globals
+		// Browser globals
 		factory(root);
 	}
 }(this, function (root) {
 	"use strict";
 
-	var categoriesDepsOrder = [ "buffers", "bufferViews", "images",  "videos", "samplers", "textures", "shaders", "programs", "techniques", "materials", "accessors", "meshes", "cameras", "lights", "skins", "nodes", "scenes", "animations" ];
+	var categoriesDepsOrder = ["extensions", "buffers", "bufferViews", "images",  "videos", "samplers", "textures", "shaders", "programs", "techniques", "materials", "accessors", "meshes", "cameras", "lights", "skins", "nodes", "animations", "scenes"];
 
 	var glTFParser = Object.create(Object.prototype, {
 
-        _rootDescription: { value: null, writable: true },
+		_rootDescription: { value: null, writable: true },
 
-        rootDescription: {
-            set: function(value) {
-	this._rootDescription = value;
-            },
-            get: function() {
-	return this._rootDescription;
-            }
-        },
-
-        baseURL: { value: null, writable: true },
+		rootDescription: {
+			set: function(value) {
+				this._rootDescription = value;
+			},
+			get: function() {
+				return this._rootDescription;
+			}
+		},
 
-        //detect absolute path following the same protocol than window.location
-        _isAbsolutePath: {
-            value: function(path) {
-	var isAbsolutePathRegExp = new RegExp("^" + window.location.protocol, "i");
+		baseURL: { value: null, writable: true },
 
-	return path.match(isAbsolutePathRegExp) ? true : false;
-            }
-        },
+		//detect absolute path following the same protocol than window.location
+		_isAbsolutePath: {
+			value: function(path) {
+				var isAbsolutePathRegExp = new RegExp("^"+window.location.protocol, "i");
 
-        resolvePathIfNeeded: {
-            value: function(path) {
-	if (this._isAbsolutePath(path)) {
-		return path;
-	}
+				return path.match(isAbsolutePathRegExp) ? true : false;
+			}
+		},
 
-	return this.baseURL + path;
-            }
-        },
-
-        _resolvePathsForCategories: {
-            value: function(categories) {
-	categories.forEach( function(category) {
-		var descriptions = this.json[category];
-		if (descriptions) {
-			var descriptionKeys = Object.keys(descriptions);
-			descriptionKeys.forEach( function(descriptionKey) {
-				var description = descriptions[descriptionKey];
-				description.path = this.resolvePathIfNeeded(description.path);
-			}, this);
-		}
-	}, this);
-            }
-        },
-
-        _json: {
-            value: null,
-            writable: true
-        },
-
-        json: {
-            enumerable: true,
-            get: function() {
-	return this._json;
-            },
-            set: function(value) {
-	if (this._json !== value) {
-		this._json = value;
-		this._resolvePathsForCategories([ "buffers", "shaders", "images", "videos" ]);
-	}
-            }
-        },
-
-        _path: {
-            value: null,
-            writable: true
-        },
-
-        getEntryDescription: {
-            value: function (entryID, entryType) {
-	var entries = null;
-
-	var category = entryType;
-	entries = this.rootDescription[category];
-	if (!entries) {
-		console.log("ERROR:CANNOT find expected category named:" + category);
-		return null;
-	}
+		resolvePathIfNeeded: {
+			value: function(path) {
+				if (this._isAbsolutePath(path)) {
+					return path;
+				}
 
-	return entries ? entries[entryID] : null;
-            }
-        },
+				var isDataUriRegex = /^data:/;
+				if (isDataUriRegex.test(path)) {
+					return path;
+				}
+				
+				return this.baseURL + path;
+			}
+		},
+
+		_resolvePathsForCategories: {
+			value: function(categories) {
+				categories.forEach( function(category) {
+					var descriptions = this.json[category];
+					if (descriptions) {
+						var descriptionKeys = Object.keys(descriptions);
+						descriptionKeys.forEach( function(descriptionKey) {
+							var description = descriptions[descriptionKey];
+							description.uri = this.resolvePathIfNeeded(description.uri);
+						}, this);
+					}
+				}, this);
+			}
+		},
+
+		_json: {
+			value: null,
+			writable: true
+		},
+
+		json: {
+			enumerable: true,
+			get: function() {
+				return this._json;
+			},
+			set: function(value) {
+				if (this._json !== value) {
+					this._json = value;
+					this._resolvePathsForCategories(["buffers", "shaders", "images", "videos"]);
+				}
+			}
+		},
+
+		_path: {
+			value: null,
+			writable: true
+		},
+
+		getEntryDescription: {
+			value: function (entryID, entryType) {
+				var entries = null;
+
+				var category = entryType;
+				entries = this.rootDescription[category];
+				if (!entries) {
+					console.log("ERROR:CANNOT find expected category named:"+category);
+					return null;
+				}
 
-        _stepToNextCategory: {
-            value: function() {
-	this._state.categoryIndex = this.getNextCategoryIndex(this._state.categoryIndex + 1);
-	if (this._state.categoryIndex !== -1) {
-		this._state.categoryState.index = 0;
-		return true;
-	}
+				return entries ? entries[entryID] : null;
+			}
+		},
+
+		_stepToNextCategory: {
+			value: function() {
+				this._state.categoryIndex = this.getNextCategoryIndex(this._state.categoryIndex + 1);
+				if (this._state.categoryIndex !== -1) {
+					this._state.categoryState.index = 0;
+					return true;
+				}
 
-	return false;
-            }
-        },
-
-        _stepToNextDescription: {
-            enumerable: false,
-            value: function() {
-	var categoryState = this._state.categoryState;
-	var keys = categoryState.keys;
-	if (!keys) {
-		console.log("INCONSISTENCY ERROR");
-		return false;
-	}
+				return false;
+			}
+		},
+
+		_stepToNextDescription: {
+			enumerable: false,
+			value: function() {
+				var categoryState = this._state.categoryState;
+				var keys = categoryState.keys;
+				if (!keys) {
+					console.log("INCONSISTENCY ERROR");
+					return false;
+				}
 
-	categoryState.index ++;
-	categoryState.keys = null;
-	if (categoryState.index >= keys.length) {
-		return this._stepToNextCategory();
-	}
-	return false;
-            }
-        },
-
-        hasCategory: {
-            value: function(category) {
-	return this.rootDescription[category] ? true : false;
-            }
-        },
-
-        _handleState: {
-            value: function() {
-
-	var methodForType = {
-                    "buffers" : this.handleBuffer,
-                    "bufferViews" : this.handleBufferView,
-                    "shaders" : this.handleShader,
-                    "programs" : this.handleProgram,
-                    "techniques" : this.handleTechnique,
-                    "materials" : this.handleMaterial,
-                    "meshes" : this.handleMesh,
-                    "cameras" : this.handleCamera,
-                    "lights" : this.handleLight,
-                    "nodes" : this.handleNode,
-                    "scenes" : this.handleScene,
-                    "images" : this.handleImage,
-                    "animations" : this.handleAnimation,
-                    "accessors" : this.handleAccessor,
-                    "skins" : this.handleSkin,
-                    "samplers" : this.handleSampler,
-                    "textures" : this.handleTexture,
-                    "videos" : this.handleVideo
-
-                };
-
-	var success = true;
-	while (this._state.categoryIndex !== -1) {
-		var category = categoriesDepsOrder[this._state.categoryIndex];
-		var categoryState = this._state.categoryState;
-		var keys = categoryState.keys;
-		if (!keys) {
-			categoryState.keys = keys = Object.keys(this.rootDescription[category]);
-			if (keys) {
-				if (keys.length == 0) {
-					this._stepToNextDescription();
-					continue;
+				categoryState.index++;
+				categoryState.keys = null;
+				if (categoryState.index >= keys.length) {
+					return this._stepToNextCategory();
 				}
+				return false;
 			}
-		}
+		},
 
-		var type = category;
-		var entryID = keys[categoryState.index];
-		var description = this.getEntryDescription(entryID, type);
-		if (!description) {
-			if (this.handleError) {
-				this.handleError("INCONSISTENCY ERROR: no description found for entry " + entryID);
-				success = false;
-				break;
+		hasCategory: {
+			value: function(category) {
+				return this.rootDescription[category] ? true : false;
 			}
-		} else {
+		},
+
+		_handleState: {
+			value: function() {
+
+				var methodForType = {
+					"buffers" : this.handleBuffer,
+					"bufferViews" : this.handleBufferView,
+					"shaders" : this.handleShader,
+					"programs" : this.handleProgram,
+					"techniques" : this.handleTechnique,
+					"materials" : this.handleMaterial,
+					"meshes" : this.handleMesh,
+					"cameras" : this.handleCamera,
+					"lights" : this.handleLight,
+					"nodes" : this.handleNode,
+					"scenes" : this.handleScene,
+					"images" : this.handleImage,
+					"animations" : this.handleAnimation,
+					"accessors" : this.handleAccessor,
+					"skins" : this.handleSkin,
+					"samplers" : this.handleSampler,
+					"textures" : this.handleTexture,
+					"videos" : this.handleVideo,
+					"extensions" : this.handleExtension,
+
+				};
+
+				var success = true;
+				while (this._state.categoryIndex !== -1) {
+					var category = categoriesDepsOrder[this._state.categoryIndex];
+					var categoryState = this._state.categoryState;
+					var keys = categoryState.keys;
+					if (!keys) {
+						categoryState.keys = keys = Object.keys(this.rootDescription[category]);
+						if (keys) {
+							if (keys.length == 0) {
+								this._stepToNextDescription();
+								continue;
+							}
+						}
+					}
+
+					var type = category;
+					var entryID = keys[categoryState.index];
+					var description = this.getEntryDescription(entryID, type);
+					if (!description) {
+						if (this.handleError) {
+							this.handleError("INCONSISTENCY ERROR: no description found for entry "+entryID);
+							success = false;
+							break;
+						}
+					} else {
+
+						if (methodForType[type]) {
+							if (methodForType[type].call(this, entryID, description, this._state.userInfo) === false) {
+								success = false;
+								break;
+							}
+						}
+
+						this._stepToNextDescription();
+					}
+				}
 
-			if (methodForType[type]) {
-				if (methodForType[type].call(this, entryID, description, this._state.userInfo) === false) {
-					success = false;
-					break;
+				if (this.handleLoadCompleted) {
+					this.handleLoadCompleted(success);
 				}
-			}
 
-			this._stepToNextDescription();
-		}
-	}
+			}
+		},
+
+		_loadJSONIfNeeded: {
+			enumerable: true,
+			value: function(callback) {
+				var self = this;
+				//FIXME: handle error
+				if (!this._json)  {
+					var jsonPath = this._path;
+					var i = jsonPath.lastIndexOf("/");
+					this.baseURL = (i !== 0) ? jsonPath.substring(0, i + 1) : '';
+					var jsonfile = new XMLHttpRequest();
+					jsonfile.open("GET", jsonPath, true);
+					jsonfile.onreadystatechange = function() {
+						if (jsonfile.readyState == 4) {
+							if (jsonfile.status == 200) {
+								self.json = JSON.parse(jsonfile.responseText);
+								if (callback) {
+									callback(self.json);
+								}
+							}
+						}
+					};
+					jsonfile.send(null);
+			   } else {
+					if (callback) {
+						callback(this.json);
+					}
+				}
+			}
+		},
+
+		/* load JSON and assign it as description to the reader */
+		_buildLoader: {
+			value: function(callback) {
+				var self = this;
+				function JSONReady(json) {
+					self.rootDescription = json;
+					if (callback)
+						callback(this);
+				}
 
-	if (this.handleLoadCompleted) {
-		this.handleLoadCompleted(success);
-	}
+				this._loadJSONIfNeeded(JSONReady);
+			}
+		},
+
+		_state: { value: null, writable: true },
+
+		_getEntryType: {
+			value: function(entryID) {
+				var rootKeys = categoriesDepsOrder;
+				for (var i = 0 ;  i < rootKeys.length ; i++) {
+					var rootValues = this.rootDescription[rootKeys[i]];
+					if (rootValues) {
+						return rootKeys[i];
+					}
+				}
+				return null;
+			}
+		},
+
+		getNextCategoryIndex: {
+			value: function(currentIndex) {
+				for (var i = currentIndex ; i < categoriesDepsOrder.length ; i++) {
+					if (this.hasCategory(categoriesDepsOrder[i])) {
+						return i;
+					}
+				}
 
-            }
-        },
-
-        _loadJSONIfNeeded: {
-            enumerable: true,
-            value: function(callback) {
-	var self = this;
-                //FIXME: handle error
-	if (!this._json) {
-		var jsonPath = this._path;
-		var i = jsonPath.lastIndexOf("/");
-		this.baseURL = (i !== 0) ? jsonPath.substring(0, i + 1) : '';
-		var jsonfile = new XMLHttpRequest();
-		jsonfile.open("GET", jsonPath, true);
-		jsonfile.addEventListener( 'load', function ( event ) {
-			self.json = JSON.parse(jsonfile.responseText);
-			if (callback) {
-				callback(self.json);
+				return -1;
 			}
-		}, false );
-		jsonfile.send(null);
-	} else {
-		if (callback) {
-			callback(this.json);
-		}
-	}
-            }
-        },
-
-        /* load JSON and assign it as description to the reader */
-        _buildLoader: {
-            value: function(callback) {
-	var self = this;
-	function JSONReady(json) {
-		self.rootDescription = json;
-		if (callback)
-                        callback(this);
-	}
+		},
+
+		load: {
+			enumerable: true,
+			value: function(userInfo, options) {
+				var self = this;
+				this._buildLoader(function loaderReady(reader) {
+					var startCategory = self.getNextCategoryIndex.call(self,0);
+					if (startCategory !== -1) {
+						self._state = { "userInfo" : userInfo,
+										"options" : options,
+										"categoryIndex" : startCategory,
+										"categoryState" : { "index" : "0" } };
+						self._handleState();
+					}
+				});
+			}
+		},
 
-	this._loadJSONIfNeeded(JSONReady);
-            }
-        },
+		initWithPath: {
+			value: function(path) {
+				this._path = path;
+				this._json = null;
+				return this;
+			}
+		},
 
-        _state: { value: null, writable: true },
+		//this is meant to be global and common for all instances
+		_knownURLs: { writable: true, value: {} },
 
-        _getEntryType: {
-            value: function(entryID) {
-	var rootKeys = categoriesDepsOrder;
-	for (var i = 0 ; i < rootKeys.length ; i ++) {
-		var rootValues = this.rootDescription[rootKeys[i]];
-		if (rootValues) {
-			return rootKeys[i];
-		}
-	}
-	return null;
-            }
-        },
-
-        getNextCategoryIndex: {
-            value: function(currentIndex) {
-	for (var i = currentIndex ; i < categoriesDepsOrder.length ; i ++) {
-		if (this.hasCategory(categoriesDepsOrder[i])) {
-			return i;
+		//to be invoked by subclass, so that ids can be ensured to not overlap
+		loaderContext: {
+			value: function() {
+				if (typeof this._knownURLs[this._path] === "undefined") {
+					this._knownURLs[this._path] = Object.keys(this._knownURLs).length;
+				}
+				return "__" + this._knownURLs[this._path];
+			}
+		},
+
+		initWithJSON: {
+			value: function(json, baseURL) {
+				this.json = json;
+				this.baseURL = baseURL;
+				if (!baseURL) {
+					console.log("WARNING: no base URL passed to Reader:initWithJSON");
+				}
+				return this;
+			}
 		}
-	}
 
-	return -1;
-            }
-        },
-
-        load: {
-            enumerable: true,
-            value: function(userInfo, options) {
-	var self = this;
-	this._buildLoader(function loaderReady(reader) {
-		var startCategory = self.getNextCategoryIndex.call(self, 0);
-		if (startCategory !== -1) {
-			self._state = { "userInfo" : userInfo,
-                                        "options" : options,
-                                        "categoryIndex" : startCategory,
-                                        "categoryState" : { "index" : "0" } };
-			self._handleState();
-		}
 	});
-            }
-        },
-
-        initWithPath: {
-            value: function(path) {
-	this._path = path;
-	this._json = null;
-	return this;
-            }
-        },
-
-        //this is meant to be global and common for all instances
-        _knownURLs: { writable: true, value: {} },
-
-        //to be invoked by subclass, so that ids can be ensured to not overlap
-        loaderContext: {
-            value: function() {
-	if (typeof this._knownURLs[this._path] === "undefined") {
-		this._knownURLs[this._path] = Object.keys(this._knownURLs).length;
-	}
-	return "__" + this._knownURLs[this._path];
-            }
-        },
-
-        initWithJSON: {
-            value: function(json, baseURL) {
-	this.json = json;
-	this.baseURL = baseURL;
-	if (!baseURL) {
-		console.log("WARNING: no base URL passed to Reader:initWithJSON");
-	}
-	return this;
-            }
-        }
-
-    });
 
-	if (root) {
+	if(root) {
 		root.glTFParser = glTFParser;
 	}
 

+ 13 - 13
examples/js/loaders/gltf/glTFAnimation.js

@@ -24,7 +24,7 @@ THREE.glTFAnimator = ( function () {
 
 		update : function()
 		{
-			for (i = 0; i < animators.length; i ++)
+			for (i = 0; i < animators.length; i++)
 			{
 				animators[i].update();
 			}
@@ -45,18 +45,18 @@ THREE.glTFAnimation = function(interps)
 	{
 		this.createInterpolators(interps);
 	}
-};
+}
 
 THREE.glTFAnimation.prototype.createInterpolators = function(interps)
 {
 	var i, len = interps.length;
-	for (i = 0; i < len; i ++)
+	for (i = 0; i < len; i++)
 	{
 		var interp = new THREE.glTFInterpolator(interps[i]);
 		this.interps.push(interp);
 		this.duration = Math.max(this.duration, interp.duration);
 	}
-};
+}
 
 // Start/stop
 THREE.glTFAnimation.prototype.play = function()
@@ -67,13 +67,13 @@ THREE.glTFAnimation.prototype.play = function()
 	this.startTime = Date.now();
 	this.running = true;
 	THREE.glTFAnimator.add(this);
-};
+}
 
 THREE.glTFAnimation.prototype.stop = function()
 {
 	this.running = false;
 	THREE.glTFAnimator.remove(this);
-};
+}
 
 // Update - drive key frame evaluation
 THREE.glTFAnimation.prototype.update = function()
@@ -90,7 +90,7 @@ THREE.glTFAnimation.prototype.update = function()
 	{
 		this.running = false;
 		var i, len = this.interps.length;
-		for (i = 0; i < len; i ++)
+		for (i = 0; i < len; i++)
 		{
 			this.interps[i].interp(this.duration);
 		}
@@ -100,12 +100,12 @@ THREE.glTFAnimation.prototype.update = function()
 	else
 	{
 		var i, len = this.interps.length;
-		for (i = 0; i < len; i ++)
+		for (i = 0; i < len; i++)
 		{
 			this.interps[i].interp(t);
 		}
 	}
-};
+}
 
 //Interpolator class
 //Construction/initialization
@@ -147,7 +147,7 @@ THREE.glTFInterpolator = function(param)
 	this.quat1 = new THREE.Quaternion;
 	this.quat2 = new THREE.Quaternion;
 	this.quat3 = new THREE.Quaternion;
-};
+}
 
 //Interpolation and tweening methods
 THREE.glTFInterpolator.prototype.interp = function(t)
@@ -202,7 +202,7 @@ THREE.glTFInterpolator.prototype.interp = function(t)
 	}
 	else
 	{
-		for (i = 0; i < this.count - 1; i ++)
+		for (i = 0; i < this.count - 1; i++)
 		{
 			var key1 = this.keys[i];
 			var key2 = this.keys[i + 1];
@@ -238,7 +238,7 @@ THREE.glTFInterpolator.prototype.interp = function(t)
 	{
 		this.copyValue(this.target);
 	}
-};
+}
 
 THREE.glTFInterpolator.prototype.copyValue = function(target) {
 	
@@ -248,4 +248,4 @@ THREE.glTFInterpolator.prototype.copyValue = function(target) {
 	else {
 		target.copy(this.vec3);
 	}		
-};
+}

File diff suppressed because it is too large
+ 1466 - 1103
examples/js/loaders/gltf/glTFLoader.js


+ 185 - 106
examples/js/loaders/gltf/glTFLoaderUtils.js

@@ -26,8 +26,8 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
         value: function() {
 	        this._streams = {};
 	        this._streamsStatus = {};
-	this._resources = {};
-	this._resourcesStatus = {};
+            this._resources = {};
+            this._resourcesStatus = {};
         }
     },
 
@@ -35,60 +35,119 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
     _containsResource: {
         enumerable: false,
         value: function(resourceID) {
-	return this._resources[resourceID] ? true : false;
+            return this._resources[resourceID] ? true : false;
         }
     },
 
     _storeResource: {
         enumerable: false,
         value: function(resourceID, resource) {
-	if (!resourceID) {
-		console.log("ERROR: entry does not contain id, cannot store");
-		return;
-	}
+            if (!resourceID) {
+                console.log("ERROR: entry does not contain id, cannot store");
+                return;
+            }
 
-	if (this._containsResource[resourceID]) {
-		console.log("WARNING: resource:" + resourceID + " is already stored, overriding");
-	}
+            if (this._containsResource[resourceID]) {
+                console.log("WARNING: resource:"+resourceID+" is already stored, overriding");
+            }
 
-	this._resources[resourceID] = resource;
+           this._resources[resourceID] = resource;
         }
     },
 
     _getResource: {
         enumerable: false,
         value: function(resourceID) {
-	return this._resources[resourceID];
+            return this._resources[resourceID];
         }
     },
 
     _loadStream: {
         value: function(path, type, delegate) {
-	var self = this;
 
-	if (!type) {
-		delegate.handleError(THREE.GLTFLoaderUtils.INVALID_TYPE, null);
-		return;
-	}
 
-	if (!path) {
-		delegate.handleError(THREE.GLTFLoaderUtils.INVALID_PATH);
-		return;
-	}
 
-	var xhr = new XMLHttpRequest();
-	xhr.open('GET', path, true);
-	xhr.responseType = (type === this.ARRAY_BUFFER) ? "arraybuffer" : "text";
+            var dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;
+
+            function decodeDataUriText(isBase64, data) {
+                var result = decodeURIComponent(data);
+                if (isBase64) {
+                    return atob(result);
+                }
+                return result;
+            }
+
+            function decodeDataUriArrayBuffer(isBase64, data) {
+                var byteString = decodeDataUriText(isBase64, data);
+                var buffer = new ArrayBuffer(byteString.length);
+                var view = new Uint8Array(buffer);
+                for (var i = 0; i < byteString.length; i++) {
+                    view[i] = byteString.charCodeAt(i);
+                }
+                return buffer;
+            }
+
+            function decodeDataUri(dataUriRegexResult, responseType) {
+                responseType = typeof responseType !== 'undefined' ? responseType : '';
+                var mimeType = dataUriRegexResult[1];
+                var isBase64 = !!dataUriRegexResult[2];
+                var data = dataUriRegexResult[3];
+
+                switch (responseType) {
+                case '':
+                case 'text':
+                    return decodeDataUriText(isBase64, data);
+                case 'ArrayBuffer':
+                    return decodeDataUriArrayBuffer(isBase64, data);
+                case 'blob':
+                    var buffer = decodeDataUriArrayBuffer(isBase64, data);
+                    return new Blob([buffer], {
+                        type : mimeType
+                    });
+                case 'document':
+                    var parser = new DOMParser();
+                    return parser.parseFromString(decodeDataUriText(isBase64, data), mimeType);
+                case 'json':
+                    return JSON.parse(decodeDataUriText(isBase64, data));
+                default:
+                    throw 'Unhandled responseType: ' + responseType;
+                }
+            }
+
+            var dataUriRegexResult = dataUriRegex.exec(path);
+            if (dataUriRegexResult !== null) {
+                delegate.streamAvailable(path, decodeDataUri(dataUriRegexResult, type));
+                return;
+            }
+
+            var self = this;
+
+            if (!type) {
+                delegate.handleError(THREE.GLTFLoaderUtils.INVALID_TYPE, null);
+                return;
+            }
+
+            if (!path) {
+                delegate.handleError(THREE.GLTFLoaderUtils.INVALID_PATH);
+                return;
+            }
+
+            var xhr = new XMLHttpRequest();
+            xhr.open('GET', path, true);
+            xhr.responseType = (type === this.ARRAY_BUFFER) ? "arraybuffer" : "text";
 
             //if this is not specified, 1 "big blob" scenes fails to load.
-	xhr.setRequestHeader("If-Modified-Since", "Sat, 01 Jan 1970 00:00:00 GMT");
-	xhr.addEventListener( 'load', function ( event ) {
-		delegate.streamAvailable(path, xhr.response);
-	}, false );
-	xhr.addEventListener( 'error', function ( event ) {
-		delegate.handleError(THREE.GLTFLoaderUtils.XMLHTTPREQUEST_STATUS_ERROR, xhr.status);
-	}, false );
-	xhr.send(null);
+            xhr.setRequestHeader("If-Modified-Since", "Sat, 01 Jan 1970 00:00:00 GMT");
+            xhr.onload = function(e) {
+                if ((xhr.status == 200) || (xhr.status == 206)) {
+
+                    delegate.streamAvailable(path, xhr.response);
+
+                } else {
+                    delegate.handleError(THREE.GLTFLoaderUtils.XMLHTTPREQUEST_STATUS_ERROR, this.status);
+                }
+            };
+            xhr.send(null);
         }
     },
 
@@ -97,89 +156,109 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
 
     _handleRequest: {
         value: function(request) {
-	var resourceStatus = this._resourcesStatus[request.id];
-	if (resourceStatus)
+            var resourceStatus = this._resourcesStatus[request.id];
+            if (resourceStatus)
             {
-		this._resourcesStatus[request.id] ++;
-	}
+            	this._resourcesStatus[request.id]++;
+            }
             else
-	{
-		this._resourcesStatus[request.id] = 1;
-	}
+            {
+            	this._resourcesStatus[request.id] = 1;
+            }
             
-	var streamStatus = this._streamsStatus[request.path];
-	if (streamStatus && streamStatus.status === "loading" )
+            var streamStatus = this._streamsStatus[request.uri];
+            if (streamStatus && streamStatus.status === "loading" )
             {
-		streamStatus.requests.push(request);
-		return;
-	}
+            	streamStatus.requests.push(request);
+                return;
+            }
             
-	this._streamsStatus[request.path] = { status : "loading", requests : [ request ] };
+            this._streamsStatus[request.uri] = { status : "loading", requests : [request] };
     		
-	var self = this;
-	var processResourceDelegate = {};
-
-	processResourceDelegate.streamAvailable = function(path, res_) {
-		var streamStatus = self._streamsStatus[path];
-		var requests = streamStatus.requests;
-		requests.forEach( function(req_) {
-			var subArray = res_.slice(req_.range[0], req_.range[1]);
-			var convertedResource = req_.delegate.convert(subArray, req_.ctx);
-			self._storeResource(req_.id, convertedResource);
-			req_.delegate.resourceAvailable(convertedResource, req_.ctx);
-			-- self._resourcesStatus[req_.id];
-
-		}, this);
+            var self = this;
+            var processResourceDelegate = {};
+
+            processResourceDelegate.streamAvailable = function(path, res_) {
+            	var streamStatus = self._streamsStatus[path];
+            	var requests = streamStatus.requests;
+                requests.forEach( function(req_) {
+                    var subArray = res_.slice(req_.range[0], req_.range[1]);
+                    var convertedResource = req_.delegate.convert(subArray, req_.ctx);
+                    self._storeResource(req_.id, convertedResource);
+                    req_.delegate.resourceAvailable(convertedResource, req_.ctx);
+                    --self._resourcesStatus[req_.id];
+
+                }, this);
             	
-		delete self._streamsStatus[path];
+                delete self._streamsStatus[path];
 
-	};
+            };
 
-	processResourceDelegate.handleError = function(errorCode, info) {
-		request.delegate.handleError(errorCode, info);
-	};
+            processResourceDelegate.handleError = function(errorCode, info) {
+                request.delegate.handleError(errorCode, info);
+            }
 
-	this._loadStream(request.path, request.type, processResourceDelegate);
+            this._loadStream(request.uri, request.type, processResourceDelegate);
         }
     },
 
 
     _elementSizeForGLType: {
-        value: function(glType) {
-	switch (glType) {
-		case WebGLRenderingContext.FLOAT :
-			return Float32Array.BYTES_PER_ELEMENT;
-		case WebGLRenderingContext.UNSIGNED_BYTE :
-			return Uint8Array.BYTES_PER_ELEMENT;
-		case WebGLRenderingContext.UNSIGNED_SHORT :
-			return Uint16Array.BYTES_PER_ELEMENT;
-		case WebGLRenderingContext.FLOAT_VEC2 :
-			return Float32Array.BYTES_PER_ELEMENT * 2;
-		case WebGLRenderingContext.FLOAT_VEC3 :
-			return Float32Array.BYTES_PER_ELEMENT * 3;
-		case WebGLRenderingContext.FLOAT_VEC4 :
-			return Float32Array.BYTES_PER_ELEMENT * 4;
-		case WebGLRenderingContext.FLOAT_MAT3 :
-			return Float32Array.BYTES_PER_ELEMENT * 9;
-		case WebGLRenderingContext.FLOAT_MAT4 :
-			return Float32Array.BYTES_PER_ELEMENT * 16;
-		default:
-			return null;
-	}
+        value: function(componentType, type) {
+    	
+    		var nElements = 0;
+    		switch(type) {    		
+	            case "SCALAR" :
+	                nElements = 1;
+	                break;
+	            case "VEC2" :
+	                nElements = 2;
+	                break;
+	            case "VEC3" :
+	                nElements = 3;
+	                break;
+	            case "VEC4" :
+	                nElements = 4;
+	                break;
+	            case "MAT2" :
+	                nElements = 4;
+	                break;
+	            case "MAT3" :
+	                nElements = 9;
+	                break;
+	            case "MAT4" :
+	                nElements = 16;
+	                break;
+	            default :
+	            	debugger;
+	            	break;
+    		}
+    		
+            switch (componentType) {
+                case WebGLRenderingContext.FLOAT :
+                    return Float32Array.BYTES_PER_ELEMENT * nElements;
+                case WebGLRenderingContext.UNSIGNED_BYTE :
+                    return Uint8Array.BYTES_PER_ELEMENT * nElements;
+                case WebGLRenderingContext.UNSIGNED_SHORT :
+                    return Uint16Array.BYTES_PER_ELEMENT * nElements;
+                default :
+                	debugger;
+                    return null;
+            }
         }
     },
 
     _handleWrappedBufferViewResourceLoading: {
         value: function(wrappedBufferView, delegate, ctx) {
-	var bufferView = wrappedBufferView.bufferView;
-	var buffer = bufferView.buffer;
-	var byteOffset = wrappedBufferView.byteOffset + bufferView.description.byteOffset;
-	var range = [ byteOffset, (this._elementSizeForGLType(wrappedBufferView.type) * wrappedBufferView.count) + byteOffset ];
+            var bufferView = wrappedBufferView.bufferView;
+            var buffer = bufferView.buffer;
+            var byteOffset = wrappedBufferView.byteOffset + bufferView.description.byteOffset;
+            var range = [byteOffset , (this._elementSizeForGLType(wrappedBufferView.componentType, wrappedBufferView.type) * wrappedBufferView.count) + byteOffset];
 
-	this._handleRequest({ "id" : wrappedBufferView.id,
+            this._handleRequest({   "id" : wrappedBufferView.id,
                                     "range" : range,
                                     "type" : buffer.description.type,
-                                    "path" : buffer.description.path,
+                                    "uri" : buffer.description.uri,
                                     "delegate" : delegate,
                                     "ctx" : ctx }, null);
         }
@@ -189,14 +268,14 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
     	
             value: function(wrappedBufferView, delegate, ctx) {
 
-	var savedBuffer = this._getResource(wrappedBufferView.id);
-	if (savedBuffer) {
-		return savedBuffer;
-	} else {
-		this._handleWrappedBufferViewResourceLoading(wrappedBufferView, delegate, ctx);
-	}
+            var savedBuffer = this._getResource(wrappedBufferView.id);
+            if (false) { // savedBuffer) {
+                return savedBuffer;
+            } else {
+                this._handleWrappedBufferViewResourceLoading(wrappedBufferView, delegate, ctx);
+            }
 
-	return null;
+            return null;
         }
     },
 
@@ -204,17 +283,17 @@ THREE.GLTFLoaderUtils = Object.create(Object, {
     	
         value: function(request, delegate, ctx) {
 
-	request.delegate = delegate;
-	request.ctx = ctx;
+    		request.delegate = delegate;
+    		request.ctx = ctx;
 
-	this._handleRequest({ "id" : request.id,
-                "path" : request.path,
-                "range" : [ 0 ],
+            this._handleRequest({   "id" : request.id,
+                "uri" : request.uri,
+                "range" : [0],
                 "type" : "text",
                 "delegate" : delegate,
                 "ctx" : ctx }, null);
     	
-	return null;
-}
+            return null;
+	    }
 	},    
 });

+ 145 - 0
examples/js/loaders/gltf/glTFShaders.js

@@ -0,0 +1,145 @@
+/**
+ * @author Tony Parisi / http://www.tonyparisi.com/
+ */
+
+THREE.glTFShaders = ( function () {
+
+	var shaders = [];
+
+	return	{
+		add : function(shader) {
+			shaders.push(shader);
+		},
+
+		remove: function(shader) {
+
+			var i = shaders.indexOf(shader);
+
+			if ( i !== -1 ) {
+				shaders.splice( i, 1 );
+			}
+		},
+
+		removeAll: function(shader) {
+
+			// probably want to clean up the shaders, too, but not for now
+			shaders = [];
+		},
+
+		bindShaderParameters: function(scene) {
+			for (i = 0; i < shaders.length; i++)
+			{
+				shaders[i].bindParameters(scene);
+			}
+		},
+
+		update : function(scene, camera) {
+			for (i = 0; i < shaders.length; i++)
+			{
+				shaders[i].update(scene, camera);
+			}
+		},
+	};
+})();
+
+// Construction/initialization
+THREE.glTFShader = function(material, params, object, scene) {
+	this.material = material;
+	this.parameters = params.technique.parameters;
+	this.uniforms = params.technique.uniforms;
+	this.joints = params.joints;
+	this.object = object;
+	this.semantics = {};
+	this.m4 = new THREE.Matrix4;
+}
+
+
+// bindParameters - connect the uniform values to their source parameters
+THREE.glTFShader.prototype.bindParameters = function(scene) {
+
+	function findObject(o, p) { 
+		if (o.glTFID == param.node) {
+			p.sourceObject = o;
+		}
+	}
+
+	for (var uniform in this.uniforms) {
+		var pname = this.uniforms[uniform];
+		var param = this.parameters[pname];
+		if (param.semantic) {
+
+			var p = { 
+				semantic : param.semantic,
+				uniform: this.material.uniforms[uniform] 
+			};
+
+			if (param.node) {
+				scene.traverse(function(o) { findObject(o, p)});
+			}
+			else {
+				p.sourceObject = this.object;
+			}			
+
+			this.semantics[pname] = p;
+
+		}
+	}
+
+}
+
+// Update - update all the uniform values
+THREE.glTFShader.prototype.update = function(scene, camera) {
+
+	// update scene graph
+
+	scene.updateMatrixWorld();
+
+	// update camera matrices and frustum
+	camera.updateMatrixWorld();
+	camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+
+	for (var sname in this.semantics) {
+		var semantic = this.semantics[sname];
+        if (semantic) {
+	        switch (semantic.semantic) {
+	            case "MODELVIEW" :
+	            	var m4 = semantic.uniform.value;
+	            	m4.multiplyMatrices(camera.matrixWorldInverse, 
+	            		semantic.sourceObject.matrixWorld);
+	                break;
+
+	            case "MODELVIEWINVERSETRANSPOSE" :
+	            	var m3 = semantic.uniform.value;
+	            	this.m4.multiplyMatrices(camera.matrixWorldInverse, 
+	            		semantic.sourceObject.matrixWorld);
+					m3.getNormalMatrix(this.m4);
+	                break;
+
+	            case "PROJECTION" :
+	            	var m4 = semantic.uniform.value;
+	            	m4.copy(camera.projectionMatrix);            		
+	                break;
+
+	            case "JOINTMATRIX" :
+	            
+	            	var m4v = semantic.uniform.value;
+					for (var mi = 0; mi < m4v.length; mi++) {
+						// So it goes like this:
+						// SkinnedMesh world matrix is already baked into MODELVIEW;
+						// ransform joints to local space,
+						// then transform using joint's inverse
+						m4v[mi].getInverse(semantic.sourceObject.matrixWorld).
+							multiply(this.joints[mi].matrixWorld).
+							multiply(this.object.skeleton.boneInverses[mi]);
+					}
+	            
+	                //console.log("Joint:", semantic)
+	                break;
+
+	            default :
+	                throw new Error("Unhandled shader semantic" + semantic);
+	                break;
+	        }
+        }
+	}
+}

+ 204 - 0
examples/js/loaders/gltf/gltfUtilities.js

@@ -0,0 +1,204 @@
+/**
+gltfUtilities
+@license
+The MIT License (MIT)
+Copyright (c) 2014 Analytical Graphics, Inc.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+(function(root, factory) {
+    "use strict";
+    /*global define*/
+    if (typeof define === 'function' && define.amd) {
+        // AMD. Register as an anonymous module.
+        define([], factory);
+    } else {
+        // Browser globals
+        root.gltfUtilities = factory();
+    }
+}(this, function() {
+    "use strict";
+
+    /**
+     * Given a URL, determine whether that URL is considered cross-origin to the current page.
+     */
+    var isCrossOriginUrl = function(url) {
+        var location = window.location;
+        var a = document.createElement('a');
+
+        a.href = url;
+
+        // host includes both hostname and port if the port is not standard
+        return location.protocol !== a.protocol || location.host !== a.host;
+    };
+
+    var isDataUriRegex = /^data:/;
+
+    /**
+     * Asynchronously loads the given image URL.  Attempts to load cross-origin images using CORS.
+     *
+     * @param {String} url The source of the image.
+     * @param {Function} success A function that will be called with an Image object
+     *                           once the image has loaded successfully.
+     * @param {Function} [error] A function that will be called if the request fails.
+     *
+     * @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a>
+     */
+    var loadImage = function(url, success, error) {
+        var image = new Image();
+
+        image.onload = function() {
+            success(image);
+        };
+
+        if (typeof error !== 'undefined') {
+            image.onerror = error;
+        }
+
+        var crossOrigin;
+        if (isDataUriRegex.test(url)) {
+            crossOrigin = false;
+        } else {
+            crossOrigin = isCrossOriginUrl(url);
+        }
+
+        if (crossOrigin) {
+            image.crossOrigin = '';
+        }
+
+        image.src = url;
+    };
+
+    var dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;
+
+    function decodeDataUriText(isBase64, data) {
+        var result = decodeURIComponent(data);
+        if (isBase64) {
+            return atob(result);
+        }
+        return result;
+    }
+
+    function decodeDataUriArrayBuffer(isBase64, data) {
+        var byteString = decodeDataUriText(isBase64, data);
+        var buffer = new ArrayBuffer(byteString.length);
+        var view = new Uint8Array(buffer);
+        for (var i = 0; i < byteString.length; i++) {
+            view[i] = byteString.charCodeAt(i);
+        }
+        return buffer;
+    }
+
+    function decodeDataUri(dataUriRegexResult, responseType) {
+        responseType = typeof responseType !== 'undefined' ? responseType : '';
+        var mimeType = dataUriRegexResult[1];
+        var isBase64 = !!dataUriRegexResult[2];
+        var data = dataUriRegexResult[3];
+
+        switch (responseType) {
+        case '':
+        case 'text':
+            return decodeDataUriText(isBase64, data);
+        case 'arraybuffer':
+            return decodeDataUriArrayBuffer(isBase64, data);
+        case 'blob':
+            var buffer = decodeDataUriArrayBuffer(isBase64, data);
+            return new Blob([buffer], {
+                type : mimeType
+            });
+        case 'document':
+            var parser = new DOMParser();
+            return parser.parseFromString(decodeDataUriText(isBase64, data), mimeType);
+        case 'json':
+            return JSON.parse(decodeDataUriText(isBase64, data));
+        default:
+            throw 'Unhandled responseType: ' + responseType;
+        }
+    }
+
+    var loadWithXhr = function(url, responseType, success, error) {
+        var dataUriRegexResult = dataUriRegex.exec(url);
+        if (dataUriRegexResult !== null) {
+            success(decodeDataUri(dataUriRegexResult, responseType));
+            return;
+        }
+
+        var xhr = new XMLHttpRequest();
+        xhr.open('GET', url, true);
+
+        if (typeof responseType !== 'undefined') {
+            xhr.responseType = responseType;
+        }
+
+        xhr.onload = function(e) {
+            if (xhr.status === 200) {
+                success(xhr.response);
+            } else {
+                error(xhr);
+            }
+        };
+
+        xhr.onerror = function(e) {
+            error(xhr);
+        };
+
+        xhr.send();
+    };
+
+    /**
+     * Asynchronously loads the given URL as raw binary data.  The data is loaded
+     * using XMLHttpRequest, which means that in order to make requests to another origin,
+     * the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
+     *
+     * @param {String} url The URL of the binary data.
+     * @param {Function} success A function that will be called with an ArrayBuffer object
+     *                           once the data has loaded successfully.
+     * @param {Function} [error] A function that will be called with the XMLHttpRequest object
+     *                           if the request fails.
+     *
+     * @see <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a>
+     * @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a>
+     */
+    var loadArrayBuffer = function(url, success, error) {
+        loadWithXhr(url, 'arraybuffer', success, error);
+    };
+
+    /**
+     * Asynchronously loads the given URL as text.  The data is loaded
+     * using XMLHttpRequest, which means that in order to make requests to another origin,
+     * the server must have Cross-Origin Resource Sharing (CORS) headers enabled.
+     *
+     * @param {String} url The URL to request.
+     * @param {Function} success A function that will be called with a String
+     *                           once the data has loaded successfully.
+     * @param {Function} [error] A function that will be called with the XMLHttpRequest object
+     *                           if the request fails.
+     *
+     * @see <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a>
+     * @see <a href='http://www.w3.org/TR/cors/'>Cross-Origin Resource Sharing</a>
+     */
+    var loadText = function(url, success, error) {
+        return loadWithXhr(url, undefined, success, error);
+    };
+
+    return {
+        loadImage : loadImage,
+        loadArrayBuffer : loadArrayBuffer,
+        loadText : loadText
+    };
+}));
+
+

+ 1 - 2
examples/js/materials/ShadowMaterial.js

@@ -6,7 +6,6 @@ THREE.ShadowMaterial = function () {
 
 	THREE.ShaderMaterial.call( this, {
 		uniforms: THREE.UniformsUtils.merge( [
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ],
 			{
 				opacity:  { type: 'f', value: 1.0 }
@@ -29,7 +28,7 @@ THREE.ShadowMaterial = function () {
 			THREE.ShaderChunk[ "shadowmask_pars_fragment" ],
 			"uniform float opacity;",
 			"void main() {",
-			"	gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity - getShadowMask() );",
+			"	gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0  - getShadowMask() ) );",
 			"}"
 		].join( '\n' )
 	} );

+ 0 - 2
examples/js/nodes/materials/PhongNode.js

@@ -32,7 +32,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		material.mergeUniform( THREE.UniformsUtils.merge( [
 
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ]
 
 		] ) );
@@ -146,7 +145,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
 			THREE.ShaderChunk[ "common" ],
 			THREE.ShaderChunk[ "fog_pars_fragment" ],
 			THREE.ShaderChunk[ "bsdfs" ],
-			THREE.ShaderChunk[ "ambient_pars" ],
 			THREE.ShaderChunk[ "lights_pars" ],
 			THREE.ShaderChunk[ "lights_phong_pars_fragment" ],
 			THREE.ShaderChunk[ "shadowmap_pars_fragment" ],

+ 0 - 2
examples/js/nodes/materials/StandardNode.js

@@ -32,7 +32,6 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		material.mergeUniform( THREE.UniformsUtils.merge( [
 
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ]
 
 		] ) );
@@ -159,7 +158,6 @@ THREE.StandardNode.prototype.build = function( builder ) {
 			THREE.ShaderChunk[ "common" ],
 			THREE.ShaderChunk[ "fog_pars_fragment" ],
 			THREE.ShaderChunk[ "bsdfs" ],
-			THREE.ShaderChunk[ "ambient_pars" ],
 			THREE.ShaderChunk[ "lights_pars" ],
 			THREE.ShaderChunk[ "lights_standard_pars_fragment" ],
 			THREE.ShaderChunk[ "shadowmap_pars_fragment" ],

+ 177 - 0
examples/js/pmrem/PMREMCubeUVPacker.js

@@ -0,0 +1,177 @@
+/**
+ * @author Prashant Sharma / spidersharma03
+ * @author Ben Houston / bhouston, https://clara.io
+ *
+ * This class takes the cube lods(corresponding to different roughness values), and creates a single cubeUV
+ * Texture. The format for a given roughness set of faces is simply::
+ * +X+Y+Z
+ * -X-Y-Z
+ * For every roughness a mip map chain is also saved, which is essential to remove the texture artifacts due to
+ * minification.
+ * Right now for every face a PlaneMesh is drawn, which leads to a lot of geometry draw calls, but can be replaced
+ * later by drawing a single buffer and by sending the appropriate faceIndex via vertex attributes.
+ * The arrangement of the faces is fixed, as assuming this arrangement, the sampling function has been written.
+ */
+
+
+THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
+
+	this.cubeLods = cubeTextureLods;
+	this.numLods = numLods;
+	var size = cubeTextureLods[ 0 ].width * 4;
+
+	this.CubeUVRenderTarget = new THREE.WebGLRenderTarget( size, size,
+	{ format: THREE.RGBAFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter, type: cubeTextureLods[ 0 ].texture.type } );
+	this.CubeUVRenderTarget.texture.generateMipmaps = false;
+  this.CubeUVRenderTarget.mapping = THREE.CubeUVReflectionMapping;
+	this.camera = new THREE.OrthographicCamera( - size * 0.5, size * 0.5, - size * 0.5, size * 0.5, 0.0, 1000 );
+
+	this.scene = new THREE.Scene();
+	this.scene.add( this.camera );
+
+	this.objects = [];
+	var xOffset = 0;
+	var faceOffsets = [];
+	faceOffsets.push( new THREE.Vector2( 0, 0 ) );
+	faceOffsets.push( new THREE.Vector2( 1, 0 ) );
+	faceOffsets.push( new THREE.Vector2( 2, 0 ) );
+	faceOffsets.push( new THREE.Vector2( 0, 1 ) );
+	faceOffsets.push( new THREE.Vector2( 1, 1 ) );
+	faceOffsets.push( new THREE.Vector2( 2, 1 ) );
+	var yOffset = 0;
+	var textureResolution = size;
+	size = cubeTextureLods[ 0 ].width;
+
+	var offset2 = 0;
+	var c = 4.0;
+	this.numLods = Math.log2( cubeTextureLods[ 0 ].width ) - 2;
+	for ( var i = 0; i < this.numLods; i ++ ) {
+
+		var offset1 = ( textureResolution - textureResolution / c ) * 0.5;
+		if ( size > 16 )
+		c *= 2;
+		var nMips = size > 16 ? 6 : 1;
+		var mipOffsetX = 0;
+		var mipOffsetY = 0;
+		var mipSize = size;
+
+		for ( var j = 0; j < nMips; j ++ ) {
+
+			// Mip Maps
+			for ( var k = 0; k < 6; k ++ ) {
+
+				// 6 Cube Faces
+				var material = this.getShader();
+				material.uniforms[ "envMap" ].value = this.cubeLods[ i ];
+				material.envMap = this.cubeLods[ i ]
+				material.uniforms[ "faceIndex" ].value = k;
+				material.uniforms[ "mapSize" ].value = mipSize;
+				var color = material.uniforms[ "testColor" ].value;
+				//color.copy(testColor[j]);
+				var planeMesh = new THREE.Mesh(
+				new THREE.PlaneGeometry( mipSize, mipSize, 0 ),
+				material );
+				planeMesh.position.x = faceOffsets[ k ].x * mipSize - offset1 + mipOffsetX;
+				planeMesh.position.y = faceOffsets[ k ].y * mipSize - offset1 + offset2 + mipOffsetY;
+				planeMesh.material.side = THREE.DoubleSide;
+				this.scene.add( planeMesh );
+				this.objects.push( planeMesh );
+
+			}
+			mipOffsetY += 1.75 * mipSize;
+			mipOffsetX += 1.25 * mipSize;
+			mipSize /= 2;
+
+		}
+		offset2 += 2 * size;
+		if ( size > 16 )
+		size /= 2;
+
+	}
+
+};
+
+THREE.PMREMCubeUVPacker.prototype = {
+
+	constructor : THREE.PMREMCubeUVPacker,
+
+	update: function( renderer ) {
+
+		var gammaInput = renderer.gammaInput;
+    var gammaOutput = renderer.gammaOutput;
+    renderer.gammaInput = false;
+    renderer.gammaOutput = false;
+
+		renderer.render( this.scene, this.camera, this.CubeUVRenderTarget, true );
+
+    renderer.gammaInput = renderer.gammaInput;
+    renderer.gammaOutput = renderer.gammaOutput;
+	},
+
+  getShader: function() {
+
+    var shaderMaterial = new THREE.ShaderMaterial( {
+
+      uniforms: {
+       	"faceIndex": { type: 'i', value: 0 },
+       	"mapSize": { type: 'f', value: 0 },
+       	"envMap": { type: 't', value: null },
+       	"testColor": { type: 'v3', value: new THREE.Vector3( 1, 1, 1 ) }
+      },
+
+      vertexShader:
+        "precision highp float;\
+         varying vec2 vUv;\
+         void main() {\
+            vUv = uv;\
+            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\
+         }",
+
+      fragmentShader:
+       "precision highp float;\
+        varying vec2 vUv;\
+        uniform samplerCube envMap;\
+        uniform float mapSize;\
+        uniform vec3 testColor;\
+        uniform int faceIndex;\
+        \
+        void main() {\
+          vec3 sampleDirection;\
+          vec2 uv = vUv;\
+          uv = uv * 2.0 - 1.0;\
+          uv.y *= -1.0;\
+          if(faceIndex == 0) {\
+              sampleDirection = normalize(vec3(1.0, uv.y, -uv.x));\
+          }\
+          else if(faceIndex == 1) {\
+              sampleDirection = normalize(vec3(uv.x, 1.0, uv.y));\
+          }\
+          else if(faceIndex == 2) {\
+              sampleDirection = normalize(vec3(uv.x, uv.y, 1.0));\
+          }\
+          else if(faceIndex == 3) {\
+              sampleDirection = normalize(vec3(-1.0, uv.y, uv.x));\
+          }\
+          else if(faceIndex == 4) {\
+              sampleDirection = normalize(vec3(uv.x, -1.0, -uv.y));\
+          }\
+          else {\
+              sampleDirection = normalize(vec3(-uv.x, uv.y, -1.0));\
+          }\
+          vec4 color = envMapTexelToLinear( textureCube( envMap, sampleDirection ) );\
+          gl_FragColor = linearToOutputTexel( color * vec4(testColor, 1.0) );\
+        }",
+
+			blending: THREE.CustomBlending,
+			blendSrc: THREE.OneFactor,
+			blendDst: THREE.ZeroFactor,
+			blendSrcAlpha: THREE.OneFactor,
+			blendDstAlpha: THREE.ZeroFactor,
+			blendEquation: THREE.AddEquation
+    });
+
+		return shaderMaterial;
+
+  }
+
+};

+ 261 - 0
examples/js/pmrem/PMREMGenerator.js

@@ -0,0 +1,261 @@
+/**
+ * @author Prashant Sharma / spidersharma03
+ * @author Ben Houston / bhouston, https://clara.io
+ *
+ * To avoid cube map seams, I create an extra pixel around each face. This way when the cube map is
+ * sampled by an application later(with a little care by sampling the centre of the texel), the extra 1 border
+ *  of pixels makes sure that there is no seams artifacts present. This works perfectly for cubeUV format as
+ *  well where the 6 faces can be arranged in any manner whatsoever.
+ * Code in the beginning of fragment shader's main function does this job for a given resolution.
+ *  Run Scene_PMREM_Test.html in the examples directory to see the sampling from the cube lods generated
+ *  by this class.
+ */
+
+ THREE.PMREMGenerator = function( sourceTexture ) {
+	if ( sourceTexture instanceof THREE.CubeTexture ) {
+
+		if ( sourceTexture.images[ 0 ] === undefined )
+		  console.error( "sourceTexture Not Initialized" );
+      if(sourceTexture.images[ 0 ] instanceof THREE.DataTexture) {
+          this.resolution = sourceTexture.images[ 0 ].image.width;
+      }
+      else {
+          this.resolution = sourceTexture.images[ 0 ].width;
+      }
+
+	}
+	else if ( sourceTexture instanceof THREE.WebGLRenderTargetCube ) {
+		if ( sourceTexture === undefined ) console.error( "Render Target Not Initialized" );
+		this.resolution = sourceTexture.width;
+	}
+	else {
+		console.error( "Wrong Input to PMREMGenerator" );
+	}
+	this.sourceTexture = sourceTexture;
+
+  var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
+    ( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );
+
+  this.sourceTexture.minFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
+  this.sourceTexture.magFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
+  this.sourceTexture.generateMipmaps = this.sourceTexture.generateMipmaps && monotonicEncoding;
+
+	this.cubeLods = [];
+
+	var size = this.resolution;
+  var params = { format: this.sourceTexture.format, magFilter: this.sourceTexture.magFilter, minFilter: this.sourceTexture.minFilter, type: this.sourceTexture.type };
+
+  // how many LODs fit in the given CubeUV Texture.
+	this.numLods = Math.log2( size ) - 2;
+  for ( var i = 0; i < this.numLods; i ++ ) {
+		var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );
+		renderTarget.texture.generateMipmaps = this.sourceTexture.generateMipmaps;
+    renderTarget.texture.anisotropy = this.sourceTexture.anisotropy;
+    renderTarget.texture.encoding = this.sourceTexture.encoding;
+    renderTarget.texture.minFilter = this.sourceTexture.minFilter;
+    renderTarget.texture.magFilter = this.sourceTexture.magFilter;
+		this.cubeLods.push( renderTarget );
+		size = Math.max( 16, size / 2 );
+	}
+
+	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0.0, 1000 );
+
+  this.shader = this.getShader();
+	this.planeMesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2, 0 ), this.shader );
+	this.planeMesh.material.side = THREE.DoubleSide;
+	this.scene = new THREE.Scene();
+	this.scene.add( this.planeMesh );
+	this.scene.add( this.camera );
+
+	this.shader.uniforms[ "envMap" ].value = this.sourceTexture;
+  this.shader.envMap = this.sourceTexture;
+};
+
+THREE.PMREMGenerator.prototype = {
+
+	constructor : THREE.PMREMGenerator,
+
+  /*
+   * Prashant Sharma / spidersharma03: More thought and work is needed here.
+   * Right now it's a kind of a hack to use the previously convolved map to convolve the current one.
+   * I tried to use the original map to convolve all the lods, but for many textures(specially the high frequency)
+   * even a high number of samples(1024) dosen't lead to satisfactory results.
+   * By using the previous convolved maps, a lower number of samples are generally sufficient(right now 32, which
+   * gives okay results unless we see the reflection very carefully, or zoom in too much), however the math
+   * goes wrong as the distribution function tries to sample a larger area than what it should be. So I simply scaled
+   * the roughness by 0.9(totally empirical) to try to visually match the original result.
+   * The condition "if(i <5)" is also an attemt to make the result match the original result.
+   * This method requires the most amount of thinking I guess. Here is a paper which we could try to implement in future::
+   * http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
+   */
+	update: function( renderer ) {
+
+		this.shader.uniforms[ "envMap" ].value = this.sourceTexture;
+    this.shader.envMap = this.sourceTexture;
+
+    var gammaInput = renderer.gammaInput;
+    var gammaOutput = renderer.gammaOutput;
+    renderer.gammaInput = false;
+    renderer.gammaOutput = false;
+		for ( var i = 0; i < this.numLods; i ++ ) {
+
+			var r = i / ( this.numLods - 1 );
+			this.shader.uniforms[ "roughness" ].value = r * 0.9; // see comment above, pragmatic choice
+			var size = this.cubeLods[ i ].width;
+			this.shader.uniforms[ "mapSize" ].value = size;
+			this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] );
+			if ( i < 5 )
+			this.shader.uniforms[ "envMap" ].value = this.cubeLods[ i ];
+
+		}
+
+    renderer.gammaInput = renderer.gammaInput;
+    renderer.gammaOutput = renderer.gammaOutput;
+
+	},
+
+	renderToCubeMapTarget: function( renderer, renderTarget ) {
+
+		for ( var i = 0; i < 6; i ++ ) {
+		  this.renderToCubeMapTargetFace( renderer, renderTarget, i )
+    }
+
+	},
+
+	renderToCubeMapTargetFace: function( renderer, renderTarget, faceIndex ) {
+		renderTarget.activeCubeFace = faceIndex;
+		this.shader.uniforms[ "faceIndex" ].value = faceIndex;
+		renderer.render( this.scene, this.camera, renderTarget, true );
+
+	},
+
+  getShader: function() {
+
+    return new THREE.ShaderMaterial( {
+
+      uniforms: {
+        "faceIndex": { type: 'i', value: 0 },
+        "roughness": { type: 'f', value: 0.5 },
+        "mapSize": { type: 'f', value: 0.5 },
+        "envMap": { type: 't', value: null },
+        "testColor": { type: 'v3', value: new THREE.Vector3( 1, 1, 1 ) }
+      },
+
+      vertexShader:
+        "varying vec2 vUv;\n\
+        void main() {\n\
+           vUv = uv;\n\
+           gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
+        }",
+
+      fragmentShader:
+        "varying vec2 vUv;\n\
+        uniform int faceIndex;\n\
+        uniform float roughness;\n\
+        uniform samplerCube envMap;\n\
+        uniform float mapSize;\n\
+        uniform vec3 testColor;\n\
+        \n\
+        float rnd(vec2 uv) {\n\
+           return fract(sin(dot(uv, vec2(12.9898, 78.233) * 2.0)) * 43758.5453);\n\
+        }\n\
+        float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\
+           float a = ggxRoughness + 0.0001;\n\
+           a *= a;\n\
+           return ( 2.0 / a - 2.0 );\n\
+        }\n\
+        const float PI = 3.14159265358979;\n\
+        vec3 ImportanceSamplePhong(vec2 uv, mat3 vecSpace, float specPow) {\n\
+           float phi = uv.y * 2.0 * PI;\n\
+           float cosTheta = pow(1.0 - uv.x, 1.0 / (specPow + 1.0));\n\
+           float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n\
+           vec3 sampleDir = vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);\n\
+           return vecSpace * sampleDir;\n\
+        }\n\
+        vec3 ImportanceSampleGGX( vec2 uv, mat3 vecSpace, float Roughness )\n\
+        {\n\
+               float a = Roughness * Roughness;\n\
+               float Phi = 2.0 * PI * uv.x;\n\
+               float CosTheta = sqrt( (1.0 - uv.y) / ( 1.0 + (a*a - 1.0) * uv.y ) );\n\
+               float SinTheta = sqrt( 1.0 - CosTheta * CosTheta );\n\
+               return vecSpace * vec3(SinTheta * cos( Phi ), SinTheta * sin( Phi ), CosTheta);\n\
+        }\n\
+        mat3 matrixFromVector(vec3 n) {\n\
+           float a = 1.0 / (1.0 + n.z);\n\
+           float b = -n.x * n.y * a;\n\
+           vec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n\
+           vec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n\
+           return mat3(b1, b2, n);\n\
+        }\n\
+        \n\
+        vec4 testColorMap(float Roughness) {\n\
+           vec4 color;\n\
+           if(faceIndex == 0)\n\
+               color = vec4(1.0,0.0,0.0,1.0);\n\
+           else if(faceIndex == 1)\n\
+               color = vec4(0.0,1.0,0.0,1.0);\n\
+           else if(faceIndex == 2)\n\
+               color = vec4(0.0,0.0,1.0,1.0);\n\
+           else if(faceIndex == 3)\n\
+               color = vec4(1.0,1.0,0.0,1.0);\n\
+           else if(faceIndex == 4)\n\
+               color = vec4(0.0,1.0,1.0,1.0);\n\
+           else\n\
+               color = vec4(1.0,0.0,1.0,1.0);\n\
+           color *= ( 1.0 - Roughness );\n\
+           return color;\n\
+        }\n\
+        void main() {\n\
+           vec3 sampleDirection;\n\
+           vec2 uv = vUv*2.0 - 1.0;\n\
+           float offset = -1.0/mapSize;\n\
+           const float a = -1.0;\n\
+           const float b = 1.0;\n\
+           float c = -1.0 + offset;\n\
+           float d = 1.0 - offset;\n\
+           float bminusa = b - a;\n\
+           uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n\
+           uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n\
+           if (faceIndex==0) {\n\
+               sampleDirection = vec3(1.0, -uv.y, -uv.x);\n\
+           }\n\
+           else if (faceIndex==1) {\n\
+               sampleDirection = vec3(-1.0, -uv.y, uv.x);\n\
+           } else if (faceIndex==2) {\n\
+               sampleDirection = vec3(uv.x, 1.0, uv.y);\n\
+           } else if (faceIndex==3) {\n\
+               sampleDirection = vec3(uv.x, -1.0, -uv.y);\n\
+           } else if (faceIndex==4) {\n\
+               sampleDirection = vec3(uv.x, -uv.y, 1.0);\n\
+           } else {\n\
+               sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n\
+           }\n\
+           mat3 vecSpace = matrixFromVector(normalize(sampleDirection));\n\
+           vec3 rgbColor = vec3(0.0);\n\
+           const int NumSamples = 1024;\n\
+           vec3 vect;\n\
+           float weight = 0.0;\n\
+           for(int i=0; i<NumSamples; i++) {\n\
+               float sini = sin(float(i));\n\
+               float cosi = cos(float(i));\n\
+               float rand = rnd(vec2(sini, cosi));\n\
+               vect = ImportanceSampleGGX(vec2(float(i) / float(NumSamples), rand), vecSpace, roughness);\n\
+               float dotProd = dot(vect, normalize(sampleDirection));\n\
+               weight += dotProd;\n\
+               vec3 color = envMapTexelToLinear(textureCube(envMap,vect)).rgb;\n\
+               rgbColor.rgb += color;\n\
+           }\n\
+           rgbColor /= float(NumSamples);\n\
+           //rgbColor = testColorMap( roughness ).rgb;\n\
+           gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
+        }",
+        blending: THREE.CustomBlending,
+        blendSrc: THREE.OneFactor,
+        blendDst: THREE.ZeroFactor,
+        blendSrcAlpha: THREE.OneFactor,
+        blendDstAlpha: THREE.ZeroFactor,
+        blendEquation: THREE.AddEquation
+      }
+    );
+  }
+};

+ 12 - 15
examples/js/postprocessing/EffectComposer.js

@@ -8,13 +8,14 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
 
 	if ( renderTarget === undefined ) {
 
-		var pixelRatio = renderer.getPixelRatio();
-
-		var width  = Math.floor( renderer.context.canvas.width  / pixelRatio ) || 1;
-		var height = Math.floor( renderer.context.canvas.height / pixelRatio ) || 1;
-		var parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBuffer: false };
-
-		renderTarget = new THREE.WebGLRenderTarget( width, height, parameters );
+		var parameters = {
+			minFilter: THREE.LinearFilter,
+			magFilter: THREE.LinearFilter,
+			format: THREE.RGBAFormat,
+			stencilBuffer: false
+		};
+		var size = renderer.getSize();
+		renderTarget = new THREE.WebGLRenderTarget( size.width, size.height, parameters );
 
 	}
 
@@ -108,20 +109,16 @@ THREE.EffectComposer.prototype = {
 
 		if ( renderTarget === undefined ) {
 
-			renderTarget = this.renderTarget1.clone();
-
-			var pixelRatio = this.renderer.getPixelRatio();
+			var size = this.renderer.getSize();
 
-			renderTarget.setSize(
-				Math.floor( this.renderer.context.canvas.width  / pixelRatio ),
-				Math.floor( this.renderer.context.canvas.height / pixelRatio )
-			);
+			renderTarget = this.renderTarget1.clone();
+			renderTarget.setSize( width, height );
 
 		}
 
 		this.renderTarget1.dispose();
-		this.renderTarget1 = renderTarget;
 		this.renderTarget2.dispose();
+		this.renderTarget1 = renderTarget;
 		this.renderTarget2 = renderTarget.clone();
 
 		this.writeBuffer = this.renderTarget1;

+ 0 - 1
examples/js/shaders/GammaCorrectionShader.js

@@ -28,7 +28,6 @@ THREE.GammaCorrectionShader = {
 
 	fragmentShader: [
 
-		"#define GAMMA_OUTPUT",
 		"#define GAMMA_FACTOR 2",
 
 		"uniform sampler2D tDiffuse;",

+ 1 - 0
examples/models/gltf/CesiumMan/README.txt

@@ -0,0 +1 @@
+Donated by Cesium for glTF testing.  Please follow the Cesium Trademark Terms and Conditions: https://github.com/AnalyticalGraphicsInc/cesium/wiki/CesiumTrademark.pdf

二進制
examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.bin


+ 2111 - 0
examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.gltf

@@ -0,0 +1,2111 @@
+{
+    "accessors": {
+        "IBM_Armature_Cesium_Man-skin": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 19,
+            "type": "MAT4"
+        },
+        "accessor_112": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 448512,
+            "byteStride": 16,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                1,
+                0.98992,
+                0.951076,
+                0.874108
+            ],
+            "min": [
+                0.0100802,
+                0,
+                0,
+                0
+            ],
+            "type": "VEC4"
+        },
+        "accessor_115": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 672768,
+            "byteStride": 16,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                18,
+                18,
+                18,
+                18
+            ],
+            "min": [
+                0,
+                0,
+                0,
+                0
+            ],
+            "type": "VEC4"
+        },
+        "accessor_21": {
+            "bufferView": "bufferView_119",
+            "byteOffset": 0,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 14016,
+            "type": "SCALAR"
+        },
+        "accessor_23": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 0,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                0.180954,
+                0.569137,
+                1.50655
+            ],
+            "min": [
+                -0.131,
+                -0.569137,
+                0
+            ],
+            "type": "VEC3"
+        },
+        "accessor_25": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 168192,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                1,
+                0.999981,
+                0.994445
+            ],
+            "min": [
+                -1,
+                -0.999981,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_27": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 336384,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                0.990806,
+                0.98803
+            ],
+            "min": [
+                0.0140794,
+                0.00844598
+            ],
+            "type": "VEC2"
+        },
+        "animAccessor_0": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 1216,
+            "componentType": 5126,
+            "count": 49,
+            "type": "SCALAR"
+        },
+        "animAccessor_1": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 1412,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_10": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 7292,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_11": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 7880,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_12": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 8468,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_13": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 9252,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_14": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 9840,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_15": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 10428,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_16": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 11212,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_17": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 11800,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_18": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 12388,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_19": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 13172,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_2": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 2000,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_20": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 13760,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_21": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 14348,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_22": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 15132,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_23": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 15720,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_24": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 16308,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_25": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 17092,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_26": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 17680,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_27": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 18268,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_28": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 19052,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_29": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 19640,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_3": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 2588,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_30": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 20228,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_31": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 21012,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_32": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 21600,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_33": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 22188,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_34": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 22972,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_35": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 23560,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_36": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 24148,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_37": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 24932,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_38": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 25520,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_39": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 26108,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_4": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 3372,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_40": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 26892,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_41": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 27480,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_42": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 28068,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_43": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 28852,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_44": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 29440,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_45": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 30028,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_46": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 30812,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_47": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 31400,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_48": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 31988,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_49": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 32772,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_5": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 3960,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_50": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 33360,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_51": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 33948,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_52": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 34732,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_53": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 35320,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_54": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 35908,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_55": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 36692,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_56": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 37280,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_57": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 37868,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_6": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 4548,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_7": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 5332,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_8": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 5920,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_9": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 6508,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        }
+    },
+    "animations": {
+        "animation_0": {
+            "channels": [
+                {
+                    "sampler": "animation_0_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_0_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_0_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_3",
+                "scale": "animAccessor_1",
+                "translation": "animAccessor_2"
+            },
+            "samplers": {
+                "animation_0_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_0_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_0_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_1": {
+            "channels": [
+                {
+                    "sampler": "animation_1_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_1_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_1_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_6",
+                "scale": "animAccessor_4",
+                "translation": "animAccessor_5"
+            },
+            "samplers": {
+                "animation_1_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_1_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_1_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_10": {
+            "channels": [
+                {
+                    "sampler": "animation_10_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_10_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_10_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_9",
+                "scale": "animAccessor_7",
+                "translation": "animAccessor_8"
+            },
+            "samplers": {
+                "animation_10_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_10_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_10_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_11": {
+            "channels": [
+                {
+                    "sampler": "animation_11_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_11_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_11_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_12",
+                "scale": "animAccessor_10",
+                "translation": "animAccessor_11"
+            },
+            "samplers": {
+                "animation_11_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_11_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_11_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_12": {
+            "channels": [
+                {
+                    "sampler": "animation_12_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_12_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_12_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_15",
+                "scale": "animAccessor_13",
+                "translation": "animAccessor_14"
+            },
+            "samplers": {
+                "animation_12_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_12_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_12_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_13": {
+            "channels": [
+                {
+                    "sampler": "animation_13_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_13_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_13_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_18",
+                "scale": "animAccessor_16",
+                "translation": "animAccessor_17"
+            },
+            "samplers": {
+                "animation_13_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_13_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_13_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_14": {
+            "channels": [
+                {
+                    "sampler": "animation_14_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_14_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_14_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_21",
+                "scale": "animAccessor_19",
+                "translation": "animAccessor_20"
+            },
+            "samplers": {
+                "animation_14_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_14_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_14_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_15": {
+            "channels": [
+                {
+                    "sampler": "animation_15_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_15_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_15_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_24",
+                "scale": "animAccessor_22",
+                "translation": "animAccessor_23"
+            },
+            "samplers": {
+                "animation_15_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_15_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_15_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_16": {
+            "channels": [
+                {
+                    "sampler": "animation_16_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_16_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_16_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_27",
+                "scale": "animAccessor_25",
+                "translation": "animAccessor_26"
+            },
+            "samplers": {
+                "animation_16_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_16_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_16_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_17": {
+            "channels": [
+                {
+                    "sampler": "animation_17_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_17_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_17_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_30",
+                "scale": "animAccessor_28",
+                "translation": "animAccessor_29"
+            },
+            "samplers": {
+                "animation_17_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_17_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_17_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_18": {
+            "channels": [
+                {
+                    "sampler": "animation_18_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_18_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_18_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_33",
+                "scale": "animAccessor_31",
+                "translation": "animAccessor_32"
+            },
+            "samplers": {
+                "animation_18_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_18_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_18_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_2": {
+            "channels": [
+                {
+                    "sampler": "animation_2_scale_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_2_translation_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_2_rotation_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_36",
+                "scale": "animAccessor_34",
+                "translation": "animAccessor_35"
+            },
+            "samplers": {
+                "animation_2_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_2_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_2_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_3": {
+            "channels": [
+                {
+                    "sampler": "animation_3_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_3_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_3_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_39",
+                "scale": "animAccessor_37",
+                "translation": "animAccessor_38"
+            },
+            "samplers": {
+                "animation_3_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_3_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_3_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_4": {
+            "channels": [
+                {
+                    "sampler": "animation_4_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_4_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_4_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_42",
+                "scale": "animAccessor_40",
+                "translation": "animAccessor_41"
+            },
+            "samplers": {
+                "animation_4_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_4_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_4_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_5": {
+            "channels": [
+                {
+                    "sampler": "animation_5_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_5_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_5_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_45",
+                "scale": "animAccessor_43",
+                "translation": "animAccessor_44"
+            },
+            "samplers": {
+                "animation_5_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_5_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_5_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_6": {
+            "channels": [
+                {
+                    "sampler": "animation_6_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_6_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_6_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_48",
+                "scale": "animAccessor_46",
+                "translation": "animAccessor_47"
+            },
+            "samplers": {
+                "animation_6_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_6_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_6_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_7": {
+            "channels": [
+                {
+                    "sampler": "animation_7_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_7_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_7_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_51",
+                "scale": "animAccessor_49",
+                "translation": "animAccessor_50"
+            },
+            "samplers": {
+                "animation_7_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_7_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_7_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_8": {
+            "channels": [
+                {
+                    "sampler": "animation_8_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_8_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_8_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_54",
+                "scale": "animAccessor_52",
+                "translation": "animAccessor_53"
+            },
+            "samplers": {
+                "animation_8_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_8_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_8_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_9": {
+            "channels": [
+                {
+                    "sampler": "animation_9_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_9_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_9_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_57",
+                "scale": "animAccessor_55",
+                "translation": "animAccessor_56"
+            },
+            "samplers": {
+                "animation_9_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_9_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_9_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        }
+    },
+    "asset": {
+        "generator": "collada2gltf@cf6371beb0bdc18ba603378d5e40c966da53d385",
+        "premultipliedAlpha": true,
+        "profile": {
+            "api": "WebGL",
+            "version": "1.0.2"
+        },
+        "version": "1.0"
+    },
+    "bufferViews": {
+        "bufferView_118": {
+            "buffer": "Cesium_Man",
+            "byteLength": 38652,
+            "byteOffset": 0
+        },
+        "bufferView_119": {
+            "buffer": "Cesium_Man",
+            "byteLength": 28032,
+            "byteOffset": 38652,
+            "target": 34963
+        },
+        "bufferView_120": {
+            "buffer": "Cesium_Man",
+            "byteLength": 897024,
+            "byteOffset": 66684,
+            "target": 34962
+        }
+    },
+    "buffers": {
+        "Cesium_Man": {
+            "byteLength": 963708,
+            "type": "arraybuffer",
+            "uri": "Cesium_Man.bin"
+        }
+    },
+    "extensionsUsed": [
+        "KHR_materials_common"
+    ],
+    "images": {
+        "Cesium_Man_jpg": {
+            "name": "Cesium_Man_jpg",
+            "uri": "Cesium_Man.jpg"
+        }
+    },
+    "materials": {
+        "Cesium_Man-effect": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 19,
+                    "technique": "PHONG",
+                    "transparent": false,
+                    "values": {
+                        "ambient": [
+                            0,
+                            0,
+                            0,
+                            1
+                        ],
+                        "diffuse": "texture_Cesium_Man_jpg",
+                        "emission": [
+                            0,
+                            0,
+                            0,
+                            1
+                        ],
+                        "shininess": 256,
+                        "specular": [
+                            0.1,
+                            0.1,
+                            0.1,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "Cesium_Man"
+        }
+    },
+    "meshes": {
+        "Cesium_Man-mesh": {
+            "name": "Cesium_Man",
+            "primitives": [
+                {
+                    "attributes": {
+                        "JOINT": "accessor_115",
+                        "NORMAL": "accessor_25",
+                        "POSITION": "accessor_23",
+                        "TEXCOORD_0": "accessor_27",
+                        "WEIGHT": "accessor_112"
+                    },
+                    "indices": "accessor_21",
+                    "material": "Cesium_Man-effect",
+                    "mode": 4
+                }
+            ]
+        }
+    },
+    "nodes": {
+        "Armature": {
+            "children": [
+                "Skeleton_torso_joint_1"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Armature"
+        },
+        "Cesium_Man": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "meshes": [
+                "Cesium_Man-mesh"
+            ],
+            "name": "Cesium_Man",
+            "skeletons": [
+                "Skeleton_torso_joint_1"
+            ],
+            "skin": "Armature_Cesium_Man-skin"
+        },
+        "Skeleton_arm_joint_L__2_": {
+            "children": [],
+            "jointName": "Skeleton_arm_joint_L__2_",
+            "name": "Skeleton_arm_joint_L__2_",
+            "rotation": [
+                -0.00611917,
+                0.0423255,
+                0.0787759,
+                0.995975
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                1.49012e-008,
+                0.187791,
+                5.96046e-008
+            ]
+        },
+        "Skeleton_arm_joint_L__3_": {
+            "children": [
+                "Skeleton_arm_joint_L__2_"
+            ],
+            "jointName": "Skeleton_arm_joint_L__3_",
+            "name": "Skeleton_arm_joint_L__3_",
+            "rotation": [
+                0.0139609,
+                0.129373,
+                0.252206,
+                0.958885
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                1.16415e-010,
+                0.242009,
+                0
+            ]
+        },
+        "Skeleton_arm_joint_L__4_": {
+            "children": [
+                "Skeleton_arm_joint_L__3_"
+            ],
+            "jointName": "Skeleton_arm_joint_L__4_",
+            "name": "Skeleton_arm_joint_L__4_",
+            "rotation": [
+                0.679733,
+                0.689686,
+                -0.226972,
+                -0.103832
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0.0910136,
+                1.41859e-005,
+                -5.80549e-005
+            ]
+        },
+        "Skeleton_arm_joint_R": {
+            "children": [
+                "Skeleton_arm_joint_R__2_"
+            ],
+            "jointName": "Skeleton_arm_joint_R",
+            "name": "Skeleton_arm_joint_R",
+            "rotation": [
+                -0.296443,
+                -0.0315103,
+                0.652255,
+                0.696916
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -0.0909878,
+                6.25998e-005,
+                -6.53267e-005
+            ]
+        },
+        "Skeleton_arm_joint_R__2_": {
+            "children": [
+                "Skeleton_arm_joint_R__3_"
+            ],
+            "jointName": "Skeleton_arm_joint_R__2_",
+            "name": "Skeleton_arm_joint_R__2_",
+            "rotation": [
+                -0.188793,
+                0.915707,
+                -0.167809,
+                -0.312534
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.242008,
+                -5.96046e-008
+            ]
+        },
+        "Skeleton_arm_joint_R__3_": {
+            "children": [],
+            "jointName": "Skeleton_arm_joint_R__3_",
+            "name": "Skeleton_arm_joint_R__3_",
+            "rotation": [
+                0.0586139,
+                -0.263777,
+                -0.0522685,
+                0.961381
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.187792,
+                0
+            ]
+        },
+        "Skeleton_neck_joint_1": {
+            "children": [
+                "Skeleton_neck_joint_2"
+            ],
+            "jointName": "Skeleton_neck_joint_1",
+            "name": "Skeleton_neck_joint_1",
+            "rotation": [
+                0.66063,
+                -8.34443e-005,
+                -7.10926e-005,
+                0.750712
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -8.84756e-009,
+                5.96046e-008,
+                0.0648366
+            ]
+        },
+        "Skeleton_neck_joint_2": {
+            "children": [],
+            "jointName": "Skeleton_neck_joint_2",
+            "name": "Skeleton_neck_joint_2",
+            "rotation": [
+                2.55261e-006,
+                0.99969,
+                -0.0248797,
+                -4.32993e-007
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.0520397,
+                0
+            ]
+        },
+        "Skeleton_torso_joint_1": {
+            "children": [
+                "Skeleton_torso_joint_2",
+                "leg_joint_L_1",
+                "leg_joint_R_1"
+            ],
+            "jointName": "Skeleton_torso_joint_1",
+            "name": "Skeleton_torso_joint_1",
+            "rotation": [
+                0.0267947,
+                0.0267326,
+                0.706561,
+                0.706639
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -3.35276e-008,
+                0.00499989,
+                0.679
+            ]
+        },
+        "Skeleton_torso_joint_2": {
+            "children": [
+                "torso_joint_3"
+            ],
+            "jointName": "Skeleton_torso_joint_2",
+            "name": "Skeleton_torso_joint_2",
+            "rotation": [
+                0.657252,
+                0.000179693,
+                0.00010428,
+                0.753671
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -1.02445e-008,
+                1.49012e-008,
+                0.145417
+            ]
+        },
+        "leg_joint_L_1": {
+            "children": [
+                "leg_joint_L_2"
+            ],
+            "jointName": "leg_joint_L_1",
+            "name": "leg_joint_L_1",
+            "rotation": [
+                0.24757,
+                -0.577568,
+                0.747914,
+                -0.213889
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0.0680367,
+                -0.0285187,
+                -0.0629628
+            ]
+        },
+        "leg_joint_L_2": {
+            "children": [
+                "leg_joint_L_3"
+            ],
+            "jointName": "leg_joint_L_2",
+            "name": "leg_joint_L_2",
+            "rotation": [
+                -0.209028,
+                0.32989,
+                0.0555992,
+                0.918906
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                3.72529e-009,
+                0.266113,
+                1.49012e-008
+            ]
+        },
+        "leg_joint_L_3": {
+            "children": [
+                "leg_joint_L_5"
+            ],
+            "jointName": "leg_joint_L_3",
+            "name": "leg_joint_L_3",
+            "rotation": [
+                -0.84774,
+                0.00425408,
+                0.00949198,
+                0.530311
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -7.45058e-009,
+                0.275824,
+                5.58794e-009
+            ]
+        },
+        "leg_joint_L_5": {
+            "children": [],
+            "jointName": "leg_joint_L_5",
+            "name": "leg_joint_L_5",
+            "rotation": [
+                0.0265735,
+                -0.320144,
+                0.944545,
+                0.0680896
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -0.00234652,
+                -0.0661733,
+                0.0278568
+            ]
+        },
+        "leg_joint_R_1": {
+            "children": [
+                "leg_joint_R_2"
+            ],
+            "jointName": "leg_joint_R_1",
+            "name": "leg_joint_R_1",
+            "rotation": [
+                -0.066427,
+                -0.611501,
+                0.785027,
+                0.0733875
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -0.068042,
+                -0.0285702,
+                -0.0629496
+            ]
+        },
+        "leg_joint_R_2": {
+            "children": [
+                "leg_joint_R_3"
+            ],
+            "jointName": "leg_joint_R_2",
+            "name": "leg_joint_R_2",
+            "rotation": [
+                -0.216291,
+                -0.124306,
+                -0.00157521,
+                0.968382
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.266111,
+                0
+            ]
+        },
+        "leg_joint_R_3": {
+            "children": [
+                "leg_joint_R_5"
+            ],
+            "jointName": "leg_joint_R_3",
+            "name": "leg_joint_R_3",
+            "rotation": [
+                -0.847274,
+                0.029564,
+                0.020868,
+                0.529922
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.275825,
+                -1.11759e-008
+            ]
+        },
+        "leg_joint_R_5": {
+            "children": [],
+            "jointName": "leg_joint_R_5",
+            "name": "leg_joint_R_5",
+            "rotation": [
+                -0.0372644,
+                -0.319313,
+                0.946053,
+                -0.040415
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -0.00145848,
+                -0.0661988,
+                0.0278567
+            ]
+        },
+        "node_21": {
+            "children": [
+                "Armature",
+                "Cesium_Man"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                0,
+                -1,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Y_UP_Transform"
+        },
+        "torso_joint_3": {
+            "children": [
+                "Skeleton_neck_joint_1",
+                "Skeleton_arm_joint_L__4_",
+                "Skeleton_arm_joint_R"
+            ],
+            "jointName": "torso_joint_3",
+            "name": "torso_joint_3",
+            "rotation": [
+                -0.622604,
+                -1.67835e-005,
+                3.1824e-006,
+                0.782537
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                4.65661e-010,
+                0.250517,
+                3.72529e-009
+            ]
+        }
+    },
+    "samplers": {
+        "sampler_0": {
+            "magFilter": 9729,
+            "minFilter": 9729,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    },
+    "scene": "defaultScene",
+    "scenes": {
+        "defaultScene": {
+            "nodes": [
+                "node_21"
+            ]
+        }
+    },
+    "skins": {
+        "Armature_Cesium_Man-skin": {
+            "bindShapeMatrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "inverseBindMatrices": "IBM_Armature_Cesium_Man-skin",
+            "jointNames": [
+                "Skeleton_torso_joint_1",
+                "Skeleton_torso_joint_2",
+                "torso_joint_3",
+                "Skeleton_neck_joint_1",
+                "Skeleton_neck_joint_2",
+                "Skeleton_arm_joint_L__4_",
+                "Skeleton_arm_joint_R",
+                "Skeleton_arm_joint_L__3_",
+                "Skeleton_arm_joint_R__2_",
+                "Skeleton_arm_joint_L__2_",
+                "Skeleton_arm_joint_R__3_",
+                "leg_joint_L_1",
+                "leg_joint_R_1",
+                "leg_joint_L_2",
+                "leg_joint_R_2",
+                "leg_joint_L_3",
+                "leg_joint_R_3",
+                "leg_joint_L_5",
+                "leg_joint_R_5"
+            ],
+            "name": "Armature"
+        }
+    },
+    "textures": {
+        "texture_Cesium_Man_jpg": {
+            "format": 6408,
+            "internalFormat": 6408,
+            "sampler": "sampler_0",
+            "source": "Cesium_Man_jpg",
+            "target": 3553,
+            "type": 5121
+        }
+    }
+}

二進制
examples/models/gltf/CesiumMan/glTF-MaterialsCommon/Cesium_Man.jpg


二進制
examples/models/gltf/CesiumMan/glTF/Cesium_Man.bin


+ 2207 - 0
examples/models/gltf/CesiumMan/glTF/Cesium_Man.gltf

@@ -0,0 +1,2207 @@
+{
+    "accessors": {
+        "IBM_Armature_Cesium_Man-skin": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 19,
+            "type": "MAT4"
+        },
+        "accessor_112": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 448512,
+            "byteStride": 16,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                1,
+                0.9899199604988098,
+                0.9510759711265564,
+                0.8741080164909363
+            ],
+            "min": [
+                0.01008019968867302,
+                0,
+                0,
+                0
+            ],
+            "type": "VEC4"
+        },
+        "accessor_115": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 672768,
+            "byteStride": 16,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                18,
+                18,
+                18,
+                18
+            ],
+            "min": [
+                0,
+                0,
+                0,
+                0
+            ],
+            "type": "VEC4"
+        },
+        "accessor_21": {
+            "bufferView": "bufferView_119",
+            "byteOffset": 0,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 14016,
+            "type": "SCALAR"
+        },
+        "accessor_23": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 0,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                0.1809539943933487,
+                0.5691369771957397,
+                1.5065499544143677
+            ],
+            "min": [
+                -0.13100001215934753,
+                -0.5691369771957397,
+                0
+            ],
+            "type": "VEC3"
+        },
+        "accessor_25": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 168192,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                1,
+                0.9999809861183167,
+                0.9944450259208679
+            ],
+            "min": [
+                -1,
+                -0.9999809861183167,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_27": {
+            "bufferView": "bufferView_120",
+            "byteOffset": 336384,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 14016,
+            "max": [
+                0.990805983543396,
+                0.9880298972129822
+            ],
+            "min": [
+                0.014079400338232517,
+                0.008445978164672852
+            ],
+            "type": "VEC2"
+        },
+        "animAccessor_0": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 1216,
+            "componentType": 5126,
+            "count": 49,
+            "type": "SCALAR"
+        },
+        "animAccessor_1": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 1412,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_10": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 7292,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_11": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 7880,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_12": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 8468,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_13": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 9252,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_14": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 9840,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_15": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 10428,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_16": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 11212,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_17": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 11800,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_18": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 12388,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_19": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 13172,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_2": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 2000,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_20": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 13760,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_21": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 14348,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_22": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 15132,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_23": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 15720,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_24": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 16308,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_25": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 17092,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_26": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 17680,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_27": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 18268,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_28": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 19052,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_29": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 19640,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_3": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 2588,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_30": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 20228,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_31": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 21012,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_32": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 21600,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_33": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 22188,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_34": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 22972,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_35": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 23560,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_36": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 24148,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_37": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 24932,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_38": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 25520,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_39": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 26108,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_4": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 3372,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_40": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 26892,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_41": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 27480,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_42": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 28068,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_43": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 28852,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_44": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 29440,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_45": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 30028,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_46": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 30812,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_47": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 31400,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_48": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 31988,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_49": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 32772,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_5": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 3960,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_50": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 33360,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_51": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 33948,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_52": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 34732,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_53": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 35320,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_54": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 35908,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_55": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 36692,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_56": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 37280,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_57": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 37868,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_6": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 4548,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        },
+        "animAccessor_7": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 5332,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_8": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 5920,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC3"
+        },
+        "animAccessor_9": {
+            "bufferView": "bufferView_118",
+            "byteOffset": 6508,
+            "componentType": 5126,
+            "count": 49,
+            "type": "VEC4"
+        }
+    },
+    "animations": {
+        "animation_0": {
+            "channels": [
+                {
+                    "sampler": "animation_0_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_0_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_0_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_3",
+                "scale": "animAccessor_1",
+                "translation": "animAccessor_2"
+            },
+            "samplers": {
+                "animation_0_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_0_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_0_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_1": {
+            "channels": [
+                {
+                    "sampler": "animation_1_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_1_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_1_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_torso_joint_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_6",
+                "scale": "animAccessor_4",
+                "translation": "animAccessor_5"
+            },
+            "samplers": {
+                "animation_1_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_1_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_1_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_10": {
+            "channels": [
+                {
+                    "sampler": "animation_10_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_10_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_10_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__3_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_9",
+                "scale": "animAccessor_7",
+                "translation": "animAccessor_8"
+            },
+            "samplers": {
+                "animation_10_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_10_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_10_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_11": {
+            "channels": [
+                {
+                    "sampler": "animation_11_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_11_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_11_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_12",
+                "scale": "animAccessor_10",
+                "translation": "animAccessor_11"
+            },
+            "samplers": {
+                "animation_11_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_11_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_11_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_12": {
+            "channels": [
+                {
+                    "sampler": "animation_12_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_12_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_12_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_15",
+                "scale": "animAccessor_13",
+                "translation": "animAccessor_14"
+            },
+            "samplers": {
+                "animation_12_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_12_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_12_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_13": {
+            "channels": [
+                {
+                    "sampler": "animation_13_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_13_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_13_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_18",
+                "scale": "animAccessor_16",
+                "translation": "animAccessor_17"
+            },
+            "samplers": {
+                "animation_13_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_13_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_13_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_14": {
+            "channels": [
+                {
+                    "sampler": "animation_14_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_14_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_14_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_L_5",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_21",
+                "scale": "animAccessor_19",
+                "translation": "animAccessor_20"
+            },
+            "samplers": {
+                "animation_14_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_14_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_14_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_15": {
+            "channels": [
+                {
+                    "sampler": "animation_15_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_15_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_15_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_24",
+                "scale": "animAccessor_22",
+                "translation": "animAccessor_23"
+            },
+            "samplers": {
+                "animation_15_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_15_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_15_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_16": {
+            "channels": [
+                {
+                    "sampler": "animation_16_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_16_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_16_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_27",
+                "scale": "animAccessor_25",
+                "translation": "animAccessor_26"
+            },
+            "samplers": {
+                "animation_16_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_16_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_16_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_17": {
+            "channels": [
+                {
+                    "sampler": "animation_17_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_17_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_17_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_30",
+                "scale": "animAccessor_28",
+                "translation": "animAccessor_29"
+            },
+            "samplers": {
+                "animation_17_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_17_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_17_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_18": {
+            "channels": [
+                {
+                    "sampler": "animation_18_scale_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_18_translation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_18_rotation_sampler",
+                    "target": {
+                        "id": "leg_joint_R_5",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_33",
+                "scale": "animAccessor_31",
+                "translation": "animAccessor_32"
+            },
+            "samplers": {
+                "animation_18_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_18_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_18_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_2": {
+            "channels": [
+                {
+                    "sampler": "animation_2_scale_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_2_translation_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_2_rotation_sampler",
+                    "target": {
+                        "id": "torso_joint_3",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_36",
+                "scale": "animAccessor_34",
+                "translation": "animAccessor_35"
+            },
+            "samplers": {
+                "animation_2_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_2_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_2_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_3": {
+            "channels": [
+                {
+                    "sampler": "animation_3_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_3_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_3_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_1",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_39",
+                "scale": "animAccessor_37",
+                "translation": "animAccessor_38"
+            },
+            "samplers": {
+                "animation_3_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_3_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_3_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_4": {
+            "channels": [
+                {
+                    "sampler": "animation_4_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_4_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_4_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_neck_joint_2",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_42",
+                "scale": "animAccessor_40",
+                "translation": "animAccessor_41"
+            },
+            "samplers": {
+                "animation_4_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_4_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_4_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_5": {
+            "channels": [
+                {
+                    "sampler": "animation_5_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_5_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_5_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__4_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_45",
+                "scale": "animAccessor_43",
+                "translation": "animAccessor_44"
+            },
+            "samplers": {
+                "animation_5_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_5_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_5_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_6": {
+            "channels": [
+                {
+                    "sampler": "animation_6_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_6_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_6_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__3_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_48",
+                "scale": "animAccessor_46",
+                "translation": "animAccessor_47"
+            },
+            "samplers": {
+                "animation_6_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_6_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_6_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_7": {
+            "channels": [
+                {
+                    "sampler": "animation_7_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_7_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_7_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_L__2_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_51",
+                "scale": "animAccessor_49",
+                "translation": "animAccessor_50"
+            },
+            "samplers": {
+                "animation_7_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_7_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_7_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_8": {
+            "channels": [
+                {
+                    "sampler": "animation_8_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_8_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_8_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_54",
+                "scale": "animAccessor_52",
+                "translation": "animAccessor_53"
+            },
+            "samplers": {
+                "animation_8_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_8_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_8_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        },
+        "animation_9": {
+            "channels": [
+                {
+                    "sampler": "animation_9_scale_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "scale"
+                    }
+                },
+                {
+                    "sampler": "animation_9_translation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "translation"
+                    }
+                },
+                {
+                    "sampler": "animation_9_rotation_sampler",
+                    "target": {
+                        "id": "Skeleton_arm_joint_R__2_",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_57",
+                "scale": "animAccessor_55",
+                "translation": "animAccessor_56"
+            },
+            "samplers": {
+                "animation_9_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                },
+                "animation_9_scale_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "scale"
+                },
+                "animation_9_translation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "translation"
+                }
+            }
+        }
+    },
+    "asset": {
+        "generator": "collada2gltf@",
+        "premultipliedAlpha": true,
+        "profile": {
+            "api": "WebGL",
+            "version": "1.0.2"
+        },
+        "version": "1.0"
+    },
+    "bufferViews": {
+        "bufferView_118": {
+            "buffer": "Cesium_Man",
+            "byteLength": 38652,
+            "byteOffset": 0
+        },
+        "bufferView_119": {
+            "buffer": "Cesium_Man",
+            "byteLength": 28032,
+            "byteOffset": 38652,
+            "target": 34963
+        },
+        "bufferView_120": {
+            "buffer": "Cesium_Man",
+            "byteLength": 897024,
+            "byteOffset": 66684,
+            "target": 34962
+        }
+    },
+    "buffers": {
+        "Cesium_Man": {
+            "byteLength": 963708,
+            "type": "arraybuffer",
+            "uri": "Cesium_Man.bin"
+        }
+    },
+    "images": {
+        "Cesium_Man_jpg": {
+            "name": "Cesium_Man_jpg",
+            "uri": "Cesium_Man.jpg"
+        }
+    },
+    "materials": {
+        "Cesium_Man-effect": {
+            "name": "Cesium_Man",
+            "technique": "technique0",
+            "values": {
+                "ambient": [
+                    0,
+                    0,
+                    0,
+                    1
+                ],
+                "diffuse": "texture_Cesium_Man_jpg",
+                "emission": [
+                    0,
+                    0,
+                    0,
+                    1
+                ],
+                "shininess": 256,
+                "specular": [
+                    0.10000000149011612,
+                    0.10000000149011612,
+                    0.10000000149011612,
+                    1
+                ]
+            }
+        }
+    },
+    "meshes": {
+        "Cesium_Man-mesh": {
+            "name": "Cesium_Man",
+            "primitives": [
+                {
+                    "attributes": {
+                        "JOINT": "accessor_115",
+                        "NORMAL": "accessor_25",
+                        "POSITION": "accessor_23",
+                        "TEXCOORD_0": "accessor_27",
+                        "WEIGHT": "accessor_112"
+                    },
+                    "indices": "accessor_21",
+                    "material": "Cesium_Man-effect",
+                    "mode": 4
+                }
+            ]
+        }
+    },
+    "nodes": {
+        "Armature": {
+            "children": [
+                "Skeleton_torso_joint_1"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Armature"
+        },
+        "Cesium_Man": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "meshes": [
+                "Cesium_Man-mesh"
+            ],
+            "name": "Cesium_Man",
+            "skeletons": [
+                "Skeleton_torso_joint_1"
+            ],
+            "skin": "Armature_Cesium_Man-skin"
+        },
+        "Skeleton_arm_joint_L__2_": {
+            "children": [],
+            "jointName": "Skeleton_arm_joint_L__2_",
+            "name": "Skeleton_arm_joint_L__2_",
+            "rotation": [
+                -0.006119159981608391,
+                0.04232554882764816,
+                0.07877608388662338,
+                0.995974600315094
+            ],
+            "scale": [
+                1.000000238418579,
+                1.000000238418579,
+                0.9999998211860657
+            ],
+            "translation": [
+                0.000000014901200273698123,
+                0.18779200315475464,
+                0.0000000596045985901128
+            ]
+        },
+        "Skeleton_arm_joint_L__3_": {
+            "children": [
+                "Skeleton_arm_joint_L__2_"
+            ],
+            "jointName": "Skeleton_arm_joint_L__3_",
+            "name": "Skeleton_arm_joint_L__3_",
+            "rotation": [
+                0.013960931450128555,
+                0.12937265634536743,
+                0.2522056996822357,
+                0.9588848352432251
+            ],
+            "scale": [
+                1.0000001192092896,
+                1.0000001192092896,
+                1.0000003576278687
+            ],
+            "translation": [
+                0.00000000011641500263781523,
+                0.2420089989900589,
+                0
+            ]
+        },
+        "Skeleton_arm_joint_L__4_": {
+            "children": [
+                "Skeleton_arm_joint_L__3_"
+            ],
+            "jointName": "Skeleton_arm_joint_L__4_",
+            "name": "Skeleton_arm_joint_L__4_",
+            "rotation": [
+                0.6797326803207397,
+                0.6896856427192688,
+                -0.22697189450263977,
+                -0.10383138060569763
+            ],
+            "scale": [
+                1.0000005960464478,
+                1,
+                1.0000001192092896
+            ],
+            "translation": [
+                0.091013602912426,
+                0.000014185899999574758,
+                -0.000058054902183357626
+            ]
+        },
+        "Skeleton_arm_joint_R": {
+            "children": [
+                "Skeleton_arm_joint_R__2_"
+            ],
+            "jointName": "Skeleton_arm_joint_R",
+            "name": "Skeleton_arm_joint_R",
+            "rotation": [
+                -0.2964428663253784,
+                -0.03151031211018562,
+                0.652255117893219,
+                0.6969161033630371
+            ],
+            "scale": [
+                1,
+                0.9999998807907104,
+                0.9999996423721313
+            ],
+            "translation": [
+                -0.09098780155181885,
+                0.00006259980000322685,
+                -0.00006532669794978574
+            ]
+        },
+        "Skeleton_arm_joint_R__2_": {
+            "children": [
+                "Skeleton_arm_joint_R__3_"
+            ],
+            "jointName": "Skeleton_arm_joint_R__2_",
+            "name": "Skeleton_arm_joint_R__2_",
+            "rotation": [
+                -0.18879348039627075,
+                0.9157071113586426,
+                -0.1678091138601303,
+                -0.3125341236591339
+            ],
+            "scale": [
+                1.0000001192092896,
+                0.9999996423721313,
+                1.0000001192092896
+            ],
+            "translation": [
+                0,
+                0.2420080006122589,
+                -0.0000000596045985901128
+            ]
+        },
+        "Skeleton_arm_joint_R__3_": {
+            "children": [],
+            "jointName": "Skeleton_arm_joint_R__3_",
+            "name": "Skeleton_arm_joint_R__3_",
+            "rotation": [
+                0.05861387029290199,
+                -0.263776570558548,
+                -0.05226854607462883,
+                0.9613814949989319
+            ],
+            "scale": [
+                1.0000003576278687,
+                1.0000001192092896,
+                1.0000001192092896
+            ],
+            "translation": [
+                0,
+                0.18779200315475464,
+                0
+            ]
+        },
+        "Skeleton_neck_joint_1": {
+            "children": [
+                "Skeleton_neck_joint_2"
+            ],
+            "jointName": "Skeleton_neck_joint_1",
+            "name": "Skeleton_neck_joint_1",
+            "rotation": [
+                0.6606296300888062,
+                -0.00008344435627805069,
+                -0.0000710925814928487,
+                0.750711977481842
+            ],
+            "scale": [
+                1,
+                0.9999998211860657,
+                0.9999998807907104
+            ],
+            "translation": [
+                -0.000000008847560017954947,
+                0.0000000596045985901128,
+                0.06483659893274307
+            ]
+        },
+        "Skeleton_neck_joint_2": {
+            "children": [],
+            "jointName": "Skeleton_neck_joint_2",
+            "name": "Skeleton_neck_joint_2",
+            "rotation": [
+                0.000002552607611505664,
+                0.9996904730796814,
+                -0.02487965300679207,
+                -0.00000043299277763253485
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                0,
+                0.052039701491594315,
+                0
+            ]
+        },
+        "Skeleton_torso_joint_1": {
+            "children": [
+                "Skeleton_torso_joint_2",
+                "leg_joint_L_1",
+                "leg_joint_R_1"
+            ],
+            "jointName": "Skeleton_torso_joint_1",
+            "name": "Skeleton_torso_joint_1",
+            "rotation": [
+                0.026794692501425743,
+                0.026732537895441055,
+                0.7065614461898804,
+                0.706638753414154
+            ],
+            "scale": [
+                1,
+                1.0000001192092896,
+                1.0000001192092896
+            ],
+            "translation": [
+                -0.00000003352759847530251,
+                0.004999889992177486,
+                0.6790000200271606
+            ]
+        },
+        "Skeleton_torso_joint_2": {
+            "children": [
+                "torso_joint_3"
+            ],
+            "jointName": "Skeleton_torso_joint_2",
+            "name": "Skeleton_torso_joint_2",
+            "rotation": [
+                0.6572521924972534,
+                0.00017969278269447386,
+                0.00010428006498841569,
+                0.7536706924438477
+            ],
+            "scale": [
+                1.0000001192092896,
+                0.9999995231628418,
+                1.0000005960464478
+            ],
+            "translation": [
+                -0.00000001024449947095718,
+                0.000000014901200273698123,
+                0.1454170048236847
+            ]
+        },
+        "leg_joint_L_1": {
+            "children": [
+                "leg_joint_L_2"
+            ],
+            "jointName": "leg_joint_L_1",
+            "name": "leg_joint_L_1",
+            "rotation": [
+                0.247569739818573,
+                -0.5775678753852844,
+                0.7479144334793091,
+                -0.21388916671276093
+            ],
+            "scale": [
+                0.9999995827674866,
+                1.0000003576278687,
+                1.000000238418579
+            ],
+            "translation": [
+                0.06803669780492783,
+                -0.02851870097219944,
+                -0.06296280026435852
+            ]
+        },
+        "leg_joint_L_2": {
+            "children": [
+                "leg_joint_L_3"
+            ],
+            "jointName": "leg_joint_L_2",
+            "name": "leg_joint_L_2",
+            "rotation": [
+                -0.20902787148952484,
+                0.32988977432250977,
+                0.05559920147061348,
+                0.9189063310623169
+            ],
+            "scale": [
+                0.9999999403953552,
+                0.9999998211860657,
+                0.9999997615814209
+            ],
+            "translation": [
+                0.0000000037252898543727042,
+                0.2661130130290985,
+                0.000000014901200273698123
+            ]
+        },
+        "leg_joint_L_3": {
+            "children": [
+                "leg_joint_L_5"
+            ],
+            "jointName": "leg_joint_L_3",
+            "name": "leg_joint_L_3",
+            "rotation": [
+                -0.847739577293396,
+                0.004254061728715897,
+                0.009491981007158756,
+                0.5303107500076294
+            ],
+            "scale": [
+                1.0000003576278687,
+                1.0000001192092896,
+                1.0000004768371582
+            ],
+            "translation": [
+                -0.0000000074505797087454084,
+                0.27582401037216187,
+                0.00000000558793988858497
+            ]
+        },
+        "leg_joint_L_5": {
+            "children": [],
+            "jointName": "leg_joint_L_5",
+            "name": "leg_joint_L_5",
+            "rotation": [
+                0.0265735425055027,
+                -0.32014429569244385,
+                0.9445450305938721,
+                0.06808965653181076
+            ],
+            "scale": [
+                0.9999997019767761,
+                1.000000238418579,
+                0.9999999403953552
+            ],
+            "translation": [
+                -0.0023465200792998075,
+                -0.06617330014705658,
+                0.027856800705194473
+            ]
+        },
+        "leg_joint_R_1": {
+            "children": [
+                "leg_joint_R_2"
+            ],
+            "jointName": "leg_joint_R_1",
+            "name": "leg_joint_R_1",
+            "rotation": [
+                -0.06642694771289825,
+                -0.6115013360977173,
+                0.785027265548706,
+                0.07338760793209076
+            ],
+            "scale": [
+                0.9999995827674866,
+                0.9999997615814209,
+                1.000000238418579
+            ],
+            "translation": [
+                -0.06804200261831284,
+                -0.028570201247930527,
+                -0.06294959783554077
+            ]
+        },
+        "leg_joint_R_2": {
+            "children": [
+                "leg_joint_R_3"
+            ],
+            "jointName": "leg_joint_R_2",
+            "name": "leg_joint_R_2",
+            "rotation": [
+                -0.21629124879837036,
+                -0.1243065595626831,
+                -0.001575213740579784,
+                0.9683818817138672
+            ],
+            "scale": [
+                1.000000238418579,
+                0.9999996423721313,
+                1.0000001192092896
+            ],
+            "translation": [
+                0,
+                0.26611199975013733,
+                0
+            ]
+        },
+        "leg_joint_R_3": {
+            "children": [
+                "leg_joint_R_5"
+            ],
+            "jointName": "leg_joint_R_3",
+            "name": "leg_joint_R_3",
+            "rotation": [
+                -0.847274124622345,
+                0.02956405282020569,
+                0.020867986604571342,
+                0.5299217104911804
+            ],
+            "scale": [
+                1,
+                1,
+                1.0000001192092896
+            ],
+            "translation": [
+                0,
+                0.27582499384880066,
+                -0.000000011175900205273592
+            ]
+        },
+        "leg_joint_R_5": {
+            "children": [],
+            "jointName": "leg_joint_R_5",
+            "name": "leg_joint_R_5",
+            "rotation": [
+                -0.03726435825228691,
+                -0.3193131983280182,
+                0.9460533857345581,
+                -0.04041508957743645
+            ],
+            "scale": [
+                1,
+                1.0000007152557373,
+                1.000000238418579
+            ],
+            "translation": [
+                -0.0014584800228476524,
+                -0.06619880348443985,
+                0.027856700122356415
+            ]
+        },
+        "node_21": {
+            "children": [
+                "Armature",
+                "Cesium_Man"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                0,
+                -1,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Y_UP_Transform"
+        },
+        "torso_joint_3": {
+            "children": [
+                "Skeleton_neck_joint_1",
+                "Skeleton_arm_joint_L__4_",
+                "Skeleton_arm_joint_R"
+            ],
+            "jointName": "torso_joint_3",
+            "name": "torso_joint_3",
+            "rotation": [
+                -0.6226037740707397,
+                -0.000016783453247626312,
+                0.0000031824033612792846,
+                0.7825372219085693
+            ],
+            "scale": [
+                1,
+                0.9999997019767761,
+                0.9999997019767761
+            ],
+            "translation": [
+                0.0000000004656610097519831,
+                0.25051701068878174,
+                0.0000000037252898543727042
+            ]
+        }
+    },
+    "programs": {
+        "program_0": {
+            "attributes": [
+                "a_joint",
+                "a_normal",
+                "a_position",
+                "a_texcoord0",
+                "a_weight"
+            ],
+            "fragmentShader": "Cesium_Man0FS",
+            "vertexShader": "Cesium_Man0VS"
+        }
+    },
+    "samplers": {
+        "sampler_0": {
+            "magFilter": 9729,
+            "minFilter": 9729,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    },
+    "scene": "defaultScene",
+    "scenes": {
+        "defaultScene": {
+            "nodes": [
+                "node_21"
+            ]
+        }
+    },
+    "shaders": {
+        "Cesium_Man0FS": {
+            "type": 35632,
+            "uri": "Cesium_Man0FS.glsl"
+        },
+        "Cesium_Man0VS": {
+            "type": 35633,
+            "uri": "Cesium_Man0VS.glsl"
+        }
+    },
+    "skins": {
+        "Armature_Cesium_Man-skin": {
+            "bindShapeMatrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "inverseBindMatrices": "IBM_Armature_Cesium_Man-skin",
+            "jointNames": [
+                "Skeleton_torso_joint_1",
+                "Skeleton_torso_joint_2",
+                "torso_joint_3",
+                "Skeleton_neck_joint_1",
+                "Skeleton_neck_joint_2",
+                "Skeleton_arm_joint_L__4_",
+                "Skeleton_arm_joint_R",
+                "Skeleton_arm_joint_L__3_",
+                "Skeleton_arm_joint_R__2_",
+                "Skeleton_arm_joint_L__2_",
+                "Skeleton_arm_joint_R__3_",
+                "leg_joint_L_1",
+                "leg_joint_R_1",
+                "leg_joint_L_2",
+                "leg_joint_R_2",
+                "leg_joint_L_3",
+                "leg_joint_R_3",
+                "leg_joint_L_5",
+                "leg_joint_R_5"
+            ],
+            "name": "Armature"
+        }
+    },
+    "techniques": {
+        "technique0": {
+            "attributes": {
+                "a_joint": "joint",
+                "a_normal": "normal",
+                "a_position": "position",
+                "a_texcoord0": "texcoord0",
+                "a_weight": "weight"
+            },
+            "parameters": {
+                "ambient": {
+                    "type": 35666
+                },
+                "diffuse": {
+                    "type": 35678
+                },
+                "emission": {
+                    "type": 35666
+                },
+                "joint": {
+                    "semantic": "JOINT",
+                    "type": 35666
+                },
+                "jointMat": {
+                    "count": 19,
+                    "semantic": "JOINTMATRIX",
+                    "type": 35676
+                },
+                "modelViewMatrix": {
+                    "semantic": "MODELVIEW",
+                    "type": 35676
+                },
+                "normal": {
+                    "semantic": "NORMAL",
+                    "type": 35665
+                },
+                "normalMatrix": {
+                    "semantic": "MODELVIEWINVERSETRANSPOSE",
+                    "type": 35675
+                },
+                "position": {
+                    "semantic": "POSITION",
+                    "type": 35665
+                },
+                "projectionMatrix": {
+                    "semantic": "PROJECTION",
+                    "type": 35676
+                },
+                "shininess": {
+                    "type": 5126
+                },
+                "specular": {
+                    "type": 35666
+                },
+                "texcoord0": {
+                    "semantic": "TEXCOORD_0",
+                    "type": 35664
+                },
+                "weight": {
+                    "semantic": "WEIGHT",
+                    "type": 35666
+                }
+            },
+            "program": "program_0",
+            "states": {
+                "enable": [
+                    2929,
+                    2884
+                ]
+            },
+            "uniforms": {
+                "u_ambient": "ambient",
+                "u_diffuse": "diffuse",
+                "u_emission": "emission",
+                "u_jointMat": "jointMat",
+                "u_modelViewMatrix": "modelViewMatrix",
+                "u_normalMatrix": "normalMatrix",
+                "u_projectionMatrix": "projectionMatrix",
+                "u_shininess": "shininess",
+                "u_specular": "specular"
+            }
+        }
+    },
+    "textures": {
+        "texture_Cesium_Man_jpg": {
+            "format": 6408,
+            "internalFormat": 6408,
+            "sampler": "sampler_0",
+            "source": "Cesium_Man_jpg",
+            "target": 3553,
+            "type": 5121
+        }
+    }
+}

二進制
examples/models/gltf/CesiumMan/glTF/Cesium_Man.jpg


+ 25 - 0
examples/models/gltf/CesiumMan/glTF/Cesium_Man0FS.glsl

@@ -0,0 +1,25 @@
+precision highp float;
+varying vec3 v_normal;
+uniform vec4 u_ambient;
+varying vec2 v_texcoord0;
+uniform sampler2D u_diffuse;
+uniform vec4 u_emission;
+uniform vec4 u_specular;
+uniform float u_shininess;
+void main(void) {
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 emission;
+vec4 ambient;
+vec4 specular;
+ambient = u_ambient;
+diffuse = texture2D(u_diffuse, v_texcoord0);
+emission = u_emission;
+specular = u_specular;
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color.xyz += emission.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
+}

+ 22 - 0
examples/models/gltf/CesiumMan/glTF/Cesium_Man0VS.glsl

@@ -0,0 +1,22 @@
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+attribute vec4 a_joint;
+attribute vec4 a_weight;
+uniform mat4 u_jointMat[19];
+uniform mat3 u_normalMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+attribute vec2 a_texcoord0;
+varying vec2 v_texcoord0;
+void main(void) {
+mat4 skinMat = a_weight.x * u_jointMat[int(a_joint.x)];
+skinMat += a_weight.y * u_jointMat[int(a_joint.y)];
+skinMat += a_weight.z * u_jointMat[int(a_joint.z)];
+skinMat += a_weight.w * u_jointMat[int(a_joint.w)];
+vec4 pos = u_modelViewMatrix * skinMat * vec4(a_position,1.0);
+v_normal = u_normalMatrix * mat3(skinMat)* a_normal;
+v_texcoord0 = a_texcoord0;
+gl_Position = u_projectionMatrix * pos;
+}

+ 1 - 0
examples/models/gltf/CesiumMilkTruck/README.txt

@@ -0,0 +1 @@
+Donated by Cesium for glTF testing.  Please follow the Cesium Trademark Terms and Conditions: https://github.com/AnalyticalGraphicsInc/cesium/wiki/CesiumTrademark.pdf

二進制
examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.bin


+ 610 - 0
examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.gltf

@@ -0,0 +1,610 @@
+{
+    "accessors": {
+        "accessor_100": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 7032,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.999039,
+                0.999038,
+                1
+            ],
+            "min": [
+                -0.999038,
+                -0.999038,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_102": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 14064,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.993657,
+                0.989576
+            ],
+            "min": [
+                0.605093,
+                0.00905001
+            ],
+            "type": "VEC2"
+        },
+        "accessor_63": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 4608,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 5232,
+            "type": "SCALAR"
+        },
+        "accessor_66": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 15072,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 168,
+            "type": "SCALAR"
+        },
+        "accessor_69": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 15408,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 864,
+            "type": "SCALAR"
+        },
+        "accessor_71": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 18752,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                2.438,
+                2.58437,
+                1.396
+            ],
+            "min": [
+                -2.43091,
+                0.2668,
+                -1.396
+            ],
+            "type": "VEC3"
+        },
+        "accessor_73": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 47456,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                1,
+                1,
+                1
+            ],
+            "min": [
+                -1,
+                -1,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_75": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 76160,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                0.896458,
+                0.997245
+            ],
+            "min": [
+                0.00295639,
+                0.015672
+            ],
+            "type": "VEC2"
+        },
+        "accessor_96": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 0,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 2304,
+            "type": "SCALAR"
+        },
+        "accessor_98": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 0,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.4278,
+                0.4278,
+                1.058
+            ],
+            "min": [
+                -0.4278,
+                -0.4278,
+                -1.058
+            ],
+            "type": "VEC3"
+        },
+        "animAccessor_0": {
+            "bufferView": "bufferView_103",
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 31,
+            "type": "SCALAR"
+        },
+        "animAccessor_1": {
+            "bufferView": "bufferView_103",
+            "byteOffset": 124,
+            "componentType": 5126,
+            "count": 31,
+            "type": "VEC4"
+        }
+    },
+    "animations": {
+        "animation_0": {
+            "channels": [
+                {
+                    "sampler": "animation_0_rotation_sampler",
+                    "target": {
+                        "id": "Geometry-mesh001Node",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_1"
+            },
+            "samplers": {
+                "animation_0_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                }
+            }
+        },
+        "animation_1": {
+            "channels": [
+                {
+                    "sampler": "animation_1_rotation_sampler",
+                    "target": {
+                        "id": "meshInst962Node",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_1"
+            },
+            "samplers": {
+                "animation_1_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                }
+            }
+        }
+    },
+    "asset": {
+        "generator": "collada2gltf@cf6371beb0bdc18ba603378d5e40c966da53d385",
+        "premultipliedAlpha": true,
+        "profile": {
+            "api": "WebGL",
+            "version": "1.0.2"
+        },
+        "version": "1.0"
+    },
+    "bufferViews": {
+        "bufferView_103": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 620,
+            "byteOffset": 0
+        },
+        "bufferView_104": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 17136,
+            "byteOffset": 620,
+            "target": 34963
+        },
+        "bufferView_105": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 95296,
+            "byteOffset": 17756,
+            "target": 34962
+        }
+    },
+    "buffers": {
+        "CesiumMilkTruck": {
+            "byteLength": 113052,
+            "type": "arraybuffer",
+            "uri": "CesiumMilkTruck.bin"
+        }
+    },
+    "extensions": {
+        "KHR_materials_common": {
+            "lights": {
+                "Light-polyRender006": {
+                    "ambient": {
+                        "color": [
+                            0,
+                            0,
+                            0
+                        ]
+                    },
+                    "name": "Render",
+                    "type": "ambient"
+                }
+            }
+        }
+    },
+    "extensionsUsed": [
+        "KHR_materials_common"
+    ],
+    "images": {
+        "Image0001": {
+            "name": "Image0001",
+            "uri": "CesiumMilkTruck.png"
+        }
+    },
+    "materials": {
+        "Effect-glass": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 0,
+                    "technique": "PHONG",
+                    "transparent": false,
+                    "values": {
+                        "diffuse": [
+                            0,
+                            0.0405063,
+                            0.0212407,
+                            1
+                        ],
+                        "shininess": 256,
+                        "specular": [
+                            0.65,
+                            0.65,
+                            0.65,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "glass"
+        },
+        "Effect-truck": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 0,
+                    "technique": "PHONG",
+                    "transparent": false,
+                    "values": {
+                        "diffuse": "texture_Image0001",
+                        "shininess": 256,
+                        "specular": [
+                            0.04,
+                            0.04,
+                            0.04,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "truck"
+        },
+        "Effect-wheels": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 0,
+                    "technique": "PHONG",
+                    "transparent": false,
+                    "values": {
+                        "diffuse": "texture_Image0001",
+                        "shininess": 256,
+                        "specular": [
+                            0.04,
+                            0.04,
+                            0.04,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "wheels"
+        },
+        "Effect-window_trim": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 0,
+                    "technique": "PHONG",
+                    "transparent": false,
+                    "values": {
+                        "diffuse": [
+                            0.064,
+                            0.064,
+                            0.064,
+                            1
+                        ],
+                        "shininess": 256,
+                        "specular": [
+                            0.04,
+                            0.04,
+                            0.04,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "window_trim"
+        }
+    },
+    "meshes": {
+        "Geometry-mesh001": {
+            "name": "Wheels",
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_100",
+                        "POSITION": "accessor_98",
+                        "TEXCOORD_0": "accessor_102"
+                    },
+                    "indices": "accessor_96",
+                    "material": "Effect-wheels",
+                    "mode": 4
+                }
+            ]
+        },
+        "Geometry-mesh002": {
+            "name": "Cesium_Milk_Truck",
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_63",
+                    "material": "Effect-truck",
+                    "mode": 4
+                },
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_66",
+                    "material": "Effect-glass",
+                    "mode": 4
+                },
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_69",
+                    "material": "Effect-window_trim",
+                    "mode": 4
+                }
+            ]
+        }
+    },
+    "nodes": {
+        "Geometry-mesh001Node": {
+            "children": [],
+            "meshes": [
+                "Geometry-mesh001"
+            ],
+            "name": "Wheels",
+            "rotation": [
+                0,
+                0,
+                -0.0884856,
+                0.996077
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                1.43267,
+                0.427722,
+                -2.98023e-008
+            ]
+        },
+        "Geometry-mesh002Node": {
+            "children": [
+                "Geometry-mesh001Node",
+                "meshInst962Node"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "meshes": [
+                "Geometry-mesh002"
+            ],
+            "name": "Cesium_Milk_Truck"
+        },
+        "groupLocator006Node": {
+            "children": [
+                "txtrLocator003Node",
+                "txtrLocator013Node"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Texture_Group"
+        },
+        "meshInst962Node": {
+            "children": [],
+            "meshes": [
+                "Geometry-mesh001"
+            ],
+            "name": "Wheels__2_",
+            "rotation": [
+                0,
+                0,
+                -0.0884856,
+                0.996077
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -1.35233,
+                0.427722,
+                -2.98023e-008
+            ]
+        },
+        "polyRender006": {
+            "children": [],
+            "extensions": {
+                "KHR_materials_common": {
+                    "light": "Light-polyRender006"
+                }
+            },
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Render"
+        },
+        "txtrLocator003Node": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Cesium_Milk_Truck__2___Image___Texture_"
+        },
+        "txtrLocator013Node": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Cesium_Milk_Truck__2___Image___2___Texture_"
+        }
+    },
+    "samplers": {
+        "sampler_0": {
+            "magFilter": 9729,
+            "minFilter": 9987,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    },
+    "scene": "defaultScene",
+    "scenes": {
+        "defaultScene": {
+            "nodes": [
+                "polyRender006",
+                "Geometry-mesh002Node",
+                "groupLocator006Node"
+            ]
+        }
+    },
+    "skins": {},
+    "textures": {
+        "texture_Image0001": {
+            "format": 6408,
+            "internalFormat": 6408,
+            "sampler": "sampler_0",
+            "source": "Image0001",
+            "target": 3553,
+            "type": 5121
+        }
+    }
+}

二進制
examples/models/gltf/CesiumMilkTruck/glTF-MaterialsCommon/CesiumMilkTruck.png


二進制
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.bin


+ 705 - 0
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.gltf

@@ -0,0 +1,705 @@
+{
+    "accessors": {
+        "accessor_100": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 7032,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.999039,
+                0.999038,
+                1
+            ],
+            "min": [
+                -0.999038,
+                -0.999038,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_102": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 14064,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.993657,
+                0.989576
+            ],
+            "min": [
+                0.605093,
+                0.00905001
+            ],
+            "type": "VEC2"
+        },
+        "accessor_63": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 4608,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 5232,
+            "type": "SCALAR"
+        },
+        "accessor_66": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 15072,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 168,
+            "type": "SCALAR"
+        },
+        "accessor_69": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 15408,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 864,
+            "type": "SCALAR"
+        },
+        "accessor_71": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 18752,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                2.438,
+                2.58437,
+                1.396
+            ],
+            "min": [
+                -2.43091,
+                0.2668,
+                -1.396
+            ],
+            "type": "VEC3"
+        },
+        "accessor_73": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 47456,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                1,
+                1,
+                1
+            ],
+            "min": [
+                -1,
+                -1,
+                -1
+            ],
+            "type": "VEC3"
+        },
+        "accessor_75": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 76160,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 2392,
+            "max": [
+                0.896458,
+                0.997245
+            ],
+            "min": [
+                0.00295639,
+                0.015672
+            ],
+            "type": "VEC2"
+        },
+        "accessor_96": {
+            "bufferView": "bufferView_104",
+            "byteOffset": 0,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 2304,
+            "type": "SCALAR"
+        },
+        "accessor_98": {
+            "bufferView": "bufferView_105",
+            "byteOffset": 0,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 586,
+            "max": [
+                0.4278,
+                0.4278,
+                1.058
+            ],
+            "min": [
+                -0.4278,
+                -0.4278,
+                -1.058
+            ],
+            "type": "VEC3"
+        },
+        "animAccessor_0": {
+            "bufferView": "bufferView_103",
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 31,
+            "type": "SCALAR"
+        },
+        "animAccessor_1": {
+            "bufferView": "bufferView_103",
+            "byteOffset": 124,
+            "componentType": 5126,
+            "count": 31,
+            "type": "VEC4"
+        }
+    },
+    "animations": {
+        "animation_0": {
+            "channels": [
+                {
+                    "sampler": "animation_0_rotation_sampler",
+                    "target": {
+                        "id": "Geometry-mesh001Node",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_1"
+            },
+            "samplers": {
+                "animation_0_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                }
+            }
+        },
+        "animation_1": {
+            "channels": [
+                {
+                    "sampler": "animation_1_rotation_sampler",
+                    "target": {
+                        "id": "meshInst962Node",
+                        "path": "rotation"
+                    }
+                }
+            ],
+            "parameters": {
+                "TIME": "animAccessor_0",
+                "rotation": "animAccessor_1"
+            },
+            "samplers": {
+                "animation_1_rotation_sampler": {
+                    "input": "TIME",
+                    "interpolation": "LINEAR",
+                    "output": "rotation"
+                }
+            }
+        }
+    },
+    "asset": {
+        "generator": "collada2gltf@ceec062e3d5793f2f249f53cbd843aee382ad40b",
+        "premultipliedAlpha": true,
+        "profile": {
+            "api": "WebGL",
+            "version": "1.0.2"
+        },
+        "version": 1
+    },
+    "bufferViews": {
+        "bufferView_103": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 620,
+            "byteOffset": 0
+        },
+        "bufferView_104": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 17136,
+            "byteOffset": 620,
+            "target": 34963
+        },
+        "bufferView_105": {
+            "buffer": "CesiumMilkTruck",
+            "byteLength": 95296,
+            "byteOffset": 17756,
+            "target": 34962
+        }
+    },
+    "buffers": {
+        "CesiumMilkTruck": {
+            "byteLength": 113052,
+            "type": "arraybuffer",
+            "uri": "CesiumMilkTruck.bin"
+        }
+    },
+    "images": {
+        "Image0001": {
+            "name": "Image0001",
+            "uri": "CesiumMilkTruck.png"
+        }
+    },
+    "materials": {
+        "Effect-glass": {
+            "name": "glass",
+            "technique": "technique0",
+            "values": {
+                "diffuse": [
+                    0,
+                    0.0405063,
+                    0.0212407,
+                    1
+                ],
+                "shininess": 256,
+                "specular": [
+                    0.65,
+                    0.65,
+                    0.65,
+                    1
+                ]
+            }
+        },
+        "Effect-truck": {
+            "name": "truck",
+            "technique": "technique1",
+            "values": {
+                "diffuse": "texture_Image0001",
+                "shininess": 256,
+                "specular": [
+                    0.04,
+                    0.04,
+                    0.04,
+                    1
+                ]
+            }
+        },
+        "Effect-wheels": {
+            "name": "wheels",
+            "technique": "technique1",
+            "values": {
+                "diffuse": "texture_Image0001",
+                "shininess": 256,
+                "specular": [
+                    0.04,
+                    0.04,
+                    0.04,
+                    1
+                ]
+            }
+        },
+        "Effect-window_trim": {
+            "name": "window_trim",
+            "technique": "technique0",
+            "values": {
+                "diffuse": [
+                    0.064,
+                    0.064,
+                    0.064,
+                    1
+                ],
+                "shininess": 256,
+                "specular": [
+                    0.04,
+                    0.04,
+                    0.04,
+                    1
+                ]
+            }
+        }
+    },
+    "meshes": {
+        "Geometry-mesh001": {
+            "name": "Wheels",
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_100",
+                        "POSITION": "accessor_98",
+                        "TEXCOORD_0": "accessor_102"
+                    },
+                    "indices": "accessor_96",
+                    "material": "Effect-wheels",
+                    "mode": 4
+                }
+            ]
+        },
+        "Geometry-mesh002": {
+            "name": "Cesium_Milk_Truck",
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_63",
+                    "material": "Effect-truck",
+                    "mode": 4
+                },
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_66",
+                    "material": "Effect-glass",
+                    "mode": 4
+                },
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_73",
+                        "POSITION": "accessor_71",
+                        "TEXCOORD_0": "accessor_75"
+                    },
+                    "indices": "accessor_69",
+                    "material": "Effect-window_trim",
+                    "mode": 4
+                }
+            ]
+        }
+    },
+    "nodes": {
+        "Geometry-mesh001Node": {
+            "children": [],
+            "meshes": [
+                "Geometry-mesh001"
+            ],
+            "name": "Wheels",
+            "rotation": [
+                0,
+                0,
+                -0.0884856,
+                0.996077
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                1.43267,
+                0.427722,
+                -2.98023e-008
+            ]
+        },
+        "Geometry-mesh002Node": {
+            "children": [
+                "Geometry-mesh001Node",
+                "meshInst962Node"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "meshes": [
+                "Geometry-mesh002"
+            ],
+            "name": "Cesium_Milk_Truck"
+        },
+        "groupLocator006Node": {
+            "children": [
+                "txtrLocator003Node",
+                "txtrLocator013Node"
+            ],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Texture_Group"
+        },
+        "meshInst962Node": {
+            "children": [],
+            "meshes": [
+                "Geometry-mesh001"
+            ],
+            "name": "Wheels__2_",
+            "rotation": [
+                0,
+                0,
+                -0.0884856,
+                0.996077
+            ],
+            "scale": [
+                1,
+                1,
+                1
+            ],
+            "translation": [
+                -1.35233,
+                0.427722,
+                -2.98023e-008
+            ]
+        },
+        "polyRender006": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Render"
+        },
+        "txtrLocator003Node": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Cesium_Milk_Truck__2___Image___Texture_"
+        },
+        "txtrLocator013Node": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "name": "Cesium_Milk_Truck__2___Image___2___Texture_"
+        }
+    },
+    "programs": {
+        "program_0": {
+            "attributes": [
+                "a_normal",
+                "a_position"
+            ],
+            "fragmentShader": "CesiumMilkTruck0FS",
+            "vertexShader": "CesiumMilkTruck0VS"
+        },
+        "program_1": {
+            "attributes": [
+                "a_normal",
+                "a_position",
+                "a_texcoord0"
+            ],
+            "fragmentShader": "CesiumMilkTruck1FS",
+            "vertexShader": "CesiumMilkTruck1VS"
+        }
+    },
+    "samplers": {
+        "sampler_0": {
+            "magFilter": 9729,
+            "minFilter": 9987,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    },
+    "scene": "defaultScene",
+    "scenes": {
+        "defaultScene": {
+            "nodes": [
+                "polyRender006",
+                "Geometry-mesh002Node",
+                "groupLocator006Node"
+            ]
+        }
+    },
+    "shaders": {
+        "CesiumMilkTruck0FS": {
+            "type": 35632,
+            "uri": "CesiumMilkTruck0FS.glsl"
+        },
+        "CesiumMilkTruck0VS": {
+            "type": 35633,
+            "uri": "CesiumMilkTruck0VS.glsl"
+        },
+        "CesiumMilkTruck1FS": {
+            "type": 35632,
+            "uri": "CesiumMilkTruck1FS.glsl"
+        },
+        "CesiumMilkTruck1VS": {
+            "type": 35633,
+            "uri": "CesiumMilkTruck1VS.glsl"
+        }
+    },
+    "skins": {},
+    "techniques": {
+        "technique0": {
+            "attributes": {
+                "a_normal": "normal",
+                "a_position": "position"
+            },
+            "parameters": {
+                "diffuse": {
+                    "type": 35666
+                },
+                "modelViewMatrix": {
+                    "semantic": "MODELVIEW",
+                    "type": 35676
+                },
+                "normal": {
+                    "semantic": "NORMAL",
+                    "type": 35665
+                },
+                "normalMatrix": {
+                    "semantic": "MODELVIEWINVERSETRANSPOSE",
+                    "type": 35675
+                },
+                "position": {
+                    "semantic": "POSITION",
+                    "type": 35665
+                },
+                "projectionMatrix": {
+                    "semantic": "PROJECTION",
+                    "type": 35676
+                },
+                "shininess": {
+                    "type": 5126
+                },
+                "specular": {
+                    "type": 35666
+                }
+            },
+            "program": "program_0",
+            "states": {
+                "enable": [
+                    2929,
+                    2884
+                ]
+            },
+            "uniforms": {
+                "u_diffuse": "diffuse",
+                "u_modelViewMatrix": "modelViewMatrix",
+                "u_normalMatrix": "normalMatrix",
+                "u_projectionMatrix": "projectionMatrix",
+                "u_shininess": "shininess",
+                "u_specular": "specular"
+            }
+        },
+        "technique1": {
+            "attributes": {
+                "a_normal": "normal",
+                "a_position": "position",
+                "a_texcoord0": "texcoord0"
+            },
+            "parameters": {
+                "diffuse": {
+                    "type": 35678
+                },
+                "modelViewMatrix": {
+                    "semantic": "MODELVIEW",
+                    "type": 35676
+                },
+                "normal": {
+                    "semantic": "NORMAL",
+                    "type": 35665
+                },
+                "normalMatrix": {
+                    "semantic": "MODELVIEWINVERSETRANSPOSE",
+                    "type": 35675
+                },
+                "position": {
+                    "semantic": "POSITION",
+                    "type": 35665
+                },
+                "projectionMatrix": {
+                    "semantic": "PROJECTION",
+                    "type": 35676
+                },
+                "shininess": {
+                    "type": 5126
+                },
+                "specular": {
+                    "type": 35666
+                },
+                "texcoord0": {
+                    "semantic": "TEXCOORD_0",
+                    "type": 35664
+                }
+            },
+            "program": "program_1",
+            "states": {
+                "enable": [
+                    2929,
+                    2884
+                ]
+            },
+            "uniforms": {
+                "u_diffuse": "diffuse",
+                "u_modelViewMatrix": "modelViewMatrix",
+                "u_normalMatrix": "normalMatrix",
+                "u_projectionMatrix": "projectionMatrix",
+                "u_shininess": "shininess",
+                "u_specular": "specular"
+            }
+        }
+    },
+    "textures": {
+        "texture_Image0001": {
+            "format": 6408,
+            "internalFormat": 6408,
+            "sampler": "sampler_0",
+            "source": "Image0001",
+            "target": 3553,
+            "type": 5121
+        }
+    }
+}

二進制
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck.png


+ 17 - 0
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck0FS.glsl

@@ -0,0 +1,17 @@
+precision highp float;
+varying vec3 v_normal;
+uniform vec4 u_diffuse;
+uniform vec4 u_specular;
+uniform float u_shininess;
+void main(void) {
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 specular;
+diffuse = u_diffuse;
+specular = u_specular;
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
+}

+ 12 - 0
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck0VS.glsl

@@ -0,0 +1,12 @@
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+uniform mat3 u_normalMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+void main(void) {
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+v_normal = u_normalMatrix * a_normal;
+gl_Position = u_projectionMatrix * pos;
+}

+ 18 - 0
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck1FS.glsl

@@ -0,0 +1,18 @@
+precision highp float;
+varying vec3 v_normal;
+varying vec2 v_texcoord0;
+uniform sampler2D u_diffuse;
+uniform vec4 u_specular;
+uniform float u_shininess;
+void main(void) {
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 specular;
+diffuse = texture2D(u_diffuse, v_texcoord0);
+specular = u_specular;
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
+}

+ 15 - 0
examples/models/gltf/CesiumMilkTruck/glTF/CesiumMilkTruck1VS.glsl

@@ -0,0 +1,15 @@
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+uniform mat3 u_normalMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+attribute vec2 a_texcoord0;
+varying vec2 v_texcoord0;
+void main(void) {
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+v_normal = u_normalMatrix * a_normal;
+v_texcoord0 = a_texcoord0;
+gl_Position = u_projectionMatrix * pos;
+}

+ 7 - 13
examples/models/gltf/duck/README.txt

@@ -1,13 +1,7 @@
----UPDATED 2/21/2007

-Scaled down the duck to a more reasonable size, removed physics scene, removed extra "dummy" transforms and pivot points, added camera and light.

----

-

-This model is a typical bathtub rubber duck.  It uses a single texture.

-

-One version uses a polylist the other is triangles only.

-

-The model has been stripped of all <extra> tags and should be COLLADA 1.4.1 compliant.

-

-For additional information post messages on www.collada.org or mail [email protected]

-

-These models are Copyright 2006 Sony Computer Entertainment Inc. and are distributed under the terms of the SCEA Shared Source License, available at http://research.scea.com/scea_shared_source_license.html
+Copyright 2006 Sony Computer Entertainment Inc.
+
+Licensed under the SCEA Shared Source License, Version 1.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://research.scea.com/scea_shared_source_license.html
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

二進制
examples/models/gltf/duck/duck.bin


File diff suppressed because it is too large
+ 0 - 122
examples/models/gltf/duck/duck.dae


二進制
examples/models/gltf/duck/glTF-MaterialsCommon/duck.bin


+ 291 - 0
examples/models/gltf/duck/glTF-MaterialsCommon/duck.gltf

@@ -0,0 +1,291 @@
+{
+    "accessors": {
+        "accessor_21": {
+            "bufferView": "bufferView_29",
+            "byteOffset": 0,
+            "byteStride": 0,
+            "componentType": 5123,
+            "count": 12636,
+            "type": "SCALAR"
+        },
+        "accessor_23": {
+            "bufferView": "bufferView_30",
+            "byteOffset": 0,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                0.961799,
+                1.6397,
+                0.539252
+            ],
+            "min": [
+                -0.692985,
+                0.0992937,
+                -0.613282
+            ],
+            "type": "VEC3"
+        },
+        "accessor_25": {
+            "bufferView": "bufferView_30",
+            "byteOffset": 28788,
+            "byteStride": 12,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                0.999599,
+                0.999581,
+                0.998436
+            ],
+            "min": [
+                -0.999084,
+                -1,
+                -0.999832
+            ],
+            "type": "VEC3"
+        },
+        "accessor_27": {
+            "bufferView": "bufferView_30",
+            "byteOffset": 57576,
+            "byteStride": 8,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                0.983346,
+                0.980037
+            ],
+            "min": [
+                0.026409,
+                0.019963
+            ],
+            "type": "VEC2"
+        }
+    },
+    "animations": {},
+    "asset": {
+        "generator": "collada2gltf@cf6371beb0bdc18ba603378d5e40c966da53d385",
+        "premultipliedAlpha": true,
+        "profile": {
+            "api": "WebGL",
+            "version": "1.0.2"
+        },
+        "version": "1.0"
+    },
+    "bufferViews": {
+        "bufferView_29": {
+            "buffer": "duck",
+            "byteLength": 25272,
+            "byteOffset": 0,
+            "target": 34963
+        },
+        "bufferView_30": {
+            "buffer": "duck",
+            "byteLength": 76768,
+            "byteOffset": 25272,
+            "target": 34962
+        }
+    },
+    "buffers": {
+        "duck": {
+            "byteLength": 102040,
+            "type": "arraybuffer",
+            "uri": "duck.bin"
+        }
+    },
+    "cameras": {
+        "cameraShape1": {
+            "name": "cameraShape1",
+            "perspective": {
+                "aspect_ratio": 1.5,
+                "yfov": 0.660593,
+                "zfar": 100,
+                "znear": 0.01
+            },
+            "type": "perspective"
+        }
+    },
+    "extensions": {
+        "KHR_materials_common": {
+            "lights": {
+                "directionalLightShape1-lib": {
+                    "directional": {
+                        "color": [
+                            1,
+                            1,
+                            1
+                        ]
+                    },
+                    "name": "directionalLightShape1",
+                    "type": "directional"
+                }
+            }
+        }
+    },
+    "extensionsUsed": [
+        "KHR_materials_common"
+    ],
+    "images": {
+        "file2": {
+            "name": "file2",
+            "uri": "duckCM.png"
+        }
+    },
+    "materials": {
+        "blinn3-fx": {
+            "extensions": {
+                "KHR_materials_common": {
+                    "doubleSided": false,
+                    "jointCount": 0,
+                    "technique": "BLINN",
+                    "transparent": false,
+                    "values": {
+                        "ambient": [
+                            0,
+                            0,
+                            0,
+                            1
+                        ],
+                        "diffuse": "texture_file2",
+                        "emission": [
+                            0,
+                            0,
+                            0,
+                            1
+                        ],
+                        "shininess": 38.4,
+                        "specular": [
+                            0,
+                            0,
+                            0,
+                            1
+                        ]
+                    }
+                }
+            },
+            "name": "blinn3"
+        }
+    },
+    "meshes": {
+        "LOD3spShape-lib": {
+            "name": "LOD3spShape",
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": "accessor_25",
+                        "POSITION": "accessor_23",
+                        "TEXCOORD_0": "accessor_27"
+                    },
+                    "indices": "accessor_21",
+                    "material": "blinn3-fx",
+                    "mode": 4
+                }
+            ]
+        }
+    },
+    "nodes": {
+        "LOD3sp": {
+            "children": [],
+            "matrix": [
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1,
+                0,
+                0,
+                0,
+                0,
+                1
+            ],
+            "meshes": [
+                "LOD3spShape-lib"
+            ],
+            "name": "LOD3sp"
+        },
+        "camera1": {
+            "camera": "cameraShape1",
+            "children": [],
+            "matrix": [
+                -0.728969,
+                0,
+                -0.684547,
+                0,
+                -0.425205,
+                0.783693,
+                0.452797,
+                0,
+                0.536475,
+                0.621148,
+                -0.571288,
+                0,
+                4.00113,
+                4.63264,
+                -4.31078,
+                1
+            ],
+            "name": "camera1"
+        },
+        "directionalLight1": {
+            "children": [],
+            "extensions": {
+                "KHR_materials_common": {
+                    "light": "directionalLightShape1-lib"
+                }
+            },
+            "matrix": [
+                -0.954692,
+                0.218143,
+                -0.202429,
+                0,
+                0.014672,
+                0.713885,
+                0.700109,
+                0,
+                0.297235,
+                0.665418,
+                -0.684741,
+                0,
+                1.48654,
+                1.83672,
+                -2.92179,
+                1
+            ],
+            "name": "directionalLight1"
+        }
+    },
+    "samplers": {
+        "sampler_0": {
+            "magFilter": 9729,
+            "minFilter": 9987,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    },
+    "scene": "defaultScene",
+    "scenes": {
+        "defaultScene": {
+            "nodes": [
+                "LOD3sp",
+                "camera1",
+                "directionalLight1"
+            ]
+        }
+    },
+    "skins": {},
+    "textures": {
+        "texture_file2": {
+            "format": 6408,
+            "internalFormat": 6408,
+            "sampler": "sampler_0",
+            "source": "file2",
+            "target": 3553,
+            "type": 5121
+        }
+    }
+}

+ 0 - 0
examples/models/gltf/duck/duckCM.png → examples/models/gltf/duck/glTF-MaterialsCommon/duckCM.png


Some files were not shown because too many files changed in this diff