Skip to content

Commit

Permalink
feat(shaders): use type conversion to permit integers in shader config
Browse files Browse the repository at this point in the history
  • Loading branch information
loqusion committed May 6, 2024
1 parent b29e1da commit 9aba379
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions shaders/blue-light-filter.glsl.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ precision highp float;
varying vec2 v_texcoord;
uniform sampler2D tex;

const float temperature = {{#nc}}{{temperature}} ? 2600.0{{/nc}};
const float temperatureStrength = {{#nc}}{{strength}} ? 1.0{{/nc}};
const float temperature = float({{#nc}}{{temperature}} ? 2600.0{{/nc}});
const float temperatureStrength = float({{#nc}}{{strength}} ? 1.0{{/nc}});

#define WithQuickAndDirtyLuminancePreservation
const float LuminancePreservationFactor = 1.0;
Expand Down
2 changes: 1 addition & 1 deletion shaders/color-filter.glsl.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ varying vec2 v_texcoord;
uniform sampler2D tex;

// Intensity of filter (1.0 - 0.0)
const float intensity = {{#nc}}{{strength}} ? 0.2{{/nc}};
const float intensity = float({{#nc}}{{strength}} ? 0.2{{/nc}});

// Enum for color correction type
const int PROTANOPIA = 0;
Expand Down
8 changes: 4 additions & 4 deletions shaders/vibrance.glsl.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ uniform sampler2D tex;

// see https://github.com/CeeJayDK/SweetFX/blob/a792aee788c6203385a858ebdea82a77f81c67f0/Shaders/Vibrance.fx#L20-L30
const vec3 VIB_RGB_BALANCE = vec3(
{{#nc}}{{balance.red}} ? 1.0{{/nc}},
{{#nc}}{{balance.green}} ? 1.0{{/nc}},
{{#nc}}{{balance.blue}} ? 1.0{{/nc}}
float({{#nc}}{{balance.red}} ? 1.0{{/nc}}),
float({{#nc}}{{balance.green}} ? 1.0{{/nc}}),
float({{#nc}}{{balance.blue}} ? 1.0{{/nc}})
);
const float VIB_VIBRANCE = {{#nc}}{{strength}} ? 0.15{{/nc}};
const float VIB_VIBRANCE = float({{#nc}}{{strength}} ? 0.15{{/nc}});

const vec3 VIB_coeffVibrance = VIB_RGB_BALANCE * -VIB_VIBRANCE;

Expand Down

0 comments on commit 9aba379

Please sign in to comment.