Browse files

1. Removed gladius.math submodule.

2. Added math.js minified version of math code.
3. Fixed some build problems with math and box2d.
  • Loading branch information...
1 parent 7d525a4 commit 5c17b32daea4642e7b5e23055ad8ca8988d72d5e @modeswitch modeswitch committed Mar 20, 2012
Showing with 19 additions and 11 deletions.
  1. +0 −3 .gitmodules
  2. +1 −2 Makefile
  3. 0 external/box2d.js/{box2d.js → }
  4. +0 −1 external/gladius.math
  5. +13 −0 external/math.js
  6. +3 −3 src/gladius-src.js
  7. +0 −1 src/gladius.js
  8. +2 −1 tools/build.js
View
3 .gitmodules
@@ -7,6 +7,3 @@
[submodule "tools/qunit"]
path = tools/qunit
url = git://github.com/jquery/qunit.git
-[submodule "external/gladius.math"]
- path = external/gladius.math
- url = git://github.com/alankligman/gladius.math.git
View
3 Makefile
@@ -34,7 +34,7 @@ complete = cat $(GLADIUS_MIN) > $(1)
.PHONY: check-lint
-all: check-lint $(DIST_DIR) $(GLADIUS_DIST) $(GLADIUS_MIN) $(CUBICVR_LIB)
+all: $(DIST_DIR) $(GLADIUS_DIST) $(GLADIUS_MIN) $(CUBICVR_LIB)
@@echo "Finished, see $(DIST_DIR)"
$(DIST_DIR):
@@ -63,7 +63,6 @@ test: $(DIST_DIR) $(GLADIUS_MIN)
@@echo "Starting web server in $(DIST_DIR), browse to http://localhost:9914/ (ctrl+c to stop)..."
@@cd $(DIST_DIR) && python ../$(TOOLS_DIR)/test_server.py
-
lint: check-lint
check-lint:
View
0 external/box2d.js/box2d.js → external/box2d.js
File renamed without changes.
1 external/gladius.math
@@ -1 +0,0 @@
-Subproject commit 2a486e312bad4566f4e49281d6632434929fe980
View
13 external/math.js
@@ -0,0 +1,13 @@
+/**
+ * @license
+ * Copyright (c) 2011, Mozilla Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the Mozilla Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */(function(){if(this._math)return;var a,b,c;(function(){function d(a){return m.call(a)==="[object Function]"}function e(a){return m.call(a)==="[object Array]"}function f(a){var b,c;for(b=0;c=a[b];b++)if(c===".")a.splice(b,1),b-=1;else if(c==="..")if(b!==1||a[2]!==".."&&a[0]!=="..")b>0&&(a.splice(b-1,2),b-=2);else break}function g(a,b){return a&&a.charAt(0)==="."&&b&&(b=b.split("/"),b=b.slice(0,b.length-1),a=b.concat(a.split("/")),f(a),a=a.join("/")),a}function h(a){return function(b){a.exports=b}}function i(a){return function(){var b=l.call(arguments,0);return b.push(a),n.apply(null,b)}}function j(a,b,c,e){var f=[],j=!1,l,m,n,o;if(d(c)){if(b)for(n=0;n<b.length;n++)m=g(b[n],a||e),m==="require"?f[n]=i(a):m==="exports"?(f[n]=k[a]={},j=!0):m==="module"?(l=f[n]={id:a,uri:"",exports:k[a]},l.setExports=h(l)):f[n]=k[m];o=c.apply(k[a],f),a&&(l&&l.exports!==undefined?o=k[a]=l.exports:o===undefined&&j?o=k[a]:k[a]=o)}else a&&(k[a]=c)}var k={},l=Array.prototype.slice,m=Object.prototype.toString,n;if(typeof c=="function"&&c.amd)return;a=n=function(a,b,c){var d,f,h;!e(a)&&typeof a!="string"&&(h=a,e(b)?(a=b,b=arguments[2]):a=[]);if(typeof a=="string"){d=a,c=b,f=g(d,c);if(f in k)return k[f];throw new Error("Module name '"+f+"' has not been loaded.")}return setTimeout(function(){j(null,a,b,c)},15),n},n.config=function(a){return n(a)},typeof b=="undefined"&&(b=n),c=function(a,b,c){e(b)||(c=b,b=[]),j(a,b,c)},c.amd={}})(),c("../tools/almond",function(){}),function(){function a(){return!0}if(!1){var b=document.getElementsByTagName("script"),c=b[b.length-1].src;c=c.split("/"),c.pop(),c=c.join("/")+"/",document.write('<script src="'+c+'../external/require.js"></'+"script>"),document.write('<script>requirejs.config( { baseUrl: "'+c+'",'+"paths: {"+' "external": "../external"'+"}"+"} );"+'requirejs(["math-src"])</'+"script>")}var d=this._math||(this._math={});d.create||(d.create=function(){(d._waitingCreates||(d._waitingCreates=[])).push(arguments)})}(),c("math",function(){}),Array.prototype.remove||(Array.prototype.remove=function(a,b){var c=this.slice((b||a)+1||this.length);return this.length=a<0?this.length+a:a,this.push.apply(this,c)}),c("lang",["require"],function(a){return{bind:function b(a,b){return function(){return b.apply(a,arguments)}},extend:function c(a,b){for(var c in b)!a.hasOwnProperty(c)&&b.hasOwnProperty(c)&&(a[c]=b[c])}}}),c("constants",["require"],function(a){return function(){var a={TAU:2*Math.PI,PI:Math.PI,HALF_PI:Math.PI/2};return a}}),c("vector/vector",["require"],function(a){return function(a){var b=function(b,c){var d=null;1===c.length?d=c[0]:d=c;var e=new a(b);for(var f=0;f<b;++f)e[f]=d[f];return e},c={$:b,add:function(a,b,c){for(var d=0;d<a.length;++d)c[d]+=a[d]+b[d];return c},clear:function(a){for(var b=0;b<a.length;++b)a[b]=0},dot:function(a,b){var c=0;for(var d=0;d<a.length;++d)c+=a[d]*b[d];return c},equal:function(a,b,c){c=c||1e-6;if(a.length!=b.length)return!1;var d=a.length;for(var e=0;e<d;++e)if(Math.abs(a[e]-b[e])>c)return!1;return!0},length:function(a){var b=0;for(var c=0;c<a.length;++c)b+=a[c]*a[c];return Math.sqrt(b)},multiply:function(a,b,c){for(var d=0;d<a.length;++d)c[d]=a[d]*b;return c},negate:function(a,b){for(var c=0;c<a.length;++c)b[c]=a[c]*-1;return b},normalize:function(a,b){var d=a.length;for(var e=0,f=c.length(a);e<d;++e)b[e]=a[e]/f;return b},subtract:function(a,b,c){for(var d=0;d<a.length;++d)c[d]=a[d]-b[d];return c}};return Object.defineProperty(c,"x",{get:function(){return Vector2([1,0])},enumerable:!0}),Object.defineProperty(c,"u",{get:function(){return Vector2([1,0])},enumerable:!0}),Object.defineProperty(c,"y",{get:function(){return Vector2([0,1])},enumerable:!0}),Object.defineProperty(c,"v",{get:function(){return Vector2([0,1])},enumerable:!0}),Object.defineProperty(c,"zero",{get:function(){return Vector2([0,0])},enumerable:!0}),Object.defineProperty(c,"one",{get:function(){return Vector2([1,1])},enumerable:!0}),c}}),c("vector/vector2",["require","./vector","../constants"],function(a){return function(b){var c=a("./vector")(b),d=a("../constants")(),e=function(){return 0===arguments.length?c.$(2,[0,0]):c.$(2,arguments)},f={$:e,add:function(a,b,d){return d=d||e(),c.add(a,b,d)},angle:function(a,b){var d=e(),f=e();return c.normalize(a,d),c.normalize(b,f),Math.acos(c.dot(d,f))},clear:c.clear,dot:c.dot,equal:c.equal,length:c.length,multiply:function(a,b,d){return d=d||e(),c.multiply(a,b,d)},negate:function(a,b){return b=b||e(),c.negate(a,b)},normalize:function(a,b){b=b||e();var d=c.length(a);return b[0]=a[0]/d,b[1]=a[1]/d,b},project:function(a,b,c){c=c||e();var d=a[0]*b[0]+a[1]*b[1],f=d/(b[0]*b[0]+b[1]*b[1]);return c[0]=f*b[0],c[1]=f*b[1],c},dproject:function(a,b,c){return f.angle(a,b)>=d.TAU/4?c=f.zero:(c=c||e(),f.project(a,b,c)),c},subtract:function(a,b,d){return d=d||e(),c.subtract(a,b,d)}};return Object.defineProperty(f,"x",{get:function(){return e([1,0])},enumerable:!0}),Object.defineProperty(f,"u",{get:function(){return e([1,0])},enumerable:!0}),Object.defineProperty(f,"y",{get:function(){return e([0,1])},enumerable:!0}),Object.defineProperty(f,"v",{get:function(){return e([0,1])},enumerable:!0}),Object.defineProperty(f,"zero",{get:function(){return e([0,0])},enumerable:!0}),Object.defineProperty(f,"one",{get:function(){return e([1,1])},enumerable:!0}),f}}),c("vector/vector3",["require","./vector"],function(a){return function(b){var c=a("./vector")(b),d=function(){return 0===arguments.length?c.$(3,[0,0,0]):c.$(3,arguments)},e={$:d,add:function(a,b,e){return e=e||d(),c.add(a,b,e)},angle:function(a,b){return Math.acos((a[0]*b[0]+a[1]*b[1]+a[2]*b[2])/(Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])*Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2])))},clear:c.clear,cross:function(a,b,c){return c=c||d(),c[0]=a[1]*b[2]-b[1]*a[2],c[1]=a[2]*b[0]-b[2]*a[0],c[2]=a[0]*b[1]-b[0]*a[1],c},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},equal:c.equal,length:c.length,multiply:function(a,b,e){return e=e||d(),c.multiply(a,b,e)},normal:function(a,b,c){return c=c||d(),d.cross(a,b,c)},normalize:function(a,b){b=b||d();var e=c.length(a);return b[0]=a[0]/e,b[1]=a[1]/e,b[2]=a[2]/e,b},subtract:function(a,b,e){return e=e||d(),c.subtract(a,b,e)}};return Object.defineProperty(e,"x",{get:function(){return d([1,0,0])},enumerable:!0}),Object.defineProperty(e,"y",{get:function(){return d([0,1,0])},enumerable:!0}),Object.defineProperty(e,"z",{get:function(){return d([0,0,1])},enumerable:!0}),Object.defineProperty(e,"zero",{get:function(){return d([0,0,0])},enumerable:!0}),Object.defineProperty(e,"one",{get:function(){return d([1,1,1])},enumerable:!0}),e}}),c("vector/vector4",["require","./vector"],function(a){return function(b){var c=a("./vector")(b),d=function(){return 0===arguments.length?c.$(4,[0,0,0,0]):c.$(4,arguments)},e={$:d,add:function(a,b,c){return c=c||d(),c[0]=a[0]+b[0],c[1]=a[1]+b[1],c[2]=a[2]+b[2],c[3]=a[3]+b[3],c},angle:function(a,b){return Math.acos((a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3])/(Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])*Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]+b[3]*b[3])))},clear:c.clear,dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},equal:c.equal,length:c.length,multiply:function(a,b,e){return e=e||d(),c.multiply(a,b,e)},normalize:function(a,b){b=b||d();var e=c.length(a);return b[0]=a[0]/e,b[1]=a[1]/e,b[2]=a[2]/e,b[3]=a[3]/e,b},subtract:function(a,b,e){return e=e||d(),c.subtract(a,b,e)}};return Object.defineProperty(e,"x",{get:function(){return d([1,0,0,0])},enumerable:!0}),Object.defineProperty(e,"y",{get:function(){return d([0,1,0,0])},enumerable:!0}),Object.defineProperty(e,"z",{get:function(){return d([0,0,1,0])},enumerable:!0}),Object.defineProperty(e,"w",{get:function(){return d([0,0,0,1])},enumerable:!0}),Object.defineProperty(e,"zero",{get:function(){return d([0,0,0,0])},enumerable:!0}),Object.defineProperty(e,"one",{get:function(){return d([1,1,1,1])},enumerable:!0}),e}}),c("vector/quaternion",["require","./vector4","./vector3"],function(a){return function(b){var c=a("./vector4")(b),d=a("./vector3")(b),e=c.$,f={$:e,to:{rpy:function(a,b){var c=b||d.$(),e=Math.atan2,f=Math.asin;c[0]=e(2*a[0]*a[1]+2*a[2]*a[3],1-2*a[1]*a[1]+2*a[2]*a[2]),c[1]=f(2*a[0]*a[2]-2*a[3]*a[1]),c[2]=e(2*a[0]*a[3]+2*a[1]*a[2],1-2*a[2]*a[2]+2*a[3]*a[3]);if(!b)return c}},from:{rpy:function(a,b){var c=b||f.$(),d=Math.sin,e=Math.cos,g=a[0]/2,h=a[1]/2,i=a[2]/2,j=d(g),k=e(g),l=d(h),m=e(h),n=d(i),o=e(i);c[0]=k*m*o+j*l*n,c[1]=j*m*o-k*l*n,c[2]=k*l*o+j*m*n,c[3]=k*m*n-j*l*o;if(!b)return c}},length:c.length,multiply:function(a,b,c){var d=c||f.$();d[0]=a[3]*b[0]+a[0]*b[3]+a[1]*b[2]-a[2]*b[1],d[1]=a[3]*b[1]-a[0]*b[2]+a[1]*b[3]+a[2]*b[0],d[2]=a[3]*b[2]+a[0]*b[1]-a[1]*b[0]+a[2]*b[3],d[3]=a[3]*b[3]-a[0]*b[0]-a[1]*b[1]-a[2]*b[2];if(!c)return d},normalize:c.normalize};return Object.defineProperty(f,"identity",{get:function(){return e([0,0,0,1])},enumerable:!0}),f}}),c("matrix/matrix",["require"],function(a){return function(a){var b=function(b,c){var d=null;1===c.length?d=c[0]:d=c;var e=new a(b);for(var f=0;f<b;++f)e[f]=d[f];return e},c={$:b,add:function(a,b,c){for(var d=0;d<a.length;++d)c[d]+=a[d]+b[d];return c},subtract:function(a,b,c){for(var d=0;d<a.length;++d)a[d]-=b[d];return a},clear:function(a){for(var b=0;b<a.length;++b)a[b]=0},equal:function(a,b,c){c=c||1e-6;if(a.length!=b.length)return!1;var d=a.length;for(var e=0;e<d;++e)if(Math.abs(a[e]-b[e])>c)return!1;return!0}};return c}}),c("matrix/matrix2",["require","./matrix"],function(a){return function(b){var c=a("./matrix")(b),d=function(){return 0===arguments.length?c.$(4,[0,0,0,0]):c.$(4,arguments)},e={$:d,add:function(a,b){b=b||d();var e=a[0];if(a.length==1)b=e;else for(var f=1;f<a.length;++f)b=c.add(e,a[f],b),e=b;return b},subtract:function(a,b){b=b||d();var e=a[0];if(a.length==1)b=e;else{var e=a[0];for(var f=1;f<a.length;++f)b=c.subtract(e,a[f],b),e=b}return b},clear:c.clear,equal:c.equal,determinant:function(a){return a[0]*a[3]-a[1]*a[2]},inverse:function(a,b){var c=e.determinant(a);if(c==0)throw"matrix is singular";return b=b||d(),b[0]=a[3]/c,b[1]=a[1]*-1/c,b[2]=a[2]*-1/c,b[3]=a[0]/c,b},multiply:function(a,b){b=b||d();if(a.length==1)return a[0];var c=a[0];for(var e=1;e<a.length;++e)b[0]=c[0]*a[e][0]+c[1]*a[e][2],b[1]=c[0]*a[e][1]+c[1]*a[e][3],b[2]=c[2]*a[e][0]+c[3]*a[e][2],b[3]=c[2]*a[e][1]+c[3]*a[e][3],c=b;return b},transpose:function(a,b){b=b||d();var c=a[1];return b[0]=a[0],b[1]=a[2],b[2]=c,b[3]=a[3],b}};return Object.defineProperty(e,"zero",{get:function(){return d([0,0,0,0])},enumerable:!0}),Object.defineProperty(e,"one",{get:function(){return d([1,1,1,1])},enumerable:!0}),Object.defineProperty(e,"identity",{get:function(){return d([1,0,0,1])},enumerable:!0}),e}}),c("matrix/matrix3",["require","./matrix"],function(a){return function(b){var c=a("./matrix")(b),d=function(){return 0===arguments.length?c.$(9,[0,0,0,0,0,0,0,0,0]):c.$(9,arguments)},e={$:d,add:function(a,b){b=b||d();if(a.length==1)return a[0];var e=a[0];for(var f=1;f<a.length;++f)b=c.add(e,a[f],b),e=b;return b},subtract:function(a,b){b=b||d();var e=a[0];if(a.length==1)b=e;else for(var f=1;f<a.length;++f)b=c.subtract(e,a[f],b),e=b;return b},clear:c.clear,equal:c.equal,determinant:function(a){return a[0]*(a[4]*a[8]-a[5]*a[7])-a[1]*(a[3]*a[8]-a[5]*a[6])+a[2]*(a[3]*a[7]-a[4]*a[6])},inverse:function(a,b){var c=e.determinant(a);if(c==0)throw"matrix is singular";return b=b||d(),b[0]=(a[8]*a[4]-a[7]*a[5])/c,b[1]=-(a[8]*a[1]-a[7]*[2])/c,b[2]=(a[5]*a[1]-a[4]*a[2])/c,b[3]=-(a[8]*a[3]-a[6]*a[5])/c,b[4]=(a[8]*a[0]-a[6]*a[2])/c,b[5]=-(a[5]*a[0]-a[3]*a[2])/c,b[6]=(a[7]*a[3]-a[6]*a[4])/c,b[7]=-(a[7]*a[0]-a[6]*a[1])/c,b[8]=(a[4]*a[0]-a[3]*a[1])/c,b},multiply:function(a,b){b=b||d();if(a.length==1)return a[0];var c=a[0];for(var e=1;e<a.length;++e)b[0]=c[0]*a[e][0]+c[1]*a[e][3]+c[2]*a[e][6],b[1]=c[0]*a[e][1]+c[1]*a[e][4]+c[2]*a[e][7],b[2]=c[0]*a[e][2]+c[1]*a[e][5]+c[2]*a[e][8],b[3]=c[3]*a[e][0]+c[4]*a[e][3]+c[5]*a[e][6],b[4]=c[3]*a[e][1]+c[4]*a[e][4]+c[5]*a[e][7],b[5]=c[3]*a[e][2]+c[4]*a[e][5]+c[5]*a[e][8],b[6]=c[6]*a[e][0]+c[7]*a[e][3]+c[8]*a[e][6],b[7]=c[6]*a[e][1]+c[7]*a[e][4]+c[8]*a[e][7],b[8]=c[6]*a[e][2]+c[7]*a[e][5]+c[8]*a[e][8],c=b;return b},rotate:function(a,b){var c=b||matrix4.identity,d,f;0!==a[2]&&(d=Math.sin(a[2]),f=Math.cos(a[2]),ml=[],ml.push(e.$([f,d,0,-d,f,0,0,0,1])),ml.push(e.$(c)),e.multiply(ml,c)),0!==a[1]&&(d=Math.sin(a[1]),f=Math.cos(a[1]),ml=[],ml.push(e.$([f,0,-d,0,1,0,d,0,f])),ml.push(e.$(c)),e.multiply(ml,c)),0!==a[0]&&(d=Math.sin(a[0]),f=Math.cos(a[0]),ml=[],ml.push(e.$([1,0,0,0,f,d,0,-d,f])),ml.push(e.$(c)),e.multiply(ml,c));if(!b)return c},transpose:function(a,b){b=b||d();var c=a[1],e=a[2],f=a[5];return b[0]=a[0],b[1]=a[3],b[2]=a[6],b[3]=c,b[4]=a[4],b[5]=a[7],b[6]=e,b[7]=f,b[8]=a[8],b}};return Object.defineProperty(e,"zero",{get:function(){return d([0,0,0,0,0,0,0,0,0])},enumerable:!0}),Object.defineProperty(e,"one",{get:function(){return d([1,1,1,1,1,1,1,1,1])},enumerable:!0}),Object.defineProperty(e,"identity",{get:function(){return d([1,0,0,0,1,0,0,0,1])},enumerable:!0}),e}}),c("matrix/matrix4",["require","./matrix","../vector/vector3"],function(a){return function(b){var c=a("./matrix")(b),d=a("../vector/vector3")(b),e=function(){return 0===arguments.length?c.$(16,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]):c.$(16,arguments)},f={$:e,add:function(a,b){b=b||e();if(a.length==1)return a[0];var d=a[0];for(var f=1;f<a.length;++f)b=c.add(d,a[f],b),d=b;return b},subtract:function(a,b){b=b||e();var d=a[0];if(a.length==1)b=d;else for(var f=1;f<a.length;++f)b=c.subtract(d,a[f],b),d=b;return b},clear:c.clear,equal:c.equal,multiply:function(a,b){b=b||e();if(a.length==1)return a[0];var c=a[0];for(var d=1;d<a.length;++d)b[0]=c[0]*a[d][0]+c[1]*a[d][4]+c[2]*a[d][8]+c[3]*a[d][12],b[1]=c[0]*a[d][1]+c[1]*a[d][5]+c[2]*a[d][9]+c[3]*a[d][13],b[2]=c[0]*a[d][2]+c[1]*a[d][6]+c[2]*a[d][10]+c[3]*a[d][14],b[3]=c[0]*a[d][3]+c[1]*a[d][7]+c[2]*a[d][11]+c[3]*a[d][15],b[4]=c[4]*a[d][0]+c[5]*a[d][4]+c[6]*a[d][8]+c[7]*a[d][12],b[5]=c[4]*a[d][1]+c[5]*a[d][5]+c[6]*a[d][9]+c[7]*a[d][13],b[6]=c[4]*a[d][2]+c[5]*a[d][6]+c[6]*a[d][10]+c[7]*a[d][14],b[7]=c[4]*a[d][3]+c[5]*a[d][7]+c[6]*a[d][11]+c[7]*a[d][15],b[8]=c[8]*a[d][0]+c[9]*a[d][4]+c[10]*a[d][8]+c[11]*a[d][12],b[9]=c[8]*a[d][1]+c[9]*a[d][5]+c[10]*a[d][9]+c[11]*a[d][13],b[10]=c[8]*a[d][2]+c[9]*a[d][6]+c[10]*a[d][10]+c[11]*a[d][14],b[11]=c[8]*a[d][3]+c[9]*a[d][7]+c[10]*a[d][11]+c[11]*a[d][15],b[12]=c[12]*a[d][0]+c[13]*a[d][4]+c[14]*a[d][8]+c[15]*a[d][12],b[13]=c[12]*a[d][1]+c[13]*a[d][5]+c[14]*a[d][9]+c[15]*a[d][13],b[14]=c[12]*a[d][2]+c[13]*a[d][6]+c[14]*a[d][10]+c[15]*a[d][14],b[15]=c[12]*a[d][3]+c[13]*a[d][7]+c[14]*a[d][11]+c[15]*a[d][15],c=b;return b},multiplyVector3:function(a,b,c){return c=c||d.$(),c[0]=a[0]*b[0]+a[4]*b[1]+a[8]*b[2]+a[12],c[1]=a[1]*b[0]+a[5]*b[1]+a[9]*b[2]+a[13],c[2]=a[2]*b[0]+a[6]*b[1]+a[10]*b[2]+a[14],c},determinant:function(a){var b=a[0]*a[5]-a[1]*a[4],c=a[0]*a[6]-a[2]*a[4],d=a[0]*a[7]-a[3]*a[4],e=a[1]*a[6]-a[2]*a[5],f=a[1]*a[7]-a[3]*a[5],g=a[2]*a[7]-a[3]*a[6],h=a[8]*a[13]-a[9]*a[12],i=a[8]*a[14]-a[10]*a[12],j=a[8]*a[15]-a[11]*a[12],k=a[9]*a[14]-a[10]*a[13],l=a[9]*a[15]-a[11]*a[13],m=a[10]*a[15]-a[11]*a[14],n=b*m-c*l+d*k+e*j-f*i+g*h;return n},transpose:function(a,b){return b=b||e(),b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15],b},inverse:function(a,b){b=b||e();var c=a[0],d=a[1],f=a[2],g=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],m=a[9],n=a[10],o=a[11],p=a[12],q=a[13],r=a[14],s=a[15],t=c*i-d*h,u=c*j-f*h,v=c*k-g*h,w=d*j-f*i,x=d*k-g*i,y=f*k-g*j,z=l*q-m*p,A=l*r-n*p,B=l*s-o*p,C=m*r-n*q,D=m*s-o*q,E=n*s-o*r,F=t*E-u*D+v*C+w*B-x*A+y*z,G;if(!F)throw"matrix is singular";return G=1/F,b[0]=(i*E-j*D+k*C)*G,b[1]=(-d*E+f*D-g*C)*G,b[2]=(q*y-r*x+s*w)*G,b[3]=(-m*y+n*x-o*w)*G,b[4]=(-h*E+j*B-k*A)*G,b[5]=(c*E-f*B+g*A)*G,b[6]=(-p*y+r*v-s*u)*G,b[7]=(l*y-n*v+o*u)*G,b[8]=(h*D-i*B+k*z)*G,b[9]=(-c*D+d*B-g*z)*G,b[10]=(p*x-q*v+s*t)*G,b[11]=(-l*x+m*v-o*t)*G,b[12]=(-h*C+i*A-j*z)*G,b[13]=(c*C-d*A+f*z)*G,b[14]=(-p*w+q*u-r*t)*G,b[15]=(l*w-m*u+n*t)*G,b},toHTML:function(a){var b="[ ";for(var c=0;c<4;++c){b+="<br>";for(var d=0;d<4;++d)b+=" ("+a[4*c+d]+") "}return b+=" ]",b}};return Object.defineProperty(f,"zero",{get:function(){return e([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])},enumerable:!0}),Object.defineProperty(f,"one",{get:function(){return e([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},enumerable:!0}),Object.defineProperty(f,"identity",{get:function(){return e([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},enumerable:!0}),f}}),c("matrix/transform",["require","./matrix4"],function(a){return function(b){var c=a("./matrix4")(b),d=c.$,e={$:d,fixed:function(a,b,d){var f=c.identity;return a&&e.translate(a,f),b&&e.rotate(b,f),d&&e.scale(d,f),f},rotate:function(a,b){var d=b||c.identity,e,f;0!==a[2]&&(e=Math.sin(a[2]),f=Math.cos(a[2]),ml=[],ml.push(c.$([f,e,0,0,-e,f,0,0,0,0,1,0,0,0,0,1])),ml.push(c.$(d)),c.multiply(ml,d)),0!==a[1]&&(e=Math.sin(a[1]),f=Math.cos(a[1]),ml=[],ml.push(c.$([f,0,-e,0,0,1,0,0,e,0,f,0,0,0,0,1])),ml.push(c.$(d)),c.multiply(ml,d)),0!==a[0]&&(e=Math.sin(a[0]),f=Math.cos(a[0]),ml=[],ml.push(c.$([1,0,0,0,0,f,e,0,0,-e,f,0,0,0,0,1])),ml.push(c.$(d)),c.multiply(ml,d));if(!b)return d},scale:function(a,b){var d=[a[0],0,0,0,0,a[1],0,0,0,0,a[2],0,0,0,0,1];if(b)c.multiply([d,c.$(b)],b);else return d},translate:function(a,b){var d=[1,0,0,0,0,1,0,0,0,0,1,0,a[0],a[1],a[2],1];if(b)c.multiply([d,c.$(b)],b);else return d}};return e}}),c("math-require",["require","./lang","./constants","./vector/vector2","./vector/vector3","./vector/vector4","./vector/quaternion","./matrix/matrix2","./matrix/matrix3","./matrix/matrix4","./matrix/transform"],function(a){var b=a("./lang"),c=a("./constants"),d=a("./vector/vector2"),e=a("./vector/vector3"),f=a("./vector/vector4"),g=a("./vector/quaternion"),h=a("./matrix/matrix2"),i=a("./matrix/matrix3"),j=a("./matrix/matrix4"),k=a("./matrix/transform"),l=function(a){var l={Float32:Float32Array,Float64:Float64Array},m=l.Float32;Object.defineProperty(this,"ARRAY_TYPE",{get:function(){return m},enumerable:!0}),b.extend(this,c());var n=d(m),o=e(m),p=f(m),q=g(m),r=h(m),s=i(m),t=j(m),u=k(m);Object.defineProperty(this,"Vector2",{get:function(){return n.$},enumerable:!0}),Object.defineProperty(this,"vector2",{get:function(){return n},enumerable:!0}),Object.defineProperty(this,"Vector3",{get:function(){return o.$},enumerable:!0}),Object.defineProperty(this,"vector3",{get:function(){return o},enumerable:!0}),Object.defineProperty(this,"Vector4",{get:function(){return p.$},enumerable:!0}),Object.defineProperty(this,"vector4",{get:function(){return p},enumerable:!0}),Object.defineProperty(this,"Quaternion",{get:function(){return q.$},enumerable:!0}),Object.defineProperty(this,"quaternion",{get:function(){return q},enumerable:!0}),Object.defineProperty(this,"Matrix2",{get:function(){return r.$},enumerable:!0}),Object.defineProperty(this,"matrix2",{get:function(){return r},enumerable:!0}),Object.defineProperty(this,"Matrix3",{get:function(){return s.$},enumerable:!0}),Object.defineProperty(this,"matrix3",{get:function(){return s},enumerable:!0}),Object.defineProperty(this,"Matrix4",{get:function(){return t.$},enumerable:!0}),Object.defineProperty(this,"matrix4",{get:function(){return t},enumerable:!0}),Object.defineProperty(this,"Transform",{get:function(){return u.$},enumerable:!0}),Object.defineProperty(this,"transform",{get:function(){return u},enumerable:!0})};return l}),c("math-src",["require","./lang","./math-require"],function(a){var b=a("./lang"),c=a("./math-require"),d,e,f,g=window._math||(window._math={});_Math=function(d,e){this.options=d||{},a([],b.bind(this,function(){b.extend(this,new c(d)),e&&e(this)}))},g.create=function(a,b){return new _Math(a,b)};if(g._waitingCreates){for(e=0;f=g._waitingCreates[e];e++)g.create.apply(g,f);delete g._waitingCreates}return g})})()
View
6 src/gladius-src.js
@@ -3,7 +3,6 @@
define( function ( require ) {
var lang = require( 'lang' ),
- _Math = require( 'math/math-require' ),
ThreadPool = require( 'core/threading/pool' ),
Scheduler = require( 'core/scheduler' ),
Delegate = require( 'common/delegate' ),
@@ -34,8 +33,9 @@ define( function ( require ) {
// for protections against overwriting an existing gladius in the page,
// for when gladius is built for deployment.
global = window.gladius || ( window.gladius = {} );
-
- require( 'external/box2d.js/box2d' );
+
+ require( 'external/math' );
+ require( 'external/box2d' );
/***
* Gladius
View
1 src/gladius.js
@@ -38,7 +38,6 @@
' "base": "./base",' +
' "common": "./common",' +
' "external": "../external",' +
- ' "math": "../external/gladius.math/src",' +
' "CubicVR.js": "../external/CubicVR.js"' +
'}' +
'} );' +
View
3 tools/build.js
@@ -12,7 +12,8 @@
// so this build file assumes make has already run in CubicVR.js
paths: {
'CubicVR.js/CubicVR': '../external/CubicVR.js/dist/CubicVR',
- 'math': '../external/gladius.math/src'
+ 'external/math': '../external/math',
+ 'external/box2d': '../external/box2d'
},
// Use has branch trimming in the build to remove the document.write

0 comments on commit 5c17b32

Please sign in to comment.