From b4a89be2b23ea5e7633841c317ce2fe730051ba1 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Thu, 12 Jun 2014 16:29:30 -0500 Subject: [PATCH 1/2] built gh-pages --- index.html | 8630 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 8630 insertions(+) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..0efa2e9 --- /dev/null +++ b/index.html @@ -0,0 +1,8630 @@ + + + + + From e40182e684cd81509a4516191dbe0b46513538aa Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Thu, 12 Jun 2014 16:33:48 -0500 Subject: [PATCH 2/2] rebuilt gh-pages --- index.html | 877 +++++++++++++++++++++++++++-------------------------- 1 file changed, 439 insertions(+), 438 deletions(-) diff --git a/index.html b/index.html index 0efa2e9..e1c06df 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ var shell = require("gl-now")(); var glslify = require("glslify"); var createBuffer = require("../buffer.js"); -var createShader = require("glslify/adapter.js")("\n#define GLSLIFY 1\n\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position.xy;\n}", "\n#define GLSLIFY 1\n\nprecision highp float;\nuniform vec2 tp;\nvarying vec2 uv;\nvoid main() {\n gl_FragColor = vec4(0.5 * (uv + 1.0), 0.5 * (cos(tp.x) + 1.0), 1.0);\n}", [{"name":"tp","type":"vec2"}], [{"name":"position","type":"vec2"}]); +var createShader = require("glslify/adapter.js")("\n#define GLSLIFY 1\n\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position.xy;\n}", "\n#define GLSLIFY 1\n\nprecision highp float;\nuniform float tick;\nvarying vec2 uv;\nvoid main() {\n gl_FragColor = vec4(0.5 * (uv + 1.0), 0.5 * (cos(tick) + 1.0), 1.0);\n}", [{"name":"tick","type":"float"}], [{"name":"position","type":"vec2"}]); var buffer, shader; shell.on("gl-init", function() { @@ -21,6 +21,7 @@ shader.bind(); buffer.bind(); shader.attributes.position.pointer(); + shader.uniforms.tick = Date.now() / 1000; gl.drawArrays(gl.TRIANGLES, 0, 3); }); },{"../buffer.js":2,"glslify/adapter.js":3,"gl-now":4,"glslify":5}],5:[function(require,module,exports){ @@ -4818,369 +4819,7 @@ } })(self,require("__browserify_Buffer").Buffer) -},{"bit-twiddle":16,"dup":17,"__browserify_Buffer":15}],8:[function(require,module,exports){ -(function(Buffer){"use strict" - -var iota = require("iota-array") - -var arrayMethods = [ - "concat", - "join", - "slice", - "toString", - "indexOf", - "lastIndexOf", - "forEach", - "every", - "some", - "filter", - "map", - "reduce", - "reduceRight" -] - -function compare1st(a, b) { - return a[0] - b[0] -} - -function order() { - var stride = this.stride - var terms = new Array(stride.length) - var i - for(i=0; iMath.abs(this._stride1))?[1,0]:[0,1]}})") - } else if(dimension === 3) { - code.push( -"var s0=Math.abs(this._stride0),s1=Math.abs(this._stride1),s2=Math.abs(this._stride2);\ -if(s0>s1){\ -if(s1>s2){\ -return [2,1,0];\ -}else if(s0>s2){\ -return [1,2,0];\ -}else{\ -return [1,0,2];\ -}\ -}else if(s0>s2){\ -return [2,0,1];\ -}else if(s2>s1){\ -return [0,1,2];\ -}else{\ -return [0,2,1];\ -}}})") - } - } else { - code.push("ORDER})") - } - } - - //view.set(i0, ..., v): - code.push([ -"proto.set=function ",className,"_set(", args.join(","), ",v){"].join("")) - if(useGetters) { - code.push(["return this.data.set(", index_str, ",v)}"].join("")) - } else { - code.push(["return this.data[", index_str, "]=v}"].join("")) - } - - //view.get(i0, ...): - code.push(["proto.get=function ",className,"_get(", args.join(","), "){"].join("")) - if(useGetters) { - code.push(["return this.data.get(", index_str, ")}"].join("")) - } else { - code.push(["return this.data[", index_str, "]}"].join("")) - } - - //view.index: - code.push([ - "proto.index=function ", - className, - "_index(", args.join(), "){return ", - index_str, "}"].join("")) - - //view.hi(): - code.push(["proto.hi=function ",className,"_hi(",args.join(","),"){return new ", className, "(this.data,", - indices.map(function(i) { - return ["(typeof i",i,"!=='number'||i",i,"<0)?this._shape", i, ":i", i,"|0"].join("") - }).join(","), ",", - indices.map(function(i) { - return "this._stride"+i - }).join(","), ",this.offset)}"].join("")) - - //view.lo(): - var a_vars = indices.map(function(i) { return "a"+i+"=this._shape"+i }) - var c_vars = indices.map(function(i) { return "c"+i+"=this._stride"+i }) - code.push(["proto.lo=function ",className,"_lo(",args.join(","),"){var b=this.offset,d=0,", a_vars.join(","), ",", c_vars.join(",")].join("")) - for(var i=0; i=0){\ -d=i",i,"|0;\ -b+=c",i,"*d;\ -a",i,"-=d}"].join("")) - } - code.push(["return new ", className, "(this.data,", - indices.map(function(i) { - return "a"+i - }).join(","),",", - indices.map(function(i) { - return "c"+i - }).join(","), ",b)}"].join("")) - - //view.step(): - code.push(["proto.step=function ",className,"_step(",args.join(","),"){var ", - indices.map(function(i) { - return "a"+i+"=this._shape"+i - }).join(","), ",", - indices.map(function(i) { - return "b"+i+"=this._stride"+i - }).join(","),",c=this.offset,d=0,ceil=Math.ceil"].join("")) - for(var i=0; i=0){c=(c+this._stride",i,"*i",i,")|0}else{a.push(this._shape",i,");b.push(this._stride",i,")}"].join("")) - } - code.push("var ctor=CTOR_LIST[a.length];return ctor(this.data,a,b,c)}") - - //Add return statement - code.push(["return function construct_",className,"(data,shape,stride,offset){return new ", className,"(data,", - indices.map(function(i) { - return "shape["+i+"]" - }).join(","), ",", - indices.map(function(i) { - return "stride["+i+"]" - }).join(","), ",offset)}"].join("")) - - //Compile procedure - var procedure = new Function("CTOR_LIST", "ORDER", code.join("\n")) - return procedure(CACHED_CONSTRUCTORS[dtype], order) -} - -function arrayDType(data) { - if(data instanceof Float64Array) { - return "float64"; - } else if(data instanceof Float32Array) { - return "float32" - } else if(data instanceof Int32Array) { - return "int32" - } else if(data instanceof Uint32Array) { - return "uint32" - } else if(data instanceof Uint8Array) { - return "uint8" - } else if(data instanceof Uint16Array) { - return "uint16" - } else if(data instanceof Int16Array) { - return "int16" - } else if(data instanceof Int8Array) { - return "int8" - } else if(data instanceof Uint8ClampedArray) { - return "uint8_clamped" - } else if((typeof Buffer !== "undefined") && (data instanceof Buffer)) { - return "buffer" - } else if(data instanceof Array) { - return "array" - } - return "generic" -} - -var CACHED_CONSTRUCTORS = { - "float32":[], - "float64":[], - "int8":[], - "int16":[], - "int32":[], - "uint8":[], - "uint16":[], - "uint32":[], - "array":[], - "uint8_clamped":[], - "buffer":[], - "generic":[] -} - -function wrappedNDArrayCtor(data, shape, stride, offset) { - if(shape === undefined) { - shape = [ data.length ] - } - var d = shape.length - if(stride === undefined) { - stride = new Array(d) - for(var i=d-1, sz=1; i>=0; --i) { - stride[i] = sz - sz *= shape[i] - } - } - if(offset === undefined) { - offset = 0 - for(var i=0; iMath.abs(this._stride1))?[1,0]:[0,1]}})") + } else if(dimension === 3) { + code.push( +"var s0=Math.abs(this._stride0),s1=Math.abs(this._stride1),s2=Math.abs(this._stride2);\ +if(s0>s1){\ +if(s1>s2){\ +return [2,1,0];\ +}else if(s0>s2){\ +return [1,2,0];\ +}else{\ +return [1,0,2];\ +}\ +}else if(s0>s2){\ +return [2,0,1];\ +}else if(s2>s1){\ +return [0,1,2];\ +}else{\ +return [0,2,1];\ +}}})") + } + } else { + code.push("ORDER})") + } + } + + //view.set(i0, ..., v): + code.push([ +"proto.set=function ",className,"_set(", args.join(","), ",v){"].join("")) + if(useGetters) { + code.push(["return this.data.set(", index_str, ",v)}"].join("")) + } else { + code.push(["return this.data[", index_str, "]=v}"].join("")) + } + + //view.get(i0, ...): + code.push(["proto.get=function ",className,"_get(", args.join(","), "){"].join("")) + if(useGetters) { + code.push(["return this.data.get(", index_str, ")}"].join("")) + } else { + code.push(["return this.data[", index_str, "]}"].join("")) + } + + //view.index: + code.push([ + "proto.index=function ", + className, + "_index(", args.join(), "){return ", + index_str, "}"].join("")) + + //view.hi(): + code.push(["proto.hi=function ",className,"_hi(",args.join(","),"){return new ", className, "(this.data,", + indices.map(function(i) { + return ["(typeof i",i,"!=='number'||i",i,"<0)?this._shape", i, ":i", i,"|0"].join("") + }).join(","), ",", + indices.map(function(i) { + return "this._stride"+i + }).join(","), ",this.offset)}"].join("")) + + //view.lo(): + var a_vars = indices.map(function(i) { return "a"+i+"=this._shape"+i }) + var c_vars = indices.map(function(i) { return "c"+i+"=this._stride"+i }) + code.push(["proto.lo=function ",className,"_lo(",args.join(","),"){var b=this.offset,d=0,", a_vars.join(","), ",", c_vars.join(",")].join("")) + for(var i=0; i=0){\ +d=i",i,"|0;\ +b+=c",i,"*d;\ +a",i,"-=d}"].join("")) + } + code.push(["return new ", className, "(this.data,", + indices.map(function(i) { + return "a"+i + }).join(","),",", + indices.map(function(i) { + return "c"+i + }).join(","), ",b)}"].join("")) + + //view.step(): + code.push(["proto.step=function ",className,"_step(",args.join(","),"){var ", + indices.map(function(i) { + return "a"+i+"=this._shape"+i + }).join(","), ",", + indices.map(function(i) { + return "b"+i+"=this._stride"+i + }).join(","),",c=this.offset,d=0,ceil=Math.ceil"].join("")) + for(var i=0; i=0){c=(c+this._stride",i,"*i",i,")|0}else{a.push(this._shape",i,");b.push(this._stride",i,")}"].join("")) + } + code.push("var ctor=CTOR_LIST[a.length];return ctor(this.data,a,b,c)}") + + //Add return statement + code.push(["return function construct_",className,"(data,shape,stride,offset){return new ", className,"(data,", + indices.map(function(i) { + return "shape["+i+"]" + }).join(","), ",", + indices.map(function(i) { + return "stride["+i+"]" + }).join(","), ",offset)}"].join("")) + + //Compile procedure + var procedure = new Function("CTOR_LIST", "ORDER", code.join("\n")) + return procedure(CACHED_CONSTRUCTORS[dtype], order) +} + +function arrayDType(data) { + if(data instanceof Float64Array) { + return "float64"; + } else if(data instanceof Float32Array) { + return "float32" + } else if(data instanceof Int32Array) { + return "int32" + } else if(data instanceof Uint32Array) { + return "uint32" + } else if(data instanceof Uint8Array) { + return "uint8" + } else if(data instanceof Uint16Array) { + return "uint16" + } else if(data instanceof Int16Array) { + return "int16" + } else if(data instanceof Int8Array) { + return "int8" + } else if(data instanceof Uint8ClampedArray) { + return "uint8_clamped" + } else if((typeof Buffer !== "undefined") && (data instanceof Buffer)) { + return "buffer" + } else if(data instanceof Array) { + return "array" + } + return "generic" +} +var CACHED_CONSTRUCTORS = { + "float32":[], + "float64":[], + "int8":[], + "int16":[], + "int32":[], + "uint8":[], + "uint16":[], + "uint32":[], + "array":[], + "uint8_clamped":[], + "buffer":[], + "generic":[] +} +function wrappedNDArrayCtor(data, shape, stride, offset) { + if(shape === undefined) { + shape = [ data.length ] + } + var d = shape.length + if(stride === undefined) { + stride = new Array(d) + for(var i=d-1, sz=1; i>=0; --i) { + stride[i] = sz + sz *= shape[i] + } + } + if(offset === undefined) { + offset = 0 + for(var i=0; i