ソースを参照

Fix the total size of RoundedBoxBufferGeometry

Garrett Johnson 4 年 前
コミット
3e231ef900
1 ファイル変更4 行追加6 行削除
  1. 4 6
      examples/jsm/geometries/RoundedBoxBufferGeometry.js

+ 4 - 6
examples/jsm/geometries/RoundedBoxBufferGeometry.js

@@ -78,18 +78,16 @@ class RoundedBoxBufferGeometry extends BoxBufferGeometry {
 		for ( let i = 0, j = 0; i < positions.length; i += 3, j += 2 ) {
 		for ( let i = 0, j = 0; i < positions.length; i += 3, j += 2 ) {
 
 
 			position.fromArray( positions, i );
 			position.fromArray( positions, i );
-			normal.copy( position ).normalize();
-
-			positions[ i + 0 ] = box.x * Math.sign( position.x ) + normal.x * radius;
-			positions[ i + 1 ] = box.y * Math.sign( position.y ) + normal.y * radius;
-			positions[ i + 2 ] = box.z * Math.sign( position.z ) + normal.z * radius;
-
 			normal.copy( position );
 			normal.copy( position );
 			normal.x -= Math.sign( normal.x ) * halfSegmentSize;
 			normal.x -= Math.sign( normal.x ) * halfSegmentSize;
 			normal.y -= Math.sign( normal.y ) * halfSegmentSize;
 			normal.y -= Math.sign( normal.y ) * halfSegmentSize;
 			normal.z -= Math.sign( normal.z ) * halfSegmentSize;
 			normal.z -= Math.sign( normal.z ) * halfSegmentSize;
 			normal.normalize();
 			normal.normalize();
 
 
+			positions[ i + 0 ] = box.x * Math.sign( position.x ) + normal.x * radius;
+			positions[ i + 1 ] = box.y * Math.sign( position.y ) + normal.y * radius;
+			positions[ i + 2 ] = box.z * Math.sign( position.z ) + normal.z * radius;
+
 			normals[ i + 0 ] = normal.x;
 			normals[ i + 0 ] = normal.x;
 			normals[ i + 1 ] = normal.y;
 			normals[ i + 1 ] = normal.y;
 			normals[ i + 2 ] = normal.z;
 			normals[ i + 2 ] = normal.z;