mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
reduce dif memory usage
This commit is contained in:
parent
3b997b907a
commit
298c1509a7
1 changed files with 52 additions and 0 deletions
|
|
@ -423,6 +423,7 @@ class DifBuilder {
|
||||||
var difresource = ResourceLoader.loadInterior(path);
|
var difresource = ResourceLoader.loadInterior(path);
|
||||||
difresource.acquire();
|
difresource.acquire();
|
||||||
dif = difresource.resource;
|
dif = difresource.resource;
|
||||||
|
dumbDownDif(dif);
|
||||||
}
|
}
|
||||||
var geo = (so == -1 ? dif.interiors[0] : dif.subObjects[so]);
|
var geo = (so == -1 ? dif.interiors[0] : dif.subObjects[so]);
|
||||||
var triangles = [];
|
var triangles = [];
|
||||||
|
|
@ -1018,4 +1019,55 @@ class DifBuilder {
|
||||||
worker.run();
|
worker.run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keeps only relevant parts of the dif to reduce memory footprint
|
||||||
|
static function dumbDownDif(dif:Dif) {
|
||||||
|
dif.aiSpecialNodes = null;
|
||||||
|
dif.forceFields = null;
|
||||||
|
dif.triggers = null;
|
||||||
|
dif.gameEntities = null;
|
||||||
|
dif.interiorPathfollowers = null;
|
||||||
|
dif.triggers = null;
|
||||||
|
dif.vehicleCollision = null;
|
||||||
|
for (itr in dif.interiors.concat(dif.subObjects)) {
|
||||||
|
itr.alarmAmbientColor = null;
|
||||||
|
itr.alarmLMapIndices = null;
|
||||||
|
itr.animatedLights = null;
|
||||||
|
itr.baseAmbientColor = null;
|
||||||
|
itr.bspNodes = null;
|
||||||
|
itr.bspSolidLeaves = null;
|
||||||
|
itr.convexHullEmitStrings = null;
|
||||||
|
itr.convexHulls = null;
|
||||||
|
itr.coordBinIndices = null;
|
||||||
|
itr.boundingSphere = null;
|
||||||
|
itr.coordBins = null;
|
||||||
|
itr.edges = null;
|
||||||
|
itr.edges2 = null;
|
||||||
|
itr.hullEmitStringIndices = null;
|
||||||
|
itr.hullIndices = null;
|
||||||
|
itr.hullPlaneIndices = null;
|
||||||
|
itr.hullSurfaceIndices = null;
|
||||||
|
itr.lightMaps = null;
|
||||||
|
itr.lightStates = null;
|
||||||
|
itr.nameBuffer = null;
|
||||||
|
itr.normalIndices = null;
|
||||||
|
itr.normalLMapIndices = null;
|
||||||
|
itr.nullSurfaces = null;
|
||||||
|
itr.pointVisibilities = null;
|
||||||
|
itr.polyListPlanes = null;
|
||||||
|
itr.polyListPoints = null;
|
||||||
|
itr.polyListStrings = null;
|
||||||
|
itr.portals = null;
|
||||||
|
itr.solidLeafSurfaces = null;
|
||||||
|
itr.stateDataBuffers = null;
|
||||||
|
itr.zones = null;
|
||||||
|
itr.zoneSurfaces = null;
|
||||||
|
itr.zoneStaticMeshes = null;
|
||||||
|
itr.windingIndices = null;
|
||||||
|
itr.texNormals = null;
|
||||||
|
itr.texMatrices = null;
|
||||||
|
itr.texMatIndices = null;
|
||||||
|
itr.stateDatas = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue