qr shader: fix aligner positioning, probably correct
This commit is contained in:
parent
bdb2c20d59
commit
7071a0189d
1 changed files with 13 additions and 18 deletions
|
@ -15,8 +15,9 @@ CGPROGRAM
|
||||||
#define VERSION _Version
|
#define VERSION _Version
|
||||||
#define WIDTH (17 + VERSION * 4)
|
#define WIDTH (17 + VERSION * 4)
|
||||||
#define ALIGNERS ((VERSION / 7) + 2)
|
#define ALIGNERS ((VERSION / 7) + 2)
|
||||||
#define ALIGNER_SPACING ((WIDTH - 13) / (ALIGNERS-1))
|
#define ALIGNER_SPACING_IDEAL ((WIDTH - 13) / (ALIGNERS-1))
|
||||||
#define MISALIGNMENT ((WIDTH - 13) % (ALIGNERS-1))
|
#define ALIGNER_SPACING (ALIGNER_SPACING_IDEAL + ALIGNER_SPACING_IDEAL % 2)
|
||||||
|
#define MISALIGNMENT ((WIDTH - 13) - ALIGNER_SPACING * ALIGNERS)
|
||||||
|
|
||||||
#define EC_LEVEL_L 1
|
#define EC_LEVEL_L 1
|
||||||
#define EC_LEVEL_M 0
|
#define EC_LEVEL_M 0
|
||||||
|
@ -72,22 +73,14 @@ CGPROGRAM
|
||||||
|
|
||||||
// Aligners
|
// Aligners
|
||||||
if (VERSION > 1
|
if (VERSION > 1
|
||||||
&& (px > 8 || py > 8) // top left
|
&& (px > 12 || py > 12) // top left
|
||||||
&& (px < WIDTH - 9 || py > 8) // top right
|
&& (px < WIDTH - 13 || py > 12) // top right
|
||||||
&& (py < WIDTH - 9 || px > 8) // bottom left
|
&& (py < WIDTH - 13 || px > 12) // bottom left
|
||||||
) {
|
) {
|
||||||
// if (MISALIGNMENT != 0) return PINK;
|
uint x = px + ALIGNER_SPACING - 4 - MISALIGNMENT;
|
||||||
|
uint y = py + ALIGNER_SPACING - 4 - MISALIGNMENT;
|
||||||
uint x = px + ALIGNER_SPACING - 4;// - MISALIGNMENT;
|
if (px < 15) x += MISALIGNMENT;
|
||||||
uint y = py + ALIGNER_SPACING - 4;// - MISALIGNMENT;
|
if (py < 15) y += MISALIGNMENT;
|
||||||
// if (px > WIDTH-15) x -= MISALIGNMENT;
|
|
||||||
// if (py > WIDTH-15) y -= MISALIGNMENT;
|
|
||||||
// if (px < 10) {
|
|
||||||
// x += MISALIGNMENT;
|
|
||||||
// }
|
|
||||||
// if (py < 10) {
|
|
||||||
// y += MISALIGNMENT;
|
|
||||||
// }
|
|
||||||
uint ax = x % ALIGNER_SPACING;
|
uint ax = x % ALIGNER_SPACING;
|
||||||
uint ay = y % ALIGNER_SPACING;
|
uint ay = y % ALIGNER_SPACING;
|
||||||
if (ax < 5 && ay < 5) {
|
if (ax < 5 && ay < 5) {
|
||||||
|
@ -109,7 +102,9 @@ CGPROGRAM
|
||||||
|
|
||||||
uint column = (WIDTH - px - (px > 6))/2;
|
uint column = (WIDTH - px - (px > 6))/2;
|
||||||
uint direction_up = column & 1;
|
uint direction_up = column & 1;
|
||||||
return lerp(BLUE, PINK, column / (WIDTH/2.));
|
// return lerp(BLUE, PINK, column / (WIDTH/2.));
|
||||||
|
return lerp(BLUE, PINK, (px+py)&1);
|
||||||
|
// return float4((px/8 + py/8) & 1, (px/2 + py/2) & 1, (px/4 + py/4) & 1, 1);
|
||||||
// return direction_up;
|
// return direction_up;
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue