wonder.js
Version:
32 lines (27 loc) • 2.18 kB
JavaScript
'use strict';
var Curry = require("bs-platform/lib/js/curry.js");
var Vector3Service$Wonderjs = require("../../../../atom/Vector3Service.js");
var QuaternionService$Wonderjs = require("../../../../atom/QuaternionService.js");
var ArrayService$WonderCommonlib = require("wonder-commonlib/lib/js/src/ArrayService.js");
var RecordTransformMainService$Wonderjs = require("../../transform/RecordTransformMainService.js");
var UpdateTransformMainService$Wonderjs = require("../../transform/UpdateTransformMainService.js");
var GetComponentGameObjectService$Wonderjs = require("../../../../record/main/gameObject/GetComponentGameObjectService.js");
var MutableSparseMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/MutableSparseMapService.js");
var GameObjectDirectionLightService$Wonderjs = require("../../../../record/main/light/direction/GameObjectDirectionLightService.js");
var RecordDirectionLightMainService$Wonderjs = require("./RecordDirectionLightMainService.js");
function getDirection(index, state) {
var gameObjectRecord = state[/* gameObjectRecord */10];
return Vector3Service$Wonderjs.transformQuat(/* tuple */[
0,
0,
1
], QuaternionService$Wonderjs.setFromEulerAngles(UpdateTransformMainService$Wonderjs.updateAndGetEulerAnglesTuple(GetComponentGameObjectService$Wonderjs.unsafeGetTransformComponent(GameObjectDirectionLightService$Wonderjs.unsafeGetGameObject(index, RecordDirectionLightMainService$Wonderjs.getRecord(state)), gameObjectRecord), state[/* globalTempRecord */37], RecordTransformMainService$Wonderjs.getRecord(state))));
}
function buildDirectionMap(getDirectionFunc, state) {
return ArrayService$WonderCommonlib.reduceOneParam((function (map, i) {
return MutableSparseMapService$WonderCommonlib.set(i, Curry._2(getDirectionFunc, i, state), map);
}), MutableSparseMapService$WonderCommonlib.createEmpty(/* () */0), RecordDirectionLightMainService$Wonderjs.getRecord(state)[/* renderLightArr */4]);
}
exports.getDirection = getDirection;
exports.buildDirectionMap = buildDirectionMap;
/* RecordTransformMainService-Wonderjs Not a pure module */