UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

28 lines (26 loc) 781 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.directionToColor = exports.colorToDirection = void 0; var _TSLBase = require("../tsl/TSLBase.js"); /** * Packs a direction vector into a color value. * * @tsl * @function * @param {Node<vec3>} node - The direction to pack. * @return {Node<vec3>} The color. */ const directionToColor = node => (0, _TSLBase.nodeObject)(node).mul(0.5).add(0.5); /** * Unpacks a color value into a direction vector. * * @tsl * @function * @param {Node<vec3>} node - The color to unpack. * @return {Node<vec3>} The direction. */ exports.directionToColor = directionToColor; const colorToDirection = node => (0, _TSLBase.nodeObject)(node).mul(2.0).sub(1); exports.colorToDirection = colorToDirection;