This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regl = require('regl')() | |
const mat4 = require('gl-mat4') | |
const bunny = require('bunny') | |
const angleNormals = require('angle-normals') | |
const setupCamera = regl({ | |
context: { | |
projection: ({viewportWidth, viewportHeight}) => | |
mat4.perspective([], | |
Math.PI / 4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regl = require('regl')({ | |
extensions: [ | |
'OES_texture_float' | |
] | |
}) | |
const camera = require('regl-camera')(regl, { | |
center: [0.5, 0.5, 0.5], | |
distance: 1 | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regl = require('regl')({ | |
extensions: 'OES_element_index_uint' | |
}) | |
const ndarray = require('ndarray') | |
const camera = require('regl-camera')(regl) | |
const normals = require('angle-normals') | |
const surfaceNets = require('surface-nets') | |
const vec3 = require('gl-vec3') | |
function processMesh (mesh) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const vec3 = require('gl-vec3') | |
const camera = require('rtcrshr')({ | |
vars: { | |
eye: [100, 0, 0], | |
up: [0, 1, 0], | |
right: [0, 0, 1], | |
center: [0, 0, 0] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SHAPE = [128, 128, 128] | |
const regl = require('regl')() | |
const surfaceNets = require('surface-nets') | |
const setupCamera = require('regl-camera')(regl, { | |
distance: 1000, | |
center: [ | |
SHAPE[0] / 2, | |
SHAPE[1] / 2, | |
SHAPE[2] / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regl = require('regl')({ | |
extensions: ['OES_texture_float', 'OES_texture_float_linear'] | |
}) | |
const camera = require('regl-camera')(regl, { | |
distance: 5 | |
}) | |
const N = 512 | |
const T = 3 |