Skip to content

Instantly share code, notes, and snippets.

@neshume
neshume / fp textures
Created December 30, 2015 10:22 — forked from neuralvis/fp textures
Creating floating point textures in threejs. Taken from here: https://github.com/mrdoob/three.js/issues/386
function createTextureFromData ( width, height, data ) {
if (!gl.getExtension("OES_texture_float")) {
throw("Requires OES_texture_float extension");
}
texture = new THREE.Texture( );
texture.needsUpdate = false;
texture.__webglTexture = gl.createTexture();
gl.bindTexture( gl.TEXTURE_2D, texture.__webglTexture );
@neshume
neshume / JavaScript reference.md
Created November 21, 2015 22:16 — forked from yig/JavaScript reference.md
An overview of JavaScript best practices. Geared towards someone with a C/C++/Java/Python background.

JavaScript reference for non-JavaScript programmers

Author: Yotam Gingold
License: Public Domain (CC0)

This document is intended as a reference or introduction to JavaScript for someone familiar with a language like C/C++/Java or Python. It follows best practices and gathers the scattered wisdom from matny stackoverflow questions and in-depth JavaScript essays. It relies on no external libraries.

@neshume
neshume / animation.html
Last active September 1, 2015 15:31 — forked from jsermeno/animation.html
Three.js Troll Animation Morph Targets
<!doctype html>
<html>
<head>
<title>Three.js - Game</title>
<meta charset="utf-8">
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
precision highp float;
#endif
uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;
float jinteresct(in vec3 rO, in vec3 rD, in vec4 c, out float ao)
{
// https://www.shadertoy.com/view/MdsGz8
// @eddbiddulph
// Use the mouse to rotate the view!
#define EPS vec2(1e-3, 0.0)
vec3 rotateX(float a, vec3 v)
{
return vec3(v.x, cos(a) * v.y + sin(a) * v.z, cos(a) * v.z - sin(a) * v.y);
}