UNPKG

wonder.js

Version:
50 lines (45 loc) 3.04 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 IndexSourceTextureMainService$Wonderjs = require("./source/IndexSourceTextureMainService.js"); var GroupBasicSourceTextureService$Wonderjs = require("../../../record/main/texture/source/basic_source/GroupBasicSourceTextureService.js"); var RecordBasicSourceTextureMainService$Wonderjs = require("./source/basic_source/RecordBasicSourceTextureMainService.js"); var GroupArrayBufferViewSourceTextureService$Wonderjs = require("../../../record/main/texture/source/arrayBufferView_source/GroupArrayBufferViewSourceTextureService.js"); var RecordArrayBufferViewSourceTextureMainService$Wonderjs = require("./source/arrayBufferView_source/RecordArrayBufferViewSourceTextureMainService.js"); function addMaterial(materialData, texture, state) { var match = IndexSourceTextureMainService$Wonderjs.isBasicSourceTextureIndex(texture, state); if (match) { var newrecord = Caml_array.caml_array_dup(state); newrecord[/* basicSourceTextureRecord */18] = GroupBasicSourceTextureService$Wonderjs.addMaterial(materialData, texture, RecordBasicSourceTextureMainService$Wonderjs.getRecord(state)); return newrecord; } else { var match$1 = IndexSourceTextureMainService$Wonderjs.isArrayBufferViewSourceTextureIndex(texture, state); if (match$1) { var newrecord$1 = Caml_array.caml_array_dup(state); newrecord$1[/* arrayBufferViewSourceTextureRecord */19] = GroupArrayBufferViewSourceTextureService$Wonderjs.addMaterial(materialData, texture, RecordArrayBufferViewSourceTextureMainService$Wonderjs.getRecord(state)); return newrecord$1; } else { return Log$WonderLog.fatal(Log$WonderLog.buildFatalMessage("addMaterial", "unknown texture: " + (String(texture) + ""), "", "", "")); } } } function removeMaterial(materialData, texture, state) { var match = IndexSourceTextureMainService$Wonderjs.isBasicSourceTextureIndex(texture, state); if (match) { var newrecord = Caml_array.caml_array_dup(state); newrecord[/* basicSourceTextureRecord */18] = GroupBasicSourceTextureService$Wonderjs.removeMaterial(materialData, texture, RecordBasicSourceTextureMainService$Wonderjs.getRecord(state)); return newrecord; } else { var match$1 = IndexSourceTextureMainService$Wonderjs.isArrayBufferViewSourceTextureIndex(texture, state); if (match$1) { var newrecord$1 = Caml_array.caml_array_dup(state); newrecord$1[/* arrayBufferViewSourceTextureRecord */19] = GroupArrayBufferViewSourceTextureService$Wonderjs.removeMaterial(materialData, texture, RecordArrayBufferViewSourceTextureMainService$Wonderjs.getRecord(state)); return newrecord$1; } else { return Log$WonderLog.fatal(Log$WonderLog.buildFatalMessage("removeMaterial", "unknown texture: " + (String(texture) + ""), "", "", "")); } } } exports.addMaterial = addMaterial; exports.removeMaterial = removeMaterial; /* Log-WonderLog Not a pure module */