@viji-dev/core 0.3.13 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -551,7 +551,7 @@ class IFrameManager {
551
551
  }
552
552
  function WorkerWrapper(options) {
553
553
  return new Worker(
554
- "" + new URL("assets/viji.worker-DTTIvWDe.js", import.meta.url).href,
554
+ "" + new URL("assets/viji.worker-Cu6zt4AH.js", import.meta.url).href,
555
555
  {
556
556
  type: "module",
557
557
  name: options?.name
@@ -716,7 +716,7 @@ class WorkerManager {
716
716
  }
717
717
  /**
718
718
  * Initializes the worker with canvas and basic setup
719
- * Waits for init-response message (worker will also send separate 'ready' event)
719
+ * Waits for init-response message
720
720
  */
721
721
  async initializeWorker() {
722
722
  if (!this.worker) {
@@ -1900,7 +1900,7 @@ class EssentiaOnsetDetection {
1900
1900
  this.initPromise = (async () => {
1901
1901
  try {
1902
1902
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1903
- const wasmModule = await import("./essentia-wasm.web-wuvxiRYm.js").then((n) => n.e);
1903
+ const wasmModule = await import("./essentia-wasm.web-CvBoZF2z.js").then((n) => n.e);
1904
1904
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1905
1905
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1906
1906
  if (!WASMModule) {
@@ -14472,6 +14472,29 @@ class DeviceSensorManager {
14472
14472
  this.externalDeviceOrder = [];
14473
14473
  }
14474
14474
  }
14475
+ class SceneAnalyzer {
14476
+ /**
14477
+ * Detects the renderer type from scene code comments
14478
+ *
14479
+ * Looks for:
14480
+ * - // @renderer shader
14481
+ * - /* @renderer shader *\/
14482
+ * - // @renderer p5
14483
+ * - /* @renderer p5 *\/
14484
+ *
14485
+ * @param sceneCode - The artist's scene code to analyze
14486
+ * @returns The detected renderer type ('shader', 'p5', or 'native')
14487
+ */
14488
+ static detectRendererType(sceneCode) {
14489
+ if (/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(sceneCode)) {
14490
+ return "shader";
14491
+ }
14492
+ if (/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(sceneCode)) {
14493
+ return "p5";
14494
+ }
14495
+ return "native";
14496
+ }
14497
+ }
14475
14498
  class VijiCore {
14476
14499
  iframeManager = null;
14477
14500
  workerManager = null;
@@ -14565,6 +14588,7 @@ class VijiCore {
14565
14588
  // InteractionManager (viji.mouse/etc) always exists regardless
14566
14589
  allowUserInteraction: config.allowUserInteraction ?? !this.isHeadless
14567
14590
  };
14591
+ this.stats.rendererType = SceneAnalyzer.detectRendererType(config.sceneCode);
14568
14592
  this.videoStream = config.videoStream || null;
14569
14593
  this.videoStreams = config.videoStreams || [];
14570
14594
  this.currentInteractionEnabled = this.config.allowUserInteraction;
@@ -14881,12 +14905,6 @@ class VijiCore {
14881
14905
  */
14882
14906
  setupCommunication() {
14883
14907
  if (!this.workerManager) return;
14884
- this.workerManager.onMessage("ready", (data) => {
14885
- this.debugLog("Worker ready:", data);
14886
- if (data.rendererType !== void 0) {
14887
- this.stats.rendererType = data.rendererType;
14888
- }
14889
- });
14890
14908
  this.workerManager.onMessage("error", (data) => {
14891
14909
  console.error("Worker error:", data);
14892
14910
  });
@@ -16240,4 +16258,4 @@ export {
16240
16258
  VijiCoreError as b,
16241
16259
  getDefaultExportFromCjs as g
16242
16260
  };
16243
- //# sourceMappingURL=index-Cj4pl_5w.js.map
16261
+ //# sourceMappingURL=index-CeLhExPX.js.map