exeldro / obs-shaderfilter

OBS Studio filter for applying an arbitrary shader to a source.
GNU General Public License v2.0
377 stars 39 forks source link

Feature/improved input fields #9

Closed FiniteSingularity closed 1 year ago

FiniteSingularity commented 1 year ago

This PR adds optional minimum, maximum, step size, and widget type annotations to input fields. For example:

// Contrast from -1.0 to 1.0
uniform float Contrast<
  string label = "Contrast Adjustment";
  string widget_type = "slider";
  float minimum = -1.0;
  float maximum = 1.0;
  float step = 0.01;
> = 0.0;

Will add a slider that has a minimum of -1.0, maximum of 1.0, and a step size of 0.01. Also adds a drop-down select widget for integer fields, e.g.:

uniform int SelectTest<
  string label = "Int Select";
  string widget_type = "select";
  int    option_0_value = 0;
  string option_0_label = "First";
  int    option_1_value = 1;
  string option_1_label = "Second";
  int    option_2_value = 3;
  string option_2_label = "Third";
> = 3;

PR also adds a preprocessing step for HLSL files allowing for #include "../relative/path/to/file.effect" to include an external hlsl file. Currently #include doesn't check for circular includes.

FiniteSingularity commented 1 year ago

I checked against a few of my own shader files, and they worked fine. Also checked against some of the demo files, and they all seemed to still be working. At some point we probably want to modify the demo files to have sane limits, using these new functions.