@@ 6,8 6,8 @@ PIXI.settings.ROUND_PIXELS = true
const width = 800, height = 800;
var renderer = PIXI.autoDetectRenderer({
+ resolution: 2,
width, height, background: '#fff',
- resolution: 2
})
document.body.appendChild(renderer.view);
renderer.view.style.width = width
@@ 22,7 22,7 @@ var logo = PIXI.Sprite.from('dist/bluebird.png');
logo.x = width / 2;
logo.y = height / 2;
logo.width = width
-logo.height = width
+logo.height = height
// Make sure the center point of the image is at its center, instead of the default top left
logo.anchor.set(0.5);
@@ 40,8 40,8 @@ void main(void)
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = vTextureCoord.xy;
- float rf = 64.0;
- float irf = 1.0 / rf;
+ float rf = 64.0; // Resolution - output is expected to be square
+ float irf = 1.0 / rf; // Inversed resolution
vec2 uvf = floor(uv * rf) * irf; // uv, floored to multiple of rf
vec2 uvi = (uv - uvf) * rf; // Distance from floor
@@ 66,20 66,31 @@ void main(void)
else
cre = col4, dix = col3, diy = col2, blk = col ;
+ // The diamond distance from of the mid point
float diamond = abs(uvi.x-0.5) + abs(uvi.y-0.5);
- if(diamond < 0.5) {
- vec3 cdx = abs(dix - diy);
+ if(diamond < .5) {
+ vec3 cdx = abs(dix - diy); // Color differce between dix and diy
float dism = cdx.x + cdx.y + cdx.z;
- if(dism < 0.1)
- cre = dix;
+ vec3 cdx2 = abs(cre - blk); // ???
+ float dism2 = cdx2.x + cdx2.y + cdx2.z;
+ if(dism < 0.1) {
+ if (dism2 < 0.1) {
+ // cre = vec3(1.0, 0.0, 0.0);
+ } else {
+ cre = dix;
+
+ }
+ }
}
+ // // Just point out the grid of cells
+ // if (abs(uvi.x) + abs(uvi.y) < .1) {
+ // cre = vec3(1.0, 0.0, 0.0);
+ // }
// Output to screen
gl_FragColor = vec4(cre, 1.0);
}
`
-logo.scale.x = 5
-logo.scale.y = 5
//Create our Pixi filter using our custom shader code
var simpleShader = new PIXI.Filter('', shaderCode);