wonder.js
Version:
31 lines (26 loc) • 1.51 kB
JavaScript
;
var ArrayService$Wonderjs = require("../../atom/ArrayService.js");
var DisposeECSService$Wonderjs = require("../ecs/DisposeECSService.js");
var MutableSparseMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/MutableSparseMapService.js");
function removeDisposedOnesFromMaterialArrayForWorkerInit(materialDataMap, materialArrayForWorkerInit) {
var match = MutableSparseMapService$WonderCommonlib.length(materialDataMap);
if (match !== 0) {
var materialMap = DisposeECSService$Wonderjs.buildMapFromArray(MutableSparseMapService$WonderCommonlib.getValidKeys(materialDataMap), MutableSparseMapService$WonderCommonlib.createEmpty(/* () */0));
return materialArrayForWorkerInit.filter((function (material) {
return !MutableSparseMapService$WonderCommonlib.has(material, materialMap);
}));
} else {
return materialArrayForWorkerInit;
}
}
function addMaterialToMaterialArrayForWorkerInit(materialIndex, materialArrayForWorkerInit) {
var match = ArrayService$Wonderjs.unsafeGetLast(materialArrayForWorkerInit) === materialIndex;
if (match) {
return materialArrayForWorkerInit;
} else {
return ArrayService$Wonderjs.push(materialIndex, materialArrayForWorkerInit);
}
}
exports.removeDisposedOnesFromMaterialArrayForWorkerInit = removeDisposedOnesFromMaterialArrayForWorkerInit;
exports.addMaterialToMaterialArrayForWorkerInit = addMaterialToMaterialArrayForWorkerInit;
/* ArrayService-Wonderjs Not a pure module */