View generate.js
var Simplex = require('simplex-noise')
module.exports = function (state, emitter) {
state.tiles = {
size: [0,0],
data: []
}
emitter.on('generate', function (seed) {
var simplex = new Simplex(seed)
var v = simplex.noise2D(500,500)*0.5+0.5
View build-kdb.js
module.exports = function build (rows, opts) {
var B = opts.branchFactor
var write = opts.write
var fB = Math.floor(B/2)
var cB = Math.ceil(B/2)
;(function walk (rows, depth, index) {
if (rows.length === 1) {
write(index, rows[0])
}
if (rows.length <= 1) return
View format.md
[header] (size: 20 bytes)
  uint32_t N
  uint32_t staging_len
  uint8_t[24] bitfields

[staging] (size: N*1 bytes)
[tree0] (size: N*1 bytes)
[tree1] (size: N*2 bytes)
...
View gist:4469cf83e0c085869122502fb1e61c9a
function swarm (key, branches, opts) {
var swarmDefaults = require('datland-swarm-defaults')
var disc = require('discovery-swarm')
var EventEmitter = require('events').EventEmitter
if (!opts) opts = {}
var sync = new EventEmitter
var sw = disc(swarmDefaults(Object.assign({
port: 3282,
id: branches[0].key,
hash: false,
View chat.js
var minimist = require('minimist')
var argv = minimist(process.argv.slice(2))
var split = require('split2')
var to = require('to2')
var pump = require('pump')
var hyperdb = require('hyperdb')
var addr = /^dat:/.test(argv._[0])
? Buffer(argv._[0].replace(/^dat:\/*/,''),'hex')
View sabotabby.js
var regl = require('regl')({
extensions: [ 'oes_standard_derivatives', 'oes_element_index_uint' ]
})
var camera = require('regl-camera')(regl, {
distance: 55, theta: 1.1, phi: -0.1
})
var parseBGA = require('parse-bga-mesh')
var resl = require('resl')
var anormals = require('angle-normals')
var glsl = require('glslify')
View camera.js
//var camera = require('regl-camera')(regl,
// { distance: 5, minDistance: 1.2, theta: -0.9, phi: 0.3 })
var projection = new Float32Array(16)
var view = new Float32Array(16)
var eye = Float32Array.from([0,+1,-7])
var center = Float32Array.from([0,0,0])
var up = Float32Array.from([0,1,0])
var camera = regl({
uniforms: {
eye: eye,
View output
$ npm i buffer
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #2: Expected string but got null
npm ERR! typeerror at exports.findRequirement (/home/substack/projects/npm/lib/install/deps.js:673:3)
npm ERR! typeerror at findChild (/home/substack/projects/npm/lib/install/deps.js:102:17)
npm ERR! typeerror at computeMetadata (/home/substack/projects/npm/lib/install/deps.js:113:9)
npm ERR! typeerror at Object.Installer.normalizeCurrentTree (/home/substack/projects/npm/lib/install.js:402:3)
npm ERR! typeerror at Array.<anonymous> (/home/substack/projects/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! typeerror at LOOP (/home/substack/projects/npm/node_modules/slide/lib/chain.js:15:14)
npm ERR! typeerror at /home/substack/projects/npm/node_modules/slide/lib/chain.js:18:7
View main.js
var regl = require('regl')()
var camera = require('regl-camera')(regl,
{ distance: 32, theta: 1.6, phi: 0.2 })
var sphere = require('icosphere')(5)
var glsl = require('glslify')
var anormals = require('angle-normals')
var mat4 = require('gl-mat4')
var feedback = require('regl-feedback')
var fbtex = regl.texture()
View main.js
var regl = require('regl')()
var camera = require('regl-camera')(regl, {
distance: 15, phi: 0.2 })
var conway = require('conway-hart')
var glsl = require('glslify')
var grid = require('grid-mesh')
var draw = {
cool: shape(regl,'T'),
good: shape(regl,'I'),