Compare commits

..

2 commits

3 changed files with 195 additions and 148 deletions

View file

@ -10,8 +10,7 @@ Material:
m_Name: QRCode m_Name: QRCode
m_Shader: {fileID: 4800000, guid: 4bdd5767586f3a92993efea8febe2aa2, type: 3} m_Shader: {fileID: 4800000, guid: 4bdd5767586f3a92993efea8febe2aa2, type: 3}
m_ValidKeywords: [] m_ValidKeywords: []
m_InvalidKeywords: m_InvalidKeywords: []
- _DISABLEMASK_ON
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
@ -62,17 +61,22 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Ints: m_Ints:
- _DisableMask: 1 - _Animate: 0
- _DisableMask: 0
- _ECLevel: 2
- _RemoveBits: 0
- _Version: 15 - _Version: 15
m_Floats: m_Floats:
- _AnimationSpeed: 1
- _BumpScale: 1 - _BumpScale: 1
- _Cutoff: 0.5 - _Cutoff: 0.5
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DstBlend: 0 - _DstBlend: 0
- _FrameSize: 0.1
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.5 - _Glossiness: 0.5
- _GlossyReflections: 1 - _GlossyReflections: 1
- _Mask: 1 - _Mask: 7
- _Metallic: 0 - _Metallic: 0
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
@ -80,9 +84,10 @@ Material:
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SrcBlend: 1 - _SrcBlend: 1
- _TimeSlider: 95 - _TimeSlider: 0
- _TimeSliderCoarse: 0
- _UVSec: 0 - _UVSec: 0
- _Version: 6 - _Version: 21
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -1,13 +1,19 @@
Shader "CrispyPin/QRCode" { Shader "CrispyPin/QRCode" {
Properties { Properties {
[HideInInspector] [HideInInspector]
_("",2D)=""{} _("uv dummy",2D)=""{}
_Version("Version", Range(1, 40)) = 1
_Mask("Mask type", Range(0, 7)) = 1 [Header(QR Code parameters)]
[Toggle] [Space]
_DisableMask("Hide mask", Integer) = 0 [IntRange] _Version("Version (must match data)", Range(1, 40)) = 1
[Toggle] [Enum(Low,1, Medium,0, Quartile,3, High,2)] _ECLevel("EC Level (must match data)", Integer) = 1
_Animate("Animate debug worm", Integer) = 0 [IntRange] _Mask("Mask type", Range(0, 7)) = 1
_FrameSize("Frame size", Range(0, 2)) = 0.1
[Header(Debugging controls)]
[Space]
[Toggle] _DisableMask("Hide mask", Integer) = 0
[Toggle] _Animate("Animate debug worm", Integer) = 0
_AnimationSpeed("Speed", Range(1, 100)) = 0 _AnimationSpeed("Speed", Range(1, 100)) = 0
_TimeSlider("Time", Range(0, 200)) = 0 _TimeSlider("Time", Range(0, 200)) = 0
_TimeSliderCoarse("Time Coarse", Range(0, 250)) = 0 _TimeSliderCoarse("Time Coarse", Range(0, 250)) = 0
@ -20,33 +26,29 @@ CGPROGRAM
struct Input{float2 uv_;}; struct Input{float2 uv_;};
uint _Version; uint _Version;
uint _Mask; uint _Mask;
uint _ECLevel;
float _FrameSize;
bool _DisableMask; bool _DisableMask;
bool _Animate; bool _Animate;
float _TimeSlider; float _TimeSlider;
float _TimeSliderCoarse; float _TimeSliderCoarse;
float _AnimationSpeed; float _AnimationSpeed;
#define EC_LEVEL _ECLevel
#define MASK_TYPE _Mask
#define VERSION _Version #define VERSION _Version
#define WIDTH (17 + VERSION * 4) #define WIDTH (17 + VERSION * 4)
#define PIXEL_WIDTH WIDTH
// #define PIXEL_WIDTH 177
#define ALIGNERS ((VERSION / 7) + 2) #define ALIGNERS ((VERSION / 7) + 2)
#define ALIGNER_SPACING_IDEAL ((WIDTH - 13) / (ALIGNERS-1)) #define ALIGNER_SPACING_IDEAL ((WIDTH - 13) / (ALIGNERS-1))
#define ALIGNER_SPACING (ALIGNER_SPACING_IDEAL + ALIGNER_SPACING_IDEAL % 2) #define ALIGNER_SPACING (ALIGNER_SPACING_IDEAL + ALIGNER_SPACING_IDEAL % 2)
#define MISALIGNMENT ((WIDTH - 13) - ALIGNER_SPACING * ALIGNERS) #define MISALIGNMENT ((WIDTH - 13) - ALIGNER_SPACING * ALIGNERS)
#define BIT_COUNT (WIDTH * WIDTH - 225 - (WIDTH - 17)*2 - 25 * (ALIGNERS * ALIGNERS - 3) * (VERSION > 1)) #define ALIGNER_COUNT ((ALIGNERS * ALIGNERS - 3) * (VERSION > 1))
#define BIT_COUNT (WIDTH * WIDTH - 225 - (WIDTH - 17)*2 - 25 * ALIGNER_COUNT + 10*(ALIGNERS-2)*(ALIGNERS>2) - 36 * (VERSION > 6))
#define TIME_MANUAL (_TimeSlider + _TimeSliderCoarse*100) #define TIME_MANUAL (_TimeSlider + _TimeSliderCoarse*100)
#define TIME (uint)(_Animate ? _Time.y * _AnimationSpeed + TIME_MANUAL : TIME_MANUAL) #define TIME (uint)(_Animate ? _Time.y * _AnimationSpeed + TIME_MANUAL : TIME_MANUAL)
#define EC_LEVEL_L 1
#define EC_LEVEL_M 0
#define EC_LEVEL_Q 3
#define EC_LEVEL_H 2
#define EC_LEVEL EC_LEVEL_L
#define MASK_TYPE _Mask
// ECI_MODE 0100 = byte
#define ECI_MODE 4
static const uint FORMAT_BIT_SETS[32] = {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b, 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed}; static const uint FORMAT_BIT_SETS[32] = {0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b, 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed};
#define FORMAT_BITS_RAW ((EC_LEVEL << 3) | MASK_TYPE) #define FORMAT_BITS_RAW ((EC_LEVEL << 3) | MASK_TYPE)
@ -55,8 +57,6 @@ CGPROGRAM
static const uint VERSION_BIT_SETS[34] = {0x07C94,0x085BC,0x09A99,0x0A4D3,0x0BBF6,0x0C762,0x0D847,0x0E60D,0x0F928,0x10B78,0x1145D,0x12A17,0x13532,0x149A6,0x15683,0x168C9,0x177EC,0x18EC4,0x191E1,0x1AFAB,0x1B08E,0x1CC1A,0x1D33F,0x1ED75,0x1F250,0x209D5,0x216F0,0x228BA,0x2379F,0x24B0B,0x2542E,0x26A64,0x27541,0x28C69}; static const uint VERSION_BIT_SETS[34] = {0x07C94,0x085BC,0x09A99,0x0A4D3,0x0BBF6,0x0C762,0x0D847,0x0E60D,0x0F928,0x10B78,0x1145D,0x12A17,0x13532,0x149A6,0x15683,0x168C9,0x177EC,0x18EC4,0x191E1,0x1AFAB,0x1B08E,0x1CC1A,0x1D33F,0x1ED75,0x1F250,0x209D5,0x216F0,0x228BA,0x2379F,0x24B0B,0x2542E,0x26A64,0x27541,0x28C69};
#define VERSION_BITS (VERSION > 6 ? VERSION_BIT_SETS[VERSION - 7] : 0) #define VERSION_BITS (VERSION > 6 ? VERSION_BIT_SETS[VERSION - 7] : 0)
#define WHITE 1
#define BLACK 0
#define PINK float3(1, .3, .5) #define PINK float3(1, .3, .5)
#define BLUE float3(0, .4, .7) #define BLUE float3(0, .4, .7)
@ -66,22 +66,14 @@ CGPROGRAM
} }
float3 main (float2 uv){ float3 main (float2 uv){
// "hell", "o wo", "rld!" const uint data[] = {0x40E746D7, 0x77660662, 0x5606D6E6, 0x068236E2, 0x5636C6F7, 0xE6571786, 0xEC184286, 0x92575616, 0x0742F616, 0x42660617, 0x044616C2, 0x52424266, 0x96112404, 0x52063742, 0xE6370762, 0x3606C697, 0x92F652C6, 0x07070704, 0x56E6EC67, 0x92076646, 0x07424646, 0x07863657, 0x4206E606, 0xC2767646, 0x92425211, 0x260776C6, 0x56460656, 0xF24696C6, 0x36071652, 0x26069796, 0xF206C206, 0xECF65656, 0x57428636, 0x560786E6, 0x968276E6, 0x06961246, 0xC6071606, 0x9711D2E6, 0x16360652, 0x57C24652, 0x52E6C296, 0x4246F607, 0x86C236D2, 0x6632EC07, 0x46B682D6, 0x0727E286, 0x04E27206, 0xC60617D6, 0x46570617, 0x06F70611, 0x4657E6C2, 0x52374604, 0x52260507, 0x17C26692, 0x17562226, 0x66162296, 0xEC862757, 0x06E24716, 0x9207C696, 0x46320616, 0x0737D7C2, 0x5652C707, 0xD6115237, 0x37970426, 0x96060757, 0xF7F207E6, 0x96463206, 0x06720726, 0x46D6EC06, 0x46324292, 0x56E71757, 0x37570746, 0xF7C28607, 0xC6160696, 0x5686F711, 0xD6F60606, 0x06E64737, 0x26362296, 0x86420752, 0x9652E6D7, 0xF7165227, 0xECF6F6F6, 0x46377792, 0x06975606, 0xF7F70696, 0x06F70742, 0x92524704, 0x4611D642, 0x62972646, 0x06974742, 0xB6575646, 0xF7375276, 0x0706E292, 0xD616EC56, 0x07063617, 0x82F62692, 0x04962276, 0x56522706, 0x9696B604, 0x0716C211, 0x96273636, 0xE0EC560E, 0x3C55514C, 0x6D15A023, 0x665E1264, 0x74673E1D, 0x5F5717CA, 0x4F40504B, 0x7421F8F3, 0xDA427336, 0x4AEF1540, 0x148EE697, 0xDA5E9475, 0x15C83730, 0x3C4A9094, 0x960142F8, 0xACF41F26, 0xB209D19B, 0xEC61B54D, 0x3215410D, 0xBD5BE302, 0xC15AF45B, 0xC49B130C, 0x8ABE32AC, 0x7B7ECDEE, 0x721EBEAB, 0x74100C8A, 0x7D387A18, 0x29B8F0C0, 0x70C95B49, 0x4FFE7EEA, 0xB6D82FB5, 0x6A2672C1, 0xA66BE33B, 0xEE4BD24C, 0xE066B984, 0x0DAC2A99, 0x9C9C9D92, 0x6C8A8D76, 0x9E42D757, 0x6E6FF527, 0x6312ADF9, 0x1830A821, 0xC1D52FB8, 0x9E7DDC14, 0x3CE8E58E, 0xD29811F0, 0x281E909F, 0xA7B9318F, 0xC67A5C75, 0xBBC270C9, 0x233ED044, 0x694734DE, 0x2C22AD0E, 0x405EE175, 0x54C5079D, 0x1C963D45, 0x3C036CC9, 0x122A41E0, 0x4E5C7F84, 0x7C6188FA, 0x450A9112, 0x5A7E5E71, 0x6707BD9A, 0x0297702F, 0xEE15E70F, 0xABB2D715, 0xAD6374FB, 0x98413E2D, 0x6C433255, 0x7A847F2B, 0x3E8FF100, 0x2A5CD1E7, 0x0367E909, 0xBEEF3E66, 0xF1F09C13, 0xAE0EDEBD, 0x6EE256B8, 0x2DF8908D, 0x0F57E334, 0x71AA45C7, 0x101C0E13, 0x144EE443, 0x7F9428CB, 0x4D8656D0, 0x1CF2E951, 0x9FC23499, 0x115B893B, 0x07384B8A, 0x7276CC05, 0x8E74B153, 0x4B3F5FE2, 0xFCED5974, 0xE994A837, 0x0ABD48CC, 0xAE47BEBE, 0x74D23E9B, 0x2E6B6030, 0x5A5D0669, 0x022F3C29, 0xE922DFFB, 0xBC3F0679, 0xD0AA2DE2, 0xA039F0CE, 0xF2E66AB5, 0xA81C4DCA, 0x381BD8A0, 0x0BD120C7, 0xD2C5FC9B, 0x4D39DDE1, 0x10F85E25, 0xBFCA6793, 0xB045ABA7, 0xD4994DC0, 0x20D7B404, 0x1C01E1A8, 0x88995798, 0x3BEB5A84, 0xB19FEA05, 0xBC1F2778, 0xAADED13F, 0xCE902F25, 0xFDE7BF8D, 0x2A7AABD2, 0x9D74F550, 0xFE143BFC, 0x38F759B2, 0xFEA4ECEE, 0x77B61A4F, 0x311A3C1F, 0x5CA77FD6, 0x3A53365B, 0xD9554AEC, 0xA956A683, 0x4F816FA3, 0x17816E04, 0x17135E8A, 0x30AF4638, 0x428CB7BE, 0x147EB239, 0x9CECC3BA, 0x5EF1BF08, 0x3FF568B3, 0xA87CEE55, 0x1C8C474C, 0x333DA5CC, 0xA1F1CF8C, 0x02122409, 0x74E46205, 0xE497AF30, 0x525685BD, 0x91FB8839, 0xCA2D504F, 0x9D70CC96, 0xDFA94318, 0x8A2B828C, 0x00D4DA56, 0x3CF15E80, 0x91C96A7E, 0xD5764DD6, 0x5E3FDC35, 0x8D63C2AD, 0xA3ECAD9A, 0x6A6940B7, 0xAD387855, 0xEE41DEA1, 0x39AC2F9A, 0xDEA8DCF4, 0x1388AF76, 0xB658B483, 0xA9E56DF6, 0xA64F0568, 0x112116C4, 0xD6A8E45D, 0x9633322A, 0xA90D0053, 0xDACA4265, 0xF6DCAA07, 0x14A7DFA3, 0x285C073F, 0xBF39BA6D, 0x7A3510C8, 0xB726A37D, 0x9F569403, 0x4F1A5D89, 0xF24F98BC, 0x36ED378F, 0x0AF508EA, 0xD38BBAF2};
const uint data[] = {0x68656c6c,0x6f20776f,0x726c6421,
// 4 bits 0 padding to align to byte (4 bit ECI_MODE is inserted before data and length)
// then ec11ec11... until some version-specific length reached?
// then EC data
0x0ec11ec1, 0x1ec2d631, 0x95423722, 0xe0000000
};
const uint data_len = 3*4;
const uint total_len = 7*4;
uv.y = 1 - uv.y; uv.y = 1 - uv.y;
uv = uv * 1.2 - 0.1; uv = uv * (_FrameSize*2 + 1.) - _FrameSize;
// Quiet zone/frame // Quiet zone/frame
if (uv.x < 0 || uv.x > 1 || uv.y < 0 || uv.y > 1) return 1; if (uv.x < 0 || uv.x > 1 || uv.y < 0 || uv.y > 1) return 1;
uint px = uv.x * PIXEL_WIDTH; uint px = uv.x * WIDTH;
uint py = uv.y * PIXEL_WIDTH; uint py = uv.y * WIDTH;
// Finder patterns // Finder patterns
if (px < 8 && py < 8) return finder_pattern(px, py); if (px < 8 && py < 8) return finder_pattern(px, py);
@ -167,8 +159,22 @@ CGPROGRAM
// aligners always cover a half column to the left and two full columns to the right // aligners always cover a half column to the left and two full columns to the right
// outer aligners are always 4 from all edges // outer aligners are always 4 from all edges
if (VERSION > 6) {
// top version info section
if (column == 5){
bit_index -= 12;
bit_index -= min(py + 1, 6);
} else if (column > 5) {
bit_index -= 18;
}
}
uint aligner_col = (column - 2) / (ALIGNER_SPACING/2); uint aligner_col = (column - 2) / (ALIGNER_SPACING/2);
uint aligner_col_mod = (column - 2) % (ALIGNER_SPACING/2); uint aligner_col_mod = (column - 2) % (ALIGNER_SPACING/2);
if (aligner_col > (ALIGNERS - 2)){
aligner_col_mod = (column-2) - (aligner_col-1) * (ALIGNER_SPACING/2);
aligner_col -= 1;
}
if (aligner_col > 0) { // full columns passed if (aligner_col > 0) { // full columns passed
bit_index -= (ALIGNERS - 1) * aligner_col*25; bit_index -= (ALIGNERS - 1) * aligner_col*25;
if (aligner_col > 1) { if (aligner_col > 1) {
@ -177,81 +183,115 @@ CGPROGRAM
} }
} }
uint passed_up = (y_relative - 9 + ALIGNER_SPACING - (!direction_up * (MISALIGNMENT+ALIGNER_SPACING))) / ALIGNER_SPACING; uint passed_up = min((y_relative - 9 + ALIGNER_SPACING)/ALIGNER_SPACING, ALIGNERS-1);
passed_up = min(passed_up, ALIGNERS-1);
#define ALIGNER_GRID_Y_START (WIDTH - 9 - ALIGNER_SPACING * (ALIGNERS - 1))
uint passed_down = py > ALIGNER_GRID_Y_START ? (py - ALIGNER_GRID_Y_START) / ALIGNER_SPACING : 0;
if (px < 9) {
if (passed_up>0) passed_up -= 1;
if (passed_down>(ALIGNERS-2)) passed_down-=1;
// if (passed_down>0) return 5;
// if (passed_up>0) return 5;
if (tiny_columns == 0) {
bit_index -= passed_up*10;
} else if (tiny_columns == 1) {
// bit_index += 16;
bit_index -= passed_down*10;
bit_index -= (ALIGNERS-2)*10;
} else if (tiny_columns == 2) {
if (VERSION > 6) {
bit_index -= 12;
}
bit_index -= (ALIGNERS-2) * 20;
} else if (tiny_columns == 3) {
if (VERSION > 6) {
bit_index -= 12;
bit_index -= (ALIGNERS-2)*20;
}
}
}
if (aligner_col_mod == 0) { if (aligner_col_mod == 0) {
if (direction_up) {
bit_index -= passed_up * 10; bit_index -= passed_up * 10;
if (direction_up && py < 5){ if (py < 8)
bit_index -= 8;
} else {
bit_index -= passed_down * 10;
if (py > 8)
bit_index -= 8; bit_index -= 8;
}
if (!direction_up && py > 5){
bit_index += 2;
if (py > WIDTH-5){
bit_index -= 10;
}
} }
} else if (aligner_col_mod == 1) { } else if (aligner_col_mod == 1) {
uint passed_down = (y_relative - 8 + ALIGNER_SPACING - !direction_up*MISALIGNMENT) / ALIGNER_SPACING; if (column > 3){
bit_index -= (passed_down + ALIGNERS - 1) * 10; bit_index -= ALIGNERS*10 - 2;
if (!direction_up) } else {
bit_index += 10; bit_index -= ALIGNERS*10;
if (aligner_col > 0) { bit_index += 26; // right finder
}
if (direction_up){
bit_index -= passed_up*10;
if (py < 5)
bit_index -= 8; bit_index -= 8;
} else { } else {
bit_index += 8; bit_index -= passed_down*10;
if (py > 8)
bit_index -= 8;
if (column == 3)
bit_index -= 8;
} }
if (direction_up ? py < 5 : py > 5){ } else if (aligner_col_mod == 2 && px > 5) {
bit_index += 2;
}
} else if (aligner_col_mod == 2) {
bit_index -= (ALIGNERS - 1) * 20; bit_index -= (ALIGNERS - 1) * 20;
if (aligner_col > 0) { if (aligner_col > 0)
bit_index -= 16; // most of the current column top aligner, excluding the left 4 pixels bit_index -= 16; // most of the current column top aligner, excluding the left 4 pixels
if (py < 9) {// top aligner if (direction_up) {
if (direction_up){ bit_index -= passed_up*5;
bit_index -= min(9-py, 5) - (py < 6); uint progress = (y_relative - 4) % ALIGNER_SPACING;
} else if (py > 3) { if (y_relative - 4 >= ALIGNER_SPACING*(ALIGNERS-1)) {
bit_index -= py - 3 - (py > 6); progress = 999;
}
if (progress < 5) {
bit_index -= progress+1;
}
if (py < 9) {
if (py < 4)
bit_index -= 4;
else
bit_index -= (9-py) - (py<6);
} }
} else { } else {
bit_index += !direction_up; bit_index -= passed_down*5;
if (py < 6 && py > 3) {
bit_index -= py-3;
} }
if (!direction_up && py > WIDTH-5){ else if (py < 9 && py > 6) {
bit_index-=5; bit_index -= py-4;
} else if (py > 8){
bit_index -= 4;
} }
}
uint offset = (column_progress + ALIGNER_SPACING - 3 - !direction_up*0 + (!direction_up * (-MISALIGNMENT+1))) % ALIGNER_SPACING;
// left side of regular aligners uint progress = (py - ALIGNER_GRID_Y_START) % ALIGNER_SPACING;
if (offset < 6 && py > 9 && px > 9) { if (py < WIDTH-((ALIGNERS-1)*ALIGNER_SPACING+4)) {
bit_index -= offset; progress = 999;
}
if (progress < 5) {
bit_index -= progress;
bit_index += 4;
}
} }
bit_index -= passed_up * 5;
} else { // include the full row } else if (aligner_col_mod > 2) { // include the full column of aligners
bit_index -= (ALIGNERS - 1)*25; bit_index -= (ALIGNERS - 1)*25;
if (aligner_col > 0){ if (aligner_col > 0){
// return PINK;
bit_index -= 20; bit_index -= 20;
} }
} }
} }
// data
uint bit = 0;
if (bit_index < 4){
bit = (ECI_MODE >> (3-bit_index))&1;
} else if (bit_index < 12) {
bit = (data_len >> (7 - (bit_index - 4))) & 1;
} else if (bit_index < total_len*8 + 12){
uint data_bit_index = bit_index - 12;
bit = ((data[data_bit_index/32] >> (31-(data_bit_index % 32))) & 1);
}
// mask // mask
uint mask; uint mask;
switch (_Mask){ switch (MASK_TYPE){
case 0: case 0:
mask = (px+py) % 2 == 0; mask = (px+py) % 2 == 0;
break; break;
@ -277,21 +317,23 @@ CGPROGRAM
mask = ((py+px)%2 + (px*py)%3) % 2 == 0; mask = ((py+px)%2 + (px*py)%3) % 2 == 0;
break; break;
} }
uint bit = ((data[bit_index/32] >> (31-(bit_index % 32))) & 1);
if (!_DisableMask) { if (!_DisableMask) {
bit ^= mask; bit ^= mask;
} }
// return !bit; return !bit;
// bit index debugging worm // bit index debugging worm
uint worm = TIME % BIT_COUNT - bit_index; // uint worm = TIME % BIT_COUNT - bit_index;
worm %= 200; // worm %= 200;
const uint length = 6; // const uint length = 6;
if (worm == 0) return float3(3,0,0); // if (worm == 0) return float3(3,0,0);
if (worm < length) return lerp(PINK, BLUE, (worm/(float)length)); // if (worm < length) return lerp(PINK, BLUE, (worm/(float)length));
if (bit_index > BIT_COUNT) return float3(1,0,0); // if (bit_index >= BIT_COUNT) return float3(1,0,0);
// #define BIT_COUNT 24 // // #define BIT_COUNT 24
return (float)(bit_index%BIT_COUNT)/(float)BIT_COUNT; // return (float)(bit_index%BIT_COUNT)/(float)BIT_COUNT;
} }
void s (Input IN, inout SurfaceOutputStandard o) { o.Albedo = main(IN.uv_); } void s (Input IN, inout SurfaceOutputStandard o) { o.Albedo = main(IN.uv_); }

