wonder.js
Version:
66 lines (58 loc) • 4.88 kB
JavaScript
'use strict';
var Caml_array = require("bs-platform/lib/js/caml_array.js");
var Contract$WonderLog = require("wonder-log/lib/js/src/Contract.js");
var StateDataMain$Wonderjs = require("../service/state/main/data/StateDataMain.js");
var IsDebugMainService$Wonderjs = require("../service/state/main/state/IsDebugMainService.js");
var AliveComponentService$Wonderjs = require("../service/primitive/component/AliveComponentService.js");
var StaticTransformService$Wonderjs = require("../service/primitive/instance/StaticTransformService.js");
var CreateSourceInstanceMainService$Wonderjs = require("../service/state/main/instance/CreateSourceInstanceMainService.js");
var GameObjectSourceInstanceService$Wonderjs = require("../service/record/main/instance/sourceInstance/GameObjectSourceInstanceService.js");
var RecordSourceInstanceMainService$Wonderjs = require("../service/state/main/instance/RecordSourceInstanceMainService.js");
var DisposeSourceInstanceMainService$Wonderjs = require("../service/state/main/instance/DisposeSourceInstanceMainService.js");
var GetObjectInstanceArrayMainService$Wonderjs = require("../service/state/main/instance/GetObjectInstanceArrayMainService.js");
var CreateObjectInstanceGameObjectMainService$Wonderjs = require("../service/state/main/instance/CreateObjectInstanceGameObjectMainService.js");
function unsafeGetSourceInstanceGameObject(sourceInstance, state) {
Contract$WonderLog.requireCheck((function (param) {
return AliveComponentService$Wonderjs.checkComponentShouldAlive(sourceInstance, DisposeSourceInstanceMainService$Wonderjs.isAlive, RecordSourceInstanceMainService$Wonderjs.getRecord(state));
}), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData));
return GameObjectSourceInstanceService$Wonderjs.unsafeGetGameObject(sourceInstance, RecordSourceInstanceMainService$Wonderjs.getRecord(state));
}
function createObjectInstanceGameObject(sourceInstance, state) {
Contract$WonderLog.requireCheck((function (param) {
return AliveComponentService$Wonderjs.checkComponentShouldAlive(sourceInstance, DisposeSourceInstanceMainService$Wonderjs.isAlive, RecordSourceInstanceMainService$Wonderjs.getRecord(state));
}), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData));
return CreateObjectInstanceGameObjectMainService$Wonderjs.createInstance(sourceInstance, state);
}
function getSourceInstanceObjectInstanceTransformArray(sourceInstance, state) {
Contract$WonderLog.requireCheck((function (param) {
return AliveComponentService$Wonderjs.checkComponentShouldAlive(sourceInstance, DisposeSourceInstanceMainService$Wonderjs.isAlive, RecordSourceInstanceMainService$Wonderjs.getRecord(state));
}), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData));
return GetObjectInstanceArrayMainService$Wonderjs.getObjectInstanceTransformArray(sourceInstance, state);
}
function markSourceInstanceModelMatrixIsStatic(sourceInstance, isStatic, state) {
Contract$WonderLog.requireCheck((function (param) {
return AliveComponentService$Wonderjs.checkComponentShouldAlive(sourceInstance, DisposeSourceInstanceMainService$Wonderjs.isAlive, RecordSourceInstanceMainService$Wonderjs.getRecord(state));
}), IsDebugMainService$Wonderjs.getIsDebug(StateDataMain$Wonderjs.stateData));
var newrecord = Caml_array.caml_array_dup(state);
var init = RecordSourceInstanceMainService$Wonderjs.getRecord(state);
newrecord[/* sourceInstanceRecord */6] = /* record */[
/* index */init[/* index */0],
/* objectInstanceTransformIndexMap */init[/* objectInstanceTransformIndexMap */1],
/* buffer */init[/* buffer */2],
/* isTransformStatics */StaticTransformService$Wonderjs.markModelMatrixIsStatic(sourceInstance, isStatic, RecordSourceInstanceMainService$Wonderjs.getRecord(state)[/* isTransformStatics */3]),
/* objectInstanceTransformCollections */init[/* objectInstanceTransformCollections */4],
/* matrixInstanceBufferCapacityMap */init[/* matrixInstanceBufferCapacityMap */5],
/* matrixFloat32ArrayMap */init[/* matrixFloat32ArrayMap */6],
/* isSendTransformMatrixDataMap */init[/* isSendTransformMatrixDataMap */7],
/* disposedIndexArray */init[/* disposedIndexArray */8],
/* gameObjectMap */init[/* gameObjectMap */9]
];
return newrecord;
}
var createSourceInstance = CreateSourceInstanceMainService$Wonderjs.create;
exports.createSourceInstance = createSourceInstance;
exports.unsafeGetSourceInstanceGameObject = unsafeGetSourceInstanceGameObject;
exports.createObjectInstanceGameObject = createObjectInstanceGameObject;
exports.getSourceInstanceObjectInstanceTransformArray = getSourceInstanceObjectInstanceTransformArray;
exports.markSourceInstanceModelMatrixIsStatic = markSourceInstanceModelMatrixIsStatic;
/* Contract-WonderLog Not a pure module */