Skip to content

Instantly share code, notes, and snippets.

@xl1
Last active August 29, 2015 14:03
Show Gist options
  • Save xl1/a1383a57c5ca6811f158 to your computer and use it in GitHub Desktop.
Save xl1/a1383a57c5ca6811f158 to your computer and use it in GitHub Desktop.
Math にあるけど GLSL でサポートされていないの何
gl = new MicroGL
for name in Object.getOwnPropertyNames(Math)
if typeof Math[name] is 'function'
args = ("0.0" for _ in [1..Math[name].length])
shader = gl._initShader gl.gl.FRAGMENT_SHADER, """
precision mediump float;
void main(){
float result = #{name}(#{args.join()});
}
"""
if not shader
console.log name
# random
# round
# atan2
# imul
@xl1
Copy link
Author

xl1 commented Jun 28, 2014

  • maxmin はたくさん引数与えられる
  • ES6 で acosh, asinh, atanh, cbrt, clz32, cosh, expm1, fround, hypot, log1p, log10, log2, sign, sinh, tanh, trunc が追加される

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment