(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports", "./constants.js"], factory); } else if (typeof exports !== "undefined") { factory(exports, require("./constants.js")); } else { var mod = { exports: {} }; factory(mod.exports, global.constants); global.NodeFrame = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _constants) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.default = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var NodeFrame = /*#__PURE__*/function () { function NodeFrame() { _classCallCheck(this, NodeFrame); this.time = 0; this.deltaTime = 0; this.frameId = 0; this.startTime = null; this.updateMap = new WeakMap(); this.renderer = null; this.material = null; this.camera = null; this.object = null; } _createClass(NodeFrame, [{ key: "updateNode", value: function updateNode(node) { if (node.updateType === _constants.NodeUpdateType.Frame) { if (this.updateMap.get(node) !== this.frameId) { this.updateMap.set(node, this.frameId); node.update(this); } } else if (node.updateType === _constants.NodeUpdateType.Object) { node.update(this); } } }, { key: "update", value: function update() { this.frameId++; if (this.lastTime === undefined) this.lastTime = performance.now(); this.deltaTime = (performance.now() - this.lastTime) / 1000; this.lastTime = performance.now(); this.time += this.deltaTime; } }]); return NodeFrame; }(); var _default = NodeFrame; _exports.default = _default; });