afterglow.web.routes.visualizer

active-fixtures

(active-fixtures show)

Return the fixtures which should currently be rendered, because they are emitting light.

active?

(active? show [id fixture-or-head])

Check whether the given fixture (represented as a tuple of [id spec], as found in a show’s :visualizer-visible map) should be included in the current visualizer frame, because it is emitting light.

adjusted-positions

(adjusted-positions lights show scale)

Move the spotlights so they all fit within the shader’s bounding cube, which extends from [-0.5, 0.25, 0.5] to [0.5, -0.25, 0].

adjusted-rotations

(adjusted-rotations show)

Get the current orientations of the active spotlights for the visualizer. Return as a series of columns of the rotation matrices, since it looks like WebGL or THREE.js is a lot happier passing vectors than matrices as uniforms.

axis-shift

(axis-shift show axis origin available-span scale)

Determine how much we need to translate show space points along an axis after they have been scaled to move them into the shader’s bounding cube. If there is extra room for this axis, center it within the bounding cube.

byte-to-double

(byte-to-double val)

Convert a one-byte color component, as used in Afterglow, to a floating point color component as used in OpenGL, where 255 becomes 1.0.

current-colors

(current-colors lights show)

Get the current color values of the active spotlights for the visualizer. Return as a series of four-element vectors of red, green, blue, and alpha.

current-pan-tilts

(current-pan-tilts lights show)

Get the current pan and tilt values of the active spotlights for the visualizer. Return as a series of two-element vectors of pan and tilt angles in the perspective of the visualizer, to save space compared to sending actual rotation matrices.

max-lights

The maximum number of lights that the visualizer will attempt to render. Adjust this based on the performance of your graphics hardware.

page

(page show-id)

Render the real-time show preview.

shader

(shader show-id)

Render a GLSL shader capable of volumetric rendering of enough lights to accommodate the current show.

shader-offsets

(shader-offsets show scale)

Determine the values to add to the coordinates of scaled light positions to move them inside the shader’s bounding cube, whose origin is [-0.5, -0.25, 0].

shader-scale

(shader-scale show)

Determine how much we need to scale the show so it fits in the shader’s bounding cube which has a width of 1.0, a height of 0.5, and a depth of 0.5. We are not going to shift lights down to the floor, though.

show-span

(show-span show axis)

Determine the degree to which a show spreads over an axis. For the X and Z axes, this is simply the difference in bounding box coordinates. For Y, we want to preserve height from the floor, so we use zero as a lower bound on the minimum coordinate.

update-preview

(update-preview show-id)

Render updated lighting information for the preview.

visualizer-pan-tilt

(visualizer-pan-tilt head pan tilt)

Given a head and DMX pan and tilt values, calculate the pan and tilt angles to send the visualizer