Przeglądaj źródła

Updated builds.

Mr.doob 8 lat temu
rodzic
commit
08bea54b8c
3 zmienionych plików z 98 dodań i 86 usunięć
  1. 20 14
      build/three.js
  2. 58 58
      build/three.min.js
  3. 20 14
      build/three.module.js

+ 20 - 14
build/three.js

@@ -14203,23 +14203,27 @@
 
 		normalizeNormals: function () {
 
-			var normals = this.attributes.normal;
+			var vector = new Vector3();
 
-			var x, y, z, n;
+			return function normalizeNormals() {
 
-			for ( var i = 0, il = normals.count; i < il; i ++ ) {
+				var normals = this.attributes.normal;
 
-				x = normals.getX( i );
-				y = normals.getY( i );
-				z = normals.getZ( i );
+				for ( var i = 0, il = normals.count; i < il; i ++ ) {
 
-				n = 1.0 / Math.sqrt( x * x + y * y + z * z );
+					vector.x = normals.getX( i );
+					vector.y = normals.getY( i );
+					vector.z = normals.getZ( i );
 
-				normals.setXYZ( i, x * n, y * n, z * n );
+					vector.normalize();
 
-			}
+					normals.setXYZ( i, vector.x, vector.y, vector.z );
 
-		},
+				}
+
+			};
+
+		}(),
 
 		toNonIndexed: function () {
 
@@ -21701,11 +21705,11 @@
 
 		function renderObject( object, scene, camera, geometry, material, group ) {
 
+			object.onBeforeRender( _this, scene, camera, geometry, material, group );
+
 			object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
 			object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
 
-			object.onBeforeRender( _this, scene, camera, geometry, material, group );
-
 			if ( object.isImmediateRenderObject ) {
 
 				state.setMaterial( material );
@@ -41921,7 +41925,7 @@
 	/**
 	 * @author WestLangley / http://github.com/WestLangley
 	 */
-	 
+
 	function PlaneHelper( plane, size, hex ) {
 
 		this.type = 'PlaneHelper';
@@ -41948,7 +41952,7 @@
 		geometry2.addAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
 		geometry2.computeBoundingSphere();
 
-		this.add( new THREE.Mesh( geometry2, new LineBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
+		this.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
 
 		//
 
@@ -41969,6 +41973,8 @@
 
 		this.lookAt( this.plane.normal );
 
+		this.updateMatrixWorld( true );
+
 	};
 
 	/**

Plik diff jest za duży
+ 58 - 58
build/three.min.js


+ 20 - 14
build/three.module.js

@@ -14197,23 +14197,27 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 	normalizeNormals: function () {
 
-		var normals = this.attributes.normal;
+		var vector = new Vector3();
 
-		var x, y, z, n;
+		return function normalizeNormals() {
 
-		for ( var i = 0, il = normals.count; i < il; i ++ ) {
+			var normals = this.attributes.normal;
 
-			x = normals.getX( i );
-			y = normals.getY( i );
-			z = normals.getZ( i );
+			for ( var i = 0, il = normals.count; i < il; i ++ ) {
 
-			n = 1.0 / Math.sqrt( x * x + y * y + z * z );
+				vector.x = normals.getX( i );
+				vector.y = normals.getY( i );
+				vector.z = normals.getZ( i );
 
-			normals.setXYZ( i, x * n, y * n, z * n );
+				vector.normalize();
 
-		}
+				normals.setXYZ( i, vector.x, vector.y, vector.z );
 
-	},
+			}
+
+		};
+
+	}(),
 
 	toNonIndexed: function () {
 
@@ -21695,11 +21699,11 @@ function WebGLRenderer( parameters ) {
 
 	function renderObject( object, scene, camera, geometry, material, group ) {
 
+		object.onBeforeRender( _this, scene, camera, geometry, material, group );
+
 		object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
 		object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
 
-		object.onBeforeRender( _this, scene, camera, geometry, material, group );
-
 		if ( object.isImmediateRenderObject ) {
 
 			state.setMaterial( material );
@@ -41915,7 +41919,7 @@ Box3Helper.prototype.onBeforeRender = function () {
 /**
  * @author WestLangley / http://github.com/WestLangley
  */
- 
+
 function PlaneHelper( plane, size, hex ) {
 
 	this.type = 'PlaneHelper';
@@ -41942,7 +41946,7 @@ function PlaneHelper( plane, size, hex ) {
 	geometry2.addAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
 	geometry2.computeBoundingSphere();
 
-	this.add( new THREE.Mesh( geometry2, new LineBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
+	this.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false } ) ) );
 
 	//
 
@@ -41963,6 +41967,8 @@ PlaneHelper.prototype.onBeforeRender = function () {
 
 	this.lookAt( this.plane.normal );
 
+	this.updateMatrixWorld( true );
+
 };
 
 /**

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików