浏览代码

Merge branch 'dev' into vec3-applyMatrix4-applyProjection

Franklin Ta 8 年之前
父节点
当前提交
4cccaa1796
共有 36 个文件被更改,包括 841 次插入178 次删除
  1. 5 5
      docs/api/cameras/OrthographicCamera.html
  2. 5 5
      docs/api/cameras/PerspectiveCamera.html
  3. 25 2
      docs/api/core/Object3D.html
  4. 14 1
      docs/api/deprecated/DeprecatedList.html
  5. 0 1
      docs/api/lights/DirectionalLight.html
  6. 2 1
      docs/api/lights/PointLight.html
  7. 70 6
      docs/api/lights/shadows/DirectionalLightShadow.html
  8. 82 16
      docs/api/lights/shadows/LightShadow.html
  9. 63 4
      docs/api/lights/shadows/SpotLightShadow.html
  10. 0 62
      docs/api/loaders/BinaryTextureLoader.html
  11. 47 2
      docs/api/loaders/DataTextureLoader.html
  12. 1 2
      docs/api/math/Vector2.html
  13. 1 2
      docs/api/math/Vector3.html
  14. 1 2
      docs/api/math/Vector4.html
  15. 0 1
      docs/list.js
  16. 1 1
      docs/page.js
  17. 62 14
      examples/js/loaders/GLTFLoader.js
  18. 5 5
      examples/js/loaders/RGBELoader.js
  19. 30 4
      examples/js/renderers/CanvasRenderer.js
  20. 8 0
      examples/models/gltf/snowflake/line_frag.glsl
  21. 17 0
      examples/models/gltf/snowflake/line_vert.glsl
  22. 二进制
      examples/models/gltf/snowflake/snowFlake.bin
  23. 133 0
      examples/models/gltf/snowflake/snowFlake.gltf
  24. 8 0
      examples/models/gltf/snowflakes/line_frag.glsl
  25. 17 0
      examples/models/gltf/snowflakes/line_vert.glsl
  26. 二进制
      examples/models/gltf/snowflakes/snowFlakes.bin
  27. 150 0
      examples/models/gltf/snowflakes/snowFlakes.gltf
  28. 20 1
      examples/webgl_loader_gltf.html
  29. 38 0
      src/Three.Legacy.js
  30. 1 1
      src/Three.js
  31. 3 4
      src/loaders/DataTextureLoader.js
  32. 1 1
      src/math/Box3.js
  33. 2 2
      src/math/Vector2.js
  34. 2 2
      src/math/Vector3.js
  35. 2 2
      src/math/Vector4.js
  36. 25 29
      src/objects/Mesh.js

+ 5 - 5
docs/api/cameras/OrthographicCamera.html

@@ -67,8 +67,7 @@ scene.add( camera );</code>
 		<div>
 		Camera frustum far plane. Default is *2000*.<br /><br />
 
-		Note that Three does not currently give warnings for incorrect values here, however the expected
-		range is between the current value of the [page:.far far] plane and infinity.
+		The valid range is between the current value of the [page:.near near] plane and infinity.
 		</div>
 
 		<h3>[property:Boolean isOrthographicCamera]</h3>
@@ -83,10 +82,11 @@ scene.add( camera );</code>
 
 		<h3>[property:Float near]</h3>
 		<div>
-			Camera fustum near plane. Default is *0.1*.<br /><br />
+			Camera frustum near plane. Default is *0.1*.<br /><br />
 
-			Note that Three does not currently give warnings for incorrect values here, however the expected
-			range is between 0 and the current value of the [page:.far far] plane.
+			The valid range is between 0 and the current value of the [page:.far far] plane.
+			Note that, unlike for the [page:PerspectiveCamera], *0* is a valid value for an
+			OrthographicCamera's near plane.
 		</div>
 
 		<h3>[property:Float right]</h3>

+ 5 - 5
docs/api/cameras/PerspectiveCamera.html

@@ -57,8 +57,7 @@ scene.add( camera );</code>
 		<div>
 			Camera frustum far plane. Default is *2000*.<br /><br />
 
-			Note that Three does not currently give warnings for incorrect values here, however the expected
-			range is between the current value of the [page:.far far] plane and infinity.
+			The valid range is between the current value of the [page:.near near] plane and infinity.
 		</div>
 
 		<h3>[property:Float filmGauge]</h3>
@@ -86,10 +85,11 @@ scene.add( camera );</code>
 
 		<h3>[property:Float near]</h3>
 		<div>
-			Camera fustum near plane. Default is *0.1*.<br /><br />
+			Camera frustum near plane. Default is *0.1*.<br /><br />
 
-			Note that Three does not currently give warnings for incorrect values here, however the expected
-			range is between 0 and the current value of the [page:.far far] plane.
+			The valid range is greater than 0 and less than the current value of the [page:.far far] plane.
+			Note that, unlike for the [page:OrthographicCamera], *0* is <em>not</em> a valid value
+			for a PerspectiveCamera's near plane.
 		</div>
 
 		<h3>[property:Object view]</h3>

+ 25 - 2
docs/api/core/Object3D.html

@@ -64,7 +64,7 @@
 		<h3>[property:Boolean matrixAutoUpdate]</h3>
 		<div>
 		When this is set, it calculates the matrix of position, (rotation or quaternion) and
-		scale every frame and also recalculates the matrixWorld property. Default is *true*.
+		scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DefaultMatrixAutoUpdate] (true).
 		</div>
 
 		<h3>[property:Matrix4 matrixWorld]</h3>
@@ -132,7 +132,10 @@
 		</div>
 
 		<h3>[property:Vector3 up]</h3>
-		<div>Up direction. Default is [page:Vector3]( 0, 1, 0 ).</div>
+		<div>
+		This is used by the [page:.lookAt lookAt] method, for example, to determine the orientation of the result.<br />
+		Default is [page:Object3D.DefaultUp] - that is, ( 0, 1, 0 ).
+		</div>
 
 		<h3>[property:object userData]</h3>
 		<div>
@@ -152,7 +155,27 @@
 
 
 
