UNPKG

wonder.js

Version:
43 lines (39 loc) 2.27 kB
'use strict'; var Caml_array = require("bs-platform/lib/js/caml_array.js"); var Log$WonderLog = require("wonder-log/lib/js/src/Log.js"); var Contract$WonderLog = require("wonder-log/lib/js/src/Contract.js"); var StateDataMain$Wonderjs = require("../data/StateDataMain.js"); var IsDebugMainService$Wonderjs = require("../state/IsDebugMainService.js"); function restore(currentState, targetState) { Contract$WonderLog.requireCheck((function (param) { var currentPrecision = currentState[/* glslRecord */29][/* precision */0]; var targetPrecision = targetState[/* glslRecord */29][/* precision */0]; return Contract$WonderLog.test(Log$WonderLog.buildAssertMessage("currentState->glslRecord->precision and targetState->glslRecord->precision be the same", "not"), (function (param) { if (currentPrecision !== undefined) { if (targetPrecision !== undefined) { return Contract$WonderLog.Operators[/* ==^ */2](currentPrecision, targetPrecision); } else { return Contract$WonderLog.assertFail(/* () */0); } } else if (targetPrecision !== undefined) { return Contract$WonderLog.assertFail(/* () */0); } else { return Contract$WonderLog.assertPass(/* () */0); } })); }), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData)); var match = currentState[/* shaderRecord */28]; var currentIndex = match[/* index */0]; var targetShaderData = targetState[/* shaderRecord */28]; var targetIndex = targetShaderData[/* index */0]; var newrecord = Caml_array.caml_array_dup(targetState); newrecord[/* shaderRecord */28] = /* record */[ /* index */Math.max(currentIndex, targetIndex), /* noMaterialShaderIndexMap */targetShaderData[/* noMaterialShaderIndexMap */1], /* shaderLibShaderIndexMap */targetShaderData[/* shaderLibShaderIndexMap */2], /* materialsMap */targetShaderData[/* materialsMap */3] ]; return newrecord; } exports.restore = restore; /* Log-WonderLog Not a pure module */