wonder.js
Version:
41 lines (35 loc) • 2.74 kB
JavaScript
;
var Caml_option = require("bs-platform/lib/js/caml_option.js");
var ArrayService$Wonderjs = require("../../service/atom/ArrayService.js");
var IndicesUtils$Wonderjs = require("../utils/IndicesUtils.js");
var ArrayService$WonderCommonlib = require("wonder-commonlib/lib/js/src/ArrayService.js");
var MutableSparseMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/MutableSparseMapService.js");
var OperateBasicSourceTextureMainService$Wonderjs = require("../../service/state/main/texture/source/basic_source/OperateBasicSourceTextureMainService.js");
var BatchSetBasicSourceTextureAllDataSystem$Wonderjs = require("./BatchSetBasicSourceTextureAllDataSystem.js");
function convertKeyFromImageIndexToBasicSourceTexture(imageTextureIndexData, basicSourceTextureArr, imageUint8ArrayDataMap) {
return MutableSparseMapService$WonderCommonlib.reduceiValid((function (resultImageUint8ArrayDataMap, data, imageIndex) {
return ArrayService$WonderCommonlib.reduceOneParam((function (resultImageUint8ArrayDataMap, basicSourceTexture) {
return MutableSparseMapService$WonderCommonlib.set(basicSourceTexture, data, resultImageUint8ArrayDataMap);
}), resultImageUint8ArrayDataMap, IndicesUtils$Wonderjs.getBasicSourceTextures(imageIndex, basicSourceTextureArr, imageTextureIndexData));
}), MutableSparseMapService$WonderCommonlib.createEmpty(/* () */0), imageUint8ArrayDataMap);
}
function _batchSetBasicSourceTextureSources(imageBasicSourceTextures, basicSourceTextureImages, state) {
return ArrayService$WonderCommonlib.reduceOneParami((function (state, basicSourceTexture, index) {
var match = ArrayService$Wonderjs.getNth(index, basicSourceTextureImages);
if (match !== undefined) {
return OperateBasicSourceTextureMainService$Wonderjs.setSource(basicSourceTexture, Caml_option.valFromOption(match), state);
} else {
return state;
}
}), state, imageBasicSourceTextures);
}
function batchSet(param, state) {
var match = param[2];
var match$1 = param[1];
var match$2 = param[0];
return _batchSetBasicSourceTextureSources(match[0], match[1], BatchSetBasicSourceTextureAllDataSystem$Wonderjs.batchSetBasicSourceTextureData(match$1[0], match$1[1], BatchSetBasicSourceTextureAllDataSystem$Wonderjs.batchSetNewDiffueMaps(match$2[0], match$2[1], state)));
}
exports.convertKeyFromImageIndexToBasicSourceTexture = convertKeyFromImageIndexToBasicSourceTexture;
exports._batchSetBasicSourceTextureSources = _batchSetBasicSourceTextureSources;
exports.batchSet = batchSet;
/* ArrayService-Wonderjs Not a pure module */