+		<h2>Static Properties</h2>
+		<div>
+			Static properties and methods are defined per class rather than per instance of that class.
+			This means that changing [page:Object3D.DefaultUp] or [page:Object3D.DefaultMatrixAutoUpdate]
+			will change the values of [page:.up up] and [page:.matrixAutoUpdate matrixAutoUpdate] for
+			<em>every</em>	instance of Object3D (or derived classes)	created after the change has
+			been made (already created Object3Ds will not be affected).
+		</div>
+
+		<h3>[property:Vector3 DefaultUp]</h3>
+		<div>
+			The default [page:.up up] direction for objects, also used as the default position for [page:DirectionalLight],
+			[page:HemisphereLight] and [page:Spotlight] (which creates lights shining from the top down).<br />
+			Set to (0, 1, 0) by default.
+		</div>
+
+		<h3>[property:Vector3 DefaultMatrixAutoUpdate]</h3>
+		<div>
+			The default setting for [page.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.<br />
 
+		</div>
 
 
 		<h2>Methods</h2>

+ 14 - 1
docs/api/deprecated/DeprecatedList.html

@@ -34,6 +34,8 @@
 		<h3>[page:AudioAnalyser]</h3>
 		<div>AudioAnalyser.getData() has been renamed to [page:AudioAnalyser.getFrequencyData]().</div>
 
+		<h3>[page:BinaryTextureLoader]</h3>
+		<div>BinaryTextureLoader has been renamed to [page:DataTextureLoader].</div>
 
 
 
@@ -354,6 +356,10 @@
 			Ray.isIntersectionSphere has been renamed to [page:Ray.intersectsSphere].
 		</div>
 
+		<h3>[page:Vector2]</h3>
+		<div>
+			Vector2.fromAttribute() has been renamed to [page:Vector2.fromBufferAttribute]().
+		</div>
 
 		<h3>[page:Vector3]</h3>
 		<div>
@@ -367,7 +373,14 @@
 
 			Vector3.getColumnFromMatrix() has been renamed to [page:Vector3.setFromMatrixColumn]().<br /><br />
 
-			Vector3.applyProjection() has been removed. Use [page:Vector3.applyMatrix4]() instead.
+			Vector3.applyProjection() has been removed. Use [page:Vector3.applyMatrix4]() instead.<br /><br />
+
+			Vector3.fromAttribute() has been renamed to [page:Vector3.fromBufferAttribute]().
+		</div>
+
+		<h3>[page:Vector4]</h3>
+		<div>
+			Vector4.fromAttribute() has been renamed to [page:Vector4.fromBufferAttribute]().
 		</div>
 
 		<h3>[page:Vertex]</h3>

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

@@ -54,7 +54,6 @@
 		<code>
 // White directional light at half intensity shining from the top.
 var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
-directionalLight.position.set( 0, 1, 0 );
 scene.add( directionalLight );
 	</code>
 

+ 2 - 1
docs/api/lights/PointLight.html

@@ -95,7 +95,8 @@ scene.add( light );
 
 		<h3>[property:LightShadow shadow]</h3>
 		<div>
-			A [page:LightShadow] used to calculate shadows for this light.<br />
+			A [page:LightShadow] used to calculate shadows for this light.<br /><br />
+
 			 The lightShadow's [page:LightShadow.camera camera]
 			is set to a  [page:PerspectiveCamera] with [page:PerspectiveCamera.fov fov] of 90,
 			[page:PerspectiveCamera.aspect aspect] of 1, [page:PerspectiveCamera.near near]

+ 70 - 6
docs/api/lights/shadows/DirectionalLightShadow.html

@@ -12,19 +12,83 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">TODO</div>
+		<div class="desc">
+			This used internally by [page:DirectionalLight DirectionalLights] for calculating shadows.<br /><br />
 
-		<h2>Constructor</h2>
+			Unlike the other shadow classes, this uses an [page:OrthographicCamera] to calculate the shadows,
+			rather than a [page:PerspectiveCamera]. This is because light rays from a [page:DirectionalLight]
+			are parallel.
+		</div>
+
+		<h2>Example</h2>
+		<div>
+			<code>
+//Create a WebGLRenderer and turn on shadows in the renderer
+var renderer = new THREE.WebGLRenderer();
+renderer.shadowMap.enabled = true;
+renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
+
+//Create a DirectionalLight and turn on shadows for the light
+var light = new THREE.DirectionalLight( 0xffffff, 1, 100 );
+light.position.set( 0, 1, 0 ); 			//default; light shining from top
+light.castShadow = true;            // default false
+scene.add( light );
+
+//Set up shadow properties for the light
+light.shadow.mapSize.width = 512;  // default
+light.shadow.mapSize.height = 512; // default
+light.shadow.camera.near = 0.5;       // default
+light.shadow.camera.far = 500      // default
+
+//Create a sphere that cast shadows (but does not receive them)
+var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 );
+var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } );
+var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
+sphere.castShadow = true; //default is false
+sphere.receiveShadow = false; //default
+scene.add( sphere );
+
+//Create a plane that receives shadows (but does not cast them)
+var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 );
+var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } )
+var plane = new THREE.Mesh( planeGeometry, planeMaterial );
+plane.receiveShadow = true;
+scene.add( plane );
 
-		The constructor creates an [page:OrthographicCamera OrthographicCamera] to manage the shadow's view of the world.
+//Create a helper for the shadow camera (optional)
+var helper = new THREE.CameraHelper( light.shadow.camera );
+scene.add( helper );
+			</code>
+		</div>
+
+		<h2>Constructor</h2>
+		<h3>[name]( [page:Integer hex], [page:Float intensity] )</h3>
+		<div>
+			Creates a new [name]. This is not intended to be called directly - it is called
+			internally by [page:DirectionalLight].
+		</div>
 
 		<h2>Properties</h2>
+		<div>
+			See the base [page:LightShadow LightShadow] class for common properties.
+		</div>
 
-		See the base [page:LightShadow LightShadow] class for common properties.
+		<h3>[property:Camera camera]</h3>
+		<div>
+			The light's view of the world. This is used to generate a depth map of the scene; objects behind
+			other objects from the light's perspective will be in shadow.<br /><br />
 
