Skip to content

Commit

Permalink
Add test for tiling UV (not noise). Ref voxel/voxelmetaverse#19
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 7, 2014
1 parent 30feb7f commit 85e4fb0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,28 @@ var f = function(x, y) {
//return step(gradient(x, y) + noise(x, y));
//return gradient(x, y) + simplex(x/16, y/16) + simplex(x/32, y/32) + simplex(x/64, y/64) + simplex(x/8, y/8);
//return octaves(x, y);
return step(gradient(x, y + octaves(x, y) * 10));
//return step(gradient(x, y + octaves(x, y) * 10));

x /= 1000;
var gl_FragColor;

var tileCount = 5;
var uStart = 0.0;
var uEnd = 0.5;

var tile = function(x, times) {
return x % (1 / times) * times;
};

var scale = function(x, fromLow, fromHigh, toLow, toHigh) {
return (x - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow;
};

gl_FragColor = scale(tile(x, tileCount), 0, 1, uStart, uEnd);

//gl_FragColor = x % mod * tileCount;

return gl_FragColor;
};

noisecomp.test(f);
Expand Down

0 comments on commit 85e4fb0

Please sign in to comment.