wonder.js
Version:
41 lines (34 loc) • 1.93 kB
JavaScript
;
var Caml_array = require("bs-platform/lib/js/caml_array.js");
var ArrayService$Wonderjs = require("../../../../atom/ArrayService.js");
var InitTextureService$Wonderjs = require("../../../../primitive/texture/InitTextureService.js");
var AllDeviceManagerService$Wonderjs = require("../../../../record/all/device/AllDeviceManagerService.js");
var WorkerDetectMainService$Wonderjs = require("../../workerDetect/WorkerDetectMainService.js");
var RecordCubemapTextureMainService$Wonderjs = require("./RecordCubemapTextureMainService.js");
function _handleInitTextureWorker(texture, state) {
ArrayService$Wonderjs.push(texture, RecordCubemapTextureMainService$Wonderjs.getRecord(state)[/* needInitedTextureIndexArray */34]);
return state;
}
function _handleInitTextureNoWorker(texture, state) {
InitTextureService$Wonderjs.initTexture(AllDeviceManagerService$Wonderjs.unsafeGetGl(state[/* deviceManagerRecord */9]), texture, RecordCubemapTextureMainService$Wonderjs.getRecord(state)[/* glTextureMap */26]);
return state;
}
function initTexture(texture, state) {
var match = WorkerDetectMainService$Wonderjs.isUseWorker(state);
if (match) {
return _handleInitTextureWorker(texture, state);
} else {
return _handleInitTextureNoWorker(texture, state);
}
}
function clearNeedInitedTextureIndexArray(state) {
var newrecord = Caml_array.caml_array_dup(state);
var newrecord$1 = Caml_array.caml_array_dup(RecordCubemapTextureMainService$Wonderjs.getRecord(state));
newrecord[/* cubemapTextureRecord */20] = (newrecord$1[/* needInitedTextureIndexArray */34] = /* array */[], newrecord$1);
return newrecord;
}
exports._handleInitTextureWorker = _handleInitTextureWorker;
exports._handleInitTextureNoWorker = _handleInitTextureNoWorker;
exports.initTexture = initTexture;
exports.clearNeedInitedTextureIndexArray = clearNeedInitedTextureIndexArray;
/* ArrayService-Wonderjs Not a pure module */