-		<h2>Methods</h2>
+			The default is an [page:OrthographicCamera] with [page:OrthographicCamera.left left] and
+			[page:OrthographicCamera.bottom bottom] set to -5,  [page:OrthographicCamera.right right]
+			and  [page:OrthographicCamera.top top] set to 5, the [page:OrthographicCamera.near near]
+			clipping plane at 0.5 and the [page:OrthographicCamera.far far] clipping plane at 500.
+		</div>
 
-		See the base [page:LightShadow LightShadow] class for common methods.
+
+		<h2>Methods</h2>
+		<div>
+			See the base [page:LightShadow LightShadow] class for common methods.
+		</div>
 
 		<h2>Source</h2>
 

+ 82 - 16
docs/api/lights/shadows/LightShadow.html

@@ -11,61 +11,127 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">TODO</div>
+		<div class="desc">
+			This used internally by [page:PointLight PointLights] for calculating shadows, and also serves as
+			a base class for the other shadow classes.
+		</div>
 
-		<h2>Constructor</h2>
 
+		<h2>Example</h2>
+		<div>
+			<code>
+//Create a WebGLRenderer and turn on shadows in the renderer
+var renderer = new THREE.WebGLRenderer();
+renderer.shadowMap.enabled = true;
+renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
+
+//Create a PointLight and turn on shadows for the light
+var light = new THREE.PointLight( 0xffffff, 1, 100 );
+light.position.set( 0, 10, 0 );
+light.castShadow = true;            // default false
+scene.add( light );
+
+//Set up shadow properties for the light
+light.shadow.mapSize.width = 512;  // default
+light.shadow.mapSize.height = 512; // default
+light.shadow.camera.near = 0.5;       // default
+light.shadow.camera.far = 500      // default
+
+//Create a sphere that cast shadows (but does not receive them)
+var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 );
+var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } );
+var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
+sphere.castShadow = true; //default is false
+sphere.receiveShadow = false; //default
+scene.add( sphere );
+
+//Create a plane that receives shadows (but does not cast them)
+var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 );
+var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } )
+var plane = new THREE.Mesh( planeGeometry, planeMaterial );
+plane.receiveShadow = true;
+scene.add( plane );
+
+//Create a helper for the shadow camera (optional)
+var helper = new THREE.CameraHelper( light.shadow.camera );
+scene.add( helper );
+			</code>
+		</div>
+
+		<h2>Constructor</h2>
 
 		<h3>[name]( [page:Camera camera] )</h3>
 		<div>
-		[page:Camera camera] — The shadow's view of the world.
+		[page:Camera camera] - the light's view of the world.<br /><br />
+
+		Create a new [name]. This is not intended to be called directly - it is called
+		internally by [page:PointLight] or used as a base class by other light shadows.
 		</div>
 
 		<h2>Properties</h2>
 
 		<h3>[property:Camera camera]</h3>
 		<div>
-			The shadow's view of the world.
+			The light's view of the world. This is used to generate a depth map of the scene; objects behind
+			other objects from the light's perspective will be in shadow.
 		</div>
 
 		<h3>[property:Float bias]</h3>
 		<div>
 			Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow.<br />
-			Default — *0*.
+			The default is 0. Very tiny adjustments here (in the order of 0.0001) may help reduce artefacts in shadows
 		</div>
 
-		<h3>[property:Float radius]</h3>
+		<h3>[property:WebGLRenderTarget map]</h3>
 		<div>
-			TODO<br />
-			Default - *0*.
+			The depth map generated using the internal camera; a location beyond a pixel's depth is
+			in shadow. Computed internally during rendering.
 		</div>
 
+
 		<h3>[property:Vector2 mapSize]</h3>
 		<div>
-			The width and height of the shadow map stored in a [page:Vector2 Vector2].<br />
-			Default — *( 512, 512 )*.
+			A [Page:Vector2] defining the width and height of the shadow map.<br /><br />
+
+			Higher values give better quality shadows at the cost of computation time. Values must be
+			powers of 2, up to the [page:WebGLRenderer.capabilities].maxTextureSize for a given device,
+			although the width and height don't have to be the same (so, for example, (512, 1024) is valid).
+			The default is *( 512, 512 )*.
 		</div>
 
-		<h3>[property:WebGLRenderTarget map]</h3>
+
+		<h3>[property:Matrix4 matrix]</h3>
 		<div>
-			The depth map generated using the internal camera; a location beyond a pixel's depth is in shadow. Computed internally during rendering.
+			Model to shadow camera space, to compute location and depth in shadow map. Stored
+			in a [page:Matrix4 Matrix4]. This is computed internally during rendering.
 		</div>
 
-		<h3>[property:Matrix4 matrix]</h3>
+		<h3>[property:Float radius]</h3>
 		<div>
-			Model to shadow camera space, to compute location and depth in shadow map. Stored in a [page:Matrix4 Matrix4]. Computed internally during rendering.
+			Setting this this to values greater than 1 will blur the edges of the shadow.<br />
+
+			High values will cause unwanted banding effects in the shadows - a greater [page:.mapSize mapSize]
+			will allow for a higher value to be used here before these effects become visible.<br /><br />
+
+			Note that this has no effect if the [page:WebGLRenderer.shadowMap.type] is set to [page:Renderer BasicShadowMap].
 		</div>
 
 
 		<h2>Methods</h2>
 		<h3>[method:LightShadow copy]( [page:LightShadow source] )</h3>
 		<div>
-		Copies value of *source* to this LightShadow object.
+		Copies value of all the properties from the [page:LightShadow source] to this
+		SpotLight.
 		</div>
 
 		<h3>[method:LightShadow clone]()</h3>
 		<div>
-		It returns a clone of LightShadow.
+		Creates a new LightShadow with the same properties as this one.
+		</div>
+
+		<h3>[method:Object toJSON]()</h3>
+		<div>
+		Serialize this LightShadow.
 		</div>
 
 		<h2>Source</h2>

