diff options
author | Jose Antonio Marquez | 2012-04-04 15:54:33 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-04-04 15:54:33 -0700 |
commit | a9bcc403df76ad2cb7c31ff7fdd42a85c35cf424 (patch) | |
tree | 9415f5ba25ad643df678e561719d2708fd3ead5a /js/helper-classes/RDGE | |
parent | 0a469a14757b8cea262c21f652e75c85c9903f4b (diff) | |
parent | e721a7c1009f298a1bd8fea583da14535e039880 (diff) | |
download | ninja-a9bcc403df76ad2cb7c31ff7fdd42a85c35cf424.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into FileIO
Diffstat (limited to 'js/helper-classes/RDGE')
43 files changed, 7585 insertions, 9491 deletions
diff --git a/js/helper-classes/RDGE/precompiled.js b/js/helper-classes/RDGE/precompiled.js deleted file mode 100755 index 7932444c..00000000 --- a/js/helper-classes/RDGE/precompiled.js +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /* | ||
8 | * A list of shared parameters that all shaders can support (the engine always try to bind these uniforms) | ||
9 | * These parameters are compiled into all jshaders and can be set from any jshader | ||
10 | * with a call to jshader.global.u_matDiffuse.set([1,0,0,1]) if the jshader depends on that parameter. | ||
11 | * To set directly call rdgeGlobalParameters.'param'.set(x), for example rdgeGlobalParameters.u_lightPos.set([1,1,1]) | ||
12 | * The values can be added to a jshaders params list - this will creating local jshader memory that binds to the parameter | ||
13 | * this parameter can be used to set the value for that shader but will not override the global setting | ||
14 | * The values set here are the default global values. | ||
15 | * note: the rdge_lights substructure can be ignored, the final parameter list contains only the uniform objects | ||
16 | */ | ||
17 | |||
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js index caf58147..0bbcb05b 100755 --- a/js/helper-classes/RDGE/rdge-compiled.js +++ b/js/helper-classes/RDGE/rdge-compiled.js | |||
@@ -1,452 +1,329 @@ | |||
1 | vec2={string:function(a){return"{ "+a[0]+", "+a[1]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<2?!1:typeof a[0]!="number"||typeof a[1]!="number"?!1:!0},copy:function(a){return a.length==void 0?[a,a]:[a[0],a[1]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1]},zero:function(){return[0,0]},up:function(){return[0,1]},right:function(){return[1,0]},add:function(a,b){return[a[0]+b[0],a[1]+b[1]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1]]},mul:function(a,b){return[a[0]*b[0], | 1 | var RDGE=RDGE||{};RDGE.vec2={};RDGE.vec2.string=function(a){return"{ "+a[0]+", "+a[1]+" }"};RDGE.vec2.verify=function(a){return void 0==a||void 0==a.length||2>a.length||"number"!=typeof a[0]||"number"!=typeof a[1]?!1:!0};RDGE.vec2.copy=function(a){return void 0==a.length?[a,a]:[a[0],a[1]]};RDGE.vec2.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1]};RDGE.vec2.zero=function(){return[0,0]};RDGE.vec2.up=function(){return[0,1]};RDGE.vec2.right=function(){return[1,0]}; |
2 | a[1]*b[1]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=2?[a[0]+b[0]*f[0],a[1]+b[1]*f[1]]:[a[0]+b[0]*f,a[1]+b[1]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=2?[a[0]*b[0],a[1]*b[1]]:[a[0]*b,a[1]*b]},negate:function(a){return[-a[0],-a[1]]},normalize:function(a){var b=Math.sqrt(a[0]*a[0],a[1]*a[1]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]},perp:function(a){return[a[1],-a[0]]},lengthSq:function(a){return a[0]*a[0]+ | 2 | RDGE.vec2.add=function(a,b){return[a[0]+b[0],a[1]+b[1]]};RDGE.vec2.sub=function(a,b){return[a[0]-b[0],a[1]-b[1]]};RDGE.vec2.mul=function(a,b){return[a[0]*b[0],a[1]*b[1]]};RDGE.vec2.addMul=function(a,b,c){return void 0!=c.length&&2<=c.length?[a[0]+b[0]*c[0],a[1]+b[1]*c[1]]:[a[0]+b[0]*c,a[1]+b[1]*c]};RDGE.vec2.scale=function(a,b){return void 0!=b.length&&2<=b.length?[a[0]*b[0],a[1]*b[1]]:[a[0]*b,a[1]*b]};RDGE.vec2.negate=function(a){return[-a[0],-a[1]]}; |
3 | a[1]*a[1]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1])]}};vec2.clamp=function(a,b,f){return vec2.min(f,vec2.max(a,b))};vec3={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<3?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"?!1:!0},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2]},copy:function(a){return a.length==void 0?[a,a,a]:[a[0],a[1],a[2]]},translation:function(a){return[a[12],a[13],a[14]]},basisX:function(a){return[a[0],a[1],a[2]]},basisY:function(a){return[a[4],a[5],a[6]]},basisZ:function(a){return[a[8], | 3 | RDGE.vec2.normalize=function(a){var b=Math.sqrt(a[0]*a[0],a[1]*a[1]);return 1.0E-4<Math.abs(1-b)?(b=1/b,[a[0]*b,a[1]*b]):a};RDGE.vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};RDGE.vec2.perp=function(a){return[a[1],-a[0]]};RDGE.vec2.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]};RDGE.vec2.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])};RDGE.vec2.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1])]};RDGE.vec2.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1])]}; |
4 | a[9],a[10]]},zero:function(){return[0,0,0]},up:function(){return[0,1,0]},forward:function(){return[0,0,1]},right:function(){return[1,0,0]},random:function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random()]},xy:function(a){return[a[0],a[1]]},xz:function(a){return[a[0],a[2]]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]},plusEqual:function(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]}, | 4 | RDGE.vec2.clamp=function(a,b,c){return RDGE.vec2.min(c,RDGE.vec2.max(a,b))};RDGE=RDGE||{};RDGE.vec3={};RDGE.vec3.string=function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+" }"};RDGE.vec3.verify=function(a){return void 0==a||void 0==a.length||3>a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||"number"!=typeof a[2]?!1:!0};RDGE.vec3.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2]};RDGE.vec3.copy=function(a){return void 0==a.length?[a,a,a]:[a[0],a[1],a[2]]};RDGE.vec3.translation=function(a){return[a[12],a[13],a[14]]}; |
5 | mul:function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=3?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f]},plusEqualMul:function(a,b,f){f.length!==void 0&&f.length>=3?(a[0]+=b[0]*f[0],a[1]+=b[1]*f[1],a[2]+=b[2]*f[2]):(a[0]+=b[0]*f,a[1]+=b[1]*f,a[2]+=b[2]*f)},scale:function(a,b){return b.length!==void 0&&b.length>=3?[a[0]*b[0],a[1]*b[1],a[2]*b[2]]:[a[0]*b,a[1]*b,a[2]*b]},inplace_scale:function(a,b){b.length!== | 5 | RDGE.vec3.basisX=function(a){return[a[0],a[1],a[2]]};RDGE.vec3.basisY=function(a){return[a[4],a[5],a[6]]};RDGE.vec3.basisZ=function(a){return[a[8],a[9],a[10]]};RDGE.vec3.zero=function(){return[0,0,0]};RDGE.vec3.up=function(){return[0,1,0]};RDGE.vec3.forward=function(){return[0,0,1]};RDGE.vec3.right=function(){return[1,0,0]};RDGE.vec3.random=function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random()]};RDGE.vec3.xy=function(a){return[a[0],a[1]]}; |
6 | void 0&&b.length>=3?(a[0]*=b[0],a[1]*=b[1],a[2]*=b[2]):(a[0]*=b,a[1]*=b,a[2]*=b)},negate:function(a){return[-a[0],-a[1],-a[2]]},inplace_negate:function(a){a[0]=-a[0];a[1]=-a[1];a[2]=-a[2]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b]):a},cross:function(a,b){return[a[1]*b[2]-b[1]*a[2],a[2]*b[0]-b[2]*a[0],a[0]*b[1]-b[0]*a[1]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},lengthSq:function(a){return a[0]*a[0]+ | 6 | RDGE.vec3.xz=function(a){return[a[0],a[2]]};RDGE.vec3.add=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]};RDGE.vec3.plusEqual=function(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]};RDGE.vec3.sub=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]};RDGE.vec3.mul=function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2]]};RDGE.vec3.addMul=function(a,b,c){return void 0!=c.length&&3<=c.length?[a[0]+b[0]*c[0],a[1]+b[1]*c[1],a[2]+b[2]*c[2]]:[a[0]+b[0]*c,a[1]+b[1]*c,a[2]+b[2]*c]}; |
7 | a[1]*a[1]+a[2]*a[2]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])},distanceSq:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return f[0]*f[0]+f[1]*f[1]+f[2]*f[2]},distance:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2])}};vec3.angle=function(a,b){return Math.acos(vec3.dot(a,b))/(vec3.length(a)*vec3.length(b))};vec3.direction=function(a,b){return vec3.normalize(vec3.sub(b,a))}; | 7 | RDGE.vec3.plusEqualMul=function(a,b,c){void 0!==c.length&&3<=c.length?(a[0]+=b[0]*c[0],a[1]+=b[1]*c[1],a[2]+=b[2]*c[2]):(a[0]+=b[0]*c,a[1]+=b[1]*c,a[2]+=b[2]*c)};RDGE.vec3.scale=function(a,b){return void 0!==b.length&&3<=b.length?[a[0]*b[0],a[1]*b[1],a[2]*b[2]]:[a[0]*b,a[1]*b,a[2]*b]};RDGE.vec3.inplace_scale=function(a,b){void 0!==b.length&&3<=b.length?(a[0]*=b[0],a[1]*=b[1],a[2]*=b[2]):(a[0]*=b,a[1]*=b,a[2]*=b)};RDGE.vec3.negate=function(a){return[-a[0],-a[1],-a[2]]}; |
8 | vec3.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])]};vec3.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2])]};vec3.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2])]};vec3.clamp=function(a,b,f){return vec3.min(f,vec3.max(a,b))};vec3.equal=function(a,b,f){f||(f=0.0010);return vec3.distanceSq(a,b)<f*f};vec3.lerp=function(a,b,f){return[a[0]+(b[0]-a[0])*f,a[1]+(b[1]-a[1])*f,a[2]+(b[2]-a[2])*f]};vec4={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<4?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"||typeof a[3]!="number"?!1:!0},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3]},copy:function(a){return a.length==void 0?[a,a,a,a]:a.length==3?[a[0],a[1],a[2],1]:[a[0],a[1],a[2],a[3]]},zero:function(){return[0,0,0,0]},identity:function(){return[0,0,0,1]},up:function(){return[0, | 8 | RDGE.vec3.inplace_negate=function(a){a[0]=-a[0];a[1]=-a[1];a[2]=-a[2]};RDGE.vec3.normalize=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return 1.0E-4<Math.abs(1-b)?(b=1/b,[a[0]*b,a[1]*b,a[2]*b]):a};RDGE.vec3.cross=function(a,b){return[a[1]*b[2]-b[1]*a[2],a[2]*b[0]-b[2]*a[0],a[0]*b[1]-b[0]*a[1]]};RDGE.vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};RDGE.vec3.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]}; |
9 | 1,0,0]},forward:function(){return[0,0,1,0]},right:function(){return[1,0,0,0]},random:function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random(),a[3]+(b[3]-a[3])*Math.random()]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]},mul:function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=4?[a[0]+b[0]* | 9 | RDGE.vec3.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])};RDGE.vec3.distanceSq=function(a,b){var c=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return c[0]*c[0]+c[1]*c[1]+c[2]*c[2]};RDGE.vec3.distance=function(a,b){var c=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])};RDGE.vec3.angle=function(a,b){return Math.acos(RDGE.vec3.dot(a,b))/(RDGE.vec3.length(a)*RDGE.vec3.length(b))};RDGE.vec3.direction=function(a,b){return RDGE.vec3.normalize(RDGE.vec3.sub(b,a))}; |
10 | f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},negate:function(a){return[-a[0],-a[1],-a[2],-a[3]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},lengthSq:function(a){return a[0]* | 10 | RDGE.vec3.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])]};RDGE.vec3.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2])]};RDGE.vec3.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2])]};RDGE.vec3.clamp=function(a,b,c){return RDGE.vec3.min(c,RDGE.vec3.max(a,b))};RDGE.vec3.equal=function(a,b,c){c||(c=0.0010);return RDGE.vec3.distanceSq(a,b)<c*c}; |
11 | a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},abs:function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]),Math.abs(a[3])]},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2]),Math.min(a[3],b[3])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2]),Math.min(a[3],b[3])]}};vec4.clamp=function(a,b,f){return vec4.min(f,vec4.max(a,b))}; | 11 | RDGE.vec3.lerp=function(a,b,c){return[a[0]+(b[0]-a[0])*c,a[1]+(b[1]-a[1])*c,a[2]+(b[2]-a[2])*c]};RDGE=RDGE||{};RDGE.vec4={};RDGE.vec4.string=function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+" }"};RDGE.vec4.verify=function(a){return void 0==a||void 0==a.length||4>a.length||"number"!=typeof a[0]||"number"!=typeof a[1]||"number"!=typeof a[2]||"number"!=typeof a[3]?!1:!0};RDGE.vec4.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3]};RDGE.vec4.copy=function(a){return void 0==a.length?[a,a,a,a]:3==a.length?[a[0],a[1],a[2],1]:[a[0],a[1],a[2],a[3]]}; |
12 | vec4.equal=function(a,b,f){f||(f=0.0010);return vec4.distanceSq(a,b)<f*f};vec4.lerp=function(a,b,f){return[a[0]+(b[0]-a[0])*f,a[1]+(b[1]-a[1])*f,a[2]+(b[2]-a[2])*f,a[3]+(b[3]-a[3])*f]};float3=function(){data=[3]};float4=function(){data=[4]}; | 12 | RDGE.vec4.zero=function(){return[0,0,0,0]};RDGE.vec4.identity=function(){return[0,0,0,1]};RDGE.vec4.up=function(){return[0,1,0,0]};RDGE.vec4.forward=function(){return[0,0,1,0]};RDGE.vec4.right=function(){return[1,0,0,0]};RDGE.vec4.random=function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random(),a[3]+(b[3]-a[3])*Math.random()]};RDGE.vec4.add=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]}; |
13 | mat4={string:function(a){var b="{ ";b+=a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", ";b+=a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", ";b+=a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", ";b+=a[12]+", "+a[13]+", "+a[14]+", "+a[15]+" }";return b},toCSSString:function(a,b){var f=10;b&&(f=b);var g="matrix3d(";g+=a[0].toFixed(10)+", "+a[1].toFixed(10)+", "+a[2].toFixed(10)+", "+a[3].toFixed(10)+", ";g+=a[4].toFixed(10)+", "+a[5].toFixed(10)+", "+a[6].toFixed(10)+", "+a[7].toFixed(10)+", ";g+=a[8].toFixed(10)+", "+a[9].toFixed(10)+ | 13 | RDGE.vec4.sub=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]};RDGE.vec4.mul=function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]};RDGE.vec4.addMul=function(a,b,c){return void 0!=c.length&&4<=c.length?[a[0]+b[0]*c[0],a[1]+b[1]*c[1],a[2]+b[2]*c[2],a[3]+b[3]*c[3]]:[a[0]+b[0]*c,a[1]+b[1]*c,a[2]+b[2]*c,a[3]+b[3]*c]};RDGE.vec4.scale=function(a,b){return void 0!=b.length&&4<=b.length?[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]}; |
14 | ", "+a[10].toFixed(10)+", "+a[11].toFixed(10)+", ";g+=a[12].toFixed(10)*f+", "+(600-a[13].toFixed(10)*f)+", "+a[14].toFixed(10)*f+", "+a[15].toFixed(10)+")";return g},verify:function(a){if(a==void 0||a.length==void 0||a.length<16)return!1;for(var b=16;b--;)if(typeof a[b]!="number")return!1;return!0},copy:function(a){return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]= | 14 | RDGE.vec4.negate=function(a){return[-a[0],-a[1],-a[2],-a[3]]};RDGE.vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};RDGE.vec4.normalize=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return 1.0E-4<Math.abs(1-b)?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a};RDGE.vec4.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]};RDGE.vec4.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])}; |
15 | b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]},identity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},zero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},basis:function(a,b,f,g){return g==null||g==void 0?[a[0],a[1],a[2],0,b[0],b[1],b[2],0,f[0],f[1],f[2],0,0,0,0,1]:[a[0],a[1],a[2],a.length==4?a[3]:0,b[0],b[1],b[2],b.length==4?b[3]:0,f[0],f[1],f[2],f.length==4?f[3]:0,g[0],g[1],g[2],g.length==4?g[3]:1]},angleAxis:function(a,b){a*= | 15 | RDGE.vec4.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]),Math.abs(a[3])]};RDGE.vec4.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2]),Math.min(a[3],b[3])]};RDGE.vec4.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2]),Math.min(a[3],b[3])]};RDGE.vec4.clamp=function(a,b,c){return RDGE.vec4.min(c,RDGE.vec4.max(a,b))};RDGE.vec4.equal=function(a,b,c){c||(c=0.0010);return RDGE.vec4.distanceSq(a,b)<c*c}; |
16 | Math.PI/180;a/=2;var f=Math.sin(a),g=Math.cos(a),h=f*f;vec3.normalize(b);vec3.lengthSq(b)<=0&&(b=[0,0,0,1]);var l=mat4.identity();if(b[0]==1&&b[1]==0&&b[2]==0)l[5]=1-2*h,l[6]=2*f*g,l[9]=-2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==1&&b[2]==0)l[0]=1-2*h,l[2]=-2*f*g,l[8]=2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==0&&b[2]==1)l[0]=1-2*h,l[1]=2*f*g,l[4]=-2*f*g,l[5]=1-2*h;else{var n=b[0],o=b[1],p=b[2],q=n*n,r=o*o,s=p*p;l[0]=1-2*(r+s)*h;l[1]=2*(n*o*h+p*f*g);l[2]=2*(n*p*h-o*f*g);l[4]=2*(o*n*h-p*f*g);l[5]=1-2* | 16 | RDGE.vec4.lerp=function(a,b,c){return[a[0]+(b[0]-a[0])*c,a[1]+(b[1]-a[1])*c,a[2]+(b[2]-a[2])*c,a[3]+(b[3]-a[3])*c]};RDGE=RDGE||{};RDGE.mat4={};RDGE.mat4.string=function(a){var b;b="{ "+(a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", ");b+=a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", ";b+=a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", ";return b+=a[12]+", "+a[13]+", "+a[14]+", "+a[15]+" }"}; |
17 | (s+q)*h;l[6]=2*(o*p*h+n*f*g);l[8]=2*(p*n*h+o*f*g);l[9]=2*(p*o*h-n*f*g);l[10]=1-2*(q+r)*h}return l}};mat4.lookAt=function(a,b,f){b=vec3.normalize(vec3.sub(a,b));vec3.length(b)<1.0E-4&&(b=[0,0,1]);var f=vec3.normalize(vec3.cross(f,b)),g=vec3.normalize(vec3.cross(b,f)),h=mat4.identity();mat4.setRow(h,0,f);mat4.setRow(h,1,g);mat4.setRow(h,2,b);mat4.setRow(h,3,a);return h}; | 17 | RDGE.mat4.toCSSString=function(a,b){var c=10;b&&(c=b);var d;d="matrix3d("+(a[0].toFixed(10)+", "+a[1].toFixed(10)+", "+a[2].toFixed(10)+", "+a[3].toFixed(10)+", ");d+=a[4].toFixed(10)+", "+a[5].toFixed(10)+", "+a[6].toFixed(10)+", "+a[7].toFixed(10)+", ";d+=a[8].toFixed(10)+", "+a[9].toFixed(10)+", "+a[10].toFixed(10)+", "+a[11].toFixed(10)+", ";return d+=a[12].toFixed(10)*c+", "+(600-a[13].toFixed(10)*c)+", "+a[14].toFixed(10)*c+", "+a[15].toFixed(10)+")"}; |
18 | mat4.frustum=function(a,b,f,g,h,l){var n=b-a,o=g-f,p=l-h,q=2*h,r=mat4.zero();r[0]=q/n;r[5]=q/o;r[8]=(b+a)/n;r[9]=(g+f)/o;r[10]=-(l+h)/p;r[11]=-1;r[14]=-(q*l)/p;return r};mat4.perspective=function(a,b,f,g){var a=Math.tan(a*Math.PI/360)*f,h=-a;return mat4.frustum(b*h,b*a,h,a,f,g)};mat4.orthographic=function(a,b,f,g,h,l){var n=(a+b)/(a-b),o=(f+g)/(f-g),p=(l+h)/(l-h),q=mat4.zero();q[0]=2/(a-b);q[5]=2/(f-g);q[10]=-2/(l-h);q[12]=n;q[13]=o;q[14]=p;q[15]=1;return q}; | 18 | RDGE.mat4.verify=function(a){if(void 0==a||void 0==a.length||16>a.length)return!1;for(var b=16;b--;)if("number"!=typeof a[b])return!1;return!0};RDGE.mat4.copy=function(a){return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]};RDGE.mat4.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]}; |
19 | mat4.mul=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[3],n=a[4],o=a[5],p=a[6],q=a[7],r=a[8],s=a[9],u=a[10],v=a[11],x=a[12],w=a[13],y=a[14],z=a[15],A=b[0],C=b[1],D=b[2],B=b[3],E=b[4],F=b[5],G=b[6],H=b[7],I=b[8],J=b[9],K=b[10],L=b[11],M=b[12],N=b[13],O=b[14],P=b[15];return[f*A+g*E+h*I+l*M,f*C+g*F+h*J+l*N,f*D+g*G+h*K+l*O,f*B+g*H+h*L+l*P,n*A+o*E+p*I+q*M,n*C+o*F+p*J+q*N,n*D+o*G+p*K+q*O,n*B+o*H+p*L+q*P,r*A+s*E+u*I+v*M,r*C+s*F+u*J+v*N,r*D+s*G+u*K+v*O,r*B+s*H+u*L+v*P,x*A+w*E+y*I+z*M,x*C+w*F+y*J+z*N,x*D+w*G+ | 19 | RDGE.mat4.identity=function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]};RDGE.mat4.zero=function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};RDGE.mat4.basis=function(a,b,c,d){return null==d||void 0==d?[a[0],a[1],a[2],0,b[0],b[1],b[2],0,c[0],c[1],c[2],0,0,0,0,1]:[a[0],a[1],a[2],4==a.length?a[3]:0,b[0],b[1],b[2],4==b.length?b[3]:0,c[0],c[1],c[2],4==c.length?c[3]:0,d[0],d[1],d[2],4==d.length?d[3]:1]}; |
20 | y*K+z*O,x*B+w*H+y*L+z*P]};mat4.mul4x3=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[4],n=a[5],o=a[6],p=a[8],q=a[9],r=a[10],s=a[12],u=a[13],v=a[14],x=b[0],w=b[1],y=b[2],z=b[4],A=b[5],C=b[6],D=b[8],B=b[9],E=b[10];return[f*x+g*z+h*D,f*w+g*A+h*B,f*y+g*C+h*E,0,l*x+n*z+o*D,l*w+n*A+o*B,l*y+n*C+o*E,0,p*x+q*z+r*D,p*w+q*A+r*B,p*y+q*C+r*E,0,s*x+u*z+v*D+b[12],s*w+u*A+v*B+b[13],s*y+u*C+v*E+b[14],1]};mat4._det2x2=function(a,b,f,g){return a*g-b*f}; | 20 | RDGE.mat4.angleAxis=function(a,b){var a=a*(Math.PI/180),a=a/2,c=Math.sin(a),d=Math.cos(a),f=c*c;RDGE.vec3.normalize(b);0>=RDGE.vec3.lengthSq(b)&&(b=[0,0,0,1]);var g=RDGE.mat4.identity();if(1==b[0]&&0==b[1]&&0==b[2])g[5]=1-2*f,g[6]=2*c*d,g[9]=-2*c*d,g[10]=1-2*f;else if(0==b[0]&&1==b[1]&&0==b[2])g[0]=1-2*f,g[2]=-2*c*d,g[8]=2*c*d,g[10]=1-2*f;else if(0==b[0]&&0==b[1]&&1==b[2])g[0]=1-2*f,g[1]=2*c*d,g[4]=-2*c*d,g[5]=1-2*f;else{var h=b[0],l=b[1],m=b[2],n=h*h,p=l*l,o=m*m;g[0]=1-2*(p+o)*f;g[1]=2*(h*l*f+m* |
21 | mat4._det3x3=function(a,b,f,g,h,l,n,o,p){return a*mat4._det2x2(h,l,o,p)-g*mat4._det2x2(b,f,o,p)+n*mat4._det2x2(b,f,h,l)};mat4._det4x4=function(a){var b=a[1],f=a[2],g=a[3],h=a[4],l=a[5],n=a[6],o=a[7],p=a[8],q=a[9],r=a[10],s=a[11],u=a[12],v=a[13],x=a[14],w=a[15];return a[0]*mat4._det3x3(l,q,v,n,r,x,o,s,w)-b*mat4._det3x3(h,p,u,n,r,x,o,s,w)+f*mat4._det3x3(h,p,u,l,q,v,o,s,w)-g*mat4._det3x3(h,p,u,l,q,v,n,r,x)}; | 21 | c*d);g[2]=2*(h*m*f-l*c*d);g[4]=2*(l*h*f-m*c*d);g[5]=1-2*(o+n)*f;g[6]=2*(l*m*f+h*c*d);g[8]=2*(m*h*f+l*c*d);g[9]=2*(m*l*f-h*c*d);g[10]=1-2*(n+p)*f}return g};RDGE.mat4.lookAt=function(a,b,c){b=RDGE.vec3.normalize(RDGE.vec3.sub(a,b));1.0E-4>RDGE.vec3.length(b)&&(b=[0,0,1]);var c=RDGE.vec3.normalize(RDGE.vec3.cross(c,b)),d=RDGE.vec3.normalize(RDGE.vec3.cross(b,c)),f=RDGE.mat4.identity();RDGE.mat4.setRow(f,0,c);RDGE.mat4.setRow(f,1,d);RDGE.mat4.setRow(f,2,b);RDGE.mat4.setRow(f,3,a);return f}; |
22 | mat4._adjoint=function(a){var b=a[0],f=a[1],g=a[2],h=a[3],l=a[4],n=a[5],o=a[6],p=a[7],q=a[8],r=a[9],s=a[10],u=a[11],v=a[12],x=a[13],w=a[14],a=a[15];return[mat4._det3x3(n,r,x,o,s,w,p,u,a),-mat4._det3x3(f,r,x,g,s,w,h,u,a),mat4._det3x3(f,n,x,g,o,w,h,p,a),-mat4._det3x3(f,n,r,g,o,s,h,p,u),-mat4._det3x3(l,q,v,o,s,w,p,u,a),mat4._det3x3(b,q,v,g,s,w,h,u,a),-mat4._det3x3(b,l,v,g,o,w,h,p,a),mat4._det3x3(b,l,q,g,o,s,h,p,u),mat4._det3x3(l,q,v,n,r,x,p,u,a),-mat4._det3x3(b,q,v,f,r,x,h,u,a),mat4._det3x3(b,l,v,f, | 22 | RDGE.mat4.frustum=function(a,b,c,d,f,g){var h=b-a,l=d-c,m=g-f,n=2*f,p=RDGE.mat4.zero();p[0]=n/h;p[5]=n/l;p[8]=(b+a)/h;p[9]=(d+c)/l;p[10]=-(g+f)/m;p[11]=-1;p[14]=-(n*g)/m;return p};RDGE.mat4.perspective=function(a,b,c,d){var a=Math.tan(a*Math.PI/360)*c,f=-a;return RDGE.mat4.frustum(b*f,b*a,f,a,c,d)};RDGE.mat4.orthographic=function(a,b,c,d,f,g){var h=(a+b)/(a-b),l=(c+d)/(c-d),m=(g+f)/(g-f),n=RDGE.mat4.zero();n[0]=2/(a-b);n[5]=2/(c-d);n[10]=-2/(g-f);n[12]=h;n[13]=l;n[14]=m;n[15]=1;return n}; |
23 | n,x,h,p,a),-mat4._det3x3(b,l,q,f,n,r,h,p,u),-mat4._det3x3(l,q,v,n,r,x,o,s,w),mat4._det3x3(b,q,v,f,r,x,g,s,w),-mat4._det3x3(b,l,v,f,n,x,g,o,w),mat4._det3x3(b,l,q,f,n,r,g,o,s)]};mat4.inverse=function(a){var b=mat4._det4x4(a);if(Math.abs(b)<1.0E-8)return null;a=mat4._adjoint(a);b=1/b;return[a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*b,a[5]*b,a[6]*b,a[7]*b,a[8]*b,a[9]*b,a[10]*b,a[11]*b,a[12]*b,a[13]*b,a[14]*b,a[15]*b]}; | 23 | RDGE.mat4.mul=function(a,b){var c=a[0],d=a[1],f=a[2],g=a[3],h=a[4],l=a[5],m=a[6],n=a[7],p=a[8],o=a[9],q=a[10],r=a[11],u=a[12],s=a[13],w=a[14],v=a[15],x=b[0],z=b[1],A=b[2],y=b[3],B=b[4],C=b[5],D=b[6],E=b[7],F=b[8],G=b[9],H=b[10],I=b[11],J=b[12],K=b[13],L=b[14],M=b[15];return[c*x+d*B+f*F+g*J,c*z+d*C+f*G+g*K,c*A+d*D+f*H+g*L,c*y+d*E+f*I+g*M,h*x+l*B+m*F+n*J,h*z+l*C+m*G+n*K,h*A+l*D+m*H+n*L,h*y+l*E+m*I+n*M,p*x+o*B+q*F+r*J,p*z+o*C+q*G+r*K,p*A+o*D+q*H+r*L,p*y+o*E+q*I+r*M,u*x+s*B+w*F+v*J,u*z+s*C+w*G+v*K,u* |
24 | mat4.rigidInverse=function(a){out=mat4.transpose3x3(a);out[12]=-vec3.dot([out[0],out[4],out[8]],[a[12],a[13],a[14]]);out[13]=-vec3.dot([out[1],out[5],out[9]],[a[12],a[13],a[14]]);out[14]=-vec3.dot([out[2],out[6],out[10]],[a[12],a[13],a[14]]);return out};mat4.transpose=function(a){return[a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]]};mat4.transpose3x3=function(a){return[a[0],a[4],a[8],a[3],a[1],a[5],a[9],a[7],a[2],a[6],a[10],a[11],a[12],a[13],a[14],a[15]]}; | 24 | A+s*D+w*H+v*L,u*y+s*E+w*I+v*M]};RDGE.mat4.mul4x3=function(a,b){var c=a[0],d=a[1],f=a[2],g=a[4],h=a[5],l=a[6],m=a[8],n=a[9],p=a[10],o=a[12],q=a[13],r=a[14],u=b[0],s=b[1],w=b[2],v=b[4],x=b[5],z=b[6],A=b[8],y=b[9],B=b[10];return[c*u+d*v+f*A,c*s+d*x+f*y,c*w+d*z+f*B,0,g*u+h*v+l*A,g*s+h*x+l*y,g*w+h*z+l*B,0,m*u+n*v+p*A,m*s+n*x+p*y,m*w+n*z+p*B,0,o*u+q*v+r*A+b[12],o*s+q*x+r*y+b[13],o*w+q*z+r*B+b[14],1]};RDGE.mat4._det2x2=function(a,b,c,d){return a*d-b*c}; |