Skip to content

Commit

Permalink
Fixed visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
newcat committed Jan 7, 2024
1 parent 4ba8cf7 commit eaf1506
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/stage/controllers/razerchroma/chroma.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ export class RazerChromaController extends BaseController<Record<string, never>,

public async dispose(): Promise<void> {
await this.api.destroy();
console.log("API disposed");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { markRaw } from "vue";
import { markRaw, toRaw } from "vue";

import { BaseFixture, FixtureType, LedStripFixture } from "@/stage/fixtures";
import { BaseVisualization, VisualizationType } from "../base.visualization";
Expand Down Expand Up @@ -39,7 +39,7 @@ export class LedStripVisualization extends BaseVisualization<LedStripFixture, Le
}

protected async onFixtureValueUpdate() {
await this.renderer.onFixtureValueUpdate(this.fixture.id, this.fixture.value);
await this.renderer.onFixtureValueUpdate(this.fixture.id, toRaw(this.fixture.value));
}

private getRendererConfig(): LedStripRendererConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { markRaw } from "vue";
import { markRaw, toRaw } from "vue";

import { BaseFixture, DmxFixture, FixtureType } from "@/stage/fixtures";
import { BaseVisualization, VisualizationType } from "../base.visualization";
Expand Down Expand Up @@ -39,6 +39,6 @@ export class SpotVisualization extends BaseVisualization<DmxFixture, SpotVisuali
}

protected async onFixtureValueUpdate() {
await this.renderer.onFixtureValueUpdate(this.fixture.id, this.fixture.value);
await this.renderer.onFixtureValueUpdate(this.fixture.id, toRaw(this.fixture.value));
}
}
3 changes: 0 additions & 3 deletions src/stage/visualization/stageRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,20 @@ export class StageRenderer {
newRenderer.onConfigUpdate(initialConfig as any);
this._fixtureRenderers.set(fixtureId, newRenderer);
this._scene?.add(newRenderer);
console.log("Created fixture renderer", fixtureId, visualizationType, initialConfig);
}

public onFixtureConfigUpdate<T extends VisualizationType>(fixtureId: string, config: FixtureRendererConfig<T>) {
console.log("Updating fixture config", fixtureId, config);
const fixtureRenderer = this.fixtureRenderers.get(fixtureId);
if (fixtureRenderer) {
fixtureRenderer.onConfigUpdate(config);
console.log("Updated fixture config", fixtureId, config);
}
}

public onFixtureValueUpdate<T extends VisualizationType>(fixtureId: string, value: FixtureRendererValue<T>) {
const fixtureRenderer = this.fixtureRenderers.get(fixtureId);
if (fixtureRenderer) {
fixtureRenderer.onFixtureValueUpdate(value);
console.log("Updated fixture value", fixtureId, value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stage/visualization/visualization.worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Comlink from "comlink";
import { StageRenderer } from "./stageRenderer";

console.log("Hello from worker!");
console.log("Stage visualization worker started");
Comlink.expose(new StageRenderer());

0 comments on commit eaf1506

Please sign in to comment.