Browse Source

Fix the total size of RoundedBoxBufferGeometry

Garrett Johnson 4 years ago
parent
commit
3e231ef900
1 changed files with 4 additions and 6 deletions
  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 ) {
 
 			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.x -= Math.sign( normal.x ) * halfSegmentSize;
 			normal.y -= Math.sign( normal.y ) * halfSegmentSize;
 			normal.z -= Math.sign( normal.z ) * halfSegmentSize;
 			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 + 1 ] = normal.y;
 			normals[ i + 2 ] = normal.z;