Parcourir la source

PlaneBufferGeometry: Avoid breakage when using a float for *Segments

Mr.doob il y a 10 ans
Parent
commit
a2b0946109
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      src/extras/geometries/PlaneBufferGeometry.js

+ 2 - 2
src/extras/geometries/PlaneBufferGeometry.js

@@ -19,8 +19,8 @@ THREE.PlaneBufferGeometry = function ( width, height, widthSegments, heightSegme
 	var width_half = width / 2;
 	var height_half = height / 2;
 
-	var gridX = widthSegments || 1;
-	var gridY = heightSegments || 1;
+	var gridX = Math.floor( widthSegments ) || 1;
+	var gridY = Math.floor( heightSegments ) || 1;
 
 	var gridX1 = gridX + 1;
 	var gridY1 = gridY + 1;