Skip to content

Instantly share code, notes, and snippets.

Mr.doob mrdoob

Block or report user

Report or block mrdoob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrdoob
mrdoob / adjoint.glsl
Created Sep 19, 2019
Matrix3.getNormalMatrix()
View adjoint.glsl
// Use to transform normals with transformation of
// arbitrary non-uniform scales (including negative)
// and skewing. The code assumes the last column of m is
// [0,0,0,1]. More info here:
// https://github.com/graphitemaster/normals_revisited
mat3 adjoint( in mat4 m )
{
return mat3(
m[1][1]*m[2][2]-m[1][2]*m[2][1],
@mrdoob
mrdoob / mov2gif.sh
Created Jun 10, 2019
ffmpeg: mov to gif
View mov2gif.sh
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=25,scale=640:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
View JSONParseAsync.js
function JSONParseAsync( text, callback ) {
var code = 'onmessage = function ( e ) { postMessage( JSON.parse( e.data ) ); close(); }';
var blob = new Blob( [ code ], { type: 'text/plain' } );
var worker = new Worker( window.URL.createObjectURL( blob ) );
worker.addEventListener( 'message', function ( e ) { callback( e.data ); } );
worker.postMessage( text );
}
View Layers.js
/**
* @author mrdoob / http://mrdoob.com/
*/
function Layers() {
this.mask = 1;
}
View html2canvas.js
/**
* @author mrdoob / http://mrdoob.com/
*/
function html2canvas( element ) {
var range = document.createRange();
function getRect( rect ) {
@mrdoob
mrdoob / gist:f2ccd368ff773752634e
Created Sep 18, 2014
Workaround for Safari/iOS8 oversized innerWidth/innerHeight on threejs.org/examples/
View gist:f2ccd368ff773752634e
if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
viewer.addEventListener( 'load', function ( event ) {
viewer.contentWindow.innerWidth -= 10;
viewer.contentWindow.innerHeight -= 2;
} );
}
View gist:a021c0c5ea229f6641da
/**
* @author mrdoob / http://mrdoob.com/
* @author mikael emtinger / http://gomo.se/
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.Object3D = function () {
this.id = THREE.Object3DIdCount ++;
@mrdoob
mrdoob / gist:4132ef6c84185a3ebe37
Created May 22, 2014
three.js authors (May 2014)
View gist:4132ef6c84185a3ebe37
Adam Leeper
Aditya Sawant
Adria2
Akash Manohar J
Aki
Aleksandar Rodic
Alessandro Piva
Alex
Alex Kogan
Alex Schworer
You can’t perform that action at this time.