View file

@ -19,7 +19,7 @@ MonoBehaviour:
width: 1920 width: 1920
height: 1029 height: 1029
m_ShowMode: 4 m_ShowMode: 4
m_Title: Game m_Title: Scene
m_RootView: {fileID: 6} m_RootView: {fileID: 6}
m_MinSize: {x: 875, y: 300} m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000} m_MaxSize: {x: 10000, y: 10000}
@ -48,7 +48,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200} m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192} m_MaxSize: {x: 24288, y: 16192}
vertical: 0 vertical: 0
controlID: 100 controlID: 85
--- !u!114 &3 --- !u!114 &3
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -68,8 +68,8 @@ MonoBehaviour:
y: 0 y: 0
width: 390 width: 390
height: 979 height: 979
m_MinSize: {x: 275, y: 50} m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 14} m_ActualView: {fileID: 14}
m_Panes: m_Panes:
- {fileID: 14} - {fileID: 14}
@ -93,9 +93,9 @@ MonoBehaviour:
x: 0 x: 0
y: 0 y: 0
width: 378 width: 378
height: 593 height: 672
m_MinSize: {x: 201, y: 221} m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 15} m_ActualView: {fileID: 15}
m_Panes: m_Panes:
- {fileID: 15} - {fileID: 15}
@ -117,9 +117,9 @@ MonoBehaviour:
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 593 y: 672
width: 1530 width: 1530
height: 386 height: 307
m_MinSize: {x: 231, y: 271} m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021} m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 13} m_ActualView: {fileID: 13}
@ -223,7 +223,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 200} m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192} m_MaxSize: {x: 16192, y: 16192}
vertical: 1 vertical: 1
controlID: 89 controlID: 86
--- !u!114 &10 --- !u!114 &10
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -244,11 +244,11 @@ MonoBehaviour:
x: 0 x: 0
y: 0 y: 0
width: 1530 width: 1530
height: 593 height: 672
m_MinSize: {x: 200, y: 100} m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096} m_MaxSize: {x: 16192, y: 8096}
vertical: 0 vertical: 0
controlID: 90 controlID: 87
--- !u!114 &11 --- !u!114 &11
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -259,7 +259,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 1 m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: GameView m_Name: SceneView
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Children: [] m_Children: []
m_Position: m_Position:
@ -267,17 +267,17 @@ MonoBehaviour:
x: 378 x: 378
y: 0 y: 0
width: 1152 width: 1152
height: 593 height: 672
m_MinSize: {x: 200, y: 200} m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4000, y: 4000} m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 17} m_ActualView: {fileID: 16}
m_Panes: m_Panes:
- {fileID: 16} - {fileID: 16}
- {fileID: 17} - {fileID: 17}
- {fileID: 12} - {fileID: 12}
- {fileID: 19} - {fileID: 19}
m_Selected: 1 m_Selected: 0
m_LastSelected: 0 m_LastSelected: 1
--- !u!114 &12 --- !u!114 &12
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@ -328,9 +328,9 @@ MonoBehaviour:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 674 y: 753
width: 1529 width: 1529
height: 365 height: 286
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@ -361,9 +361,9 @@ MonoBehaviour:
m_IsLocked: 0 m_IsLocked: 0
m_FolderTreeState: m_FolderTreeState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: 6a550000 m_SelectedIDs: a0550000
m_LastClickedID: 21866 m_LastClickedID: 21920
m_ExpandedIDs: 00000000685500006a55000000ca9a3b m_ExpandedIDs: 000000009e550000a055000000ca9a3b
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -391,7 +391,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 00000000685500006a550000 m_ExpandedIDs: 000000009e550000a0550000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -418,7 +418,7 @@ MonoBehaviour:
m_ListAreaState: m_ListAreaState:
m_SelectedInstanceIDs: m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0 m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 1 m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs: c6230000 m_ExpandedInstanceIDs: c6230000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
@ -512,7 +512,7 @@ MonoBehaviour:
x: 0 x: 0
y: 81 y: 81
width: 377 width: 377
height: 572 height: 651
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@ -521,9 +521,9 @@ MonoBehaviour:
m_SceneHierarchy: m_SceneHierarchy:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: 80570000 m_SelectedIDs: a4540000
m_LastClickedID: 22400 m_LastClickedID: 21668
m_ExpandedIDs: bef8ffffb2f9ffff32fbffff m_ExpandedIDs: 32fbffff
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@ -570,7 +570,7 @@ MonoBehaviour:
x: 378 x: 378
y: 81 y: 81
width: 1150 width: 1150
height: 572 height: 651
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@ -828,9 +828,9 @@ MonoBehaviour:
m_PlayAudio: 0 m_PlayAudio: 0
m_AudioPlay: 0 m_AudioPlay: 0
m_Position: m_Position:
m_Target: {x: -0.04489796, y: 0.120189056, z: -0.034687217} m_Target: {x: -0.013000671, y: 0.39374268, z: 1.5206755}
speed: 2 speed: 2
m_Value: {x: -0.04489796, y: 0.120189056, z: -0.034687217} m_Value: {x: -0.013000743, y: 0.39374268, z: 1.5206755}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
@ -877,13 +877,13 @@ MonoBehaviour:
m_GridAxis: 1 m_GridAxis: 1
m_gridOpacity: 0.5 m_gridOpacity: 0.5
m_Rotation: m_Rotation:
m_Target: {x: 0.28117505, y: 0.4320915, z: -0.14381126, w: 0.84475166} m_Target: {x: 0.0038246175, y: -0.99537355, z: 0.078170605, w: 0.061358314}
speed: 2 speed: 2
m_Value: {x: 0.2811681, y: 0.43208084, z: -0.14380771, w: 0.8447308} m_Value: {x: 0.0038233586, y: -0.9950459, z: 0.07814488, w: 0.06133812}
m_Size: m_Size:
m_Target: 0.4773262 m_Target: 0.22548148
speed: 2 speed: 2
m_Value: 0.4773262 m_Value: 0.22548148
m_Ortho: m_Ortho:
m_Target: 0 m_Target: 0
speed: 2 speed: 2
@ -931,7 +931,7 @@ MonoBehaviour:
x: 378 x: 378
y: 81 y: 81
width: 1150 width: 1150
height: 572 height: 651
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@ -943,7 +943,7 @@ MonoBehaviour:
m_ShowGizmos: 0 m_ShowGizmos: 0
m_TargetDisplay: 0 m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0} m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1150, y: 551} m_TargetSize: {x: 1150, y: 630}
m_TextureFilterMode: 0 m_TextureFilterMode: 0
m_TextureHideFlags: 61 m_TextureHideFlags: 61
m_RenderIMGUI: 1 m_RenderIMGUI: 1
@ -960,8 +960,8 @@ MonoBehaviour:
vZoomLockedByDefault: 0 vZoomLockedByDefault: 0
m_HBaseRangeMin: -575 m_HBaseRangeMin: -575
m_HBaseRangeMax: 575 m_HBaseRangeMax: 575
m_VBaseRangeMin: -275.5 m_VBaseRangeMin: -315
m_VBaseRangeMax: 275.5 m_VBaseRangeMax: 315
m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1 m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1 m_VAllowExceedBaseRangeMin: 1
@ -980,9 +980,9 @@ MonoBehaviour:
x: 0 x: 0
y: 21 y: 21
width: 1150 width: 1150
height: 551 height: 630
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Translation: {x: 575, y: 275.5} m_Translation: {x: 575, y: 315}
m_MarginLeft: 0 m_MarginLeft: 0
m_MarginRight: 0 m_MarginRight: 0
m_MarginTop: 0 m_MarginTop: 0
@ -990,12 +990,12 @@ MonoBehaviour:
m_LastShownAreaInsideMargins: m_LastShownAreaInsideMargins:
serializedVersion: 2 serializedVersion: 2
x: -575 x: -575
y: -275.5 y: -315
width: 1150 width: 1150
height: 551 height: 630
m_MinimalGUI: 1 m_MinimalGUI: 1
m_defaultScale: 1 m_defaultScale: 1
m_LastWindowPixelSize: {x: 1150, y: 572} m_LastWindowPixelSize: {x: 1150, y: 651}
m_ClearInEditMode: 1 m_ClearInEditMode: 1
m_NoCameraWarning: 1 m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000 m_LowResolutionForAspectRatios: 01000000000000000000
@ -1053,7 +1053,7 @@ MonoBehaviour:
x: 378 x: 378
y: 81 y: 81
width: 1150 width: 1150
height: 572 height: 651
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default