Skip to content

Instantly share code, notes, and snippets.

View marioecg's full-sized avatar

Mario Carrillo marioecg

View GitHub Profile
@marioecg
marioecg / fragment.glsl
Last active April 2, 2020 00:05
default threejs shaders
precision mediump float;
varying vec2 vUv;
void main() {
gl_Position = vec4(vUv, 0., 1.);
}
@marioecg
marioecg / scene.js
Created January 8, 2020 04:20
Basic set up for a three.js scene
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
let camera, scene, renderer;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
@marioecg
marioecg / lerp.js
Created January 8, 2020 03:59
Linear interpolation (lerp or mix)
function lerp(start, end, t) {
return start * (1 - t) + end * t;
}