Skip to content

Instantly share code, notes, and snippets.

@neiltron
neiltron / mesh.js
Last active January 24, 2018 15:58
Dynamically generate meshes with customize sides, height, and radius
// usage:
// `const mesh = generateTubeMesh();`
// or with optional params:
// `const mesh = generateTubeMesh(1, 1, 10);`
const generateTubeMesh = (radius = 1, height = 1, sides = 5) => {
const points = sides * height * 6;
const step = (Math.PI * 2) / sides;
let angle = 0;
export default class Constraint {
constructor (opts) {
this.vertices = opts.vertices;
this.points = opts.points;
this.index = opts.index;
this.restingDistance = opts.restingDistance || this.vertices[0].distanceTo(this.vertices[1]);
this.stiffness = this.index == 0 ? .05 : .005;
this.masses = opts.masses || [.01, .01];
@neiltron
neiltron / Webcam.js
Last active June 19, 2018 13:40
Using a webcam as a THREE VideoTexture
// npm install this for convenience
var getUserMedia = require('getusermedia');
// usage:
// Webcam.initCamera({
// fallbackVideo: '/assets/video_mobile.mp4', // optional
// videoElement: someDOMElement, // (optional, defaults to document.querySelector('video')),
// facingMode: "environment", // defaults to "environment", which is rear cam
// });
//
@neiltron
neiltron / DifferencePass.js
Last active June 19, 2018 20:48
Frame differencing pass for THREE.EffectComposer
import { Pass, RenderPass } from 'postprocessing';
const glslify = require('glslify');
const path = require('path');
export default class DifferencePass extends Pass {
constructor() {
super("DifferencePass");
this.bufferTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter});
this.renderPassLastBuffer = new RenderPass(this.scene, this.camera);
@neiltron
neiltron / FeedbackPass.js
Created June 19, 2018 20:48
Feedback Pass for THREE.EffectComposer
import { Pass, RenderPass } from 'postprocessing';
const glslify = require('glslify');
const path = require('path');
export default class FeedbackPass extends Pass {
constructor() {
super("FeedbackPass");
this.time = 0;
this.lastUpdate = 0;
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Neil Pullman",
"label": "Creative Technologist",
"image": "https://avatars.githubusercontent.com/u/452313",
"email": "[email protected]",
"phone": "757-763-0724",
"url": "http://www.descend.org",
"summary": "Building things with creative tech. Interested in interfaces, creative work, and building creative tools.",