Separated cursor and glint intensities from their colors, which can now safely reside in their color spaces.

This commit is contained in:
Rezmason
2022-11-01 08:05:48 -07:00
parent c7fafcdb13
commit acc21ef1f4
10 changed files with 76 additions and 28 deletions

View File

@@ -7,6 +7,7 @@ uniform sampler2D paletteTex;
uniform float ditherMagnitude;
uniform float time;
uniform vec3 backgroundColor, cursorColor, glintColor;
uniform float cursorIntensity, glintIntensity;
varying vec2 vUV;
highp float rand( const in vec2 uv, const in float t ) {
@@ -30,8 +31,8 @@ void main() {
// Map the brightness to a position in the palette texture
gl_FragColor = vec4(
texture2D( paletteTex, vec2(brightness.r, 0.0)).rgb
+ min(cursorColor * brightness.g, vec3(1.0))
+ min(glintColor * brightness.b, vec3(1.0))
+ min(cursorColor * cursorIntensity * brightness.g, vec3(1.0))
+ min(glintColor * glintIntensity * brightness.b, vec3(1.0))
+ backgroundColor,
1.0
);

View File

@@ -7,6 +7,7 @@ uniform sampler2D stripeTex;
uniform float ditherMagnitude;
uniform float time;
uniform vec3 backgroundColor, cursorColor, glintColor;
uniform float cursorIntensity, glintIntensity;
varying vec2 vUV;
highp float rand( const in vec2 uv, const in float t ) {
@@ -31,8 +32,8 @@ void main() {
gl_FragColor = vec4(
color * brightness.r
+ min(cursorColor * brightness.g, vec3(1.0))
+ min(glintColor * brightness.b, vec3(1.0))
+ min(cursorColor * cursorIntensity * brightness.g, vec3(1.0))
+ min(glintColor * glintIntensity * brightness.b, vec3(1.0))
+ backgroundColor,
1.0
);