+ 63 - 4
docs/api/lights/shadows/SpotLightShadow.html

@@ -12,23 +12,82 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">TODO</div>
+		<div class="desc">
+			This used internally by [page:SpotLight SpotLights] for calculating shadows.
+		</div>
+
+		<h2>Example</h2>
+		<div>
+			<code>
+//Create a WebGLRenderer and turn on shadows in the renderer
+var renderer = new THREE.WebGLRenderer();
+renderer.shadowMap.enabled = true;
+renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
+
+//Create a SpotLight and turn on shadows for the light
+var light = new THREE.SpotLight( 0xffffff );
+light.castShadow = true;            // default false
+scene.add( light );
+
+//Set up shadow properties for the light
+light.shadow.mapSize.width = 512;  // default
+light.shadow.mapSize.height = 512; // default
+light.shadow.camera.near = 0.5;       // default
+light.shadow.camera.far = 500      // default
+
+//Create a sphere that cast shadows (but does not receive them)
+var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 );
+var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } );
+var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial );
+sphere.castShadow = true; //default is false
+sphere.receiveShadow = false; //default
+scene.add( sphere );
+
+//Create a plane that receives shadows (but does not cast them)
+var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 );
+var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } )
+var plane = new THREE.Mesh( planeGeometry, planeMaterial );
+plane.receiveShadow = true;
+scene.add( plane );
+
+//Create a helper for the shadow camera (optional)
+var helper = new THREE.CameraHelper( light.shadow.camera );
+scene.add( helper );
+			</code>
+		</div>
+
 
 		<h2>Constructor</h2>
 
 		The constructor creates a [page:PerspectiveCamera PerspectiveCamera] to manage the shadow's view of the world.
 
 		<h2>Properties</h2>
-
 		See the base [page:LightShadow LightShadow] class for common properties.
 
-		<h2>Methods</h2>
 
+	 <h3>[property:Camera camera]</h3>
+	 <div>
+		 The light's view of the world. This is used to generate a depth map of the scene; objects behind
+		 other objects from the light's perspective will be in shadow.<br /><br />
+
+		 The default is a  [page:PerspectiveCamera] with [page:PerspectiveCamera.fov fov] of 90,
+	  [page:PerspectiveCamera.aspect aspect] of 1, [page:PerspectiveCamera.near near]
+		clipping plane at 0.5 and	[page:PerspectiveCamera.far far] clipping plane at 500.
+	 </div>
+
+	 <h3>[property:Boolean isSpotLightShadow]</h3>
+	 <div>
+		 Used to check whether this or derived classes are spot light shadows. Default is *true*.<br /><br />
+
+		 You should not change this, as it used internally for optimisation.
+	 </div>
+
+		<h2>Methods</h2>
 		See the base [page:LightShadow LightShadow] class for common methods.
 
 		<h3>[method:SpotLightShadow update]( [page:SpotLight light] )</h3>
 		<div>
-		Updates the internal perspective camera.
+		Updates the internal perspective [page:.camera camera] based on the passed in [page:SpotLight light].
 		</div>
 
 		<h2>Source</h2>

+ 0 - 62
docs/api/loaders/BinaryTextureLoader.html

@@ -1,62 +0,0 @@
-<!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>
-		<h1>[name]</h1>
-
-		<div class="desc">
-		Abstract base class to load generic binary textures formats (rgbe, hdr, ...).
-		This uses the [page:FileLoader] internally for loading files.
-		</div>
-
-		<h2>Examples</h2>
-
-		<div>
-			See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
-			for an example of a derived class.
-		</div>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [page:LoadingManager manager] )</h3>
-		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
-		Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
-
-		Creates a new [name].
-		</div>
-
-
-		<h2>Properties</h2>
-
-		<h3>[property:LoadingManager manager]</h3>
-		<div>
-		The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
-		</div>
-
-
-		<h2>Methods</h2>
-
-		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
-		<div>
-		[page:String url] — the path or URL to the file. This can also be a
-			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
-		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
-		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
-		[page:Function onError] — Will be called when load errors.<br />
-		</div>
-		<div>
-		Begin loading from url and pass the loaded texture to onLoad.
-		</div>
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>

+ 47 - 2
docs/api/loaders/DataTextureLoader.html

@@ -10,9 +10,54 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">This is an alias for the [page:BinaryTextureLoader BinaryTextureLoader].
-			See that page for details.
+		<div class="desc">
+		Abstract base class to load generic binary textures formats (rgbe, hdr, ...).
+		This uses the [page:FileLoader] internally for loading files, and creates a new
+		[page:DataTexture].
 		</div>
 
+		<h2>Examples</h2>
+
+		<div>
+			See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
+			for an example of a derived class.
+		</div>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]( [page:LoadingManager manager] )</h3>
+		<div>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
+		Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
+		Creates a new [name].
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+		The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
+		<div>
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
+		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
+		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
+		[page:Function onError] — Will be called when load errors.<br />
+		</div>
+		<div>
+		Begin loading from url and pass the loaded texture to onLoad.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 	</body>
 </html>

+ 1 - 2
docs/api/math/Vector2.html

@@ -184,11 +184,10 @@
 		Sets this vector's [page:.x x] value to be array[0] and [page:.y y] value to be array[1].
 		</div>
 
-		<h3>[method:Vector2 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector2 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x] and [page:.y y] values from the [page:BufferAttribute attribute].
 		</div>

+ 1 - 2
docs/api/math/Vector3.html

@@ -220,11 +220,10 @@ var d = a.distanceTo( b );
 		and [page:.z z] value to be array[ offset + 2 ].
 		</div>
 
-		<h3>[method:Vector3 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector3 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] values from the [page:BufferAttribute attribute].
 		</div>

+ 1 - 2
docs/api/math/Vector4.html

@@ -157,11 +157,10 @@ var d = a.distanceTo( b );
 		[page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ].
 		</div>
 
