UNPKG

wonder.js

Version:
87 lines (78 loc) 4.02 kB
'use strict'; var Caml_array = require("bs-platform/lib/js/caml_array.js"); var Caml_option = require("bs-platform/lib/js/caml_option.js"); var ViewService$Wonderjs = require("../../../record/main/device/ViewService.js"); var AllProgramService$Wonderjs = require("../../../record/all/program/AllProgramService.js"); var ManageIMGUIAPI$WonderImgui = require("wonder-imgui/lib/js/src/api/ManageIMGUIAPI.js"); var RecordIMGUIMainService$Wonderjs = require("./RecordIMGUIMainService.js"); function getCanvasSize(param) { var viewRecord = param[/* viewRecord */8]; var match = ViewService$Wonderjs.getCanvas(viewRecord); if (match !== undefined) { var canvas = Caml_option.valFromOption(match); return /* tuple */[ canvas.width, canvas.height ]; } else { return /* tuple */[ 0, 0 ]; } } var getRecord = RecordIMGUIMainService$Wonderjs.getWonderIMGUIRecord; function setRecord(record, state) { var newrecord = Caml_array.caml_array_dup(state); var init = state[/* imguiRecord */44]; newrecord[/* imguiRecord */44] = /* record */[ /* ioData */init[/* ioData */0], /* isSetExecFuncInRenderWorkerForWorker */init[/* isSetExecFuncInRenderWorkerForWorker */1], /* extendData */init[/* extendData */2], /* wonderImguiIMGUIRecord */record ]; return newrecord; } function sendCustomTextureProgramUniformProjectionMatData(gl, canvasSize, state) { var newrecord = Caml_array.caml_array_dup(state); newrecord[/* programRecord */30] = AllProgramService$Wonderjs.clearLastSendProgram(state[/* programRecord */30]); var init = state[/* imguiRecord */44]; newrecord[/* imguiRecord */44] = /* record */[ /* ioData */init[/* ioData */0], /* isSetExecFuncInRenderWorkerForWorker */init[/* isSetExecFuncInRenderWorkerForWorker */1], /* extendData */init[/* extendData */2], /* wonderImguiIMGUIRecord */ManageIMGUIAPI$WonderImgui.sendCustomTextureProgramUniformProjectionMatData(gl, canvasSize, RecordIMGUIMainService$Wonderjs.getWonderIMGUIRecord(state)) ]; return newrecord; } function sendFontTextureProgramUniformProjectionMatData(gl, canvasSize, state) { var newrecord = Caml_array.caml_array_dup(state); newrecord[/* programRecord */30] = AllProgramService$Wonderjs.clearLastSendProgram(state[/* programRecord */30]); var init = state[/* imguiRecord */44]; newrecord[/* imguiRecord */44] = /* record */[ /* ioData */init[/* ioData */0], /* isSetExecFuncInRenderWorkerForWorker */init[/* isSetExecFuncInRenderWorkerForWorker */1], /* extendData */init[/* extendData */2], /* wonderImguiIMGUIRecord */ManageIMGUIAPI$WonderImgui.sendFontTextureProgramUniformProjectionMatData(gl, canvasSize, RecordIMGUIMainService$Wonderjs.getWonderIMGUIRecord(state)) ]; return newrecord; } function sendNoTextureProgramUniformProjectionMatData(gl, canvasSize, state) { var newrecord = Caml_array.caml_array_dup(state); newrecord[/* programRecord */30] = AllProgramService$Wonderjs.clearLastSendProgram(state[/* programRecord */30]); var init = state[/* imguiRecord */44]; newrecord[/* imguiRecord */44] = /* record */[ /* ioData */init[/* ioData */0], /* isSetExecFuncInRenderWorkerForWorker */init[/* isSetExecFuncInRenderWorkerForWorker */1], /* extendData */init[/* extendData */2], /* wonderImguiIMGUIRecord */ManageIMGUIAPI$WonderImgui.sendNoTextureProgramUniformProjectionMatData(gl, canvasSize, RecordIMGUIMainService$Wonderjs.getWonderIMGUIRecord(state)) ]; return newrecord; } exports.getCanvasSize = getCanvasSize; exports.getRecord = getRecord; exports.setRecord = setRecord; exports.sendCustomTextureProgramUniformProjectionMatData = sendCustomTextureProgramUniformProjectionMatData; exports.sendFontTextureProgramUniformProjectionMatData = sendFontTextureProgramUniformProjectionMatData; exports.sendNoTextureProgramUniformProjectionMatData = sendNoTextureProgramUniformProjectionMatData; /* ViewService-Wonderjs Not a pure module */