This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//float n = 5.0; | |
//float f = 800.0; | |
float getDepth(float z, float n, float f) { | |
return (2.0 * n) / (f + n - z*(f-n)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p.__defineGetter__("test", function() { | |
return "testing testing"; | |
}); | |
p.__defineSetter__("test", function() { | |
// DO SOMETHING | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MathUtils = MathUtils || {}; | |
MathUtils.level = function(i) { | |
if(i==0) return 1; | |
else return i*MathUtils.level(i-1); | |
} | |
MathUtils.binCoefficient = function(n, i) { | |
return MathUtils.level(n) / ( MathUtils.level(i) * MathUtils.level(n-i) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>Delete Line</key> | |
<string>deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R G B | |
Silver 0.971519 0.959915 0.915324 | |
Aluminium 0.913183 0.921494 0.924524 | |
Gold 1 0.765557 0.336057 | |
Copper 0.955008 0.637427 0.538163 | |
Chromium 0.549585 0.556114 0.554256 | |
Nickel 0.659777 0.608679 0.525649 | |
Titanium 0.541931 0.496791 0.449419 | |
Cobalt 0.662124 0.654864 0.633732 | |
Platinum 0.672411 0.637331 0.585456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec4 when_eq(vec4 x, vec4 y) { | |
return 1.0 - abs(sign(x - y)); | |
} | |
vec4 when_neq(vec4 x, vec4 y) { | |
return abs(sign(x - y)); | |
} | |
vec4 when_gt(vec4 x, vec4 y) { | |
return max(sign(x - y), 0.0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#extension GL_EXT_shader_texture_lod : enable | |
uniform samplerCube uRadianceMap; | |
uniform samplerCube uIrradianceMap; | |
#define saturate(x) clamp(x, 0.0, 1.0) | |
#define PI 3.1415926535897932384626433832795 | |
const float A = 0.15; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dropArea = window; | |
const preventDefaults = (e)=> { | |
e.preventDefault() | |
e.stopPropagation(); | |
} | |
;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
dropArea.addEventListener(eventName, preventDefaults, false); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compression.js | |
const defaultPrecision = 10; | |
const encode = (a, b, mPrecision=defaultPrecision) => { | |
const precision = mPrecision; | |
const base = Math.floor(Math.sqrt(Math.pow(93, precision))); | |
let lat = a, lng = b; | |
let lng935 = Math.floor( ( parseFloat(lng) +180)*base/360 ); | |
let lat935 = Math.floor( ( parseFloat(lat) +90)*base/180 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float map(float value, float start, float end, float newStart, float newEnd) { | |
float percent = (value - start) / (end - start); | |
if (percent < 0.0) { | |
percent = 0.0; | |
} | |
if (percent > 1.0) { | |
percent = 1.0; | |
} | |
float newValue = newStart + (newEnd - newStart) * percent; | |
return newValue; |
OlderNewer