1 line
20 KiB
JavaScript
1 line
20 KiB
JavaScript
|
!function(a){"use strict";function b(){var a=void 0===arguments[0]?1:arguments[0],b=void 0===arguments[1]?20:arguments[1],c=new t;c.vertices.push(0,0,0),c.vertexIndex=[],c.vertexNormals=[];var d=Math.PI/(b-1);b*=2;for(var e=0,f=1;b>f;e+=d,f++)c.vertices.push(Math.cos(e)*a,Math.sin(e)*a,0);for(var f=0;f<c.vertices.length;f++)c.vertexNormals.push(0,0,1);for(var f=0;f<c.vertices.length/3;f++)c.vertexIndex.push(f);return c.darwingFunction=i.drawingFunctions.ELEMENTS,c.drawingMode=i.drawingMode.TRIANGLE_FAN,c}function c(){var a=new t;return a.vertices=[-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1],a.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],a.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],a.darwingFunction=i.drawingFunctions.ELEMENTS,a.drawingMode=i.drawingMode.TRIANGLES,a}function d(){var a=void 0===arguments[0]?2:arguments[0],b=void 0===arguments[1]?1:arguments[1],c=void 0===arguments[2]?1:arguments[2],d=void 0===arguments[3]?20:arguments[3],e=new t;e.vertexIndex=[],e.vertexNormals=[];var f=Math.PI/(d-1);d*=2;for(var g=a/2,h=a/-2,j=0,k=1;d>=k;j+=f,k++){var l=new r(Math.cos(j)*b,Math.sin(j)*b,g),m=new r(Math.cos(j)*c,Math.sin(j)*c,h),n=l.cross(m);e.vertexNormals.push(n.x,n.y,n.z),e.vertexNormals.push(n.x,n.y,n.z),e.vertices.push(l.x,l.y,l.z),e.vertices.push(m.x,m.y,m.z)}for(var k=0;k<e.vertices.length/3;k++)e.vertexIndex.push(k);return e.darwingFunction=i.drawingFunctions.ELEMENTS,e.drawingMode=i.drawingMode.TRIANGLE_STRIP,e}function e(){for(var a=void 0===arguments[0]?1:arguments[0],b=void 0===arguments[1]?30:arguments[1],c=void 0===arguments[2]?30:arguments[2],d=new t,e=[],f=[],g=[],h=0;b>=h;h++)for(var j=h*Math.PI/b,k=Math.sin(j),l=Math.cos(j),m=0;c>=m;m++){var n=2*m*Math.PI/c,o=Math.sin(n),p=Math.cos(n),q=p*k,r=l,s=o*k,u=1-m/c,v=1-h/b;f.push(q),f.push(r),f.push(s),g.push(u),g.push(v),e.push(a*q),e.push(a*r),e.push(a*s)}for(var w=[],h=0;b>h;h++)for(var m=0;c>m;m++){var x=h*(c+1)+m,y=x+c+1;w.push(x),w.push(y),w.push(x+1),w.push(y),w.push(y+1),w.push(x+1)}return d.vertexIndex=w,d.vertexNormals=f,d.vertices=e,d.darwingFunction=i.drawingFunctions.ELEMENTS,d.drawingMode=i.drawingMode.TRIANGLES,d}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 q,this.lookAt=[0,0,0],this.position=[0,0,5],this.up=[0,1,0],this._zoom=1}return f(a,null,{zoom:{set:function(a){if(1>a)throw"Zoom should be equal or greater than 1";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.perspective(a,this.aspect,this.near,this.far)},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];void 0===arguments[3]?1:arguments[3]}this.array=[a,b,c]}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)/255,this.array[2]=parseInt(c[3],16)/255},get:function(){var a=function(a){var b=a.toString(16);return 1==b.length?"0"+b:b};return"#"+a(this.array[0])+a(this.array[1])+a(this.array[2])},enumerable:!0,configurable:!0},rgb:{value:function(a,b,c){return this.array[0]=a,this.array[1]=b,this.ar
|