Skip to content

Instantly share code, notes, and snippets.

// 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);
}
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)
{
@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;
@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 / 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 / CMakeLists.txt
Created March 16, 2017 22:35 — forked from floooh/CMakeLists.txt
copy asset files as fips code-gen job
# a code-gen job must be added to the application's CMakeLists.txt through a call to fips_generate()
fips_begin_app(dragons windowed)
fips_src(.)
fips_generate(files.yml TYPE filecopy OUT_OF_SOURCE ARGS "{ deploy_dir: \"${FIPS_PROJECT_DEPLOY_DIR}\" }")
n3h5_files(files.yml)
fips_deps(emsctest)
fips_end_app()
@neshume
neshume / float16.c
Created May 21, 2017 22:05
Fast half-precision to single-precision floating point conversion
// float32
// Martin Kallman
//
// Fast half-precision to single-precision floating point conversion
// - Supports signed zero and denormals-as-zero (DAZ)
// - Does not support infinities or NaN
// - Few, partially pipelinable, non-branching instructions,
// - Core opreations ~6 clock cycles on modern x86-64
void float32(float* __restrict out, const uint16_t in) {
uint32_t t1;
/*
a shader executes per pixel
so every thing you see here is he function for every pixel
raymarching is in principe a function that finds the closest point to any surface in the world
then we move our point by that distance and use the same function,
the function will probably be closer to an object in the world every time
and after about 40 to 200 iterations you'll either have found an object or
missed them all into infinity
@neshume
neshume / MultipleDevicesOverTCP.md
Created January 30, 2018 19:26 — forked from teocci/MultipleDevicesOverTCP.md
How to connect multiple Android devices with ADB over TCP

#How to connect multiple Android devices with ADB over TCP

From your device, if it is rooted

According to a post on xda-developers, you can enable ADB over Wi-Fi from the device with the commands:

su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
@neshume
neshume / invaders.pde
Created February 12, 2018 11:21 — forked from tangzero/invaders.pde
Space Invaders Generator
/**
* Space invaders generator. Generates and draws invaders. Inspired
* by invaders fractals:
* http://www.levitated.net/daily/levInvaderFractal.html
*
* Mouse press will create new invaders and draw the new ones.
*/
/** Scaling factor */
float sc = 3f;