Skip to content

Commit fd24a78

Browse files
mvaligurskyMartin Valigursky
andauthored
Converted more classes in scene folder to use let and const (playcanvas#3473)
* Converted more classes in scene folder to use let and const * typo fix Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
1 parent 695a49d commit fd24a78

File tree

9 files changed

+401
-413
lines changed

9 files changed

+401
-413
lines changed

src/scene/batching/batch-manager.js

Lines changed: 137 additions & 120 deletions
Large diffs are not rendered by default.

src/scene/batching/batch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Batch {
3131

3232
addToLayers(scene, layers) {
3333
for (let i = 0; i < layers.length; i++) {
34-
var layer = scene.layers.getLayerById(layers[i]);
34+
const layer = scene.layers.getLayerById(layers[i]);
3535
if (layer) {
3636
layer.addMeshInstances([this.meshInstance]);
3737
}
@@ -40,7 +40,7 @@ class Batch {
4040

4141
removeFromLayers(scene, layers) {
4242
for (let i = 0; i < layers.length; i++) {
43-
var layer = scene.layers.getLayerById(layers[i]);
43+
const layer = scene.layers.getLayerById(layers[i]);
4444
if (layer) {
4545
layer.removeMeshInstances([this.meshInstance]);
4646
}
@@ -50,7 +50,7 @@ class Batch {
5050
// Updates bounding box for a batch
5151
updateBoundingBox() {
5252
this._aabb.copy(this.origMeshInstances[0].aabb);
53-
for (var i = 1; i < this.origMeshInstances.length; i++) {
53+
for (let i = 1; i < this.origMeshInstances.length; i++) {
5454
this._aabb.add(this.origMeshInstances[i].aabb);
5555
}
5656
this.meshInstance.aabb = this._aabb;

src/scene/batching/skin-batch-instance.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class SkinBatchInstance extends SkinInstance {
66

77
super();
88

9-
var numBones = nodes.length;
9+
const numBones = nodes.length;
1010
this.init(device, numBones);
1111

1212
this.device = device;
@@ -20,16 +20,14 @@ class SkinBatchInstance extends SkinInstance {
2020
}
2121

2222
updateMatrixPalette(rootNode, skinUpdateIndex) {
23-
var pe;
24-
var mp = this.matrixPalette;
25-
var base;
23+
const mp = this.matrixPalette;
2624

27-
var count = this.bones.length;
28-
for (var i = 0; i < count; i++) {
29-
pe = this.bones[i].getWorldTransform().data;
25+
const count = this.bones.length;
26+
for (let i = 0; i < count; i++) {
27+
const pe = this.bones[i].getWorldTransform().data;
3028

3129
// Copy the matrix into the palette, ready to be sent to the vertex shader, transpose matrix from 4x4 to 4x3 format as well
32-
base = i * 12;
30+
const base = i * 12;
3331
mp[base] = pe[0];
3432
mp[base + 1] = pe[4];
3533
mp[base + 2] = pe[8];

0 commit comments

Comments
 (0)