new THREE.Face4(i+l*h+s,i+l*(h+1)+s,i+1+l*(h+1)+s,i+1+l*h+s),a.normal.copy(T),a.vertexNormals.push(T.clone(),T.clone(),T.clone(),T.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/p,h/o),new THREE.UV(i/p,(h+1)/o),new THREE.UV((i+1)/p,(h+1)/o),new THREE.UV((i+1)/p,h/o)])}THREE.Geometry.call(this);var j=this,k=a/2,p=b/2,m=c/2,o,q,n,r,s,u;if(void 0!==g){if(g instanceof Array)this.materials=g;else{this.materials=[];for(o=0;6>o;o++)this.materials.push(g)}o=0;r=1;q=2;s=
3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(void 0!=h)for(var v in h)void 0!==this.sides[v]&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,p,q);this.sides.ny&&i("x","z",1,-1,a,c,-p,s);this.sides.pz&&i("x","y",1,-1,a,b,m,n);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;