Skip to content

Feature: pick a look preset from a single #define in blackhole.glsl #9

Description

@quentincherifi

Motivation

The named presets (Gargantua, Quasar, M87* donut, Blazar, Inferno, Zen, …) currently live only in the SwiftUI tuner (tuner/Sources/BlackHoleTuner/ParamSpec.swift). To use one without the tuner you have to hand-copy ~13 disk constants into blackhole.glsl. That leaves out anyone who doesn't build the macOS Swift app, and it's clunky even on macOS for a quick "just give me Zen and reload".

Proposal

A one-line look selector at the top of blackhole.glsl, mirroring the existing #define SIZE_MODE MODE_TOKENS idiom:

#define PRESET PRESET_ZEN   // or PRESET_CUSTOM to hand-tune / use the tuner
  • A #if / #elif ladder holds each preset's values, ported verbatim from ParamSpec.swift so the Swift tuner stays the single source of truth for the numbers.
  • PRESET_CUSTOM (the committed default) keeps today's behavior exactly: the tuner-editable const float literal lines are used.

Tuner compatibility

The tuner's constRe only matches numeric literal lines — ^const float NAME = -?\d+\.\d+;…$. The design keeps those literals live only in the PRESET_CUSTOM branch; named presets source their values from macro identifiers (const float DISK_TEMP = PRESET_DISK_TEMP;), which the regex ignores. So:

  • In PRESET_CUSTOM mode the tuner works exactly as today.
  • With a named preset active, the disk look is fixed at compile time and tuner slider edits to disk params are ignored until you switch back to PRESET_CUSTOM. (Documented in the README.)

No Swift changes in this PR.

Scope

  • blackhole.glsl: preset name defines, the selector, the value ladder, and the wrapped disk-constant block.
  • README.md: a short note under Tuning.

Happy to open the PR if this direction looks good — wanted to check the design (especially the tuner-compat approach and whether you'd prefer a different override mechanism) before writing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions