X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=equations.frag;h=04e5370fd9d53baf5afda39ee140a526d6937945;hb=ce2e0615420b706e1ff2405fffcedfba37a9adac;hp=ae32ed7fd72e48b166211a828a3d331335827a45;hpb=632cf18d06090795ea725117b4c48bd230dda72f;p=nageru diff --git a/equations.frag b/equations.frag index ae32ed7..04e5370 100644 --- a/equations.frag +++ b/equations.frag @@ -1,12 +1,14 @@ #version 450 core -in vec2 tc, tc_left, tc_down; -out uvec4 equation; +in vec3 tc0, tc_left0, tc_down0; +in vec3 tc1, tc_left1, tc_down1; +in float line_offset; +out uvec4 equation_red, equation_black; -uniform sampler2D I_x_y_tex, I_t_tex; -uniform sampler2D diff_flow_tex, base_flow_tex; -uniform sampler2D beta_0_tex; -uniform sampler2D diffusivity_tex; +uniform sampler2DArray I_x_y_tex, I_t_tex; +uniform sampler2DArray diff_flow_tex, base_flow_tex; +uniform sampler2DArray beta_0_tex; +uniform sampler2DArray diffusivity_tex; // Relative weighting of intensity term. uniform float delta; @@ -65,7 +67,7 @@ float zero_if_outside_border(vec4 val) } } -void main() +uvec4 compute_equation(vec3 tc, vec3 tc_left, vec3 tc_down) { // Read the flow (on top of the u0/v0 flow). float du, dv; @@ -161,8 +163,25 @@ void main() b2 += laplacian.y; // Encode the equation down into four uint32s. - equation.x = floatBitsToUint(1.0 / A11); - equation.y = floatBitsToUint(A12); - equation.z = floatBitsToUint(1.0 / A22); - equation.w = pack_floats_shared(b1, b2); + uvec4 ret; + ret.x = floatBitsToUint(1.0 / A11); + ret.y = floatBitsToUint(A12); + ret.z = floatBitsToUint(1.0 / A22); + ret.w = pack_floats_shared(b1, b2); + return ret; +} + +void main() +{ + uvec4 eq0 = compute_equation(tc0, tc_left0, tc_down0); + uvec4 eq1 = compute_equation(tc1, tc_left1, tc_down1); + + if ((int(round(line_offset)) & 1) == 1) { + // Odd line, so the right value is red. + equation_red = eq1; + equation_black = eq0; + } else { + equation_red = eq0; + equation_black = eq1; + } }