#N canvas 546 139 729 807 10;
#X declare -lib Gem;
#N canvas 1 89 450 300 fps 0;
#X obj 46 -61 gemhead;
#X obj 46 -21 realtime;
#X obj 46 -41 t b b;
#X obj 46 41 /;
#X msg 46 21 1000 \$1;
#X obj 46 106 outlet;
#X obj 46 63 + 0.5;
#X obj 46 85 i;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 1 0;
#X connect 2 1 1 1;
#X connect 3 0 6 0;
#X connect 4 0 3 0;
#X connect 6 0 7 0;
#X connect 7 0 5 0;
#X restore 616 149 pd fps;
#X floatatom 616 172 5 0 0 1 fps - - 0;
#N canvas 5 76 450 300 gemwin 0;
#X obj 132 246 gemwin;
#X obj 67 89 outlet;
#X obj 67 10 inlet;
#X obj 67 41 route create;
#X msg 67 70 set destroy;
#X msg 142 68 set create;
#X msg 198 142 destroy;
#X msg 132 142 create \, 1;
#X obj 245 38 loadbang;
#X msg 272 82 reset \, frame 100;
#X obj 245 58 t b b;
#X obj 132 117 t b b;
#X msg 376 135 \; pd dsp 1;
#X obj 349 114 t b b;
#X obj 349 181 del 100;
#X obj 349 201 s \$0-init100;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 0 11 0;
#X connect 3 1 5 0;
#X connect 3 1 6 0;
#X connect 4 0 1 0;
#X connect 5 0 1 0;
#X connect 6 0 0 0;
#X connect 7 0 0 0;
#X connect 8 0 10 0;
#X connect 9 0 0 0;
#X connect 10 0 5 0;
#X connect 10 1 9 0;
#X connect 11 0 7 0;
#X connect 11 1 13 0;
#X connect 13 0 14 0;
#X connect 13 1 12 0;
#X connect 14 0 15 0;
#X restore 387 115 pd gemwin;
#X msg 387 95 create;
#X text 383 75 Create window:;
#X obj 154 116 gemhead;
#X obj 36 403 tgl 15 1 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 1 1;
#X msg 36 433 position_enable \$1;
#X obj 277 548 cnv 15 90 40 empty empty empty 20 12 0 14 #c4fcc4 #404040 0;
#X msg 286 559 program \$1;
#X obj 30 544 cnv 15 120 70 empty empty empty 20 12 0 14 #c4fcc4 #404040 0;
#X msg 39 583 print_attributes;
#X msg 38 556 reset_attributes;
#X obj 27 487 cnv 15 140 40 empty empty empty 20 12 0 14 #c4fcc4 #404040 0;
#X obj 36 465 tgl 15 1 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 1 1;
#X msg 36 498 attribute_enable \$1;
#X text 406 232 syntax:;
#X text 370 559 <----- essential for lookup functions;
#X text 406 248 attribute <name> <array> <offset(optional)>;
#N canvas 359 182 450 300 tables 0;
#N canvas 81 49 460 613 load_tables 0;
#X obj 39 17 loadbang;
#X msg 39 106 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0.5 0.5 1 0.5 0.5 1 0.5 0.5 1 0.5 0.5 0 0.5 0.6 0 0.5 0.6 0 0.5 0.6 0 0.5 0.6 1 1 1 1 1 1 1 1 1 1 1 1;
#X obj 39 149 s \$0_BrickColor;
#X msg 39 170 0 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9 0.82 0.7 0.82 0.7 0.82 0.7 0.82 0.7 0.92 0.9 0.92 0.9 0.92 0.9 0.92 0.9;
#X obj 39 213 s \$0_BrickPct;
#X msg 39 266 0 0.32 0.2 0.32 0.2 0.32 0.2 0.32 0.2 0.32 0.2 0.32 0.2 0.32 0.2 0.32 0.2 0.92 0.45 0.92 0.45 0.92 0.45 0.92 0.45 0.62 0.2 0.62 0.2 0.62 0.2 0.62 0.2;
#X obj 39 309 s \$0_BrickSize;
#X msg 39 357 0 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 3.5 -6 -0.4 3.5 -6 -0.4 3.5 -6 -0.4 3.5 -6 -0.4 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2 -3 -1 -0.2;
#X obj 39 400 s \$0_LightPosition;
#X msg 39 505 0 -3.25 3.25 0 -0.75 3.25 0 -0.75 0.75 0 -3.25 0.75 0 0.75 3.25 0 3.25 3.25 0 3.25 0.75 0 0.75 0.75 0 0.75 -0.75 0 3.25 -0.75 0 3.25 -3.25 0 0.75 -3.25 0 -3.25 -0.75 0 -0.75 -0.75 0 -0.75 -3.25 0 -3.25 -3.25 0;
#X obj 39 561 s \$0_position;
#X msg 39 437 0 1 0.5 0.5 1 0.5 0.5 1 0.5 0.5 1 0.5 0.5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
#X obj 39 467 s \$0_MortarColor;
#X obj 39 39 t b b b b b b;
#X msg 133 15 bang;
#X connect 0 0 13 0;
#X connect 1 0 2 0;
#X connect 3 0 4 0;
#X connect 5 0 6 0;
#X connect 7 0 8 0;
#X connect 9 0 10 0;
#X connect 11 0 12 0;
#X connect 13 0 1 0;
#X connect 13 1 3 0;
#X connect 13 2 5 0;
#X connect 13 3 7 0;
#X connect 13 4 11 0;
#X connect 13 5 9 0;
#X connect 14 0 13 0;
#X restore 129 244 pd load_tables;
#X obj 129 66 table \$0_position 48;
#X obj 129 87 table \$0_LightPosition 48;
#X obj 129 108 table \$0_BrickColor 48;
#X obj 129 128 table \$0_MortarColor 48;
#X obj 129 149 table \$0_BrickSize 32;
#X obj 128 169 table \$0_BrickPct 32;
#X restore 564 73 pd tables;
#X obj 183 443 list prepend \$0;
#X obj 396 298 cnv 15 90 40 empty empty empty 20 12 0 14 #c4fcc4 #404040 0;
#X obj 396 348 cnv 15 90 40 empty empty empty 20 12 0 14 #c4fcc4 #404040 0;
#X msg 408 310 attribute LightPosition \$1_LightPosition;
#N canvas 268 270 483 439 more 0;
#X text 66 43 syntax:;
#X text 67 95 adds an attribute to gemvertexbuffer;
#X text 67 127 if the attribute already exists in gemvertexbuffer \, this message updates the attribute with the array data;
#X text 66 60 attribute <name> <array> <offset(optional)>;
#X text 66 281 attribute tables are interleaved only;
#X text 64 177 if the vert or frag files are changed \, the attributes in gemvertexbuffer can be reset with a "reset_attributes" msg and re-added;
#X text 65 236 there is no limit for the amount of attributes that can be added;
#X text 66 321 in order to set 'uniform' type variables once per vertex or geo \, they must be changed to attribute/varying type in the vert and frag files;
#X restore 407 359 pd more;
#X obj 164 646 t a;
#X obj 194 647 print vb;
#X msg 183 420 bang;
#X obj 563 7 declare -lib Gem;
#X obj 154 172 glsl shader/brick;
#X msg 165 152 bang;
#X floatatom 278 204 5 0 0 0 - - - 0;
#X obj 154 673 gemvertexbuffer \; resize 16 \; draw quad;
#X obj 259 366 t b f;
#X msg 183 475 position \$1_position \, attribute LightPosition \$1_LightPosition \, attribute BrickColor \$1_BrickColor \, attribute MortarColor \$1_MortarColor \, attribute BrickSize \$1_BrickSize \, attribute BrickPct \$1_BrickPct;
#X connect 0 0 1 0;
#X connect 2 0 3 0;
#X connect 3 0 2 0;
#X connect 5 0 29 0;
#X connect 6 0 7 0;
#X connect 7 0 25 0;
#X connect 9 0 25 0;
#X connect 11 0 25 0;
#X connect 12 0 25 0;
#X connect 14 0 15 0;
#X connect 15 0 25 0;
#X connect 20 0 34 0;
#X connect 25 0 26 0;
#X connect 25 0 32 0;
#X connect 27 0 20 0;
#X connect 29 0 32 0;
#X connect 29 1 31 0;
#X connect 29 1 33 0;
#X connect 30 0 29 0;
#X connect 33 0 27 0;
#X connect 33 1 9 0;
#X connect 34 0 25 0;
