Skip to content

Commit

Permalink
Added white channel for SpotVisualization
Browse files Browse the repository at this point in the history
  • Loading branch information
newcat committed Mar 25, 2024
1 parent 6516284 commit d0beca5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const props = defineProps<{
}>();
const options = computed(() => {
const options: { label: string; value: number }[] = [];
const options: { label: string; value: number }[] = [{ label: "None", value: -1 }];
for (let i = 0; i < props.fixture.channelNames.length; i++) {
options.push({
label: props.fixture.channelNames[i],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<LabelledFormField label="DMX Channel Blue">
<DmxChannelSelector v-model="config.colorChannels[2]" :fixture="props.visualization.fixture" />
</LabelledFormField>
<LabelledFormField label="DMX Channel White">
<DmxChannelSelector v-model="config.colorChannels[3]" :fixture="props.visualization.fixture" />
</LabelledFormField>
</div>
<div>
<Button outlined label="Apply" :disabled="!dirty" @click="save" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ export class SpotRenderer extends BaseRenderer<SpotVisualizationConfig, number[]
}

public override onFixtureValueUpdate(data: number[]): void {
const red = data[this.config.colorChannels[0]] ?? 0;
const green = data[this.config.colorChannels[1]] ?? 0;
const blue = data[this.config.colorChannels[2]] ?? 0;
const [redChannel, greenChannel, blueChannel, whiteChannel] = this.config.colorChannels;
const red = redChannel >= 0 ? data[this.config.colorChannels[0]] ?? 0 : 0;
const green = greenChannel >= 0 ? data[this.config.colorChannels[1]] ?? 0 : 0;
const blue = blueChannel >= 0 ? data[this.config.colorChannels[2]] ?? 0 : 0;
const white = whiteChannel >= 0 ? data[this.config.colorChannels[3]] ?? 0 : 0;
const color = new THREE.Color(red / 255, green / 255, blue / 255);
color.addScalar(white / 255);
this.volumeMaterial.uniforms.lightColor.value = color;
this.spotlight.color = color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class SpotVisualization extends BaseVisualization<DmxFixture, SpotVisuali
super(fixture, {
position: [0, 0, 0],
target: [0, 0, 0],
colorChannels: [0, 0, 0],
colorChannels: [-1, -1, -1, -1],
});
void this.renderer.createFixtureRenderer(fixture.id, this.type, this.config);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface SpotVisualizationConfig {
position: [number, number, number];
target: [number, number, number];
colorChannels: [number, number, number];
colorChannels: [number, number, number, number];
}

0 comments on commit d0beca5

Please sign in to comment.