Skip to content

Instantly share code, notes, and snippets.

Mikola Lysenko mikolalysenko

Block or report user

Report or block mikolalysenko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vox-to-box.js
// install:
//
// npm install ndarray parse-magica-voxel
//
// usage:
//
// node vox-to-box.js my-file.vox > my-file.terrain
//
const parseMagicaVoxel = require('parse-magica-voxel')
View strawman-api.js
const HelNumber = require('helschema/number')
const HelString = require('helschema/string')
const HelStruct = require('helschema/struct')
const HelDictionary = require('helschema/dictionary')
const EntitySchema = HelStruct({
x: HelNumber,
y: HelNumber,
color: HelString
})
View gl-toaster.js
const regl = require('regl')()
const video = document.createElement('video')
video.src = 'mario.mp4'
video.currentTime = window.localStorage.getItem('currentTime') | 0
function persistVideoLocation () {
window.localStorage.setItem('currentTime', video.currentTime)
}
View regl-multiply-blend.js
const regl = require('regl')()
const drawCircle = regl({
attributes: {
p: [0] // dummy attribute
},
frag: `
precision highp float;
uniform vec3 color;
View blendMode.js
{
blend: {
enable: true,
func: {
src: 'dst color',
dst: 'one minus src alpha'
},
equation: 'add'
}
}
View fill-screen.js
module.exports = function (regl) {
return regl({
vert: `
precision highp float;
attribute vec2 position;
varying vec2 uv;
void main () {
uv = 0.5 * (position + 1.0);
gl_Position = vec4(position, 0, 1);
}
View drip.js
const regl = require('regl')({
extensions: 'OES_texture_float'
})
const fillScreen = require('./fill-screen')(regl)
const RESOLUTION = 256
const initialData = new Float32Array(RESOLUTION * RESOLUTION * 4)
for (var i = 0; i < initialData.length; ++i) {
initialData[i] = Math.random()
View bunny3d.js
const regl = require('regl')()
const calcNormals = require('angle-normals')
const mat4 = require('gl-mat4')
const bunny = require('bunny')
// coordinate systems:
//
// data --model--> world --view--> camera --projection--> device
//
View wip-rendering.js
const regl = require('regl')({
extensions: 'OES_texture_float'
})
const LAPLACIAN_SHADER = `
vec4 laplacian (sampler2D img, vec2 id, float DX) {
return -texture2D(img, id) + 0.25 * (
texture2D(img, id + DX * vec2(-1, 0))
+ texture2D(img, id + DX * vec2(1, 0))
+ texture2D(img, id + DX * vec2(0, -1))
You can’t perform that action at this time.