bolt-engine/demos/mouse-gravitation/lithree.min.js

2 lines
28 KiB
JavaScript
Raw Permalink Normal View History

2015-01-28 15:56:03 +00:00
!function(a){"use strict";function b(){var a,b,c=void 0===arguments[0]?1:arguments[0],d=void 0===arguments[1]?20:arguments[1],e=new y;e.vertices.push(0,0,0),e.vertexIndex=[],e.vertexNormals=[];var f=Math.PI/(d-1);for(d*=2,b=0,a=1;d>a;b+=f,a++)e.vertices.push(Math.cos(b)*c,Math.sin(b)*c,0);for(a=0;a<e.vertices.length;a++)e.vertexNormals.push(0,0,1);for(a=0;a<e.vertices.length/3;a++)e.vertexIndex.push(a);return e.darwingFunction=i.drawingFunctions.ELEMENTS,e.drawingMode=i.drawingMode.TRIANGLE_FAN,e}function c(){var a=void 0===arguments[0]?1:arguments[0],b=new y;return b.vertices=[-a,-a,a,a,-a,a,a,a,a,-a,a,a,-a,-a,-a,-a,a,-a,a,a,-a,a,-a,-a,-a,a,-a,-a,a,a,a,a,a,a,a,-a,-a,-a,-a,a,-a,-a,a,-a,a,-a,-a,a,a,-a,-a,a,a,-a,a,a,a,a,-a,a,-a,-a,-a,-a,-a,a,-a,a,a,-a,a,-a],b.vertexIndex=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],b.vertexNormals=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0],b.darwingFunction=i.drawingFunctions.ELEMENTS,b.drawingMode=i.drawingMode.TRIANGLES,b}function d(){var a,b,c=void 0===arguments[0]?2:arguments[0],d=void 0===arguments[1]?1:arguments[1],e=void 0===arguments[2]?1:arguments[2],f=void 0===arguments[3]?20:arguments[3],g=new y;g.vertexIndex=[],g.vertexNormals=[];var h=Math.PI/(f-1);f*=2;var j=c/2,k=c/-2;for(b=0,a=1;f>=a;b+=h,a++){var l=new w(Math.cos(b)*d,j,Math.sin(b)*d),m=new w(Math.cos(b)*e,k,Math.sin(b)*e),n=l.cross(m);g.vertexNormals.push(n.x,n.y,n.z),g.vertexNormals.push(n.x,n.y,n.z),g.vertices.push(l.x,l.y,l.z),g.vertices.push(m.x,m.y,m.z)}for(a=0;a<g.vertices.length/3;a++)g.vertexIndex.push(a);return g.darwingFunction=i.drawingFunctions.ELEMENTS,g.drawingMode=i.drawingMode.TRIANGLE_STRIP,g}function e(){var a,b,c=void 0===arguments[0]?1:arguments[0],d=void 0===arguments[1]?30:arguments[1],e=void 0===arguments[2]?30:arguments[2],f=new y,g=[],h=[],j=[];for(a=0;d>=a;a++){var k=a*Math.PI/d,l=Math.sin(k),m=Math.cos(k);for(b=0;e>=b;b++){var n=2*b*Math.PI/e,o=Math.sin(n),p=Math.cos(n),q=p*l,r=m,s=o*l,t=1-b/e,u=1-a/d;h.push(q),h.push(r),h.push(s),j.push(t),j.push(u),g.push(c*q),g.push(c*r),g.push(c*s)}}var v=[];for(a=0;d>a;a++)for(b=0;e>b;b++){var w=a*(e+1)+b,x=w+e+1;v.push(w),v.push(x),v.push(w+1),v.push(x),v.push(x+1),v.push(w+1)}return f.vertexIndex=v,f.vertexNormals=h,f.vertices=g,f.darwingFunction=i.drawingFunctions.ELEMENTS,f.drawingMode=i.drawingMode.TRIANGLES,f}var f=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},g=function(){function a(){var a=void 0===arguments[0]?.785398:arguments[0],b=void 0===arguments[1]?1:arguments[1],c=void 0===arguments[2]?.1:arguments[2],d=void 0===arguments[3]?100:arguments[3];this.fovy=a,this.aspect=b,this.near=c,this.far=d,this.matrix=new v,this.lookAt=new w,this.position=new w,this.rotation=new w,this.up=new w,this._zoom=1}return f(a,null,{zoom:{set:function(a){if(0>a)throw"Zoom should be equal or greater than 0";this._zoom=a},get:function(){return this._zoom},enumerable:!0,configurable:!0},updatePerspective:{value:function(){var a=2*Math.atan(Math.tan(.5*this.fovy)/this._zoom);this.matrix.identity(),this.matrix.perspective(a,this.aspect,this.near,this.far)},writable:!0,enumerable:!0,configurable:!0},getMatrix:{value:function(){var a=new v;return a.identity(),a.translate(this.position),a.rotateX(this.rotation.x),a.rotateY(this.rotation.y),a.rotateZ(this.rotation.z),a},writable:!0,enumerable:!0,configurable:!0}}),a}(),f=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},h=function(){function a(){var a=void 0===arguments[0]?1:arguments[0],b=void 0===arguments[1]?1:arguments[1],c=void 0===arguments[2]?1:arguments[2],d=void 0===arguments[3]?1:arguments[3];this.array=[a,b,c,d]}return f(a,null,{hex:{set:function(a){var b=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;a=a.replace(b,function(a,b,c,d){return b+b+c+c+d+d});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);this.array[0]=parseInt(c[1],16)/255,this.array[1]=parseInt(c[2],16)/25
//# sourceMappingURL=lithree.min.js.map