|
@@ -9,7 +9,7 @@ THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.Re
|
|
|
THREE.LessDepth=2;THREE.LessEqualDepth=3;THREE.EqualDepth=4;THREE.GreaterEqualDepth=5;THREE.GreaterDepth=6;THREE.NotEqualDepth=7;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302;THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;
|
|
|
THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.HalfFloatType=1025;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;
|
|
|
THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGBEFormat=THREE.RGBAFormat;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103;THREE.LoopOnce=2200;THREE.LoopRepeat=2201;THREE.LoopPingPong=2202;
|
|
|
-THREE.InterpolateDiscrete=2300;THREE.InterpolateLinear=2301;THREE.InterpolateSmooth=2302;THREE.ZeroCurvatureEnding=2400;THREE.ZeroSlopeEnding=2401;THREE.WrapAroundEnding=2402;THREE.Color=function(a){return 3===arguments.length?this.fromArray(arguments):this.set(a)};
|
|
|
+THREE.InterpolateDiscrete=2300;THREE.InterpolateLinear=2301;THREE.InterpolateSmooth=2302;THREE.ZeroCurvatureEnding=2400;THREE.ZeroSlopeEnding=2401;THREE.WrapAroundEnding=2402;THREE.TrianglesDrawMode=0;THREE.TriangleStripDrawMode=1;THREE.TriangleFanDrawMode=2;THREE.Color=function(a){return 3===arguments.length?this.fromArray(arguments):this.set(a)};
|
|
|
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1<d&&(d-=1);return d<1/6?a+6*(c-a)*d:.5>d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b,
|
|
|
c,d){b=THREE.Math.euclideanModulo(b,1);c=THREE.Math.clamp(c,0,1);d=THREE.Math.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=
|
|
|
Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(c[1])/
|
|
@@ -87,11 +87,11 @@ this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min
|
|
|
this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&
|
|
|
a.max.equals(this.max)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};
|
|
|
THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new THREE.Vector3;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),setFromObject:function(){var a;return function(b){void 0===a&&(a=new THREE.Box3);var c=this;this.makeEmpty();
|
|
|
-b.updateMatrixWorld(!0);b.traverse(function(b){var e=b.geometry;void 0!==e&&(e.computeBoundingBox(),a.copy(e.boundingBox),a.applyMatrix4(b.matrixWorld),c.union(a))});return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||
|
|
|
-this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||
|
|
|
-a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>
|
|
|
-this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},intersectsSphere:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;0<a.normal.x?(b=a.normal.x*this.min.x,c=a.normal.x*this.max.x):(b=a.normal.x*this.max.x,c=a.normal.x*this.min.x);0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y);0<
|
|
|
-a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z);return b<=a.constant&&c>=a.constant},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=.5*
|
|
|
+b.updateMatrixWorld(!0);b.traverse(function(b){var e=b.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),a.copy(e.boundingBox),a.applyMatrix4(b.matrixWorld),c.union(a))});return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<
|
|
|
+this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||
|
|
|
+a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||
|
|
|
+a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},intersectsSphere:function(){var a;return function(b){void 0===a&&(a=new THREE.Vector3);this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;0<a.normal.x?(b=a.normal.x*this.min.x,c=a.normal.x*this.max.x):(b=a.normal.x*this.max.x,c=a.normal.x*this.min.x);0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y);
|
|
|
+0<a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z);return b<=a.constant&&c>=a.constant},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=.5*
|
|
|
this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,
|
|
|
this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&
|
|
|
a.max.equals(this.max)}};THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")};
|
|
@@ -360,9 +360,9 @@ THREE.SpotLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,
|
|
|
THREE.Loader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a,b,c;return function(d,e,f){function g(a,c,d,g,l){a=e+a;var k=THREE.Loader.Handlers.get(a);null!==k?a=k.load(a):(b.setCrossOrigin(f),a=b.load(a));void 0!==c&&(a.repeat.fromArray(c),1!==c[0]&&(a.wrapS=
|
|
|
THREE.RepeatWrapping),1!==c[1]&&(a.wrapT=THREE.RepeatWrapping));void 0!==d&&a.offset.fromArray(d);void 0!==g&&("repeat"===g[0]&&(a.wrapS=THREE.RepeatWrapping),"mirror"===g[0]&&(a.wrapS=THREE.MirroredRepeatWrapping),"repeat"===g[1]&&(a.wrapT=THREE.RepeatWrapping),"mirror"===g[1]&&(a.wrapT=THREE.MirroredRepeatWrapping));void 0!==l&&(a.anisotropy=l);c=THREE.Math.generateUUID();h[c]=a;return c}void 0===a&&(a=new THREE.Color);void 0===b&&(b=new THREE.TextureLoader);void 0===c&&(c=new THREE.MaterialLoader);
|
|
|
-var h={},l={uuid:THREE.Math.generateUUID(),type:"MeshLambertMaterial"},k;for(k in d){var m=d[k];switch(k){case "DbgColor":void 0===l.color&&(l.color=m);break;case "DbgIndex":case "opticalDensity":case "illumination":break;case "DbgName":l.name=m;break;case "blending":l.blending=THREE[m];break;case "colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case "colorDiffuse":l.color=a.fromArray(m).getHex();break;case "colorSpecular":l.specular=a.fromArray(m).getHex();
|
|
|
-break;case "colorEmissive":l.emissive=a.fromArray(m).getHex();break;case "specularCoef":l.shininess=m;break;case "shading":"basic"===m.toLowerCase()&&(l.type="MeshBasicMaterial");"phong"===m.toLowerCase()&&(l.type="MeshPhongMaterial");break;case "mapDiffuse":l.map=g(m,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case "mapDiffuseRepeat":case "mapDiffuseOffset":case "mapDiffuseWrap":case "mapDiffuseAnisotropy":break;case "mapLight":l.lightMap=g(m,d.mapLightRepeat,
|
|
|
-d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case "mapLightRepeat":case "mapLightOffset":case "mapLightWrap":case "mapLightAnisotropy":break;case "mapAO":l.aoMap=g(m,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case "mapAORepeat":case "mapAOOffset":case "mapAOWrap":case "mapAOAnisotropy":break;case "mapBump":l.bumpMap=g(m,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case "mapBumpScale":l.bumpScale=m;break;case "mapBumpRepeat":case "mapBumpOffset":case "mapBumpWrap":case "mapBumpAnisotropy":break;
|
|
|
+var h={},l={uuid:THREE.Math.generateUUID(),type:"MeshLambertMaterial"},k;for(k in d){var m=d[k];switch(k){case "DbgColor":case "DbgIndex":case "opticalDensity":case "illumination":break;case "DbgName":l.name=m;break;case "blending":l.blending=THREE[m];break;case "colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case "colorDiffuse":l.color=a.fromArray(m).getHex();break;case "colorSpecular":l.specular=a.fromArray(m).getHex();break;case "colorEmissive":l.emissive=
|
|
|
+a.fromArray(m).getHex();break;case "specularCoef":l.shininess=m;break;case "shading":"basic"===m.toLowerCase()&&(l.type="MeshBasicMaterial");"phong"===m.toLowerCase()&&(l.type="MeshPhongMaterial");break;case "mapDiffuse":l.map=g(m,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case "mapDiffuseRepeat":case "mapDiffuseOffset":case "mapDiffuseWrap":case "mapDiffuseAnisotropy":break;case "mapLight":l.lightMap=g(m,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);
|
|
|
+break;case "mapLightRepeat":case "mapLightOffset":case "mapLightWrap":case "mapLightAnisotropy":break;case "mapAO":l.aoMap=g(m,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case "mapAORepeat":case "mapAOOffset":case "mapAOWrap":case "mapAOAnisotropy":break;case "mapBump":l.bumpMap=g(m,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case "mapBumpScale":l.bumpScale=m;break;case "mapBumpRepeat":case "mapBumpOffset":case "mapBumpWrap":case "mapBumpAnisotropy":break;
|
|
|
case "mapNormal":l.normalMap=g(m,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);break;case "mapNormalFactor":l.normalScale=[m,m];break;case "mapNormalRepeat":case "mapNormalOffset":case "mapNormalWrap":case "mapNormalAnisotropy":break;case "mapSpecular":l.specularMap=g(m,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case "mapSpecularRepeat":case "mapSpecularOffset":case "mapSpecularWrap":case "mapSpecularAnisotropy":break;case "mapAlpha":l.alphaMap=
|
|
|
g(m,d.mapAlphaRepeat,d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case "mapAlphaRepeat":case "mapAlphaOffset":case "mapAlphaWrap":case "mapAlphaAnisotropy":break;case "flipSided":l.side=THREE.BackSide;break;case "doubleSided":l.side=THREE.DoubleSide;break;case "transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity");l.opacity=m;break;case "opacity":case "transparent":case "depthTest":case "depthWrite":case "transparent":case "visible":case "wireframe":l[k]=
|
|
|
m;break;case "vertexColors":!0===m&&(l.vertexColors=THREE.VertexColors);"face"===m&&(l.vertexColors=THREE.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",k,m)}}"MeshPhongMaterial"!==l.type&&delete l.specular;1>l.opacity&&(l.transparent=!0);c.setTextures(h);return c.parse(l)}}()};THREE.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;c<d;c+=2){var e=b[c+1];if(b[c].test(a))return e}return null}};
|
|
@@ -478,7 +478,7 @@ THREE.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,
|
|
|
THREE.BufferGeometry){var n=g.index,q=g.attributes;if(null!==n)for(var g=n.array,q=q.position.array,n=0,r=g.length-1;n<r;n+=p){var u=g[n+1];h.fromArray(q,3*g[n]);l.fromArray(q,3*u);u=b.distanceSqToSegment(h,l,m,k);u>f||(m.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(m),u<d.near||u>d.far||e.push({distance:u,point:k.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}else for(q=q.position.array,n=0,r=q.length/3-1;n<r;n+=p)h.fromArray(q,3*n),l.fromArray(q,
|
|
|
3*n+3),u=b.distanceSqToSegment(h,l,m,k),u>f||(m.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(m),u<d.near||u>d.far||e.push({distance:u,point:k.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,l=h.length,n=0;n<l-1;n+=p)u=b.distanceSqToSegment(h[n],h[n+1],m,k),u>f||(m.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(m),u<d.near||u>d.far||e.push({distance:u,point:k.clone().applyMatrix4(this.matrixWorld),
|
|
|
index:n,face:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};THREE.LineStrip=0;THREE.LinePieces=1;THREE.LineSegments=function(a,b){THREE.Line.call(this,a,b);this.type="LineSegments"};THREE.LineSegments.prototype=Object.create(THREE.Line.prototype);THREE.LineSegments.prototype.constructor=THREE.LineSegments;
|
|
|
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.constructor=THREE.Mesh;
|
|
|
+THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.drawMode=THREE.TrianglesDrawMode;this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.setDrawMode=function(a){this.drawMode=a};
|
|
|
THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
|
|
|
THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
|
|
|
THREE.Mesh.prototype.raycast=function(){function a(a,b,c,d,e,f,g){THREE.Triangle.barycoordFromPoint(a,b,c,d,u);e.multiplyScalar(u.x);f.multiplyScalar(u.y);g.multiplyScalar(u.z);e.add(f).add(g);return e.clone()}function b(a,b,c,d,e,f,g){var h=a.material;if(null===(h.side===THREE.BackSide?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,h.side!==THREE.DoubleSide,g)))return null;t.copy(g);t.applyMatrix4(a.matrixWorld);c=b.ray.origin.distanceTo(t);return c<b.near||c>b.far?null:{distance:c,point:t.clone(),
|
|
@@ -643,26 +643,27 @@ b){a=[];c=0;for(l=b.length;c<l;c++){var m=b[c];a.push([m,c])}a.sort(k);8<a.lengt
|
|
|
s.uniform1fv(a.morphTargetInfluences,oa);l=!0}b=d.index;c=d.attributes.position;!0===e.wireframe&&(b=na.getWireframeAttribute(d));null!==b?(a=Ba,a.setIndex(b)):a=Aa;if(l){a:{var l=void 0,q;if(d instanceof THREE.InstancedBufferGeometry&&(q=U.get("ANGLE_instanced_arrays"),null===q)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===l&&(l=0);I.initAttributes();var m=d.attributes,
|
|
|
h=h.getAttributes(),n=e.defaultAttributeValues,p;for(p in h){var r=h[p];if(0<=r){var t=m[p];if(void 0!==t){var v=t.itemSize,x=na.getAttributeBuffer(t);if(t instanceof THREE.InterleavedBufferAttribute){var D=t.data,F=D.stride,t=t.offset;D instanceof THREE.InstancedInterleavedBuffer?(I.enableAttributeAndDivisor(r,D.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=D.meshPerAttribute*D.count)):I.enableAttribute(r);s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(r,v,s.FLOAT,
|
|
|
!1,F*D.array.BYTES_PER_ELEMENT,(l*F+t)*D.array.BYTES_PER_ELEMENT)}else t instanceof THREE.InstancedBufferAttribute?(I.enableAttributeAndDivisor(r,t.meshPerAttribute,q),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):I.enableAttribute(r),s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(r,v,s.FLOAT,!1,0,l*v*4)}else if(void 0!==n&&(v=n[p],void 0!==v))switch(v.length){case 2:s.vertexAttrib2fv(r,v);break;case 3:s.vertexAttrib3fv(r,v);break;case 4:s.vertexAttrib4fv(r,
|
|
|
-v);break;default:s.vertexAttrib1fv(r,v)}}}I.disableUnusedAttributes()}null!==b&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,na.getAttributeBuffer(b))}q=Infinity;null!==b?q=b.count:void 0!==c&&(q=c.count);p=d.drawRange.start;b=d.drawRange.count;c=null!==g?g.start:0;l=null!==g?g.count:Infinity;g=Math.max(0,p,c);q=Math.min(0+q,p+b,c+l)-1;q=Math.max(0,q-g+1);f instanceof THREE.Mesh?(!0===e.wireframe?(I.setLineWidth(e.wireframeLinewidth*G),a.setMode(s.LINES)):a.setMode(s.TRIANGLES),d instanceof THREE.InstancedBufferGeometry&&
|
|
|
-0<d.maxInstancedCount?a.renderInstances(d):a.render(g,q)):f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),I.setLineWidth(d*G),f instanceof THREE.LineSegments?a.setMode(s.LINES):a.setMode(s.LINE_STRIP),a.render(g,q)):f instanceof THREE.Points&&(a.setMode(s.POINTS),a.render(g,q))};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;ka="";pa=-1;ja=null;!0===a.autoUpdate&&a.updateMatrixWorld();
|
|
|
-null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);qa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ua.setFromMatrix(qa);V.length=0;ma=ea=-1;$.length=0;va.length=0;q(a,b);Y.length=ea+1;aa.length=ma+1;!0===Z.sortObjects&&(Y.sort(m),aa.sort(p));var f=V,g,h,k,l=0,n=0,t=0,v,u,w,D=b.matrixWorldInverse,F=0,E=0,B=0,z=0;T.shadows=0;g=T.shadowsPointLight=0;for(h=f.length;g<h;g++)if(k=f[g],v=k.color,u=k.intensity,w=k.distance,k instanceof THREE.AmbientLight)l+=
|
|
|
-v.r,n+=v.g,t+=v.b;else if(k instanceof THREE.DirectionalLight){k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,color:new THREE.Color});var A=k.__webglUniforms;A.direction.setFromMatrixPosition(k.matrixWorld);W.setFromMatrixPosition(k.target.matrixWorld);A.direction.sub(W);A.direction.transformDirection(D);A.color.copy(k.color).multiplyScalar(k.intensity);T.directional[F++]=A;k.castShadow&&T.shadows++}else k instanceof THREE.PointLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,
|
|
|
-color:new THREE.Color,distance:0,decay:0}),A=k.__webglUniforms,A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),A.color.copy(k.color).multiplyScalar(k.intensity),A.distance=k.distance,A.decay=0===k.distance?0:k.decay,T.point[E++]=A,k.castShadow&&(T.shadows++,T.shadowsPointLight++)):k instanceof THREE.SpotLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,direction:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0,angleCos:0}),A=k.__webglUniforms,
|
|
|
-A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),A.color.copy(v).multiplyScalar(u),A.distance=w,A.direction.setFromMatrixPosition(k.matrixWorld),W.setFromMatrixPosition(k.target.matrixWorld),A.direction.sub(W),A.direction.transformDirection(D),A.angleCos=Math.cos(k.angle),A.exponent=k.exponent,A.decay=0===k.distance?0:k.decay,T.spot[B++]=A,k.castShadow&&T.shadows++):k instanceof THREE.HemisphereLight&&(k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,skyColor:new THREE.Color,
|
|
|
-groundColor:new THREE.Color}),A=k.__webglUniforms,A.direction.setFromMatrixPosition(k.matrixWorld),A.direction.transformDirection(D),A.direction.normalize(),A.skyColor.copy(k.color).multiplyScalar(u),A.groundColor.copy(k.groundColor).multiplyScalar(u),T.hemi[z++]=A);T.ambient[0]=l;T.ambient[1]=n;T.ambient[2]=t;T.directional.length=F;T.point.length=E;T.spot.length=B;T.hemi.length=z;T.hash=F+","+E+","+B+","+z;wa.render(a,b);ca.calls=0;ca.vertices=0;ca.faces=0;ca.points=0;this.setRenderTarget(c);(this.autoClear||
|
|
|
-d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(Y,b,V,e,d),r(aa,b,V,e,d)):(I.setBlending(THREE.NoBlending),r(Y,b,V,e),r(aa,b,V,e));Ca.render(a,b);Da.render(a,b,xa,ya);c&&(a=c.texture,a.generateMipmaps&&x(c)&&a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=S.get(c.texture).__webglTexture,I.bindTexture(a,c),s.generateMipmap(a),I.bindTexture(a,
|
|
|
-null)));I.setDepthTest(!0);I.setDepthWrite(!0);I.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?I.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),I.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=S.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",
|
|
|
-a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.addEventListener("dispose",f),c.__webglTexture=s.createTexture(),da.textures++);I.activeTexture(s.TEXTURE0+b);I.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=F(a.image,
|
|
|
-ba.maxTextureSize);if((a.wrapS!==THREE.ClampToEdgeWrapping||a.wrapT!==THREE.ClampToEdgeWrapping||a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter)&&!1===x(a.image)){d=a.image;if(d instanceof HTMLImageElement||d instanceof HTMLCanvasElement){var e=document.createElement("canvas");e.width=THREE.Math.nearestPowerOfTwo(d.width);e.height=THREE.Math.nearestPowerOfTwo(d.height);e.getContext("2d").drawImage(d,0,0,e.width,e.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+
|
|
|
-d.width+"x"+d.height+"). Resized to "+e.width+"x"+e.height,d);d=e}a.image=d}var g=a.image,d=x(g),e=D(a.format),h=D(a.type);v(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,n=k.length;l<n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,g.width,g.height,0,e,h,g.data);else if(a instanceof THREE.CompressedTexture)for(l=0,n=k.length;l<n;l++)g=k[l],a.format!==THREE.RGBAFormat&&
|
|
|
-a.format!==THREE.RGBFormat?-1<I.getCompressedTextureFormats().indexOf(e)?I.compressedTexImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);else if(0<k.length&&d){l=0;for(n=k.length;l<n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,e,h,g);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,e,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);
|
|
|
-c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else I.activeTexture(s.TEXTURE0+b),I.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===S.get(a).__webglFramebuffer){var c=S.get(a),d=S.get(a.texture);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",g);d.__webglTexture=s.createTexture();da.textures++;var e=x(a),f=D(a.texture.format),h=D(a.texture.type);
|
|
|
-if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];I.bindTexture(s.TEXTURE_CUBE_MAP,d.__webglTexture);v(s.TEXTURE_CUBE_MAP,a.texture,e);for(d=0;6>d;d++)c.__webglFramebuffer[d]=s.createFramebuffer(),c.__webglRenderbuffer[d]=s.createRenderbuffer(),I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer[d],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+d),y(c.__webglRenderbuffer[d],a);a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=
|
|
|
-s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),I.bindTexture(s.TEXTURE_2D,d.__webglTexture),v(s.TEXTURE_2D,a.texture,e),I.texImage2D(s.TEXTURE_2D,0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,
|
|
|
-s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):y(c.__webglRenderbuffer,a),a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_2D);b?I.bindTexture(s.TEXTURE_CUBE_MAP,null):I.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=S.get(a),d=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,e=a.height,h=f=0):(d=null,c=ha,e=ia,f=fa,h=ga);d!==sa&&(s.bindFramebuffer(s.FRAMEBUFFER,d),s.viewport(f,h,c,
|
|
|
-e),sa=d);b&&(d=S.get(a.texture),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,d.__webglTexture,0));xa=c;ya=e};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=S.get(a).__webglFramebuffer;if(g){var h=!1;g!==sa&&(s.bindFramebuffer(s.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==
|
|
|
-THREE.RGBAFormat&&D(k.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===THREE.UnsignedByteType||D(k.type)===s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&U.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&U.get("EXT_color_buffer_half_float")?s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,
|
|
|
-c,d,e,D(k.format),D(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&s.bindFramebuffer(s.FRAMEBUFFER,sa)}}}}};
|
|
|
+v);break;default:s.vertexAttrib1fv(r,v)}}}I.disableUnusedAttributes()}null!==b&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,na.getAttributeBuffer(b))}q=Infinity;null!==b?q=b.count:void 0!==c&&(q=c.count);p=d.drawRange.start;b=d.drawRange.count;c=null!==g?g.start:0;l=null!==g?g.count:Infinity;g=Math.max(0,p,c);q=Math.min(0+q,p+b,c+l)-1;q=Math.max(0,q-g+1);if(f instanceof THREE.Mesh){if(!0===e.wireframe)I.setLineWidth(e.wireframeLinewidth*G),a.setMode(s.LINES);else switch(f.mode){case THREE.TrianglesDrawMode:a.setMode(s.TRIANGLES);
|
|
|
+break;case THREE.TriangleStripDrawMode:a.setMode(s.TRIANGLE_STRIP);break;case THREE.TriangleFanDrawMode:a.setMode(s.TRIANGLE_FAN)}d instanceof THREE.InstancedBufferGeometry&&0<d.maxInstancedCount?a.renderInstances(d):a.render(g,q)}else f instanceof THREE.Line?(d=e.linewidth,void 0===d&&(d=1),I.setLineWidth(d*G),f instanceof THREE.LineSegments?a.setMode(s.LINES):a.setMode(s.LINE_STRIP),a.render(g,q)):f instanceof THREE.Points&&(a.setMode(s.POINTS),a.render(g,q))};this.render=function(a,b,c,d){if(!1===
|
|
|
+b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e=a.fog;ka="";pa=-1;ja=null;!0===a.autoUpdate&&a.updateMatrixWorld();null===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);qa.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ua.setFromMatrix(qa);V.length=0;ma=ea=-1;$.length=0;va.length=0;q(a,b);Y.length=ea+1;aa.length=ma+1;!0===Z.sortObjects&&(Y.sort(m),aa.sort(p));var f=V,g,h,k,l=0,n=
|
|
|
+0,t=0,v,u,w,D=b.matrixWorldInverse,F=0,E=0,B=0,z=0;T.shadows=0;g=T.shadowsPointLight=0;for(h=f.length;g<h;g++)if(k=f[g],v=k.color,u=k.intensity,w=k.distance,k instanceof THREE.AmbientLight)l+=v.r,n+=v.g,t+=v.b;else if(k instanceof THREE.DirectionalLight){k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,color:new THREE.Color});var A=k.__webglUniforms;A.direction.setFromMatrixPosition(k.matrixWorld);W.setFromMatrixPosition(k.target.matrixWorld);A.direction.sub(W);A.direction.transformDirection(D);
|
|
|
+A.color.copy(k.color).multiplyScalar(k.intensity);T.directional[F++]=A;k.castShadow&&T.shadows++}else k instanceof THREE.PointLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0}),A=k.__webglUniforms,A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),A.color.copy(k.color).multiplyScalar(k.intensity),A.distance=k.distance,A.decay=0===k.distance?0:k.decay,T.point[E++]=A,k.castShadow&&(T.shadows++,T.shadowsPointLight++)):
|
|
|
+k instanceof THREE.SpotLight?(k.__webglUniforms||(k.__webglUniforms={position:new THREE.Vector3,direction:new THREE.Vector3,color:new THREE.Color,distance:0,decay:0,angleCos:0}),A=k.__webglUniforms,A.position.setFromMatrixPosition(k.matrixWorld),A.position.applyMatrix4(D),A.color.copy(v).multiplyScalar(u),A.distance=w,A.direction.setFromMatrixPosition(k.matrixWorld),W.setFromMatrixPosition(k.target.matrixWorld),A.direction.sub(W),A.direction.transformDirection(D),A.angleCos=Math.cos(k.angle),A.exponent=
|
|
|
+k.exponent,A.decay=0===k.distance?0:k.decay,T.spot[B++]=A,k.castShadow&&T.shadows++):k instanceof THREE.HemisphereLight&&(k.__webglUniforms||(k.__webglUniforms={direction:new THREE.Vector3,skyColor:new THREE.Color,groundColor:new THREE.Color}),A=k.__webglUniforms,A.direction.setFromMatrixPosition(k.matrixWorld),A.direction.transformDirection(D),A.direction.normalize(),A.skyColor.copy(k.color).multiplyScalar(u),A.groundColor.copy(k.groundColor).multiplyScalar(u),T.hemi[z++]=A);T.ambient[0]=l;T.ambient[1]=
|
|
|
+n;T.ambient[2]=t;T.directional.length=F;T.point.length=E;T.spot.length=B;T.hemi.length=z;T.hash=F+","+E+","+B+","+z;wa.render(a,b);ca.calls=0;ca.vertices=0;ca.faces=0;ca.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMaterial,r(Y,b,V,e,d),r(aa,b,V,e,d)):(I.setBlending(THREE.NoBlending),r(Y,b,V,e),r(aa,b,V,e));Ca.render(a,b);Da.render(a,b,xa,ya);c&&(a=c.texture,a.generateMipmaps&&x(c)&&
|
|
|
+a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter&&(a=c instanceof THREE.WebGLRenderTargetCube?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,c=S.get(c.texture).__webglTexture,I.bindTexture(a,c),s.generateMipmap(a),I.bindTexture(a,null)));I.setDepthTest(!0);I.setDepthWrite(!0);I.setColorWrite(!0)}};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?I.disable(s.CULL_FACE):(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?
|
|
|
+s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),I.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=S.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.addEventListener("dispose",f),c.__webglTexture=s.createTexture(),
|
|
|
+da.textures++);I.activeTexture(s.TEXTURE0+b);I.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=F(a.image,ba.maxTextureSize);if((a.wrapS!==THREE.ClampToEdgeWrapping||a.wrapT!==THREE.ClampToEdgeWrapping||a.minFilter!==THREE.NearestFilter&&a.minFilter!==THREE.LinearFilter)&&!1===x(a.image)){d=a.image;if(d instanceof HTMLImageElement||d instanceof
|
|
|
+HTMLCanvasElement){var e=document.createElement("canvas");e.width=THREE.Math.nearestPowerOfTwo(d.width);e.height=THREE.Math.nearestPowerOfTwo(d.height);e.getContext("2d").drawImage(d,0,0,e.width,e.height);console.warn("THREE.WebGLRenderer: image is not power of two ("+d.width+"x"+d.height+"). Resized to "+e.width+"x"+e.height,d);d=e}a.image=d}var g=a.image,d=x(g),e=D(a.format),h=D(a.type);v(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,n=k.length;l<
|
|
|
+n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,g.width,g.height,0,e,h,g.data);else if(a instanceof THREE.CompressedTexture)for(l=0,n=k.length;l<n;l++)g=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<I.getCompressedTextureFormats().indexOf(e)?I.compressedTexImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):
|
|
|
+I.texImage2D(s.TEXTURE_2D,l,e,g.width,g.height,0,e,h,g.data);else if(0<k.length&&d){l=0;for(n=k.length;l<n;l++)g=k[l],I.texImage2D(s.TEXTURE_2D,l,e,e,h,g);a.generateMipmaps=!1}else I.texImage2D(s.TEXTURE_2D,0,e,e,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else I.activeTexture(s.TEXTURE0+b),I.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===
|
|
|
+S.get(a).__webglFramebuffer){var c=S.get(a),d=S.get(a.texture);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",g);d.__webglTexture=s.createTexture();da.textures++;var e=x(a),f=D(a.texture.format),h=D(a.texture.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=[];I.bindTexture(s.TEXTURE_CUBE_MAP,d.__webglTexture);v(s.TEXTURE_CUBE_MAP,a.texture,e);for(d=0;6>d;d++)c.__webglFramebuffer[d]=s.createFramebuffer(),c.__webglRenderbuffer[d]=
|
|
|
+s.createRenderbuffer(),I.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer[d],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+d),y(c.__webglRenderbuffer[d],a);a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),I.bindTexture(s.TEXTURE_2D,d.__webglTexture),v(s.TEXTURE_2D,a.texture,e),I.texImage2D(s.TEXTURE_2D,
|
|
|
+0,f,a.width,a.height,0,f,h,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):y(c.__webglRenderbuffer,a),a.texture.generateMipmaps&&e&&s.generateMipmap(s.TEXTURE_2D);b?I.bindTexture(s.TEXTURE_CUBE_MAP,null):I.bindTexture(s.TEXTURE_2D,
|
|
|
+null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=S.get(a),d=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,e=a.height,h=f=0):(d=null,c=ha,e=ia,f=fa,h=ga);d!==sa&&(s.bindFramebuffer(s.FRAMEBUFFER,d),s.viewport(f,h,c,e),sa=d);b&&(d=S.get(a.texture),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,d.__webglTexture,0));xa=c;ya=e};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===
|
|
|
+a instanceof THREE.WebGLRenderTarget)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=S.get(a).__webglFramebuffer;if(g){var h=!1;g!==sa&&(s.bindFramebuffer(s.FRAMEBUFFER,g),h=!0);try{var k=a.texture;k.format!==THREE.RGBAFormat&&D(k.format)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):k.type===THREE.UnsignedByteType||
|
|
|
+D(k.type)===s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)||k.type===THREE.FloatType&&U.get("WEBGL_color_buffer_float")||k.type===THREE.HalfFloatType&&U.get("EXT_color_buffer_half_float")?s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?s.readPixels(b,c,d,e,D(k.format),D(k.type),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&
|
|
|
+s.bindFramebuffer(s.FRAMEBUFFER,sa)}}}}};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.uuid=THREE.Math.generateUUID();this.width=a;this.height=b;c=c||{};void 0===c.minFilter&&(c.minFilter=THREE.LinearFilter);this.texture=new THREE.Texture(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose()},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.shareDepthFrom=a.shareDepthFrom;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);
|
|
|
THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
|