[ts] Fixed memory leak in Triangulator. Added coin example to WebGL test

This commit is contained in:
badlogic 2017-05-04 14:11:11 +02:00
parent a97d18aafd
commit fdf6aba634
14 changed files with 58 additions and 6 deletions

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -5460,6 +5460,10 @@ var spine;
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
}
else {
this.polygonPool.free(polygon);
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
polygon.push(x1);
@ -5528,6 +5532,9 @@ var spine;
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
}
}
return convexPolygons;

File diff suppressed because one or more lines are too long

View File

@ -164,6 +164,9 @@ module spine {
if (polygon.length > 0) {
convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices);
} else {
this.polygonPool.free(polygon)
this.polygonIndicesPool.free(polygonIndices);
}
polygon = this.polygonPool.obtain();
polygon.length = 0;
@ -238,6 +241,9 @@ module spine {
if (polygon.length == 0) {
convexPolygons.splice(i, 1);
this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i]
convexPolygonsIndices.splice(i, 1)
this.polygonIndicesPool.free(polygonIndices);
}
}

View File

@ -79,6 +79,9 @@ function init () {
assetManager.loadText("assets/stretchyman.json");
assetManager.loadText("assets/stretchyman.atlas");
assetManager.loadTexture("assets/stretchyman.png");
assetManager.loadText("assets/coin.json");
assetManager.loadText("assets/coin.atlas");
assetManager.loadTexture("assets/coin.png");
requestAnimationFrame(load);
}
@ -91,6 +94,7 @@ function load () {
skeletons["goblins"] = loadSkeleton("goblins-mesh", "walk", false, "goblin");
skeletons["vine"] = loadSkeleton("vine", "animation", false);
skeletons["stretchyman"] = loadSkeleton("stretchyman", "sneak", false);
skeletons["coin"] = loadSkeleton("coin", "rotate", false);
setupUI();
requestAnimationFrame(render);
} else {