-		<h3>[method:Vector4 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector4 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values from the [page:BufferAttribute attribute].
 		</div>

+ 0 - 1
docs/list.js

@@ -195,7 +195,6 @@ var list = {
 		"Loaders": [
 			[ "AnimationLoader", "api/loaders/AnimationLoader" ],
 			[ "AudioLoader", "api/loaders/AudioLoader" ],
-			[ "BinaryTextureLoader", "api/loaders/BinaryTextureLoader" ],
 			[ "BufferGeometryLoader", "api/loaders/BufferGeometryLoader" ],
 			[ "Cache", "api/loaders/Cache" ],
 			[ "CompressedTextureLoader", "api/loaders/CompressedTextureLoader" ],

+ 1 - 1
docs/page.js

@@ -43,7 +43,7 @@ var onDocumentLoad = function ( event ) {
 	text = text.replace( /\[example:([\w\_]+)\]/gi, "[example:$1 $1]" ); // [example:name] to [example:name title]
 	text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, "<a href=\"../examples/#$1\"  target=\"_blank\">$2</a>" ); // [example:name title]
 
-
+	
 	document.body.innerHTML = text;
 
 	// handle code snippets formatting

+ 62 - 14
examples/js/loaders/GLTFLoader.js

@@ -301,6 +301,7 @@ THREE.GLTFLoader = ( function () {
 		REPEAT: 10497,
 		SAMPLER_2D: 35678,
 		TRIANGLES: 4,
+		LINES: 1,
 		UNSIGNED_BYTE: 5121,
 		UNSIGNED_SHORT: 5123,
 
@@ -1206,27 +1207,60 @@ THREE.GLTFLoader = ( function () {
 
 						if ( primitive.indices ) {
 
-							var indexArray = dependencies.accessors[ primitive.indices ];
+							geometry.setIndex( dependencies.accessors[ primitive.indices ] );
 
-							geometry.setIndex( indexArray );
+						}
 
-							var offset = {
-								start: 0,
-								index: 0,
-								count: indexArray.count
-							};
+						var material = dependencies.materials[ primitive.material ];
+
+						var meshNode = new THREE.Mesh( geometry, material );
+						meshNode.castShadow = true;
 
-							geometry.groups.push( offset );
+						if ( primitive.extras ) meshNode.userData = primitive.extras;
 
-							geometry.computeBoundingSphere();
+						group.add( meshNode );
 
-						}
+					} else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {
+
+						var geometry = new THREE.BufferGeometry();
+
+						var attributes = primitive.attributes;
+
+						_each( attributes, function ( attributeEntry, attributeId ) {
+
+							if ( ! attributeEntry ) return;
+
+							var bufferAttribute = dependencies.accessors[ attributeEntry ];
 
+							switch ( attributeId ) {
+
+								case 'POSITION':
+									geometry.addAttribute( 'position', bufferAttribute );
+									break;
+
+								case 'COLOR':
+									geometry.addAttribute( 'color', bufferAttribute );
+									break;
+
+							}
+
+						} );
 
 						var material = dependencies.materials[ primitive.material ];
 
-						var meshNode = new THREE.Mesh( geometry, material );
-						meshNode.castShadow = true;
+						var meshNode;
+
+						if ( primitive.indices ) {
+
+							geometry.setIndex( dependencies.accessors[ primitive.indices ] );
+
+							meshNode = new THREE.LineSegments( geometry, material );
+
+						} else {
+
+							meshNode = new THREE.Line( geometry, material );
+
+						}
 
 						if ( primitive.extras ) meshNode.userData = primitive.extras;
 
@@ -1234,7 +1268,7 @@ THREE.GLTFLoader = ( function () {
 
 					} else {
 
-						console.warn( "Non-triangular primitives are not supported" );
+						console.warn( "Only triangular and line primitives are supported" );
 
 					}
 
@@ -1475,7 +1509,21 @@ THREE.GLTFLoader = ( function () {
 
 								}
 
-								child = new THREE.Mesh( originalGeometry, material );
+								switch ( child.type ) {
+
+									case 'LineSegments':
+										child = new THREE.LineSegments( originalGeometry, material );
+										break;
+
+									case 'Line':
+										child = new THREE.Line( originalGeometry, material );
+										break;
+
+									default:
+										child = new THREE.Mesh( originalGeometry, material );
+
+								}
+
 								child.castShadow = true;
 								child.userData = originalUserData;
 

+ 5 - 5
examples/js/loaders/RGBELoader.js

@@ -11,8 +11,8 @@ THREE.HDRLoader = THREE.RGBELoader = function ( manager ) {
 
 };
 
-// extend THREE.BinaryTextureLoader
-THREE.RGBELoader.prototype = Object.create( THREE.BinaryTextureLoader.prototype );
+// extend THREE.DataTextureLoader
+THREE.RGBELoader.prototype = Object.create( THREE.DataTextureLoader.prototype );
 
 // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
 THREE.RGBELoader.prototype._parser = function( buffer ) {
@@ -112,16 +112,16 @@ THREE.RGBELoader.prototype._parser = function( buffer ) {
 
 					programtype: 'RGBE',              /* listed at beginning of file to identify it
 													* after "#?".  defaults to "RGBE" */
-														
+
 					format: '',                       /* RGBE format, default 32-bit_rle_rgbe */
 
 					gamma: 1.0,                       /* image has already been gamma corrected with
 													* given gamma.  defaults to 1.0 (no correction) */
-														
+
 					exposure: 1.0,                    /* a value of 1.0 in an image corresponds to
 													* <exposure> watts/steradian/m^2.
 													* defaults to 1.0 */
-														
+
 					width: 0, height: 0               /* image dimensions, width/height */
 
 				}

+ 30 - 4
examples/js/renderers/CanvasRenderer.js

@@ -854,16 +854,42 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 		}
 
+		var repeatX = texture.wrapS === THREE.RepeatWrapping || texture.wrapS === THREE.MirroredRepeatWrapping;
+		var repeatY = texture.wrapT === THREE.RepeatWrapping || texture.wrapT === THREE.MirroredRepeatWrapping;
+
+		var mirrorX = texture.wrapS === THREE.MirroredRepeatWrapping;
+		var mirrorY = texture.wrapT === THREE.MirroredRepeatWrapping;
+
+		//
+
 		var canvas = document.createElement( 'canvas' );
-		canvas.width = image.width;
-		canvas.height = image.height;
+		canvas.width = image.width * ( mirrorX ? 2 : 1 );
+		canvas.height = image.height * ( mirrorY ? 2 : 1 );
 
 		var context = canvas.getContext( '2d' );
 		context.setTransform( 1, 0, 0, - 1, 0, image.height );
 		context.drawImage( image, 0, 0 );
 
-		var repeatX = texture.wrapS === THREE.RepeatWrapping;
-		var repeatY = texture.wrapT === THREE.RepeatWrapping;
+		if ( mirrorX === true ) {
+
+			context.setTransform( - 1, 0, 0, - 1, image.width, image.height );
+			context.drawImage( image, - image.width, 0 );
+
+		}
+
+		if ( mirrorY === true ) {
+
+			context.setTransform( 1, 0, 0, 1, 0, 0 );
+			context.drawImage( image, 0, image.height );
+
+		}
+
+		if ( mirrorX === true && mirrorY === true ) {
+
+			context.setTransform( - 1, 0, 0, 1, image.width, 0 );
+			context.drawImage( image, - image.width, image.height );
+
+		}
 
 		var repeat = 'no-repeat';
 

+ 8 - 0
examples/models/gltf/snowflake/line_frag.glsl

@@ -0,0 +1,8 @@
+precision highp float;
+varying vec3 vertexColor;
+
+void main(void) {
+
+	gl_FragColor = vec4(vertexColor.r, vertexColor.g, vertexColor.b, 1.0);;
+	
+}

+ 17 - 0
examples/models/gltf/snowflake/line_vert.glsl

@@ -0,0 +1,17 @@
+precision highp float;
+
+attribute vec3 position;
+attribute vec3 color;
+
+uniform mat4 modelViewMatrix;
+uniform mat4 projectionMatrix;
+
+varying vec3 vertexColor;
+
+void main(void) {
+
+	vec4 pos = modelViewMatrix * vec4(position,1.0);
+	vertexColor = vec3(color.x, color.y, color.y);
+	gl_Position = projectionMatrix * pos;
+	
+}

二进制
examples/models/gltf/snowflake/snowFlake.bin


+ 133 - 0
examples/models/gltf/snowflake/snowFlake.gltf

@@ -0,0 +1,133 @@
+{
+  "accessors": {
+    "VertexAccessor": {
+      "bufferView": "VertexBuffer",
+      "byteOffset": 0,
+      "byteStride": 12,
+      "componentType": 5126,
+      "count": 257,
+      "type": "VEC3",
+      "name": "VertexAccessor"
+    },
+    "ColorAccessor": {
+      "bufferView": "ColorView",
+      "byteOffset": 0,
+      "byteStride": 12,
+      "componentType": 5126,
+      "count": 257,
+      "type": "VEC3",
+      "name": "ColorAccessor"
+    }
+  },
+  "buffers": {
+    "Buffer": {
+      "uri": "snowFlake.bin",
+      "byteLength": 6168,
+      "type": "arraybuffer",
+      "name": "Buffer",
+      "extensions": {}
+    }
+  },
+  "bufferViews": {
+    "VertexBuffer": {
+      "buffer": "Buffer",
+      "byteOffset": 0,
+      "byteLength": 3084,
+      "target": 34962,
+      "name": "VertexBuffer"
+    },
+    "ColorView": {
+      "buffer": "Buffer",
+      "byteOffset": 3084,
+      "byteLength": 3084,
+      "target": 34962,
+      "name": "ColorView"
+    }
+  },
+  "images": {},
+  "materials": {
+    "meshMaterial": {
+      "technique": "meshTechnique",
+      "values": {},
+      "name": "meshMaterial"
+    }
+  },
+  "meshes": {
+    "mesh": {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": "VertexAccessor",
+            "COLOR": "ColorAccessor"
+          },
+          "material": "meshMaterial",
+          "mode": 1
+        }
+      ],
+      "name": "mesh"
+    }
+  },
+  "nodes": {
+    "node1": {
+      "children": [],
+      "meshes": [
+        "mesh"
+      ],
+      "name": "node1"
+    }
+  },
+  "programs": {
+    "meshProgram": {
+      "attributes": [
+        "VertexAccessor",
+        "ColorAccessor"
+      ],
+      "fragmentShader": "fragmentShader",
+      "vertexShader": "vertexShader",
+      "name": "shader"
+    }
+  },
+  "samplers": {},
+  "scene": "default scene",
+  "scenes": {
+    "default scene": {
+      "nodes": [
+        "node1"
+      ],
+      "name": "default scene"
+    }
+  },
+  "shaders": {
+    "fragmentShader": {
+      "uri": "line_frag.glsl",
+      "type": 35632,
+      "name": "fragmentShader"
+    },
+    "vertexShader": {
+      "uri": "line_vert.glsl",
+      "type": 35633,
+      "name": "vertexShader"
+    }
+  },
+  "techniques": {
+    "meshTechnique": {
+      "parameters": {
+        "color": {
+          "type": 35665,
+          "semantic": "color"
+        }
+      },
+      "attributes": {},
+      "program": "meshProgram",
+      "uniforms": {},
+      "states": {
+        "enable": [
+          3042,
+          2929
+        ]
+      },
+      "name": "meshTechnique"
+    }
+  },
+  "textures": {}
+}

+ 8 - 0
examples/models/gltf/snowflakes/line_frag.glsl

@@ -0,0 +1,8 @@
+precision highp float;
+varying vec3 vertexColor;
+
+void main(void) {
+
+	gl_FragColor = vec4(vertexColor.r, vertexColor.g, vertexColor.b, 1.0);;
+	
+}

+ 17 - 0
examples/models/gltf/snowflakes/line_vert.glsl

@@ -0,0 +1,17 @@
+precision highp float;
+
+attribute vec3 position;
+attribute vec3 color;
+
+uniform mat4 modelViewMatrix;
+uniform mat4 projectionMatrix;
+
+varying vec3 vertexColor;
+
+void main(void) {
+
+	vec4 pos = modelViewMatrix * vec4(position,1.0);
+	vertexColor = vec3(color.x, color.y, color.y);
+	gl_Position = projectionMatrix * pos;
+	
+}

二进制
examples/models/gltf/snowflakes/snowFlakes.bin


+ 150 - 0
examples/models/gltf/snowflakes/snowFlakes.gltf

@@ -0,0 +1,150 @@
+{
+  "accessors": {
+    "VertexAccessor": {
+      "bufferView": "VertexBuffer",
+      "byteOffset": 0,
+      "byteStride": 12,
+      "componentType": 5126,
+      "count": 1376,
+      "type": "VEC3",
+      "name": "VertexAccessor"
+    },
+    "TriangleAccessor": {
+      "bufferView": "Lines",
+      "byteOffset": 0,
+      "byteStride": 2,
+      "componentType": 5123,
+      "count": 2720,
+      "type": "SCALAR",
+      "name": "TriangleAccessor"
+    },
+    "ColorAccessor": {
+      "bufferView": "ColorView",
+      "byteOffset": 0,
+      "byteStride": 12,
+      "componentType": 5126,
+      "count": 1376,
+      "type": "VEC3",
+      "name": "ColorAccessor"
+    }
+  },
+  "buffers": {
+    "Buffer": {
+      "uri": "snowFlakes.bin",
+      "byteLength": 38464,
+      "type": "arraybuffer",
+      "name": "Buffer",
+      "extensions": {}
+    }
+  },
+  "bufferViews": {
+    "VertexBuffer": {
+      "buffer": "Buffer",
+      "byteOffset": 0,
+      "byteLength": 16512,
+      "target": 34962,
+      "name": "VertexBuffer"
+    },
+    "Lines": {
+      "buffer": "Buffer",
+      "byteOffset": 16512,
+      "byteLength": 5440,
+      "target": 34962,
+      "name": "Lines"
+    },
+    "ColorView": {
+      "buffer": "Buffer",
+      "byteOffset": 21952,
+      "byteLength": 16512,
+      "target": 34962,
+      "name": "ColorView"
+    }
+  },
+  "images": {},
+  "materials": {
+    "meshMaterial": {
+      "technique": "meshTechnique",
+      "values": {},
+      "name": "meshMaterial"
+    }
+  },
+  "meshes": {
+    "mesh": {
+      "primitives": [
+        {
+          "attributes": {
+            "POSITION": "VertexAccessor",
+            "COLOR": "ColorAccessor"
+          },
+          "indices": "TriangleAccessor",
+          "material": "meshMaterial",
+          "mode": 1
+        }
+      ],
+      "name": "mesh"
+    }
+  },
+  "nodes": {
+    "node1": {
+      "children": [],
+      "meshes": [
+        "mesh"
+      ],
+      "name": "node1"
+    }
+  },
+  "programs": {
+    "meshProgram": {
+      "attributes": [
+        "VertexAccessor",
+        "ColorAccessor"
+      ],
+      "fragmentShader": "fragmentShader",
+      "vertexShader": "vertexShader",
+      "name": "shader"
+    }
+  },
+  "samplers": {},
+  "scene": "default scene",
+  "scenes": {
+    "default scene": {
+      "nodes": [
+        "node1"
+      ],
+      "name": "default scene"
+    }
+  },
+  "shaders": {
+    "fragmentShader": {
+      "uri": "line_frag.glsl",
+      "type": 35632,
+      "name": "fragmentShader"
+    },
+    "vertexShader": {
+      "uri": "line_vert.glsl",
+      "type": 35633,
+      "name": "vertexShader"
+    }
+  },
+  "techniques": {
+    "meshTechnique": {
+      "parameters": {
+        "color": {
+          "type": 35665,
+          "semantic": "color"
+        }
+      },
+      "attributes": {},
+      "program": "meshProgram",
+      "uniforms": {},
+      "states": {
+        "enable": [
+          3042,
+          2929
+        ]
+      },
+      "name": "meshTechnique"
+    }
+  },
+  "textures": {}
+}

+ 20 - 1
examples/webgl_loader_gltf.html

@@ -94,7 +94,7 @@
 		<a href="https://github.com/KhronosGroup/glTF" target="_blank">glTF</a> loader -
 		<br>
 		monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a> -
-		COLLADA duck by Sony - other models courtesy <a href="http://cesiumjs.org/" target="_blank">Cesium</a>
+		COLLADA duck by Sony - Cesium models courtesy <a href="http://cesiumjs.org/" target="_blank">Cesium</a>
 		</div>
 	<div id="container">
 	</div>
@@ -429,6 +429,25 @@
 					addLights:true,
 					addGround:true,
 					shadows:true
+				},
+				{
+					name : "Snowflake",
+					url : "./models/gltf/snowflake/snowFlake.gltf",
+					objectScale: new THREE.Vector3(4, 4, 1),
+					cameraPos: new THREE.Vector3(0, 100, 5000),
+					objectPosition: new THREE.Vector3(0, 0, 0),
+					addLights:false,
+					addGround:false,
+					shadows:false
+				},
+				{
+					name : "Snowflakes",
+					url : "./models/gltf/snowflakes/snowFlakes.gltf",
+					cameraPos: new THREE.Vector3(0, 100, 5000),
+					objectPosition: new THREE.Vector3(-1200, -1200, 0),
+					addLights:false,
+					addGround:false,
+					shadows:false
 				}
 			];
 

+ 38 - 0
src/Three.Legacy.js

@@ -35,6 +35,7 @@ import { Light } from './lights/Light.js';
 import { FileLoader } from './loaders/FileLoader.js';
 import { AudioLoader } from './loaders/AudioLoader.js';
 import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
+import { DataTextureLoader } from './loaders/DataTextureLoader.js';
 import { TextureLoader } from './loaders/TextureLoader.js';
 import { Material } from './materials/Material.js';
 import { LineBasicMaterial } from './materials/LineBasicMaterial.js';
@@ -52,7 +53,9 @@ import { Matrix4 } from './math/Matrix4.js';
 import { Plane } from './math/Plane.js';
 import { Quaternion } from './math/Quaternion.js';
 import { Ray } from './math/Ray.js';
+import { Vector2 } from './math/Vector2.js';
 import { Vector3 } from './math/Vector3.js';
+import { Vector4 } from './math/Vector4.js';
 import { LineSegments } from './objects/LineSegments.js';
 import { LOD } from './objects/LOD.js';
 import { Points } from './objects/Points.js';
@@ -267,6 +270,13 @@ export function XHRLoader( manager ) {
 
 }
 
+export function BinaryTextureLoader( manager ) {
+
+	console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );
+	return new DataTextureLoader( manager );
+
+}
+
 //
 
 Object.assign( Box2.prototype, {
@@ -541,6 +551,17 @@ Object.assign( Shape.prototype, {
 
 } );
 
+Object.assign( Vector2.prototype, {
+
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
+	}
+
+} );
+
 Object.assign( Vector3.prototype, {
 
 	setEulerFromRotationMatrix: function () {
@@ -576,6 +597,23 @@ Object.assign( Vector3.prototype, {
 		console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );
 		return this.applyMatrix4( m );
 
+	},
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
+	}
+
+} );
+
+Object.assign( Vector4.prototype, {
+
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
 	}
 
 } );

+ 1 - 1
src/Three.js

@@ -32,7 +32,7 @@ export { Texture } from './textures/Texture.js';
 export * from './geometries/Geometries.js';
 export * from './materials/Materials.js';
 export { CompressedTextureLoader } from './loaders/CompressedTextureLoader.js';
-export { BinaryTextureLoader, DataTextureLoader } from './loaders/BinaryTextureLoader.js';
+export { DataTextureLoader } from './loaders/DataTextureLoader.js';
 export { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
 export { TextureLoader } from './loaders/TextureLoader.js';
 export { ObjectLoader } from './loaders/ObjectLoader.js';

+ 3 - 4
src/loaders/BinaryTextureLoader.js → src/loaders/DataTextureLoader.js

@@ -9,8 +9,7 @@ import { DefaultLoadingManager } from './LoadingManager';
  * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
  */
 
-var DataTextureLoader = BinaryTextureLoader;
-function BinaryTextureLoader( manager ) {
+function DataTextureLoader( manager ) {
 
 	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
 
@@ -19,7 +18,7 @@ function BinaryTextureLoader( manager ) {
 
 }
 
-Object.assign( BinaryTextureLoader.prototype, {
+Object.assign( DataTextureLoader.prototype, {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
@@ -93,4 +92,4 @@ Object.assign( BinaryTextureLoader.prototype, {
 } );
 
 
-export { BinaryTextureLoader, DataTextureLoader };
+export { DataTextureLoader };

+ 1 - 1
src/math/Box3.js

@@ -165,7 +165,7 @@ Box3.prototype = {
 
 							for ( i = 0, l = attribute.count; i < l; i ++ ) {
 
-								v1.fromAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
+								v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
 
 								scope.expandByPoint( v1 );
 

+ 2 - 2
src/math/Vector2.js

@@ -453,11 +453,11 @@ Vector2.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector2: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 2 - 2
src/math/Vector3.js

@@ -744,11 +744,11 @@ Vector3.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector3: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 2 - 2
src/math/Vector4.js

@@ -611,11 +611,11 @@ Vector4.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector4: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 25 - 29
src/objects/Mesh.js

@@ -143,23 +143,23 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-		function checkBufferGeometryIntersection( object, raycaster, ray, positions, uvs, a, b, c ) {
+		function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {
 
-			vA.fromArray( positions, a * 3 );
-			vB.fromArray( positions, b * 3 );
-			vC.fromArray( positions, c * 3 );
+			vA.fromBufferAttribute( position, a );
+			vB.fromBufferAttribute( position, b );
+			vC.fromBufferAttribute( position, c );
 
 			var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint );
 
 			if ( intersection ) {
 
-				if ( uvs ) {
+				if ( uv ) {
 
-					uvA.fromArray( uvs, a * 2 );
-					uvB.fromArray( uvs, b * 2 );
-					uvC.fromArray( uvs, c * 2 );
+					uvA.fromBufferAttribute( uv, a );
+					uvB.fromBufferAttribute( uv, b );
+					uvC.fromBufferAttribute( uv, c );
 
-					intersection.uv = uvIntersection( intersectionPoint,  vA, vB, vC,  uvA, uvB, uvC );
+					intersection.uv = uvIntersection( intersectionPoint,  vA, vB, vC, uvA, uvB, uvC );
 
 				}
 
@@ -202,32 +202,27 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 			}
 
-			var uvs, intersection;
+			var intersection;
 
 			if ( geometry.isBufferGeometry ) {
 
 				var a, b, c;
 				var index = geometry.index;
-				var attributes = geometry.attributes;
-				var positions = attributes.position.array;
-
-				if ( attributes.uv !== undefined ) {
-
-					uvs = attributes.uv.array;
-
-				}
+				var position = geometry.attributes.position;
+				var uv = geometry.attributes.uv;
+				var i, l;
 
 				if ( index !== null ) {
 
-					var indices = index.array;
+					// indexed buffer geometry
 
-					for ( var i = 0, l = indices.length; i < l; i += 3 ) {
+					for ( i = 0, l = index.count; i < l; i += 3 ) {
 
-						a = indices[ i ];
-						b = indices[ i + 1 ];
-						c = indices[ i + 2 ];
+						a = index.getX( i );
+						b = index.getX( i + 1 );
+						c = index.getX( i + 2 );
 
-						intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
+						intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
 
 						if ( intersection ) {
 
@@ -240,14 +235,15 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 				} else {
 
+					// non-indexed buffer geometry
 
-					for ( var i = 0, l = positions.length; i < l; i += 9 ) {
+					for ( i = 0, l = position.count; i < l; i += 3 ) {
 
-						a = i / 3;
-						b = a + 1;
-						c = a + 2;
+						a = i;
+						b = i + 1;
+						c = i + 2;
 
-						intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
+						intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
 
 						if ( intersection ) {