UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

81 lines (71 loc) 2.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.timerLocal = exports.timerGlobal = exports.timerDelta = exports.time = exports.frameId = exports.deltaTime = void 0; var _UniformGroupNode = require("../core/UniformGroupNode.js"); var _UniformNode = require("../core/UniformNode.js"); /** * Represents the elapsed time in seconds. * * @tsl * @type {UniformNode<float>} */ const time = exports.time = /*@__PURE__*/(0, _UniformNode.uniform)(0).setGroup(_UniformGroupNode.renderGroup).onRenderUpdate(frame => frame.time); /** * Represents the delta time in seconds. * * @tsl * @type {UniformNode<float>} */ const deltaTime = exports.deltaTime = /*@__PURE__*/(0, _UniformNode.uniform)(0).setGroup(_UniformGroupNode.renderGroup).onRenderUpdate(frame => frame.deltaTime); /** * Represents the current frame ID. * * @tsl * @type {UniformNode<uint>} */ const frameId = exports.frameId = /*@__PURE__*/(0, _UniformNode.uniform)(0, 'uint').setGroup(_UniformGroupNode.renderGroup).onRenderUpdate(frame => frame.frameId); // Deprecated /** * @tsl * @function * @deprecated since r170. Use {@link time} instead. * * @param {number} [timeScale=1] - The time scale. * @returns {UniformNode<float>} */ const timerLocal = (timeScale = 1) => { // @deprecated, r170 console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'); return time.mul(timeScale); }; /** * @tsl * @function * @deprecated since r170. Use {@link time} instead. * * @param {number} [timeScale=1] - The time scale. * @returns {UniformNode<float>} */ exports.timerLocal = timerLocal; const timerGlobal = (timeScale = 1) => { // @deprecated, r170 console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'); return time.mul(timeScale); }; /** * @tsl * @function * @deprecated since r170. Use {@link deltaTime} instead. * * @param {number} [timeScale=1] - The time scale. * @returns {UniformNode<float>} */ exports.timerGlobal = timerGlobal; const timerDelta = (timeScale = 1) => { // @deprecated, r170 console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'); return deltaTime.mul(timeScale); }; exports.timerDelta = timerDelta;