From 5f544091a9d98e57d837d462b572fc06715034a5 Mon Sep 17 00:00:00 2001 From: Rezmason Date: Sun, 18 Sep 2022 22:30:10 -0700 Subject: [PATCH] Deferring the holoplay import until it's determined that it's needed. Changing the holoplay effect version a little. --- js/config.js | 27 ++++++++++++++++++--------- js/regl/lkgHelper.js | 23 ++++++++++------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/js/config.js b/js/config.js index a33fcea..ec97b69 100644 --- a/js/config.js +++ b/js/config.js @@ -317,20 +317,29 @@ const versions = { holoplay: { font: "resurrections", - numColumns: 20, - fallSpeed: 0.35, - cycleSpeed: 0.04, + glintTexture: "metal", glyphEdgeCrop: 0.1, - ditherMagnitude: 0, + cursorColor: [1.4, 2, 1.2], + isolateGlint: true, + glintColor: [3, 2.5, 0.6], + glintBrightness: -0.5, + glintContrast: 1.5, + baseBrightness: -0.4, + baseContrast: 1.5, + highPassThreshold: 0, + cycleSpeed: 0.03, + bloomStrength: 0.7, + fallSpeed: 0.3, paletteEntries: [ - { hsl: [0.39, 0.9, 0.0], at: 0.0 }, - { hsl: [0.39, 1.0, 0.6], at: 0.5 }, - { hsl: [0.39, 1.0, 1.0], at: 1.0 }, + { hsl: [0.37, 0.6, 0.0], at: 0.0 }, + { hsl: [0.37, 0.6, 0.5], at: 1.0 }, ], - raindropLength: 1.4, - highPassThreshold: 0.2, + cycleSpeed: 0.01, + raindropLength: 0.3, renderer: "regl", + numColumns: 20, + ditherMagnitude: 0, bloomStrength: 0, volumetric: true, forwardSpeed: 0, diff --git a/js/regl/lkgHelper.js b/js/regl/lkgHelper.js index b686d53..c8636c2 100644 --- a/js/regl/lkgHelper.js +++ b/js/regl/lkgHelper.js @@ -1,5 +1,3 @@ -import * as HoloPlayCore from "../../lib/holoplaycore.module.js"; - const recordedDevice = { buttons: [0, 0, 0, 0], calibration: { @@ -34,14 +32,6 @@ const recordedDevice = { windowCoords: [1440, 900], }; -const getDetectedDevice = new Promise( - (resolve, reject) => - new HoloPlayCore.Client( - (data) => resolve(data.devices?.[0]), - (error) => resolve(null) - ) -); - const interpretDevice = (device) => { if (device == null) { return { enabled: false, tileX: 1, tileY: 1 }; @@ -84,9 +74,16 @@ export default async (useHoloplay = false, useRecordedDevice = false) => { if (!useHoloplay) { return interpretDevice(null); } - const detectedDevice = await getDetectedDevice; - if (detectedDevice == null && useRecordedDevice) { + const HoloPlayCore = await import("../../lib/holoplaycore.module.js"); + const device = await new Promise( + (resolve, reject) => + new HoloPlayCore.Client( + (data) => resolve(data.devices?.[0]), + (error) => resolve(null) + ) + ); + if (device == null && useRecordedDevice) { return interpretDevice(recordedDevice); } - return interpretDevice(detectedDevice); + return interpretDevice(device); };