Skip to content

Commit

Permalink
Merge pull request #19461 from DefinitelyMaybe/src/geometries/box
Browse files Browse the repository at this point in the history
ES6 (let&const): src/geometries/boxGeometry
  • Loading branch information
mrdoob authored May 26, 2020
2 parents af91f47 + db42bc5 commit 62b9212
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/geometries/BoxGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BoxBufferGeometry extends BufferGeometry {
depthSegments: depthSegments
};

var scope = this;
const scope = this;

width = width || 1;
height = height || 1;
Expand All @@ -67,15 +67,15 @@ class BoxBufferGeometry extends BufferGeometry {

// buffers

var indices = [];
var vertices = [];
var normals = [];
var uvs = [];
const indices = [];
const vertices = [];
const normals = [];
const uvs = [];

// helper variables

var numberOfVertices = 0;
var groupStart = 0;
let numberOfVertices = 0;
let groupStart = 0;

// build each side of the box geometry

Expand All @@ -95,32 +95,32 @@ class BoxBufferGeometry extends BufferGeometry {

function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {

var segmentWidth = width / gridX;
var segmentHeight = height / gridY;
const segmentWidth = width / gridX;
const segmentHeight = height / gridY;

var widthHalf = width / 2;
var heightHalf = height / 2;
var depthHalf = depth / 2;
const widthHalf = width / 2;
const heightHalf = height / 2;
const depthHalf = depth / 2;

var gridX1 = gridX + 1;
var gridY1 = gridY + 1;
const gridX1 = gridX + 1;
const gridY1 = gridY + 1;

var vertexCounter = 0;
var groupCount = 0;
let vertexCounter = 0;
let groupCount = 0;

var ix, iy;
let ix, iy;

var vector = new Vector3();
const vector = new Vector3();

// generate vertices, normals and uvs

for ( iy = 0; iy < gridY1; iy ++ ) {

var y = iy * segmentHeight - heightHalf;
const y = iy * segmentHeight - heightHalf;

for ( ix = 0; ix < gridX1; ix ++ ) {

var x = ix * segmentWidth - widthHalf;
const x = ix * segmentWidth - widthHalf;

// set values to correct vector component

Expand Down Expand Up @@ -165,10 +165,10 @@ class BoxBufferGeometry extends BufferGeometry {

for ( ix = 0; ix < gridX; ix ++ ) {

var a = numberOfVertices + ix + gridX1 * iy;
var b = numberOfVertices + ix + gridX1 * ( iy + 1 );
var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
const a = numberOfVertices + ix + gridX1 * iy;
const b = numberOfVertices + ix + gridX1 * ( iy + 1 );
const c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
const d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;

// faces

Expand Down

0 comments on commit 62b9212

Please sign in to comment.