mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
Refactored everything to use CamelCase naming for properties. Plus some smaller fixes here and there.
Went through all examples, all should work. JSON files exported from Blender / converted from OBJ files still use underscored property names internally. I don't know, should these also be changed?
This commit is contained in:
+99
-98
@@ -48,7 +48,7 @@ b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this
|
||||
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
||||
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
|
||||
multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,n=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+n*-k-w*-h;b.y=n*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-n*-g;return b}};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
|
||||
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
||||
THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
|
||||
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
||||
@@ -66,11 +66,11 @@ h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+
|
||||
THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
|
||||
THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
|
||||
THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
|
||||
THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
||||
THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
||||
this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
||||
THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.001-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.001-j;j=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n<w;n++){g=this.hierarchy[n];if(k[n][h]!==undefined){g.skinMatrix=
|
||||
k[n][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=f[c];if(c==="rot"){if(b<
|
||||
0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][h]=this.hierarchy[n].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
||||
THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n<w;n++){g=this.hierarchy[n];if(k[n][h]!==
|
||||
undefined){g.skinMatrix=k[n][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
|
||||
f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][h]=this.hierarchy[n].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
||||
THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
|
||||
THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=
|
||||
0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
||||
@@ -79,40 +79,40 @@ THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.loo
|
||||
this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
|
||||
THREE.Camera.prototype.frustumContains=function(a){var b=a.matrixWorld.n14,c=a.matrixWorld.n24,d=a.matrixWorld.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.near)return!1;if(h+g<-this.far)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
|
||||
if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.positionScreen.set(n,b,h,g);return!0};function bind(a,b){return function(){b.apply(a,arguments)}}
|
||||
THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movement_speed=1;this.look_speed=0.005;this.nofly=!1;this.look_vertical=!0;this.domElement=document;if(a){if(a.movement_speed!==undefined)this.movement_speed=a.movement_speed;if(a.look_speed!==undefined)this.look_speed=a.look_speed;if(a.nofly!==undefined)this.nofly=a.nofly;if(a.look_vertical!==undefined)this.look_vertical=a.look_vertical;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=
|
||||
this.phy=this.lon=this.lat=this.mouseY=this.mouseX=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=
|
||||
THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phy=
|
||||
this.lon=this.lat=this.mouseY=this.mouseX=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=
|
||||
function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=
|
||||
function(){this.moveForward&&this.translateZ(-this.movement_speed,this.nofly);this.moveBackward&&this.translateZ(this.movement_speed,this.nofly);this.moveLeft&&this.translateX(-this.movement_speed,this.nofly);this.moveRight&&this.translateX(this.movement_speed,this.nofly);this.lon+=this.mouseX*this.look_speed;this.look_vertical&&(this.lat-=this.mouseY*this.look_speed);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,
|
||||
function(){this.moveForward&&this.translateZ(-this.movementSpeed,this.noFly);this.moveBackward&&this.translateZ(this.movementSpeed,this.noFly);this.moveLeft&&this.translateX(-this.movementSpeed,this.noFly);this.moveRight&&this.translateX(this.movementSpeed,this.noFly);this.lon+=this.mouseX*this.lookSpeed;this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,
|
||||
c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",bind(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",bind(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",bind(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",
|
||||
bind(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",bind(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;
|
||||
THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
|
||||
THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};
|
||||
THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
||||
this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
||||
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
||||
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
||||
a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
||||
undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
||||
undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
|
||||
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
|
||||
this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
|
||||
undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
|
||||
undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader=
|
||||
a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==
|
||||
undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
||||
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
|
||||
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
|
||||
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
||||
THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
||||
THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
||||
var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]){d=a[b][c];f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)f[c]=d[c]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
||||
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
||||
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
||||
@@ -157,22 +157,22 @@ W[K];U=ba.color;if(ba instanceof THREE.AmbientLight){I.r+=U.r;I.g+=U.g;I.b+=U.b}
|
||||
ja);F.normalize();pa=ba.dot(F)*Ea;if(pa>0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}}}function Ha(K,ja,ba){if(ba.opacity!=0){a(ba.opacity);b(ba.blending);var U,W,pa,Da,Ea,Ia;if(ba instanceof THREE.ParticleBasicMaterial){if(ba.map){Da=ba.map.image;Ea=Da.width>>1;Ia=Da.height>>1;W=ja.scale.x*k;pa=ja.scale.y*j;ba=W*Ea;U=pa*Ia;t.set(K.x-ba,K.y-U,K.x+ba,K.y+U);if(B.instersects(t)){m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(W,-pa);m.translate(-Ea,-Ia);m.drawImage(Da,0,0);m.restore()}}}else if(ba instanceof
|
||||
THREE.ParticleCircleMaterial){if(E){C.r=I.r+L.r+z.r;C.g=I.g+L.g+z.g;C.b=I.b+L.b+z.b;S.r=ba.color.r*C.r;S.g=ba.color.g*C.g;S.b=ba.color.b*C.b;S.updateStyleString()}else S.__styleString=ba.color.__styleString;ba=ja.scale.x*k;U=ja.scale.y*j;t.set(K.x-ba,K.y-U,K.x+ba,K.y+U);if(B.instersects(t)){W=S.__styleString;if(A!=W)m.fillStyle=A=W;m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(ba,U);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function La(K,ja,ba,U){if(U.opacity!=
|
||||
0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ja.positionScreen.x,ja.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){S.__styleString=U.color.__styleString;K=U.linewidth;if(G!=K)m.lineWidth=G=K;K=S.__styleString;if(x!=K)m.strokeStyle=x=K;m.stroke();t.inflate(U.linewidth*2)}}}function ca(K,ja,ba,U,W,pa){if(W.opacity!=0){a(W.opacity);b(W.blending);M=K.positionScreen.x;e=K.positionScreen.y;da=ja.positionScreen.x;O=ja.positionScreen.y;
|
||||
P=ba.positionScreen.x;V=ba.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(da,O);m.lineTo(P,V);m.lineTo(M,e);m.closePath();if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(W.env_map){if(W.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.matrixWorld;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;ga=-(F.x*
|
||||
K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ua=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;ra(M,e,da,O,P,V,W.env_map.image,ia,ga,ua,xa,l,y)}}else W.wireframe?X(W.color.__styleString,W.wireframe_linewidth):Y(W.color.__styleString);else if(W instanceof THREE.MeshLambertMaterial){if(W.map&&!W.wireframe){W.map.mapping instanceof
|
||||
THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!W.wireframe&&W.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){Z.r=ea.r=J.r=I.r;Z.g=ea.g=J.g=I.g;Z.b=ea.b=J.b=I.b;Ga(pa,U.v1.positionWorld,U.vertexNormalsWorld[0],Z);Ga(pa,U.v2.positionWorld,U.vertexNormalsWorld[1],ea);Ga(pa,U.v3.positionWorld,U.vertexNormalsWorld[2],J);$.r=(ea.r+J.r)*0.5;$.g=(ea.g+J.g)*0.5;$.b=(ea.b+J.b)*0.5;la=Ja(Z,ea,
|
||||
J,$);ra(M,e,da,O,P,V,la,0,0,1,0,0,1)}else{C.r=I.r;C.g=I.g;C.b=I.b;Ga(pa,U.centroidWorld,U.normalWorld,C);S.r=W.color.r*C.r;S.g=W.color.g*C.g;S.b=W.color.b*C.b;S.updateStyleString();W.wireframe?X(S.__styleString,W.wireframe_linewidth):Y(S.__styleString)}else W.wireframe?X(W.color.__styleString,W.wireframe_linewidth):Y(W.color.__styleString)}else if(W instanceof THREE.MeshDepthMaterial){ta=Ca.near;aa=Ca.far;Z.r=Z.g=Z.b=1-Aa(K.positionScreen.z,ta,aa);ea.r=ea.g=ea.b=1-Aa(ja.positionScreen.z,ta,aa);J.r=
|
||||
J.g=J.b=1-Aa(ba.positionScreen.z,ta,aa);$.r=(ea.r+J.r)*0.5;$.g=(ea.g+J.g)*0.5;$.b=(ea.b+J.b)*0.5;la=Ja(Z,ea,J,$);ra(M,e,da,O,P,V,la,0,0,1,0,0,1)}else if(W instanceof THREE.MeshNormalMaterial){S.r=N(U.normalWorld.x);S.g=N(U.normalWorld.y);S.b=N(U.normalWorld.z);S.updateStyleString();W.wireframe?X(S.__styleString,W.wireframe_linewidth):Y(S.__styleString)}}}function X(K,ja){if(x!=K)m.strokeStyle=x=K;if(G!=ja)m.lineWidth=G=ja;m.stroke();t.inflate(ja*2)}function Y(K){if(A!=K)m.fillStyle=A=K;m.fill()}function ra(K,
|
||||
ja,ba,U,W,pa,Da,Ea,Ia,Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ba-=K;U-=ja;W-=K;pa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ba-Ka*W)*Oa;Ka=(Sa*U-Ka*pa)*Oa;ba=(Ma*W-Fa*ba)*Oa;U=(Ma*pa-Fa*U)*Oa;K=K-Na*Ea-ba*Ia;ja=ja-Ka*Ea-U*Ia;m.save();m.transform(Na,Ka,ba,U,K,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(K,ja,ba,U){var W=~~(K.r*255),pa=~~(K.g*255);K=~~(K.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*255);ja=~~(ja.b*
|
||||
255);var Ia=~~(ba.r*255),Ma=~~(ba.g*255);ba=~~(ba.b*255);var Ka=~~(U.r*255),Fa=~~(U.g*255);U=~~(U.b*255);ka[0]=W<0?0:W>255?255:W;ka[1]=pa<0?0:pa>255?255:pa;ka[2]=K<0?0:K>255?255:K;ka[4]=Da<0?0:Da>255?255:Da;ka[5]=Ea<0?0:Ea>255?255:Ea;ka[6]=ja<0?0:ja>255?255:ja;ka[8]=Ia<0?0:Ia>255?255:Ia;ka[9]=Ma<0?0:Ma>255?255:Ma;ka[10]=ba<0?0:ba>255?255:ba;ka[12]=Ka<0?0:Ka>255?255:Ka;ka[13]=Fa<0?0:Fa>255?255:Fa;ka[14]=U<0?0:U>255?255:U;Q.putImageData(fa,0,0);na.drawImage(T,0,0);return qa}function Aa(K,ja,ba){K=(K-
|
||||
ja)/(ba-ja);return K*K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Ba(K,ja){var ba=ja.x-K.x,U=ja.y-K.y,W=1/Math.sqrt(ba*ba+U*U);ba*=W;U*=W;ja.x+=ba;ja.y+=U;K.x-=ba;K.y-=U}var Pa,Ta,sa,oa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&R(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){sa=c[Pa];t.empty();if(sa instanceof THREE.RenderableParticle){v=sa;v.x*=k;v.y*=j;oa=0;for(za=sa.materials.length;oa<za;oa++)Ha(v,
|
||||
sa,sa.materials[oa],ha)}else if(sa instanceof THREE.RenderableLine){v=sa.v1;H=sa.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(t)){oa=0;for(za=sa.materials.length;oa<za;)La(v,H,sa,sa.materials[oa++],ha)}}else if(sa instanceof THREE.RenderableFace3){v=sa.v1;H=sa.v2;o=sa.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;H.positionScreen.x*=k;
|
||||
H.positionScreen.y*=j;o.positionScreen.x*=k;o.positionScreen.y*=j;if(sa.overdraw){Ba(v.positionScreen,H.positionScreen);Ba(H.positionScreen,o.positionScreen);Ba(o.positionScreen,v.positionScreen)}t.add3Points(v.positionScreen.x,v.positionScreen.y,H.positionScreen.x,H.positionScreen.y,o.positionScreen.x,o.positionScreen.y);if(B.instersects(t)){oa=0;for(za=sa.meshMaterials.length;oa<za;){va=sa.meshMaterials[oa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=sa.faceMaterials.length;wa<ya;)(va=
|
||||
sa.faceMaterials[wa++])&&ca(v,H,o,sa,va,ha)}else ca(v,H,o,sa,va,ha)}}}q.addRectangle(t)}m.setTransform(1,0,0,1,0,0)}};
|
||||
P=ba.positionScreen.x;V=ba.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(da,O);m.lineTo(P,V);m.lineTo(M,e);m.closePath();if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.matrixWorld;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;ga=-(F.x*K.n21+
|
||||
F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ua=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;ra(M,e,da,O,P,V,W.envMap.image,ia,ga,ua,xa,l,y)}}else W.wireframe?X(W.color.__styleString,W.wireframeLinewidth):Y(W.color.__styleString);else if(W instanceof THREE.MeshLambertMaterial){if(W.map&&!W.wireframe){W.map.mapping instanceof THREE.UVMapping&&
|
||||
ra(M,e,da,O,P,V,W.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!W.wireframe&&W.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){Z.r=ea.r=J.r=I.r;Z.g=ea.g=J.g=I.g;Z.b=ea.b=J.b=I.b;Ga(pa,U.v1.positionWorld,U.vertexNormalsWorld[0],Z);Ga(pa,U.v2.positionWorld,U.vertexNormalsWorld[1],ea);Ga(pa,U.v3.positionWorld,U.vertexNormalsWorld[2],J);$.r=(ea.r+J.r)*0.5;$.g=(ea.g+J.g)*0.5;$.b=(ea.b+J.b)*0.5;la=Ja(Z,ea,J,$);ra(M,e,da,
|
||||
O,P,V,la,0,0,1,0,0,1)}else{C.r=I.r;C.g=I.g;C.b=I.b;Ga(pa,U.centroidWorld,U.normalWorld,C);S.r=W.color.r*C.r;S.g=W.color.g*C.g;S.b=W.color.b*C.b;S.updateStyleString();W.wireframe?X(S.__styleString,W.wireframeLinewidth):Y(S.__styleString)}else W.wireframe?X(W.color.__styleString,W.wireframeLinewidth):Y(W.color.__styleString)}else if(W instanceof THREE.MeshDepthMaterial){ta=Ca.near;aa=Ca.far;Z.r=Z.g=Z.b=1-Aa(K.positionScreen.z,ta,aa);ea.r=ea.g=ea.b=1-Aa(ja.positionScreen.z,ta,aa);J.r=J.g=J.b=1-Aa(ba.positionScreen.z,
|
||||
ta,aa);$.r=(ea.r+J.r)*0.5;$.g=(ea.g+J.g)*0.5;$.b=(ea.b+J.b)*0.5;la=Ja(Z,ea,J,$);ra(M,e,da,O,P,V,la,0,0,1,0,0,1)}else if(W instanceof THREE.MeshNormalMaterial){S.r=N(U.normalWorld.x);S.g=N(U.normalWorld.y);S.b=N(U.normalWorld.z);S.updateStyleString();W.wireframe?X(S.__styleString,W.wireframeLinewidth):Y(S.__styleString)}}}function X(K,ja){if(x!=K)m.strokeStyle=x=K;if(G!=ja)m.lineWidth=G=ja;m.stroke();t.inflate(ja*2)}function Y(K){if(A!=K)m.fillStyle=A=K;m.fill()}function ra(K,ja,ba,U,W,pa,Da,Ea,Ia,
|
||||
Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ba-=K;U-=ja;W-=K;pa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ba-Ka*W)*Oa;Ka=(Sa*U-Ka*pa)*Oa;ba=(Ma*W-Fa*ba)*Oa;U=(Ma*pa-Fa*U)*Oa;K=K-Na*Ea-ba*Ia;ja=ja-Ka*Ea-U*Ia;m.save();m.transform(Na,Ka,ba,U,K,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(K,ja,ba,U){var W=~~(K.r*255),pa=~~(K.g*255);K=~~(K.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*255);ja=~~(ja.b*255);var Ia=~~(ba.r*
|
||||
255),Ma=~~(ba.g*255);ba=~~(ba.b*255);var Ka=~~(U.r*255),Fa=~~(U.g*255);U=~~(U.b*255);ka[0]=W<0?0:W>255?255:W;ka[1]=pa<0?0:pa>255?255:pa;ka[2]=K<0?0:K>255?255:K;ka[4]=Da<0?0:Da>255?255:Da;ka[5]=Ea<0?0:Ea>255?255:Ea;ka[6]=ja<0?0:ja>255?255:ja;ka[8]=Ia<0?0:Ia>255?255:Ia;ka[9]=Ma<0?0:Ma>255?255:Ma;ka[10]=ba<0?0:ba>255?255:ba;ka[12]=Ka<0?0:Ka>255?255:Ka;ka[13]=Fa<0?0:Fa>255?255:Fa;ka[14]=U<0?0:U>255?255:U;Q.putImageData(fa,0,0);na.drawImage(T,0,0);return qa}function Aa(K,ja,ba){K=(K-ja)/(ba-ja);return K*
|
||||
K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Ba(K,ja){var ba=ja.x-K.x,U=ja.y-K.y,W=1/Math.sqrt(ba*ba+U*U);ba*=W;U*=W;ja.x+=ba;ja.y+=U;K.x-=ba;K.y-=U}var Pa,Ta,sa,oa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&R(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){sa=c[Pa];t.empty();if(sa instanceof THREE.RenderableParticle){v=sa;v.x*=k;v.y*=j;oa=0;for(za=sa.materials.length;oa<za;oa++)Ha(v,sa,sa.materials[oa],
|
||||
ha)}else if(sa instanceof THREE.RenderableLine){v=sa.v1;H=sa.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;t.addPoint(v.positionScreen.x,v.positionScreen.y);t.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(t)){oa=0;for(za=sa.materials.length;oa<za;)La(v,H,sa,sa.materials[oa++],ha)}}else if(sa instanceof THREE.RenderableFace3){v=sa.v1;H=sa.v2;o=sa.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=
|
||||
j;o.positionScreen.x*=k;o.positionScreen.y*=j;if(sa.overdraw){Ba(v.positionScreen,H.positionScreen);Ba(H.positionScreen,o.positionScreen);Ba(o.positionScreen,v.positionScreen)}t.add3Points(v.positionScreen.x,v.positionScreen.y,H.positionScreen.x,H.positionScreen.y,o.positionScreen.x,o.positionScreen.y);if(B.instersects(t)){oa=0;for(za=sa.meshMaterials.length;oa<za;){va=sa.meshMaterials[oa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=sa.faceMaterials.length;wa<ya;)(va=sa.faceMaterials[wa++])&&
|
||||
ca(v,H,o,sa,va,ha)}else ca(v,H,o,sa,va,ha)}}}q.addRectangle(t)}m.setTransform(1,0,0,1,0,0)}};
|
||||
THREE.SVGRenderer=function(){function a(ia,ga,ua){var xa,l,y,B;xa=0;for(l=ia.lights.length;xa<l;xa++){y=ia.lights[xa];if(y instanceof THREE.DirectionalLight){B=ga.normalWorld.dot(y.position)*y.intensity;if(B>0){ua.r+=y.color.r*B;ua.g+=y.color.g*B;ua.b+=y.color.b*B}}else if(y instanceof THREE.PointLight){V.sub(y.position,ga.centroidWorld);V.normalize();B=ga.normalWorld.dot(V)*y.intensity;if(B>0){ua.r+=y.color.r*B;ua.g+=y.color.g*B;ua.b+=y.color.b*B}}}}function b(ia,ga,ua,xa,l,y){J=d($++);J.setAttribute("d",
|
||||
"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(H){M.r=e.r;M.g=e.g;M.b=e.b;a(y,xa,M);o.r=l.color.r*M.r;o.g=l.color.g*M.g;o.b=l.color.b*M.b;o.updateStyleString()}else o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){P=1-l.__2near/(l.__farPlusNear-
|
||||
xa.z*l.__farMinusNear);o.setRGB(P,P,P)}else l instanceof THREE.MeshNormalMaterial&&o.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):J.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(J)}function c(ia,ga,ua,xa,
|
||||
l,y,B){J=d($++);J.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)o.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(H){M.r=e.r;M.g=e.g;M.b=e.b;a(B,l,M);o.r=y.color.r*M.r;o.g=y.color.g*M.g;o.b=y.color.b*M.b;o.updateStyleString()}else o.__styleString=y.color.__styleString;
|
||||
else if(y instanceof THREE.MeshDepthMaterial){P=1-y.__2near/(y.__farPlusNear-l.z*y.__farMinusNear);o.setRGB(P,P,P)}else y instanceof THREE.MeshNormalMaterial&&o.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));y.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):J.setAttribute("style","fill: "+o.__styleString+
|
||||
xa.z*l.__farMinusNear);o.setRGB(P,P,P)}else l instanceof THREE.MeshNormalMaterial&&o.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):J.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(J)}function c(ia,ga,ua,xa,l,
|
||||
y,B){J=d($++);J.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)o.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(H){M.r=e.r;M.g=e.g;M.b=e.b;a(B,l,M);o.r=y.color.r*M.r;o.g=y.color.g*M.g;o.b=y.color.b*M.b;o.updateStyleString()}else o.__styleString=y.color.__styleString;
|
||||
else if(y instanceof THREE.MeshDepthMaterial){P=1-y.__2near/(y.__farPlusNear-l.z*y.__farMinusNear);o.setRGB(P,P,P)}else y instanceof THREE.MeshNormalMaterial&&o.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));y.wireframe?J.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+y.wireframeLinewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframeLinecap+"; stroke-linejoin: "+y.wireframeLinejoin):J.setAttribute("style","fill: "+o.__styleString+
|
||||
"; fill-opacity: "+y.opacity);k.appendChild(J)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,u,p,x,A,G=new THREE.Rectangle,v=new THREE.Rectangle,H=!1,o=new THREE.Color(16777215),M=new THREE.Color(16777215),
|
||||
e=new THREE.Color(0),da=new THREE.Color(0),O=new THREE.Color(0),P,V=new THREE.Vector3,S=[],Z=[],ea=[],J,$,ta,aa,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);G.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
|
||||
this.render=function(ia,ga){var ua,xa,l,y,B,q,t,E;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);aa=ta=$=0;if(H=ia.lights.length>0){t=ia.lights;e.setRGB(0,0,0);da.setRGB(0,0,0);O.setRGB(0,0,0);ua=0;for(xa=t.length;ua<xa;ua++){l=t[ua];y=l.color;if(l instanceof THREE.AmbientLight){e.r+=y.r;e.g+=y.g;e.b+=y.b}else if(l instanceof THREE.DirectionalLight){da.r+=y.r;da.g+=y.g;da.b+=y.b}else if(l instanceof THREE.PointLight){O.r+=y.r;O.g+=y.g;O.b+=y.b}}}ua=0;for(xa=g.length;ua<xa;ua++){t=
|
||||
@@ -183,22 +183,22 @@ E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(J)}}}}else if(t instan
|
||||
THREE.MeshFaceMaterial){B=0;for(q=t.faceMaterials.length;B<q;)(E=t.faceMaterials[B++])&&b(u,p,x,t,E,ia)}else E&&b(u,p,x,t,E,ia)}}}else if(t instanceof THREE.RenderableFace4){u=t.v1;p=t.v2;x=t.v3;A=t.v4;u.positionScreen.x*=n;u.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;A.positionScreen.x*=n;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,
|
||||
x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(v)){l=0;for(y=t.meshMaterials.length;l<y;){E=t.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(q=t.faceMaterials.length;B<q;)(E=t.faceMaterials[B++])&&c(u,p,x,A,t,E,ia)}else E&&c(u,p,x,A,t,E,ia)}}}}}};
|
||||
THREE.WebGLRenderer=function(a){function b(l,y,B){var q,t,E,C=l.vertices,I=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,fa=l.__dirtyColors;if(B.sortParticles){$.multiplySelf(B.matrixWorld);for(q=0;q<I;q++){t=C[q].position;ia.copy(t);$.multiplyVector3(ia);T[q]=[ia.z,q]}T.sort(function(ka,qa){return qa[0]-ka[0]});for(q=0;q<I;q++){t=C[T[q][1]].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}for(q=0;q<z;q++){E=q*3;color=L[T[q][1]];F[E]=color.r;F[E+
|
||||
1]=color.g;F[E+2]=color.b}}else{if(Q)for(q=0;q<I;q++){t=C[q].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}if(fa)for(q=0;q<z;q++){color=L[q];E=q*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(fa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
|
||||
Uniforms.clone(y.uniforms)}function d(l,y,B,q,t){q.program||P.initMaterial(q,y,B);var E=q.program,C=E.uniforms,I=q.uniforms;if(E!=da){e.useProgram(E);da=E;e.uniformMatrix4fv(C.projectionMatrix,!1,ta)}if(B&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){I.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){I.fogNear.value=B.near;I.fogFar.value=
|
||||
B.far}else if(B instanceof THREE.FogExp2)I.fogDensity.value=B.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,fa,ka,qa=P.lights,na=qa.directional.colors,ma=qa.directional.positions,ha=qa.point.colors,Ca=qa.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;fa=z.position;ka=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;na[z]=Q.r*ka;na[z+1]=
|
||||
Q.g*ka;na[z+2]=Q.b*ka;ma[z]=fa.x;ma[z+1]=fa.y;ma[z+2]=fa.z;R+=1}else if(z instanceof THREE.PointLight){z=Ga*3;ha[z]=Q.r*ka;ha[z+1]=Q.g*ka;ha[z+2]=Q.b*ka;Ca[z]=fa.x;Ca[z+1]=fa.y;Ca[z+2]=fa.z;Ga+=1}}for(B=R*3;B<na.length;B++)na[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;qa.point.length=Ga;qa.directional.length=R;qa.ambient[0]=D;qa.ambient[1]=F;qa.ambient[2]=T;y=P.lights;I.enableLighting.value=y.directional.length+y.point.length;I.ambientLightColor.value=y.ambient;I.directionalLightColor.value=y.directional.colors;
|
||||
I.directionalLightDirection.value=y.directional.positions;I.pointLightColor.value=y.point.colors;I.pointLightPosition.value=y.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){I.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity;I.map.texture=q.map;I.light_map.texture=q.light_map;I.env_map.texture=q.env_map;I.reflectivity.value=q.reflectivity;I.refraction_ratio.value=
|
||||
q.refraction_ratio;I.combine.value=q.combine;I.useRefract.value=q.env_map&&q.env_map.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){I.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){I.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity;I.size.value=q.size;I.map.texture=q.map}else if(q instanceof
|
||||
THREE.MeshPhongMaterial){I.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);I.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);I.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){I.mNear.value=l.near;I.mFar.value=l.far;I.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)I.opacity.value=q.opacity;for(var Ha in I)if(D=E.uniforms[Ha]){B=I[Ha];L=B.type;y=B.value;if(L=="i")e.uniform1i(D,y);else if(L=="f")e.uniform1f(D,y);else if(L=="fv1")e.uniform1fv(D,
|
||||
y);else if(L=="fv")e.uniform3fv(D,y);else if(L=="v2")e.uniform2f(D,y.x,y.y);else if(L=="v3")e.uniform3f(D,y.x,y.y,y.z);else if(L=="c")e.uniform3f(D,y.r,y.g,y.b);else if(L=="t"){e.uniform1i(D,y);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(B.needsUpdate){if(!B.image.__webGLTextureCube)B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);
|
||||
e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(L=0;L<6;++L)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[L]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{if(B.needsUpdate){if(B.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
|
||||
B.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
|
||||
0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);B.__wasSetOnce=!0}B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(C.modelViewMatrix,
|
||||
!1,t._modelViewMatrixArray);e.uniformMatrix3fv(C.normalMatrix,!1,t._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||q instanceof THREE.MeshPhongMaterial||q.env_map)&&e.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(q instanceof THREE.MeshShaderMaterial||q.env_map||q.skinning)&&e.uniformMatrix4fv(C.objectMatrix,!1,t._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&e.uniformMatrix4fv(C.viewMatrix,
|
||||
1]=color.g;F[E+2]=color.b}}else{if(Q)for(q=0;q<I;q++){t=C[q].position;E=q*3;D[E]=t.x;D[E+1]=t.y;D[E+2]=t.z}if(fa)for(q=0;q<z;q++){color=L[q];E=q*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(fa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragmentShader=y.fragmentShader;l.vertexShader=y.vertexShader;l.uniforms=Uniforms.clone(y.uniforms)}
|
||||
function d(l,y,B,q,t){q.program||P.initMaterial(q,y,B);var E=q.program,C=E.uniforms,I=q.uniforms;if(E!=da){e.useProgram(E);da=E;e.uniformMatrix4fv(C.projectionMatrix,!1,ta)}if(B&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){I.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){I.fogNear.value=B.near;I.fogFar.value=B.far}else if(B instanceof
|
||||
THREE.FogExp2)I.fogDensity.value=B.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,fa,ka,qa=P.lights,na=qa.directional.colors,ma=qa.directional.positions,ha=qa.point.colors,Ca=qa.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;fa=z.position;ka=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;na[z]=Q.r*ka;na[z+1]=Q.g*ka;na[z+2]=Q.b*ka;ma[z]=
|
||||
fa.x;ma[z+1]=fa.y;ma[z+2]=fa.z;R+=1}else if(z instanceof THREE.PointLight){z=Ga*3;ha[z]=Q.r*ka;ha[z+1]=Q.g*ka;ha[z+2]=Q.b*ka;Ca[z]=fa.x;Ca[z+1]=fa.y;Ca[z+2]=fa.z;Ga+=1}}for(B=R*3;B<na.length;B++)na[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;qa.point.length=Ga;qa.directional.length=R;qa.ambient[0]=D;qa.ambient[1]=F;qa.ambient[2]=T;y=P.lights;I.enableLighting.value=y.directional.length+y.point.length;I.ambientLightColor.value=y.ambient;I.directionalLightColor.value=y.directional.colors;I.directionalLightDirection.value=
|
||||
y.directional.positions;I.pointLightColor.value=y.point.colors;I.pointLightPosition.value=y.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){I.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity;I.map.texture=q.map;I.lightMap.texture=q.lightMap;I.envMap.texture=q.envMap;I.reflectivity.value=q.reflectivity;I.refractionRatio.value=q.refractionRatio;I.combine.value=
|
||||
q.combine;I.useRefract.value=q.envMap&&q.envMap.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){I.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){I.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);I.opacity.value=q.opacity;I.size.value=q.size;I.map.texture=q.map}else if(q instanceof THREE.MeshPhongMaterial){I.ambient.value.setRGB(q.ambient.r,
|
||||
q.ambient.g,q.ambient.b);I.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);I.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){I.mNear.value=l.near;I.mFar.value=l.far;I.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)I.opacity.value=q.opacity;for(var Ha in I)if(D=E.uniforms[Ha]){B=I[Ha];L=B.type;y=B.value;if(L=="i")e.uniform1i(D,y);else if(L=="f")e.uniform1f(D,y);else if(L=="fv1")e.uniform1fv(D,y);else if(L=="fv")e.uniform3fv(D,y);else if(L==
|
||||
"v2")e.uniform2f(D,y.x,y.y);else if(L=="v3")e.uniform3f(D,y.x,y.y,y.z);else if(L=="c")e.uniform3f(D,y.r,y.g,y.b);else if(L=="t"){e.uniform1i(D,y);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(B.needsUpdate){if(!B.image.__webGLTextureCube)B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
|
||||
e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(L=0;L<6;++L)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[L]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{if(B.needsUpdate){if(B.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
|
||||
B.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
|
||||
0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);B.__wasSetOnce=!0}B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(C.modelViewMatrix,
|
||||
!1,t._modelViewMatrixArray);e.uniformMatrix3fv(C.normalMatrix,!1,t._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||q instanceof THREE.MeshPhongMaterial||q.envMap)&&e.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(q instanceof THREE.MeshShaderMaterial||q.envMap||q.skinning)&&e.uniformMatrix4fv(C.objectMatrix,!1,t._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&e.uniformMatrix4fv(C.viewMatrix,
|
||||
!1,la);if(q.skinning){e.uniformMatrix4fv(C.cameraInverseMatrix,!1,aa);e.uniformMatrix4fv(C.boneGlobalMatrices,!1,t.boneMatrices)}return E}function f(l,y,B,q,t,E){l=d(l,y,B,q,E).attributes;e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
|
||||
3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(t.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(t.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
|
||||
if(q.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
|
||||
4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(q.wireframe){e.lineWidth(q.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(q.linewidth);e.drawArrays(E,0,t.__webGLLineCount)}else if(E instanceof
|
||||
4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(q.wireframe){e.lineWidth(q.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(q.linewidth);e.drawArrays(E,0,t.__webGLLineCount)}else if(E instanceof
|
||||
THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else E instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}function g(l,y){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.position);e.vertexAttribPointer(y.attributes.position,
|
||||
3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.normal);e.vertexAttribPointer(y.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(ea!=
|
||||
l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ea=l}}function j(l){J[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);J[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);J[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);J[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);J[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);J[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var y;for(l=0;l<6;l++){y=J[l];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}
|
||||
@@ -206,7 +206,7 @@ function m(l){for(var y=l.matrixWorld,B=-l.geometry.boundingSphere.radius*Math.m
|
||||
I=l.opaque,L=l.transparent;L.count=0;l=I.count=0;for(q=E.materials.length;l<q;l++){y=E.materials[l];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=C.materials.length;y<B;y++)(t=C.materials[y])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t))}else{t=y;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?n(L,t):n(I,t)}}}function p(l,y){return y.z-l.z}function x(l,y,B,q,t){if(y[B]==undefined){l.push({buffer:q,object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});
|
||||
y[B]=1}}function A(l,y){l._modelViewMatrix.multiplyToArray(y.matrixWorld,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function G(l){if(l!=Z){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);
|
||||
e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Z=l}}function v(l,y){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,
|
||||
o(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,o(l.format),l.width,l.height,0,o(l.format),o(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,
|
||||
o(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,o(l.format),l.width,l.height,0,o(l.format),o(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,
|
||||
l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,q,t;if(l){B=l.__webGLFramebuffer;q=l.width;t=l.height}else{B=null;q=M.width;t=M.height}if(B!=O){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,q,t);y&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=B}}function H(l,y){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,y);e.compileShader(B);
|
||||
if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function o(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;
|
||||
case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;
|
||||
@@ -214,15 +214,15 @@ case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document
|
||||
if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(q){console.log(q)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(ga,ua,xa);this.context=
|
||||
e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,y,B){var q,t;if(l instanceof THREE.MeshDepthMaterial)c(l,
|
||||
THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,I,L;t=I=L=0;for(E=y.length;t<
|
||||
E;t++){C=y[t];C instanceof THREE.DirectionalLight&&I++;C instanceof THREE.PointLight&&L++}if(L+I<=4)y=I;else{y=Math.ceil(4*I/(L+I));L=4-y}t={directional:y,point:L};L=l.fragment_shader;y=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};B=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
||||
E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",
|
||||
E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
||||
E;t++){C=y[t];C instanceof THREE.DirectionalLight&&I++;C instanceof THREE.PointLight&&L++}if(L+I<=4)y=I;else{y=Math.ceil(4*I/(L+I));L=4-y}t={directional:y,point:L};L=l.fragmentShader;y=l.vertexShader;E={fog:B,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};B=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,
|
||||
E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.envMap?"#define USE_ENVMAP":"",E.lightMap?"#define USE_LIGHTMAP":"",E.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.map?"#define USE_MAP":"",E.envMap?"#define USE_ENVMAP":
|
||||
"",E.lightMap?"#define USE_LIGHTMAP":"",E.vertexColors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
||||
e.attachShader(B,H("fragment",t+L));e.attachShader(B,H("vertex",E+y));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(q in l.uniforms)B.push(q);q=l.program;L=0;for(y=B.length;L<
|
||||
y;L++){t=B[L];q.uniforms[t]=e.getUniformLocation(q,t)}q=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];L=0;for(y=B.length;L<y;L++){t=B[L];q.attributes[t]=e.getAttribLocation(q,t)}q=l.program.attributes;e.enableVertexAttribArray(q.position);q.color>=0&&e.enableVertexAttribArray(q.color);q.normal>=0&&e.enableVertexAttribArray(q.normal);q.tangent>=0&&e.enableVertexAttribArray(q.tangent);if(l.skinning&&q.skinVertexA>=0&&q.skinVertexB>=
|
||||
0&&q.skinIndex>=0&&q.skinWeight>=0){e.enableVertexAttribArray(q.skinVertexA);e.enableVertexAttribArray(q.skinVertexB);e.enableVertexAttribArray(q.skinIndex);e.enableVertexAttribArray(q.skinWeight)}};this.render=function(l,y,B,q){var t,E,C,I,L,z,D,F,T=l.lights,Q=l.fog;y.matrixAutoUpdate&&y.update();y.matrixWorld.flattenToArray(la);y.projectionMatrix.flattenToArray(ta);y.inverseMatrix.flattenToArray(aa);$.multiply(y.projectionMatrix,y.matrixWorld);j($);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
||||
l.update(undefined,!1,y);this.initWebGLObjects(l,y);v(B,q!==undefined?q:!0);this.autoClear&&this.clear();L=l.__webGLObjects.length;for(q=0;q<L;q++){t=l.__webGLObjects[q];D=t.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);u(t);t.render=!0;if(this.sortObjects){ia.copy(D.position);$.multiplyVector3(ia);t.z=ia.z}}else t.render=!1;else t.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);z=l.__webGLObjectsImmediate.length;for(q=0;q<
|
||||
z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);w(t)}}G(THREE.NormalBlending);for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depth_test);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,
|
||||
E)})}}}for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depth_test);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depth_test);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
|
||||
z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);w(t)}}G(THREE.NormalBlending);for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depthTest);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.opaque;h(D);for(t=0;t<C.count;t++){I=C.list[t];k(I.depthTest);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,
|
||||
E)})}}}for(q=0;q<L;q++){t=l.__webGLObjects[q];if(t.render){D=t.object;F=t.buffer;C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depthTest);f(y,T,Q,I,F,D)}}}for(q=0;q<z;q++){t=l.__webGLObjectsImmediate[q];D=t.object;if(D.visible){C=t.transparent;h(D);for(t=0;t<C.count;t++){I=C.list[t];G(I.blending);k(I.depthTest);E=d(y,T,Q,I,D);D.render(function(fa){g(fa,E)})}}}if(B&&B.minFilter!==THREE.NearestFilter&&B.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
|
||||
e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l,y){var B,q,t;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}B=0;for(q=l.objects.length;B<q;B++){t=l.objects[B];var E=l,C=y,I=void 0,L=void 0,z=void 0,D=void 0;L=t.geometry;if(E.__webGLObjectsMap[t.id]==undefined){E.__webGLObjectsMap[t.id]={};t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);
|
||||
t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}D=E.__webGLObjectsMap[t.id];objlist=E.__webGLObjects;if(t instanceof THREE.Mesh){for(I in L.geometryChunks){z=L.geometryChunks[I];if(!z.__webGLVertexBuffer){C=z;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=
|
||||
e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=z;var F=t,T=void 0,Q=void 0,fa=0,ka=E=0,qa=F.geometry.faces,na=C.faces;T=0;for(Q=na.length;T<Q;T++){fi=na[T];face=qa[fi];if(face instanceof THREE.Face3){fa+=3;E+=1;ka+=3}else if(face instanceof THREE.Face4){fa+=4;E+=2;ka+=4}}C.__vertexArray=new Float32Array(fa*3);C.__normalArray=
|
||||
@@ -248,25 +248,25 @@ na,z)}if(ma){for(Q=0;Q<ka;Q++){color=E[Q];C=Q*3;T[C]=color.r;T[C+1]=color.g;T[C+
|
||||
I.__webGLParticleCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}(L.__dirtyVertices||L.__dirtyColors||t.sortParticles)&&b(L,e.DYNAMIC_DRAW,t,C);x(objlist,D,0,L,t);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes){L=D;if(L[0]==undefined){E.__webGLObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});L[0]=1}}}};this.removeObject=function(l,y){var B,q;for(B=l.__webGLObjects.length-1;B>=0;B--){q=l.__webGLObjects[B].object;
|
||||
y==q&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,y){if(l){!y||y=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
||||
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
||||
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
|
||||
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
||||
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
||||
lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
||||
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
|
||||
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
||||
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
|
||||
lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
||||
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
||||
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
||||
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
||||
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
||||
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
||||
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
||||
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
||||
value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
||||
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
||||
THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
||||
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
||||
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
||||
value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
||||
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
||||
THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
||||
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
||||
THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
||||
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
||||
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
||||
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
||||
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
||||
THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
||||
THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
||||
THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;",
|
||||
THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
|
||||
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
||||
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
|
||||
@@ -277,23 +277,23 @@ b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function()
|
||||
G[1],G[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;J.scene.addObject(object);J.objects[n]=object}}}function h($){return function(ta){J.geometries[$]=ta;g();V-=1;k()}}function k(){d({total_models:Z,total_textures:ea,loaded_models:Z-V,loaded_textures:ea-S},J);V==0&&S==0&&c(J)}var j,m,n,w,u,p,x,A,G,v,H,o,M,e,da,O,P,V,S,Z,ea,J;O=f.data;P=new THREE.Loader;S=V=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
|
||||
fogs:{}};f=function(){S-=1;k()};for(u in O.cameras){v=O.cameras[u];if(v.type=="perspective")M=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}G=v.position;v=v.target;M.position.set(G[0],G[1],G[2]);M.target.position.set(v[0],v[1],v[2]);J.cameras[u]=M}for(w in O.lights){u=O.lights[w];if(u.type=="directional"){G=u.direction;light=new THREE.DirectionalLight;light.position.set(G[0],
|
||||
G[1],G[2]);light.position.normalize()}else if(u.type=="point"){G=u.position;light=new THREE.PointLight;light.position.set(G[0],G[1],G[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);J.scene.addLight(light);J.lights[w]=light}for(p in O.fogs){w=O.fogs[p];if(w.type=="linear")e=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(e=new THREE.FogExp2(0,w.density));v=w.color;e.color.setRGB(v[0],v[1],v[2]);J.fogs[p]=e}if(J.cameras&&O.defaults.camera)J.currentCamera=J.cameras[O.defaults.camera];
|
||||
if(J.fogs&&O.defaults.fog)J.scene.fog=J.fogs[O.defaults.fog];v=O.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(v[0],v[1],v[2]);J.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){p=O.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh")V+=1}Z=V;for(j in O.geometries){p=O.geometries[j];if(p.type=="cube"){o=new Cube(p.width,p.height,p.depth,p.segments_width,p.segments_height,null,p.flipped,p.sides);J.geometries[j]=o}else if(p.type=="plane"){o=new Plane(p.width,p.height,p.segments_width,
|
||||
p.segments_height);J.geometries[j]=o}else if(p.type=="sphere"){o=new Sphere(p.radius,p.segments_width,p.segments_height);J.geometries[j]=o}else if(p.type=="cylinder"){o=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);J.geometries[j]=o}else if(p.type=="torus"){o=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);J.geometries[j]=o}else if(p.type=="icosahedron"){o=new Icosahedron(p.subdivisions);J.geometries[j]=o}else if(p.type=="bin_mesh")P.loadBinary({model:p.url,callback:h(j)});
|
||||
else p.type=="ascii_mesh"&&P.loadAscii({model:p.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];S+=j.url instanceof Array?j.url.length:1}ea=S;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)p=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{p=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)p.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)p.mag_filter=
|
||||
THREE[j.mag_filter]}J.textures[x]=p}for(m in O.materials){x=O.materials[m];for(H in x.parameters)if(H=="env_map"||H=="map"||H=="light_map")x.parameters[H]=J.textures[x.parameters[H]];else if(H=="shading")x.parameters[H]=x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")x.parameters[H]=THREE[x.parameters[H]]?THREE[x.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=
|
||||
new THREE[x.type](x.parameters);J.materials[m]=x}g();b(J)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,
|
||||
b,b,1,1,null,!0),c);a.addObject(b);return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,
|
||||
b,b,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
||||
SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
||||
vertex_shader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
||||
if(J.fogs&&O.defaults.fog)J.scene.fog=J.fogs[O.defaults.fog];v=O.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(v[0],v[1],v[2]);J.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){p=O.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh")V+=1}Z=V;for(j in O.geometries){p=O.geometries[j];if(p.type=="cube"){o=new Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,null,p.flipped,p.sides);J.geometries[j]=o}else if(p.type=="plane"){o=new Plane(p.width,p.height,p.segmentsWidth,
|
||||
p.segmentsHeight);J.geometries[j]=o}else if(p.type=="sphere"){o=new Sphere(p.radius,p.segmentsWidth,p.segmentsHeight);J.geometries[j]=o}else if(p.type=="cylinder"){o=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);J.geometries[j]=o}else if(p.type=="torus"){o=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);J.geometries[j]=o}else if(p.type=="icosahedron"){o=new Icosahedron(p.subdivisions);J.geometries[j]=o}else if(p.type=="bin_mesh")P.loadBinary({model:p.url,callback:h(j)});
|
||||
else p.type=="ascii_mesh"&&P.loadAscii({model:p.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];S+=j.url instanceof Array?j.url.length:1}ea=S;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)p=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{p=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)p.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)p.magFilter=
|
||||
THREE[j.magFilter]}J.textures[x]=p}for(m in O.materials){x=O.materials[m];for(H in x.parameters)if(H=="envMap"||H=="map"||H=="lightMap")x.parameters[H]=J.textures[x.parameters[H]];else if(H=="shading")x.parameters[H]=x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")x.parameters[H]=THREE[x.parameters[H]]?THREE[x.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);x=new THREE[x.type](x.parameters);
|
||||
J.materials[m]=x}g();b(J)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);
|
||||
return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
|
||||
a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
|
||||
SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
||||
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
||||
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
||||
uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragment_shader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
|
||||
vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
|
||||
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
|
||||
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
||||
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
||||
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
||||
fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,G,v,H,o,M,e,da){var O,P,V=d||1,S=f||1,Z=V+1,ea=S+1,J=o/2,$=M/2;o/=V;var ta=M/S,aa=m.vertices.length;if(A=="x"&&G=="y"||A=="y"&&G=="x")O="z";else if(A=="x"&&G=="z"||A=="z"&&G=="x")O="y";
|
||||
uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
|
||||
vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
|
||||
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
|
||||
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
||||
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
||||
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
||||
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,G,v,H,o,M,e,da){var O,P,V=d||1,S=f||1,Z=V+1,ea=S+1,J=o/2,$=M/2;o/=V;var ta=M/S,aa=m.vertices.length;if(A=="x"&&G=="y"||A=="y"&&G=="x")O="z";else if(A=="x"&&G=="z"||A=="z"&&G=="x")O="y";
|
||||
else if(A=="z"&&G=="y"||A=="y"&&G=="z")O="x";for(P=0;P<ea;P++)for(M=0;M<Z;M++){var la=new THREE.Vector3;la[A]=(M*o-J)*v;la[G]=(P*ta-$)*H;la[O]=e;m.vertices.push(new THREE.Vertex(la))}for(P=0;P<S;P++)for(M=0;M<V;M++){m.faces.push(new THREE.Face4(M+Z*P+aa,M+Z*(P+1)+aa,M+1+Z*(P+1)+aa,M+1+Z*P+aa,null,da));m.uvs.push([new THREE.UV(M/V,P/S),new THREE.UV(M/V,(P+1)/S),new THREE.UV((M+1)/V,(P+1)/S),new THREE.UV((M+1)/V,P/S)])}}THREE.Geometry.call(this);var m=this,n=a/2,w=b/2,u=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
|
||||
Array)this.materials=g;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-n,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,n,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
|
||||
a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var A=[],G=[],v=0,H=m.vertices.length;v<H;v++){for(var o=m.vertices[v],M=!1,e=0,da=A.length;e<da;e++){var O=A[e];if(o.position.x==O.position.x&&o.position.y==O.position.y&&o.position.z==O.position.z){G[v]=e;M=!0;break}}if(!M){G[v]=A.length;A.push(new THREE.Vertex(o.position.clone()))}}v=0;for(H=m.faces.length;v<H;v++){o=m.faces[v];o.a=G[o.a];o.b=G[o.b];o.c=G[o.c];o.d=G[o.d]}m.vertices=A})();this.computeCentroids();
|
||||
@@ -310,8 +310,9 @@ var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c|
|
||||
var Icosahedron=function(a){function b(w,u,p){var x=Math.sqrt(w*w+u*u+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,u/x,p/x)))-1}function c(w,u,p,x){x.faces.push(new THREE.Face3(w,u,p))}function d(w,u){var p=f.vertices[w].position,x=f.vertices[u].position;return b((p.x+x.x)/2,(p.y+x.y)/2,(p.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
|
||||
1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),n=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,n,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
|
||||
n,m,h);c(j,m,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
||||
function LathedObject(a,b,c){THREE.Geometry.call(this);c=c||2*Math.PI;b=c/(b||12);for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(b),m=0;m<=c+0.001;m+=b){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],
|
||||
g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
||||
function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));
|
||||
g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
||||
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
||||
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
||||
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(n[c],n[c+3],h);f[g+1]=this.lerp(n[c+1],n[c+4],h);f[g+2]=this.lerp(n[c+2],n[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
|
||||
2]=m;d=c+this.yd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
|
||||
@@ -373,5 +374,5 @@ j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animati
|
||||
c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],n=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,n,k),new THREE.Vector3(w,
|
||||
u,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,n){h=a.materials[h];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];var p=b[m*3],x=b[m*3+1];m=b[m*3+2];var A=b[n*3],G=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,u,j),new THREE.Vector3(p,x,m),new THREE.Vector3(A,G,n)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
|
||||
c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/
|
||||
Math.LN2));k.image.width=n;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,n,w)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.map_diffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
|
||||
255;g.color=h;g.opacity=a.transparency}else if(a.a_dbg_color)g.color=a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");g.light_map=new THREE.Texture(h);d(g.light_map,b+"/"+a.map_lightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
||||
Math.LN2));k.image.width=n;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,n,w)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.map_diffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
|
||||
255;g.color=h;g.opacity=a.transparency}else if(a.a_dbg_color)g.color=a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.map_lightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
||||
|
||||
+26
-26
@@ -48,7 +48,7 @@ b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this
|
||||
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var h=a*b,j=d*e;this.w=h*f-j*c;this.x=h*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
||||
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,h=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*h;this.y=c*a+e*h+d*f-b*j;this.z=d*a+e*j+b*h-c*f;this.w=e*a-b*f-c*h-d*j;return this},
|
||||
multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,h=this.y,j=this.z,g=this.w,i=g*c+h*e-j*d,l=g*d+j*c-f*e,m=g*e+f*d-h*c;c=-f*c-h*d-j*e;b.x=i*g+c*-f+l*-j-m*-h;b.y=l*g+c*-h+m*-f-i*-j;b.z=m*g+c*-j+i*-h-l*-f;return b}};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/h;d=Math.sin(d*f)/h;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/h;d=Math.sin(d*f)/h;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
||||
THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
|
||||
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
||||
@@ -72,25 +72,25 @@ THREE.Camera.prototype.frustumContains=function(a){var b=a.matrixWorld.n14,c=a.m
|
||||
if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.positionScreen.set(l,b,h,f);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
||||
THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
||||
THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
||||
this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
||||
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
||||
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
||||
undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=e!==undefined?e:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)}};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
|
||||
this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
|
||||
undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
|
||||
undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
||||
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=f!==undefined?f:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
||||
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
||||
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
||||
THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
||||
@@ -127,13 +127,13 @@ v[n];p=z.color;if(z instanceof THREE.AmbientLight){aa.r+=p.r;aa.g+=p.g;aa.b+=p.b
|
||||
M=z.dot(R)*X;if(M>0){p.r+=W.r*M;p.g+=W.g*M;p.b+=W.b*M}}}}function Na(n,G,z){if(z.opacity!=0){a(z.opacity);b(z.blending);var p,v,M,W,X,Z;if(z instanceof THREE.ParticleBasicMaterial){if(z.map){W=z.map.image;X=W.width>>1;Z=W.height>>1;v=G.scale.x*j;M=G.scale.y*g;z=v*X;p=M*Z;H.set(n.x-z,n.y-p,n.x+z,n.y+p);if($.instersects(H)){i.save();i.translate(n.x,n.y);i.rotate(-G.rotation);i.scale(v,-M);i.translate(-X,-Z);i.drawImage(W,0,0);i.restore()}}}else if(z instanceof THREE.ParticleCircleMaterial){if(U){Q.r=
|
||||
aa.r+na.r+oa.r;Q.g=aa.g+na.g+oa.g;Q.b=aa.b+na.b+oa.b;u.r=z.color.r*Q.r;u.g=z.color.g*Q.g;u.b=z.color.b*Q.b;u.updateStyleString()}else u.__styleString=z.color.__styleString;z=G.scale.x*j;p=G.scale.y*g;H.set(n.x-z,n.y-p,n.x+z,n.y+p);if($.instersects(H)){v=u.__styleString;if(t!=v)i.fillStyle=t=v;i.save();i.translate(n.x,n.y);i.rotate(-G.rotation);i.scale(z,p);i.beginPath();i.arc(0,0,1,0,La,!0);i.closePath();i.fill();i.restore()}}}}function Oa(n,G,z,p){if(p.opacity!=0){a(p.opacity);b(p.blending);i.beginPath();
|
||||
i.moveTo(n.positionScreen.x,n.positionScreen.y);i.lineTo(G.positionScreen.x,G.positionScreen.y);i.closePath();if(p instanceof THREE.LineBasicMaterial){u.__styleString=p.color.__styleString;n=p.linewidth;if(r!=n)i.lineWidth=r=n;n=u.__styleString;if(s!=n)i.strokeStyle=s=n;i.stroke();H.inflate(p.linewidth*2)}}}function Ha(n,G,z,p,v,M){if(v.opacity!=0){a(v.opacity);b(v.blending);I=n.positionScreen.x;F=n.positionScreen.y;N=G.positionScreen.x;A=G.positionScreen.y;w=z.positionScreen.x;K=z.positionScreen.y;
|
||||
i.beginPath();i.moveTo(I,F);i.lineTo(N,A);i.lineTo(w,K);i.lineTo(I,F);i.closePath();if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,A,w,K,v.map.image,p.uvs[0].u,p.uvs[0].v,p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);else if(v.env_map){if(v.env_map.mapping instanceof THREE.SphericalReflectionMapping){n=da.matrixWorld;R.copy(p.vertexNormalsWorld[0]);Y=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;J=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;R.copy(p.vertexNormalsWorld[1]);
|
||||
ja=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;ka=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;R.copy(p.vertexNormalsWorld[2]);la=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;ma=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;ua(I,F,N,A,w,K,v.env_map.image,Y,J,ja,ka,la,ma)}}else v.wireframe?za(v.color.__styleString,v.wireframe_linewidth):Aa(v.color.__styleString);else if(v instanceof THREE.MeshLambertMaterial){if(v.map&&!v.wireframe){v.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,A,w,K,v.map.image,p.uvs[0].u,p.uvs[0].v,
|
||||
i.beginPath();i.moveTo(I,F);i.lineTo(N,A);i.lineTo(w,K);i.lineTo(I,F);i.closePath();if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,A,w,K,v.map.image,p.uvs[0].u,p.uvs[0].v,p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping){n=da.matrixWorld;R.copy(p.vertexNormalsWorld[0]);Y=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;J=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;R.copy(p.vertexNormalsWorld[1]);
|
||||
ja=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;ka=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;R.copy(p.vertexNormalsWorld[2]);la=(R.x*n.n11+R.y*n.n12+R.z*n.n13)*0.5+0.5;ma=-(R.x*n.n21+R.y*n.n22+R.z*n.n23)*0.5+0.5;ua(I,F,N,A,w,K,v.envMap.image,Y,J,ja,ka,la,ma)}}else v.wireframe?za(v.color.__styleString,v.wireframeLinewidth):Aa(v.color.__styleString);else if(v instanceof THREE.MeshLambertMaterial){if(v.map&&!v.wireframe){v.map.mapping instanceof THREE.UVMapping&&ua(I,F,N,A,w,K,v.map.image,p.uvs[0].u,p.uvs[0].v,
|
||||
p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);b(THREE.SubtractiveBlending)}if(U)if(!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3){L.r=E.r=y.r=aa.r;L.g=E.g=y.g=aa.g;L.b=E.b=y.b=aa.b;ya(M,p.v1.positionWorld,p.vertexNormalsWorld[0],L);ya(M,p.v2.positionWorld,p.vertexNormalsWorld[1],E);ya(M,p.v3.positionWorld,p.vertexNormalsWorld[2],y);B.r=(E.r+y.r)*0.5;B.g=(E.g+y.g)*0.5;B.b=(E.b+y.b)*0.5;P=Ia(L,E,y,B);ua(I,F,N,A,w,K,P,0,0,1,0,0,1)}else{Q.r=aa.r;Q.g=aa.g;Q.b=aa.b;ya(M,p.centroidWorld,
|
||||
p.normalWorld,Q);u.r=v.color.r*Q.r;u.g=v.color.g*Q.g;u.b=v.color.b*Q.b;u.updateStyleString();v.wireframe?za(u.__styleString,v.wireframe_linewidth):Aa(u.__styleString)}else v.wireframe?za(v.color.__styleString,v.wireframe_linewidth):Aa(v.color.__styleString)}else if(v instanceof THREE.MeshDepthMaterial){T=da.near;x=da.far;L.r=L.g=L.b=1-Da(n.positionScreen.z,T,x);E.r=E.g=E.b=1-Da(G.positionScreen.z,T,x);y.r=y.g=y.b=1-Da(z.positionScreen.z,T,x);B.r=(E.r+y.r)*0.5;B.g=(E.g+y.g)*0.5;B.b=(E.b+y.b)*0.5;P=
|
||||
Ia(L,E,y,B);ua(I,F,N,A,w,K,P,0,0,1,0,0,1)}else if(v instanceof THREE.MeshNormalMaterial){u.r=Ea(p.normalWorld.x);u.g=Ea(p.normalWorld.y);u.b=Ea(p.normalWorld.z);u.updateStyleString();v.wireframe?za(u.__styleString,v.wireframe_linewidth):Aa(u.__styleString)}}}function za(n,G){if(s!=n)i.strokeStyle=s=n;if(r!=G)i.lineWidth=r=G;i.stroke();H.inflate(G*2)}function Aa(n){if(t!=n)i.fillStyle=t=n;i.fill()}function ua(n,G,z,p,v,M,W,X,Z,ga,ca,ha,va){var ea,ia;ea=W.width-1;ia=W.height-1;X*=ea;Z*=ia;ga*=ea;ca*=
|
||||
ia;ha*=ea;va*=ia;z-=n;p-=G;v-=n;M-=G;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*z-ca*v)*ia;ca=(va*p-ca*M)*ia;z=(ga*v-ha*z)*ia;p=(ga*M-ha*p)*ia;n=n-ea*X-z*Z;G=G-ca*X-p*Z;i.save();i.transform(ea,ca,z,p,n,G);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(n,G,z,p){var v=~~(n.r*255),M=~~(n.g*255);n=~~(n.b*255);var W=~~(G.r*255),X=~~(G.g*255);G=~~(G.b*255);var Z=~~(z.r*255),ga=~~(z.g*255);z=~~(z.b*255);var ca=~~(p.r*255),ha=~~(p.g*255);p=~~(p.b*255);ba[0]=v<0?0:v>255?255:v;ba[1]=
|
||||
M<0?0:M>255?255:M;ba[2]=n<0?0:n>255?255:n;ba[4]=W<0?0:W>255?255:W;ba[5]=X<0?0:X>255?255:X;ba[6]=G<0?0:G>255?255:G;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?255:ga;ba[10]=z<0?0:z>255?255:z;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=p<0?0:p>255?255:p;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(n,G,z){n=(n-G)/(z-G);return n*n*(3-2*n)}function Ea(n){n=(n+1)*0.5;return n<0?0:n>1?1:n}function Fa(n,G){var z=G.x-n.x,p=G.y-n.y,v=1/Math.sqrt(z*z+p*p);z*=v;p*=v;G.x+=
|
||||
p.normalWorld,Q);u.r=v.color.r*Q.r;u.g=v.color.g*Q.g;u.b=v.color.b*Q.b;u.updateStyleString();v.wireframe?za(u.__styleString,v.wireframeLinewidth):Aa(u.__styleString)}else v.wireframe?za(v.color.__styleString,v.wireframeLinewidth):Aa(v.color.__styleString)}else if(v instanceof THREE.MeshDepthMaterial){T=da.near;x=da.far;L.r=L.g=L.b=1-Da(n.positionScreen.z,T,x);E.r=E.g=E.b=1-Da(G.positionScreen.z,T,x);y.r=y.g=y.b=1-Da(z.positionScreen.z,T,x);B.r=(E.r+y.r)*0.5;B.g=(E.g+y.g)*0.5;B.b=(E.b+y.b)*0.5;P=Ia(L,
|
||||
E,y,B);ua(I,F,N,A,w,K,P,0,0,1,0,0,1)}else if(v instanceof THREE.MeshNormalMaterial){u.r=Ea(p.normalWorld.x);u.g=Ea(p.normalWorld.y);u.b=Ea(p.normalWorld.z);u.updateStyleString();v.wireframe?za(u.__styleString,v.wireframeLinewidth):Aa(u.__styleString)}}}function za(n,G){if(s!=n)i.strokeStyle=s=n;if(r!=G)i.lineWidth=r=G;i.stroke();H.inflate(G*2)}function Aa(n){if(t!=n)i.fillStyle=t=n;i.fill()}function ua(n,G,z,p,v,M,W,X,Z,ga,ca,ha,va){var ea,ia;ea=W.width-1;ia=W.height-1;X*=ea;Z*=ia;ga*=ea;ca*=ia;ha*=
|
||||
ea;va*=ia;z-=n;p-=G;v-=n;M-=G;ga-=X;ca-=Z;ha-=X;va-=Z;ea=ga*va-ha*ca;if(ea!=0){ia=1/ea;ea=(va*z-ca*v)*ia;ca=(va*p-ca*M)*ia;z=(ga*v-ha*z)*ia;p=(ga*M-ha*p)*ia;n=n-ea*X-z*Z;G=G-ca*X-p*Z;i.save();i.transform(ea,ca,z,p,n,G);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(n,G,z,p){var v=~~(n.r*255),M=~~(n.g*255);n=~~(n.b*255);var W=~~(G.r*255),X=~~(G.g*255);G=~~(G.b*255);var Z=~~(z.r*255),ga=~~(z.g*255);z=~~(z.b*255);var ca=~~(p.r*255),ha=~~(p.g*255);p=~~(p.b*255);ba[0]=v<0?0:v>255?255:v;ba[1]=M<0?
|
||||
0:M>255?255:M;ba[2]=n<0?0:n>255?255:n;ba[4]=W<0?0:W>255?255:W;ba[5]=X<0?0:X>255?255:X;ba[6]=G<0?0:G>255?255:G;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ga<0?0:ga>255?255:ga;ba[10]=z<0?0:z>255?255:z;ba[12]=ca<0?0:ca>255?255:ca;ba[13]=ha<0?0:ha>255?255:ha;ba[14]=p<0?0:p>255?255:p;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(n,G,z){n=(n-G)/(z-G);return n*n*(3-2*n)}function Ea(n){n=(n+1)*0.5;return n<0?0:n>1?1:n}function Fa(n,G){var z=G.x-n.x,p=G.y-n.y,v=1/Math.sqrt(z*z+p*p);z*=v;p*=v;G.x+=
|
||||
z;G.y+=p;n.x-=z;n.y-=p}var Ba,Ja,S,fa,qa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,g);c=d.projectScene(V,da,this.sortElements);(U=V.lights.length>0)&&Ma(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){S=c[Ba];H.empty();if(S instanceof THREE.RenderableParticle){k=S;k.x*=j;k.y*=g;fa=0;for(qa=S.materials.length;fa<qa;fa++)Na(k,S,S.materials[fa],V)}else if(S instanceof THREE.RenderableLine){k=S.v1;D=S.v2;k.positionScreen.x*=j;k.positionScreen.y*=g;D.positionScreen.x*=j;D.positionScreen.y*=g;
|
||||
H.addPoint(k.positionScreen.x,k.positionScreen.y);H.addPoint(D.positionScreen.x,D.positionScreen.y);if($.instersects(H)){fa=0;for(qa=S.materials.length;fa<qa;)Oa(k,D,S,S.materials[fa++],V)}}else if(S instanceof THREE.RenderableFace3){k=S.v1;D=S.v2;C=S.v3;k.positionScreen.x*=j;k.positionScreen.y*=g;D.positionScreen.x*=j;D.positionScreen.y*=g;C.positionScreen.x*=j;C.positionScreen.y*=g;if(S.overdraw){Fa(k.positionScreen,D.positionScreen);Fa(D.positionScreen,C.positionScreen);Fa(C.positionScreen,k.positionScreen)}H.add3Points(k.positionScreen.x,
|
||||
k.positionScreen.y,D.positionScreen.x,D.positionScreen.y,C.positionScreen.x,C.positionScreen.y);if($.instersects(H)){fa=0;for(qa=S.meshMaterials.length;fa<qa;){wa=S.meshMaterials[fa++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=S.faceMaterials.length;Ga<Ka;)(wa=S.faceMaterials[Ga++])&&Ha(k,D,C,S,wa,V)}else Ha(k,D,C,S,wa,V)}}}O.addRectangle(H)}i.setTransform(1,0,0,1,0,0)}};
|
||||
|
||||
@@ -48,7 +48,7 @@ b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this
|
||||
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
||||
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
|
||||
multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,l=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+l*-i-m*-g;b.y=l*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-l*-f;return b}};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
||||
THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
|
||||
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
|
||||
|
||||
+21
-20
@@ -5,23 +5,23 @@ d);d=g.loadCount=0;for(f=a.length;d<f;++d){g[d]=new Image;g[d].onload=function()
|
||||
z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=t.visible;F.scene.addObject(object);F.objects[m]=object}}}function e(P){return function(Q){F.geometries[P]=Q;c();H-=1;h()}}function h(){f({total_models:K,total_textures:M,loaded_models:K-H,loaded_textures:M-I},F);H==0&&I==0&&b(F)}var j,l,m,v,q,n,p,t,z,w,x,k,D,E,J,A,C,H,I,K,M,F;A=g.data;C=new THREE.Loader;I=H=0;F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
|
||||
fogs:{}};g=function(){I-=1;h()};for(q in A.cameras){w=A.cameras[q];if(w.type=="perspective")D=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){D=new THREE.Camera;D.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}z=w.position;w=w.target;D.position.set(z[0],z[1],z[2]);D.target.position.set(w[0],w[1],w[2]);F.cameras[q]=D}for(v in A.lights){q=A.lights[v];if(q.type=="directional"){z=q.direction;light=new THREE.DirectionalLight;light.position.set(z[0],
|
||||
z[1],z[2]);light.position.normalize()}else if(q.type=="point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}w=q.color;i=q.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);F.scene.addLight(light);F.lights[v]=light}for(n in A.fogs){v=A.fogs[n];if(v.type=="linear")E=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(E=new THREE.FogExp2(0,v.density));w=v.color;E.color.setRGB(w[0],w[1],w[2]);F.fogs[n]=E}if(F.cameras&&A.defaults.camera)F.currentCamera=F.cameras[A.defaults.camera];
|
||||
if(F.fogs&&A.defaults.fog)F.scene.fog=F.fogs[A.defaults.fog];w=A.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(w[0],w[1],w[2]);F.bgColorAlpha=A.defaults.bgalpha;for(j in A.geometries){n=A.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")H+=1}K=H;for(j in A.geometries){n=A.geometries[j];if(n.type=="cube"){k=new Cube(n.width,n.height,n.depth,n.segments_width,n.segments_height,null,n.flipped,n.sides);F.geometries[j]=k}else if(n.type=="plane"){k=new Plane(n.width,n.height,n.segments_width,
|
||||
n.segments_height);F.geometries[j]=k}else if(n.type=="sphere"){k=new Sphere(n.radius,n.segments_width,n.segments_height);F.geometries[j]=k}else if(n.type=="cylinder"){k=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);F.geometries[j]=k}else if(n.type=="torus"){k=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);F.geometries[j]=k}else if(n.type=="icosahedron"){k=new Icosahedron(n.subdivisions);F.geometries[j]=k}else if(n.type=="bin_mesh")C.loadBinary({model:n.url,callback:e(j)});
|
||||
else n.type=="ascii_mesh"&&C.loadAscii({model:n.url,callback:e(j)})}for(p in A.textures){j=A.textures[p];I+=j.url instanceof Array?j.url.length:1}M=I;for(p in A.textures){j=A.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)n=ImageUtils.loadTextureCube(j.url,j.mapping,g);else{n=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.min_filter]!=undefined)n.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=undefined)n.mag_filter=
|
||||
THREE[j.mag_filter]}F.textures[p]=n}for(l in A.materials){p=A.materials[l];for(x in p.parameters)if(x=="env_map"||x=="map"||x=="light_map")p.parameters[x]=F.textures[p.parameters[x]];else if(x=="shading")p.parameters[x]=p.parameters[x]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(x=="blending")p.parameters[x]=THREE[p.parameters[x]]?THREE[p.parameters[x]]:THREE.NormalBlending;else x=="combine"&&(p.parameters[x]=p.parameters[x]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);p=
|
||||
new THREE[p.type](p.parameters);F.materials[l]=p}c();d(F)}},addMesh:function(a,d,b,f,g,c,e,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=f;d.position.y=g;d.position.z=c;d.rotation.x=e;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragment_shader:f.fragment_shader,vertex_shader:f.vertex_shader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,
|
||||
d,d,1,1,null,!0),b);a.addObject(d);return d},addPanoramaCube:function(a,d,b){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new Cube(d,
|
||||
d,d,1,1,f,!0),new THREE.MeshFaceMaterial);a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var f=d/2;d=new Plane(d,d);var g=Math.PI,c=Math.PI/2;SceneUtils.addMesh(a,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,d,1,-f,0,0,0,c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,d,1,f,0,0,0,-c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,d,1,0,f,0,c,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
|
||||
SceneUtils.addMesh(a,d,1,0,-f,0,-c,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
||||
vertex_shader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
||||
if(F.fogs&&A.defaults.fog)F.scene.fog=F.fogs[A.defaults.fog];w=A.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(w[0],w[1],w[2]);F.bgColorAlpha=A.defaults.bgalpha;for(j in A.geometries){n=A.geometries[j];if(n.type=="bin_mesh"||n.type=="ascii_mesh")H+=1}K=H;for(j in A.geometries){n=A.geometries[j];if(n.type=="cube"){k=new Cube(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,null,n.flipped,n.sides);F.geometries[j]=k}else if(n.type=="plane"){k=new Plane(n.width,n.height,n.segmentsWidth,
|
||||
n.segmentsHeight);F.geometries[j]=k}else if(n.type=="sphere"){k=new Sphere(n.radius,n.segmentsWidth,n.segmentsHeight);F.geometries[j]=k}else if(n.type=="cylinder"){k=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);F.geometries[j]=k}else if(n.type=="torus"){k=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);F.geometries[j]=k}else if(n.type=="icosahedron"){k=new Icosahedron(n.subdivisions);F.geometries[j]=k}else if(n.type=="bin_mesh")C.loadBinary({model:n.url,callback:e(j)});
|
||||
else n.type=="ascii_mesh"&&C.loadAscii({model:n.url,callback:e(j)})}for(p in A.textures){j=A.textures[p];I+=j.url instanceof Array?j.url.length:1}M=I;for(p in A.textures){j=A.textures[p];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)n=ImageUtils.loadTextureCube(j.url,j.mapping,g);else{n=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.minFilter]!=undefined)n.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)n.magFilter=
|
||||
THREE[j.magFilter]}F.textures[p]=n}for(l in A.materials){p=A.materials[l];for(x in p.parameters)if(x=="envMap"||x=="map"||x=="lightMap")p.parameters[x]=F.textures[p.parameters[x]];else if(x=="shading")p.parameters[x]=p.parameters[x]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(x=="blending")p.parameters[x]=THREE[p.parameters[x]]?THREE[p.parameters[x]]:THREE.NormalBlending;else x=="combine"&&(p.parameters[x]=p.parameters[x]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);p=new THREE[p.type](p.parameters);
|
||||
F.materials[l]=p}c();d(F)}},addMesh:function(a,d,b,f,g,c,e,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=f;d.position.y=g;d.position.z=c;d.rotation.x=e;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,null,!0),b);a.addObject(d);
|
||||
return d},addPanoramaCube:function(a,d,b){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new Cube(d,d,d,1,1,f,!0),new THREE.MeshFaceMaterial);
|
||||
a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var f=d/2;d=new Plane(d,d);var g=Math.PI,c=Math.PI/2;SceneUtils.addMesh(a,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,d,1,-f,0,0,0,c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,d,1,f,0,0,0,-c,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,d,1,0,f,0,c,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
|
||||
SceneUtils.addMesh(a,d,1,0,-f,0,-c,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
||||
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
||||
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
|
||||
uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragment_shader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
|
||||
vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
|
||||
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
|
||||
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
||||
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
||||
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
||||
fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,f,g,c=2*Math.ceil(a*3)+1;c>25&&(c=25);g=(c-1)*0.5;b=Array(c);for(d=f=0;d<c;++d){b[d]=Math.exp(-((d-g)*(d-g))/(2*a*a));f+=b[d]}for(d=0;d<c;++d)b[d]/=f;return b}},Cube=function(a,d,b,f,g,c,e,h){function j(t,z,w,x,k,D,E,J){var A,C,H=f||1,I=g||1,K=H+1,M=I+1,F=k/2,P=D/2;k/=H;var Q=D/I,R=l.vertices.length;if(t=="x"&&z=="y"||t=="y"&&z=="x")A="z";else if(t=="x"&&z=="z"||t=="z"&&z=="x")A="y";else if(t==
|
||||
uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
|
||||
vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
|
||||
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
|
||||
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
|
||||
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
|
||||
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
||||
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var d,b,f,g,c=2*Math.ceil(a*3)+1;c>25&&(c=25);g=(c-1)*0.5;b=Array(c);for(d=f=0;d<c;++d){b[d]=Math.exp(-((d-g)*(d-g))/(2*a*a));f+=b[d]}for(d=0;d<c;++d)b[d]/=f;return b}},Cube=function(a,d,b,f,g,c,e,h){function j(t,z,w,x,k,D,E,J){var A,C,H=f||1,I=g||1,K=H+1,M=I+1,F=k/2,P=D/2;k/=H;var Q=D/I,R=l.vertices.length;if(t=="x"&&z=="y"||t=="y"&&z=="x")A="z";else if(t=="x"&&z=="z"||t=="z"&&z=="x")A="y";else if(t==
|
||||
"z"&&z=="y"||t=="y"&&z=="z")A="x";for(C=0;C<M;C++)for(D=0;D<K;D++){var S=new THREE.Vector3;S[t]=(D*k-F)*w;S[z]=(C*Q-P)*x;S[A]=E;l.vertices.push(new THREE.Vertex(S))}for(C=0;C<I;C++)for(D=0;D<H;D++){l.faces.push(new THREE.Face4(D+K*C+R,D+K*(C+1)+R,D+1+K*(C+1)+R,D+1+K*C+R,null,J));l.uvs.push([new THREE.UV(D/H,C/I),new THREE.UV(D/H,(C+1)/I),new THREE.UV((D+1)/H,(C+1)/I),new THREE.UV((D+1)/H,C/I)])}}THREE.Geometry.call(this);var l=this,m=a/2,v=d/2,q=b/2;e=e?-1:1;if(c!==undefined)if(c instanceof Array)this.materials=
|
||||
c;else{this.materials=[];for(var n=0;n<6;n++)this.materials.push([c])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=undefined)for(var p in h)this.sides[p]!=undefined&&(this.sides[p]=h[p]);this.sides.px&&j("z","y",1*e,-1,b,d,-m,this.materials[0]);this.sides.nx&&j("z","y",-1*e,-1,b,d,m,this.materials[1]);this.sides.py&&j("x","z",1*e,1,a,b,v,this.materials[2]);this.sides.ny&&j("x","z",1*e,-1,a,b,-v,this.materials[3]);this.sides.pz&&j("x","y",1*e,-1,a,d,q,this.materials[4]);
|
||||
this.sides.nz&&j("x","y",-1*e,-1,a,d,-q,this.materials[5]);(function(){for(var t=[],z=[],w=0,x=l.vertices.length;w<x;w++){for(var k=l.vertices[w],D=!1,E=0,J=t.length;E<J;E++){var A=t[E];if(k.position.x==A.position.x&&k.position.y==A.position.y&&k.position.z==A.position.z){z[w]=E;D=!0;break}}if(!D){z[w]=t.length;t.push(new THREE.Vertex(k.position.clone()))}}w=0;for(x=l.faces.length;w<x;w++){k=l.faces[w];k.a=z[k.a];k.b=z[k.b];k.c=z[k.c];k.d=z[k.d]}l.vertices=t})();this.computeCentroids();this.computeFaceNormals();
|
||||
@@ -38,8 +38,9 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
|
||||
var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=g.vertices[v].position,p=g.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var g=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
|
||||
1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var h in c.faces){var j=f(c.faces[h].a,c.faces[h].b),l=f(c.faces[h].b,c.faces[h].c),m=f(c.faces[h].c,c.faces[h].a);b(c.faces[h].a,j,m,e);b(c.faces[h].b,l,j,e);b(c.faces[h].c,
|
||||
m,l,e);b(j,l,m,e)}c.faces=e.faces}g.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
|
||||
function LathedObject(a,d,b){THREE.Geometry.call(this);b=b||2*Math.PI;d=b/(d||12);for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(d),l=0;l<=b+0.001;l+=d){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],
|
||||
c[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
||||
function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.0010;l+=this.stepSize){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));
|
||||
c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
|
||||
if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
|
||||
THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
||||
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,f,g){return b+(f-b)*g};this.VIntX=function(b,f,g,c,e,h,j,l,m,v){e=(e-m)/(v-m);m=this.normal_cache;f[c]=h+e*this.delta;f[c+1]=j;f[c+2]=l;g[c]=this.lerp(m[b],m[b+3],e);g[c+1]=this.lerp(m[b+1],m[b+4],e);g[c+2]=this.lerp(m[b+2],m[b+5],e)};this.VIntY=function(b,f,g,c,e,h,j,l,m,v){e=(e-m)/(v-m);m=this.normal_cache;f[c]=h;f[c+1]=j+e*this.delta;f[c+
|
||||
2]=l;f=b+this.yd*3;g[c]=this.lerp(m[b],m[f],e);g[c+1]=this.lerp(m[b+1],m[f+1],e);g[c+2]=this.lerp(m[b+2],m[f+2],e)};this.VIntZ=function(b,f,g,c,e,h,j,l,m,v){e=(e-m)/(v-m);m=this.normal_cache;f[c]=h;f[c+1]=j;f[c+2]=l+e*this.delta;f=b+this.zd*3;g[c]=this.lerp(m[b],m[f],e);g[c+1]=this.lerp(m[b+1],m[f+1],e);g[c+2]=this.lerp(m[b+2],m[f+2],e)};this.compNorm=function(b){var f=b*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[b-1]-this.field[b+1];this.normal_cache[f+1]=this.field[b-this.yd]-
|
||||
@@ -101,5 +102,5 @@ a.bones);THREE.Loader.prototype.animation(c,a.animation)})();this.computeCentroi
|
||||
vc:function(a,d,b,f){var g=new THREE.Color(16777215);g.setRGB(d,b,f);a.colors.push(g)},f3:function(a,d,b,f,g){a.faces.push(new THREE.Face3(d,b,f,null,a.materials[g]))},f4:function(a,d,b,f,g,c){a.faces.push(new THREE.Face4(d,b,f,g,null,a.materials[c]))},f3n:function(a,d,b,f,g,c,e,h,j){c=a.materials[c];var l=d[h*3],m=d[h*3+1];h=d[h*3+2];var v=d[j*3],q=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,f,g,[new THREE.Vector3(d[e*3],d[e*3+1],d[e*3+2]),new THREE.Vector3(l,m,h),new THREE.Vector3(v,q,j)],
|
||||
c))},f4n:function(a,d,b,f,g,c,e,h,j,l,m){e=a.materials[e];var v=d[j*3],q=d[j*3+1];j=d[j*3+2];var n=d[l*3],p=d[l*3+1];l=d[l*3+2];var t=d[m*3],z=d[m*3+1];m=d[m*3+2];a.faces.push(new THREE.Face4(b,f,g,c,[new THREE.Vector3(d[h*3],d[h*3+1],d[h*3+2]),new THREE.Vector3(v,q,j),new THREE.Vector3(n,p,l),new THREE.Vector3(t,z,m)],e))},uv3:function(a,d,b,f,g,c,e){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(f,g));h.push(new THREE.UV(c,e));a.push(h)},uv4:function(a,d,b,f,g,c,e,h,j){var l=[];l.push(new THREE.UV(d,
|
||||
b));l.push(new THREE.UV(f,g));l.push(new THREE.UV(c,e));l.push(new THREE.UV(h,j));a.push(l)},init_materials:function(a,d,b){a.materials=[];for(var f=0;f<d.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function f(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var m=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/
|
||||
Math.LN2));h.image.width=m;h.image.height=v;h.image.getContext("2d").drawImage(this,0,0,m,v)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,c,e;g="MeshLambertMaterial";c={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.map_diffuse&&d){e=document.createElement("canvas");c.map=new THREE.Texture(e);f(c.map,d+"/"+a.map_diffuse)}else if(a.col_diffuse){e=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
|
||||
255;c.color=e;c.opacity=a.transparency}else if(a.a_dbg_color)c.color=a.a_dbg_color;if(a.map_lightmap&&d){e=document.createElement("canvas");c.light_map=new THREE.Texture(e);f(c.light_map,d+"/"+a.map_lightmap)}return new THREE[g](c)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
||||
Math.LN2));h.image.width=m;h.image.height=v;h.image.getContext("2d").drawImage(this,0,0,m,v)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,c,e;g="MeshLambertMaterial";c={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.map_diffuse&&d){e=document.createElement("canvas");c.map=new THREE.Texture(e);f(c.map,d+"/"+a.map_diffuse)}else if(a.col_diffuse){e=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
|
||||
255;c.color=e;c.opacity=a.transparency}else if(a.a_dbg_color)c.color=a.a_dbg_color;if(a.map_lightmap&&d){e=document.createElement("canvas");c.lightMap=new THREE.Texture(e);f(c.lightMap,d+"/"+a.map_lightmap)}return new THREE[g](c)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|
||||
|
||||
+21
-21
@@ -48,7 +48,7 @@ b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this
|
||||
THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
||||
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
|
||||
multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
|
||||
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
||||
THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
|
||||
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
||||
@@ -72,24 +72,24 @@ THREE.Camera.prototype.frustumContains=function(a){var b=a.matrixWorld.n14,c=a.m
|
||||
if(b+f<-this.screenCenterY)return!1;if(b-f>this.screenCenterY)return!1;a.positionScreen.set(n,b,g,f);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
||||
THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
||||
THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
||||
this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
||||
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
||||
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
||||
undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
|
||||
this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
|
||||
undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
|
||||
undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
||||
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
||||
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
||||
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
||||
@@ -119,9 +119,9 @@ C.w);j=m[n]=m[n]||new THREE.RenderableLine;j.v1.positionScreen.copy(y);j.v2.posi
|
||||
Math.abs(l.y-(t.y+v.projectionMatrix.n22)/(t.w+v.projectionMatrix.n24));l.materials=A.materials;E.push(l);o++}}}}I&&E.sort(a);return E};this.unprojectVector=function(z,v){var I=THREE.Matrix4.makeInvert(v.matrixWorld);I.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));I.multiplyVector3(z);return z}};
|
||||
THREE.SVGRenderer=function(){function a(F,A,O){var Q,B,w,M;Q=0;for(B=F.lights.length;Q<B;Q++){w=F.lights[Q];if(w instanceof THREE.DirectionalLight){M=A.normalWorld.dot(w.position)*w.intensity;if(M>0){O.r+=w.color.r*M;O.g+=w.color.g*M;O.b+=w.color.b*M}}else if(w instanceof THREE.PointLight){I.sub(w.position,A.centroidWorld);I.normalize();M=A.normalWorld.dot(I)*w.intensity;if(M>0){O.r+=w.color.r*M;O.g+=w.color.g*M;O.b+=w.color.b*M}}}}function b(F,A,O,Q,B,w){u=d(D++);u.setAttribute("d","M "+F.positionScreen.x+
|
||||
" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)p.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(H){y.r=C.r;y.g=C.g;y.b=C.b;a(w,Q,y);p.r=B.color.r*y.r;p.g=B.color.g*y.g;p.b=B.color.b*y.b;p.updateStyleString()}else p.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){v=1-B.__2near/(B.__farPlusNear-Q.z*B.__farMinusNear);
|
||||
p.setRGB(v,v,v)}else B instanceof THREE.MeshNormalMaterial&&p.setRGB(e(Q.normalWorld.x),e(Q.normalWorld.y),e(Q.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):u.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+B.opacity);i.appendChild(u)}function c(F,A,O,Q,B,w,M){u=d(D++);u.setAttribute("d",
|
||||
p.setRGB(v,v,v)}else B instanceof THREE.MeshNormalMaterial&&p.setRGB(e(Q.normalWorld.x),e(Q.normalWorld.y),e(Q.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):u.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+B.opacity);i.appendChild(u)}function c(F,A,O,Q,B,w,M){u=d(D++);u.setAttribute("d",
|
||||
"M "+F.positionScreen.x+" "+F.positionScreen.y+" L "+A.positionScreen.x+" "+A.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+"z");if(w instanceof THREE.MeshBasicMaterial)p.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshLambertMaterial)if(H){y.r=C.r;y.g=C.g;y.b=C.b;a(M,B,y);p.r=w.color.r*y.r;p.g=w.color.g*y.g;p.b=w.color.b*y.b;p.updateStyleString()}else p.__styleString=w.color.__styleString;else if(w instanceof THREE.MeshDepthMaterial){v=
|
||||
1-w.__2near/(w.__farPlusNear-B.z*w.__farMinusNear);p.setRGB(v,v,v)}else w instanceof THREE.MeshNormalMaterial&&p.setRGB(e(B.normalWorld.x),e(B.normalWorld.y),e(B.normalWorld.z));w.wireframe?u.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+w.wireframe_linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframe_linecap+"; stroke-linejoin: "+w.wireframe_linejoin):u.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+w.opacity);i.appendChild(u)}
|
||||
1-w.__2near/(w.__farPlusNear-B.z*w.__farMinusNear);p.setRGB(v,v,v)}else w instanceof THREE.MeshNormalMaterial&&p.setRGB(e(B.normalWorld.x),e(B.normalWorld.y),e(B.normalWorld.z));w.wireframe?u.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+w.wireframeLinewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.wireframeLinecap+"; stroke-linejoin: "+w.wireframeLinejoin):u.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+w.opacity);i.appendChild(u)}
|
||||
function d(F){if(E[F]==null){E[F]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&E[F].setAttribute("shape-rendering","crispEdges")}return E[F]}function e(F){return F<0?Math.min((1+F)*0.5,0.5):0.5+Math.min(F*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,n,m,l,o,q,s,t=new THREE.Rectangle,k=new THREE.Rectangle,H=!1,p=new THREE.Color(16777215),y=new THREE.Color(16777215),C=new THREE.Color(0),L=new THREE.Color(0),z=new THREE.Color(0),
|
||||
v,I=new THREE.Vector3,E=[],K=[],J=[],u,D,S,x,N=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(F){switch(F){case "high":N=1;break;case "low":N=0}};this.setSize=function(F,A){h=F;j=A;n=h/2;m=j/2;i.setAttribute("viewBox",-n+" "+-m+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);t.set(-n,-m,n,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(F,A){var O,Q,B,w,M,P,r,G;this.autoClear&&
|
||||
this.clear();f=g.projectScene(F,A,this.sortElements);x=S=D=0;if(H=F.lights.length>0){r=F.lights;C.setRGB(0,0,0);L.setRGB(0,0,0);z.setRGB(0,0,0);O=0;for(Q=r.length;O<Q;O++){B=r[O];w=B.color;if(B instanceof THREE.AmbientLight){C.r+=w.r;C.g+=w.g;C.b+=w.b}else if(B instanceof THREE.DirectionalLight){L.r+=w.r;L.g+=w.g;L.b+=w.b}else if(B instanceof THREE.PointLight){z.r+=w.r;z.g+=w.g;z.b+=w.b}}}O=0;for(Q=f.length;O<Q;O++){r=f[O];k.empty();if(r instanceof THREE.RenderableParticle){l=r;l.x*=n;l.y*=-m;B=0;
|
||||
|
||||
+57
-57
@@ -49,7 +49,7 @@ b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this
|
||||
THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var i=Math.cos(d);d=Math.sin(d);var j=a*b,m=e*g;this.w=j*i-m*d;this.x=j*d+m*i;this.y=e*b*i+a*g*d;this.z=a*g*i-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
||||
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,i=a.x,j=a.y,m=a.z;a=a.w;this.x=b*a+g*i+d*m-e*j;this.y=d*a+g*j+e*i-b*m;this.z=e*a+g*m+b*j-d*i;this.w=g*a-b*i-d*j-e*m;return this},
|
||||
multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,i=this.x,j=this.y,m=this.z,k=this.w,s=k*d+j*g-m*e,w=k*e+m*d-i*g,x=k*g+i*e-j*d;d=-i*d-j*e-m*g;b.x=s*k+d*-i+w*-m-x*-j;b.y=w*k+d*-j+x*-i-s*-m;b.z=x*k+d*-m+s*-j-w*-i;return b}};
|
||||
THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
|
||||
THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var i=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
|
||||
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
|
||||
THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,i){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};
|
||||
THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
||||
@@ -73,31 +73,31 @@ THREE.Camera.prototype.frustumContains=function(a){var b=a.matrixWorld.n14,d=a.m
|
||||
if(b+i<-this.screenCenterY)return!1;if(b-i>this.screenCenterY)return!1;a.positionScreen.set(w,b,j,i);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
||||
THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
||||
THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
||||
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
||||
undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
||||
this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
||||
if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
||||
if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
||||
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
||||
a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
||||
undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==
|
||||
undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)}};
|
||||
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
||||
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
||||
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
||||
this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
|
||||
a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
|
||||
this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
|
||||
undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
|
||||
undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
|
||||
THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
|
||||
undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
|
||||
THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader=
|
||||
a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==
|
||||
undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
||||
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
|
||||
undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
||||
THREE.Texture=function(a,b,d,e,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=i!==undefined?i:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
|
||||
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
|
||||
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
||||
THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
||||
THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
||||
var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
|
||||
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
||||
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
||||
@@ -115,22 +115,22 @@ THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light
|
||||
THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
||||
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,g=d.length;for(e=0;e<g;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
|
||||
THREE.WebGLRenderer=function(a){function b(f,o,n){var h,l,v,r=f.vertices,q=r.length,t=f.colors,G=t.length,F=f.__vertexArray,I=f.__colorArray,S=f.__sortArray,y=f.__dirtyVertices,M=f.__dirtyColors;if(n.sortParticles){qa.multiplySelf(n.matrixWorld);for(h=0;h<q;h++){l=r[h].position;Aa.copy(l);qa.multiplyVector3(Aa);S[h]=[Aa.z,h]}S.sort(function(ea,Z){return Z[0]-ea[0]});for(h=0;h<q;h++){l=r[S[h][1]].position;v=h*3;F[v]=l.x;F[v+1]=l.y;F[v+2]=l.z}for(h=0;h<G;h++){v=h*3;color=t[S[h][1]];I[v]=color.r;I[v+
|
||||
1]=color.g;I[v+2]=color.b}}else{if(y)for(h=0;h<q;h++){l=r[h].position;v=h*3;F[v]=l.x;F[v+1]=l.y;F[v+2]=l.z}if(M)for(h=0;h<G;h++){color=t[h];v=h*3;I[v]=color.r;I[v+1]=color.g;I[v+2]=color.b}}if(y||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,F,o)}if(M||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,I,o)}}function d(f,o){f.fragment_shader=o.fragment_shader;f.vertex_shader=o.vertex_shader;f.uniforms=Uniforms.clone(o.uniforms)}
|
||||
1]=color.g;I[v+2]=color.b}}else{if(y)for(h=0;h<q;h++){l=r[h].position;v=h*3;F[v]=l.x;F[v+1]=l.y;F[v+2]=l.z}if(M)for(h=0;h<G;h++){color=t[h];v=h*3;I[v]=color.r;I[v+1]=color.g;I[v+2]=color.b}}if(y||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,F,o)}if(M||n.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,I,o)}}function d(f,o){f.fragmentShader=o.fragmentShader;f.vertexShader=o.vertexShader;f.uniforms=Uniforms.clone(o.uniforms)}
|
||||
function e(f,o,n,h,l){h.program||ca.initMaterial(h,o,n);var v=h.program,r=v.uniforms,q=h.uniforms;if(v!=aa){c.useProgram(v);aa=v;c.uniformMatrix4fv(r.projectionMatrix,!1,va)}if(n&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){q.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){q.fogNear.value=n.near;q.fogFar.value=n.far}else if(n instanceof
|
||||
THREE.FogExp2)q.fogDensity.value=n.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var t,G,F=0,I=0,S=0,y,M,ea,Z=ca.lights,Q=Z.directional.colors,O=Z.directional.positions,N=Z.point.colors,ra=Z.point.positions,u=0,ma=0;n=G=G=0;for(t=o.length;n<t;n++){G=o[n];y=G.color;M=G.position;ea=G.intensity;if(G instanceof THREE.AmbientLight){F+=y.r;I+=y.g;S+=y.b}else if(G instanceof THREE.DirectionalLight){G=u*3;Q[G]=y.r*ea;Q[G+1]=y.g*ea;Q[G+2]=y.b*ea;O[G]=M.x;O[G+1]=M.y;
|
||||
O[G+2]=M.z;u+=1}else if(G instanceof THREE.PointLight){G=ma*3;N[G]=y.r*ea;N[G+1]=y.g*ea;N[G+2]=y.b*ea;ra[G]=M.x;ra[G+1]=M.y;ra[G+2]=M.z;ma+=1}}for(n=u*3;n<Q.length;n++)Q[n]=0;for(n=ma*3;n<N.length;n++)N[n]=0;Z.point.length=ma;Z.directional.length=u;Z.ambient[0]=F;Z.ambient[1]=I;Z.ambient[2]=S;o=ca.lights;q.enableLighting.value=o.directional.length+o.point.length;q.ambientLightColor.value=o.ambient;q.directionalLightColor.value=o.directional.colors;q.directionalLightDirection.value=o.directional.positions;
|
||||
q.pointLightColor.value=o.point.colors;q.pointLightPosition.value=o.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.map.texture=h.map;q.light_map.texture=h.light_map;q.env_map.texture=h.env_map;q.reflectivity.value=h.reflectivity;q.refraction_ratio.value=h.refraction_ratio;q.combine.value=h.combine;q.useRefract.value=
|
||||
h.env_map&&h.env_map.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){q.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.size.value=h.size;q.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){q.ambient.value.setRGB(h.ambient.r,h.ambient.g,
|
||||
q.pointLightColor.value=o.point.colors;q.pointLightPosition.value=o.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.map.texture=h.map;q.lightMap.texture=h.lightMap;q.envMap.texture=h.envMap;q.reflectivity.value=h.reflectivity;q.refractionRatio.value=h.refractionRatio;q.combine.value=h.combine;q.useRefract.value=
|
||||
h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){q.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){q.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);q.opacity.value=h.opacity;q.size.value=h.size;q.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){q.ambient.value.setRGB(h.ambient.r,h.ambient.g,
|
||||
h.ambient.b);q.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);q.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){q.mNear.value=f.near;q.mFar.value=f.far;q.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)q.opacity.value=h.opacity;for(var ka in q)if(F=v.uniforms[ka]){n=q[ka];t=n.type;o=n.value;if(t=="i")c.uniform1i(F,o);else if(t=="f")c.uniform1f(F,o);else if(t=="fv1")c.uniform1fv(F,o);else if(t=="fv")c.uniform3fv(F,o);else if(t=="v2")c.uniform2f(F,
|
||||
o.x,o.y);else if(t=="v3")c.uniform3f(F,o.x,o.y,o.z);else if(t=="c")c.uniform3f(F,o.r,o.g,o.b);else if(t=="t"){c.uniform1i(F,o);if(n=n.texture)if(n.image instanceof Array&&n.image.length==6){if(n.image.length==6){if(n.needsUpdate){if(!n.image.__webGLTextureCube)n.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);
|
||||
c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(t=0;t<6;++t)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image[t]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_CUBE_MAP,n.image.__webGLTextureCube)}}else{if(n.needsUpdate){if(n.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
|
||||
n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(n.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(n.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(n.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(n.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{n.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
|
||||
0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(n.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(n.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(n.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(n.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);n.__wasSetOnce=!0}n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(r.modelViewMatrix,
|
||||
!1,l._modelViewMatrixArray);c.uniformMatrix3fv(r.normalMatrix,!1,l._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.env_map)&&c.uniform3f(r.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.env_map||h.skinning)&&c.uniformMatrix4fv(r.objectMatrix,!1,l._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(r.viewMatrix,
|
||||
n.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(n.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(n.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(n.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(n.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{n.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
|
||||
0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,n.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(n.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(n.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(n.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(n.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);n.__wasSetOnce=!0}n.needsUpdate=!1}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_2D,n.__webGLTexture)}}}c.uniformMatrix4fv(r.modelViewMatrix,
|
||||
!1,l._modelViewMatrixArray);c.uniformMatrix3fv(r.normalMatrix,!1,l._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.envMap)&&c.uniform3f(r.cameraPosition,f.position.x,f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(r.objectMatrix,!1,l._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(r.viewMatrix,
|
||||
!1,Ha);if(h.skinning){c.uniformMatrix4fv(r.cameraInverseMatrix,!1,wa);c.uniformMatrix4fv(r.boneGlobalMatrices,!1,l.boneMatrices)}return v}function g(f,o,n,h,l,v){f=e(f,o,n,h,v).attributes;c.bindBuffer(c.ARRAY_BUFFER,l.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
|
||||
3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(l.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(l.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
|
||||
if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
|
||||
4,c.FLOAT,!1,0,0)}if(v instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframe_linewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);c.drawElements(c.LINES,l.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,l.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(v instanceof THREE.Line){v=v.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(v,0,l.__webGLLineCount)}else if(v instanceof
|
||||
4,c.FLOAT,!1,0,0)}if(v instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);c.drawElements(c.LINES,l.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,l.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(v instanceof THREE.Line){v=v.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(v,0,l.__webGLLineCount)}else if(v instanceof
|
||||
THREE.ParticleSystem)c.drawArrays(c.POINTS,0,l.__webGLParticleCount);else v instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,l.__webGLVertexCount)}function i(f,o){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(o.attributes.position);c.vertexAttribPointer(o.attributes.position,
|
||||
3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(o.attributes.normal);c.vertexAttribPointer(o.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function j(f){if(ga!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);ga=f.doubleSided}if(da!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);da=f.flipSided}}function m(f){if(na!=
|
||||
f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);na=f}}function k(f){$[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);$[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);$[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);$[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);$[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);$[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var o;for(f=0;f<6;f++){o=$[f];o.divideScalar(Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z))}}
|
||||
@@ -138,23 +138,23 @@ function s(f){for(var o=f.matrixWorld,n=-f.geometry.boundingSphere.radius*Math.m
|
||||
q=f.opaque,t=f.transparent;t.count=0;f=q.count=0;for(h=v.materials.length;f<h;f++){o=v.materials[f];if(o instanceof THREE.MeshFaceMaterial){o=0;for(n=r.materials.length;o<n;o++)(l=r.materials[o])&&(l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(t,l):w(q,l))}else{l=o;l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(t,l):w(q,l)}}}function A(f,o){return o.z-f.z}function E(f,o,n,h,l){if(o[n]==undefined){f.push({buffer:h,object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}});
|
||||
o[n]=1}}function H(f,o){f._modelViewMatrix.multiplyToArray(o.matrixWorld,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function K(f){if(f!=ja){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;
|
||||
case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ja=f}}function J(f,o){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,
|
||||
f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(f.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(f.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(f.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(f.min_filter));c.texImage2D(c.TEXTURE_2D,0,L(f.format),f.width,f.height,0,L(f.format),L(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);
|
||||
c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var n,h,l;if(f){n=f.__webGLFramebuffer;h=f.width;l=f.height}else{n=null;h=P.width;l=P.height}if(n!=ba){c.bindFramebuffer(c.FRAMEBUFFER,n);c.viewport(0,0,h,l);o&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);ba=n}}function R(f,o){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f==
|
||||
"vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,o);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function L(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;
|
||||
case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;
|
||||
case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var P=document.createElement("canvas"),c,aa=null,ba=null,ca=this,ga=null,da=null,ja=null,na=null,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,va=new Float32Array(16),wa=new Float32Array(16),Ha=new Float32Array(16),Aa=new THREE.Vector4,
|
||||
Ia=!0,Oa=new THREE.Color(0),Pa=0;if(a){if(a.antialias!==undefined)Ia=a.antialias;a.clearColor!==undefined&&Oa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Pa=a.clearAlpha}this.domElement=P;this.autoClear=!0;this.sortObjects=!1;(function(f,o,n){try{c=P.getContext("experimental-webgl",{antialias:f})}catch(h){console.log(h)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);
|
||||
c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(o.r,o.g,o.b,n);_cullEnabled=!0})(Ia,Oa,Pa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,o){P.width=f;P.height=o;c.viewport(0,0,P.width,P.height)};this.setClearColorHex=function(f,o){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,o)};this.setClearColor=function(f,o){c.clearColor(f.r,f.g,f.b,o)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
|
||||
c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,o,n){var h,l;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof
|
||||
THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var v,r,q,t;l=q=t=0;for(v=o.length;l<v;l++){r=o[l];r instanceof THREE.DirectionalLight&&q++;r instanceof THREE.PointLight&&t++}if(t+q<=4)o=q;else{o=Math.ceil(4*q/(t+q));t=4-o}l={directional:o,point:t};t=f.fragment_shader;o=f.vertex_shader;v={fog:n,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:l.directional,maxPointLights:l.point};n=c.createProgram();l=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
||||
"#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+
|
||||
v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
||||
f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,L(f.format),f.width,f.height,0,L(f.format),L(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,
|
||||
c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var n,h,l;if(f){n=f.__webGLFramebuffer;h=f.width;l=f.height}else{n=null;h=P.width;l=P.height}if(n!=ba){c.bindFramebuffer(c.FRAMEBUFFER,n);c.viewport(0,0,h,l);o&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);ba=n}}function R(f,o){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));
|
||||
c.shaderSource(n,o);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(n));return null}return n}function L(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;
|
||||
case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;
|
||||
case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var P=document.createElement("canvas"),c,aa=null,ba=null,ca=this,ga=null,da=null,ja=null,na=null,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,va=new Float32Array(16),wa=new Float32Array(16),Ha=new Float32Array(16),Aa=new THREE.Vector4,Ia=!0,Oa=new THREE.Color(0),Pa=0;if(a){if(a.antialias!==undefined)Ia=
|
||||
a.antialias;a.clearColor!==undefined&&Oa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Pa=a.clearAlpha}this.domElement=P;this.autoClear=!0;this.sortObjects=!1;(function(f,o,n){try{c=P.getContext("experimental-webgl",{antialias:f})}catch(h){console.log(h)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);
|
||||
c.clearColor(o.r,o.g,o.b,n);_cullEnabled=!0})(Ia,Oa,Pa);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,o){P.width=f;P.height=o;c.viewport(0,0,P.width,P.height)};this.setClearColorHex=function(f,o){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,o)};this.setClearColor=function(f,o){c.clearColor(f.r,f.g,f.b,o)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=
|
||||
function(f,o,n){var h,l;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&
|
||||
d(f,THREE.ShaderLib.particle_basic);var v,r,q,t;l=q=t=0;for(v=o.length;l<v;l++){r=o[l];r instanceof THREE.DirectionalLight&&q++;r instanceof THREE.PointLight&&t++}if(t+q<=4)o=q;else{o=Math.ceil(4*q/(t+q));t=4-o}l={directional:o,point:t};t=f.fragmentShader;o=f.vertexShader;v={fog:n,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:l.directional,maxPointLights:l.point};n=c.createProgram();l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
|
||||
v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,
|
||||
v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
||||
c.attachShader(n,R("fragment",l+t));c.attachShader(n,R("vertex",v+o));c.linkProgram(n);c.getProgramParameter(n,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(n,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(h in f.uniforms)n.push(h);h=f.program;t=0;for(o=n.length;t<
|
||||
o;t++){l=n[t];h.uniforms[l]=c.getUniformLocation(h,l)}h=f.program;n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];t=0;for(o=n.length;t<o;t++){l=n[t];h.attributes[l]=c.getAttribLocation(h,l)}h=f.program.attributes;c.enableVertexAttribArray(h.position);h.color>=0&&c.enableVertexAttribArray(h.color);h.normal>=0&&c.enableVertexAttribArray(h.normal);h.tangent>=0&&c.enableVertexAttribArray(h.tangent);if(f.skinning&&h.skinVertexA>=0&&h.skinVertexB>=
|
||||
0&&h.skinIndex>=0&&h.skinWeight>=0){c.enableVertexAttribArray(h.skinVertexA);c.enableVertexAttribArray(h.skinVertexB);c.enableVertexAttribArray(h.skinIndex);c.enableVertexAttribArray(h.skinWeight)}};this.render=function(f,o,n,h){var l,v,r,q,t,G,F,I,S=f.lights,y=f.fog;o.matrixAutoUpdate&&o.update();o.matrixWorld.flattenToArray(Ha);o.projectionMatrix.flattenToArray(va);o.inverseMatrix.flattenToArray(wa);qa.multiply(o.projectionMatrix,o.matrixWorld);k(qa);THREE.AnimationHandler&&THREE.AnimationHandler.update();
|
||||
f.update(undefined,!1,o);this.initWebGLObjects(f,o);J(n,h!==undefined?h:!0);this.autoClear&&this.clear();t=f.__webGLObjects.length;for(h=0;h<t;h++){l=f.__webGLObjects[h];F=l.object;if(F.visible)if(!(F instanceof THREE.Mesh)||s(F)){F.matrixWorld.flattenToArray(F._objectMatrixArray);H(F,o);z(l);l.render=!0;if(this.sortObjects){Aa.copy(F.position);qa.multiplyVector3(Aa);l.z=Aa.z}}else l.render=!1;else l.render=!1}this.sortObjects&&f.__webGLObjects.sort(A);G=f.__webGLObjectsImmediate.length;for(h=0;h<
|
||||
G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray);H(F,o);x(l)}}K(THREE.NormalBlending);for(h=0;h<t;h++){l=f.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.opaque;j(F);for(l=0;l<r.count;l++){q=r.list[l];m(q.depth_test);g(o,S,y,q,I,F)}}}for(h=0;h<G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.opaque;j(F);for(l=0;l<r.count;l++){q=r.list[l];m(q.depth_test);v=e(o,S,y,q,F);F.render(function(M){i(M,
|
||||
v)})}}}for(h=0;h<t;h++){l=f.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.transparent;j(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);m(q.depth_test);g(o,S,y,q,I,F)}}}for(h=0;h<G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.transparent;j(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);m(q.depth_test);v=e(o,S,y,q,F);F.render(function(M){i(M,v)})}}}if(n&&n.min_filter!==THREE.NearestFilter&&n.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);
|
||||
G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray);H(F,o);x(l)}}K(THREE.NormalBlending);for(h=0;h<t;h++){l=f.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.opaque;j(F);for(l=0;l<r.count;l++){q=r.list[l];m(q.depthTest);g(o,S,y,q,I,F)}}}for(h=0;h<G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.opaque;j(F);for(l=0;l<r.count;l++){q=r.list[l];m(q.depthTest);v=e(o,S,y,q,F);F.render(function(M){i(M,
|
||||
v)})}}}for(h=0;h<t;h++){l=f.__webGLObjects[h];if(l.render){F=l.object;I=l.buffer;r=l.transparent;j(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);m(q.depthTest);g(o,S,y,q,I,F)}}}for(h=0;h<G;h++){l=f.__webGLObjectsImmediate[h];F=l.object;if(F.visible){r=l.transparent;j(F);for(l=0;l<r.count;l++){q=r.list[l];K(q.blending);m(q.depthTest);v=e(o,S,y,q,F);F.render(function(M){i(M,v)})}}}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,n.__webGLTexture);
|
||||
c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f,o){var n,h,l;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}n=0;for(h=f.objects.length;n<h;n++){l=f.objects[n];var v=f,r=o,q=void 0,t=void 0,G=void 0,F=void 0;t=l.geometry;if(v.__webGLObjectsMap[l.id]==undefined){v.__webGLObjectsMap[l.id]={};l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);
|
||||
l._objectMatrixArray=new Float32Array(16);l.matrixWorld.flattenToArray(l._objectMatrixArray)}F=v.__webGLObjectsMap[l.id];objlist=v.__webGLObjects;if(l instanceof THREE.Mesh){for(q in t.geometryChunks){G=t.geometryChunks[q];if(!G.__webGLVertexBuffer){r=G;r.__webGLVertexBuffer=c.createBuffer();r.__webGLNormalBuffer=c.createBuffer();r.__webGLTangentBuffer=c.createBuffer();r.__webGLColorBuffer=c.createBuffer();r.__webGLUVBuffer=c.createBuffer();r.__webGLUV2Buffer=c.createBuffer();r.__webGLSkinVertexABuffer=
|
||||
c.createBuffer();r.__webGLSkinVertexBBuffer=c.createBuffer();r.__webGLSkinIndicesBuffer=c.createBuffer();r.__webGLSkinWeightsBuffer=c.createBuffer();r.__webGLFaceBuffer=c.createBuffer();r.__webGLLineBuffer=c.createBuffer();r=G;var I=l,S=void 0,y=void 0,M=0,ea=v=0,Z=I.geometry.faces,Q=r.faces;S=0;for(y=Q.length;S<y;S++){fi=Q[S];face=Z[fi];if(face instanceof THREE.Face3){M+=3;v+=1;ea+=3}else if(face instanceof THREE.Face4){M+=4;v+=2;ea+=4}}r.__vertexArray=new Float32Array(M*3);r.__normalArray=new Float32Array(M*
|
||||
@@ -179,23 +179,23 @@ O=q.__dirtyColors;if(q.__dirtyVertices){for(y=0;y<Z;y++){I=M[y].position;r=y*3;Q
|
||||
c.createBuffer();q.__webGLColorBuffer=c.createBuffer();q=t;G=q.vertices.length;q.__vertexArray=new Float32Array(G*3);q.__colorArray=new Float32Array(G*3);q.__sortArray=[];q.__webGLParticleCount=G;t.__dirtyVertices=!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||l.sortParticles)&&b(t,c.DYNAMIC_DRAW,l,r);E(objlist,F,0,t,l);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes){t=F;if(t[0]==undefined){v.__webGLObjectsImmediate.push({object:l,
|
||||
opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=function(f,o){var n,h;for(n=f.__webGLObjects.length-1;n>=0;n--){h=f.__webGLObjects[n].object;o==h&&f.__webGLObjects.splice(n,1)}};this.setFaceCulling=function(f,o){if(f){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
||||
0}};
|
||||
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
||||
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
||||
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
||||
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
||||
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
|
||||
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
||||
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
|
||||
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
||||
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
||||
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
||||
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
||||
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
||||
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
||||
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
||||
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
||||
value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
||||
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
||||
THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
||||
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
||||
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
||||
value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
||||
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
||||
THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
||||
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
||||
THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
||||
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
||||
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
||||
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
||||
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
||||
THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
||||
THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
||||
THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;",
|
||||
THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
{ material: new THREE.MeshNormalMaterial(), overdraw: true, doubleSided: false },
|
||||
{ material: new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
|
||||
{ material: new THREE.MeshLambertMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), overdraw: false, doubleSided: false },
|
||||
{ material: new THREE.MeshBasicMaterial( { env_map: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), overdraw: false, doubleSided: false }
|
||||
{ material: new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ), overdraw: false, doubleSided: false }
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
geometry = new WaltHead();
|
||||
geometry.computeVertexNormals();
|
||||
|
||||
mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { env_map: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
|
||||
mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) );
|
||||
mesh.overdraw = true;
|
||||
scene.addObject( mesh );
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
imageContext.fillRect( 0, 0, 480, 204 );
|
||||
|
||||
texture = new THREE.Texture( image );
|
||||
texture.min_filter = THREE.LinearFilter;
|
||||
texture.mag_filter = THREE.LinearFilter;
|
||||
texture.minFilter = THREE.LinearFilter;
|
||||
texture.magFilter = THREE.LinearFilter;
|
||||
|
||||
var material = new THREE.MeshBasicMaterial( { map: texture } );
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
imageReflectionGradient.addColorStop( 1, 'rgba(240, 240, 240, 0.8)' );
|
||||
|
||||
textureReflection = new THREE.Texture( imageReflection );
|
||||
textureReflection.min_filter = THREE.LinearFilter;
|
||||
textureReflection.mag_filter = THREE.LinearFilter;
|
||||
textureReflection.minFilter = THREE.LinearFilter;
|
||||
textureReflection.magFilter = THREE.LinearFilter;
|
||||
|
||||
var materialReflection = new THREE.MeshBasicMaterial( { map: textureReflection } );
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
objects = [];
|
||||
|
||||
geometry = new Sphere( 100, 16, 8 );
|
||||
material = new THREE.MeshBasicMaterial( { env_map: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } );
|
||||
material = new THREE.MeshBasicMaterial( { envMap: ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } );
|
||||
|
||||
for ( var i = 0; i < 10; i ++ ) {
|
||||
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
/**
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
* @author paulirish / http://paulirish.com/
|
||||
*/
|
||||
|
||||
function bind( scope, fn ) {
|
||||
return function () {
|
||||
fn.apply( scope, arguments );
|
||||
};
|
||||
}
|
||||
|
||||
CameraControlWASD = function ( camera, movement_speed, look_speed, nofly, look_vertical ) {
|
||||
|
||||
this.movement_speed = movement_speed !== undefined ? movement_speed : 1.0;
|
||||
this.look_speed = look_speed !== undefined ? look_speed : 0.005;
|
||||
|
||||
this.nofly = nofly;
|
||||
this.look_vertical = look_vertical;
|
||||
|
||||
this.camera = camera;
|
||||
|
||||
this.mouseX = 0;
|
||||
this.mouseY = 0;
|
||||
|
||||
this.lat = 0;
|
||||
this.lon = 0;
|
||||
this.phy = 0;
|
||||
this.theta = 0;
|
||||
|
||||
this.moveForward = false;
|
||||
this.moveBackward = false;
|
||||
this.moveLeft = false;
|
||||
this.moveRight = false;
|
||||
|
||||
this.windowHalfX = window.innerWidth / 2;
|
||||
this.windowHalfY = window.innerHeight / 2;
|
||||
|
||||
this.onDocumentMouseDown = function ( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
switch ( event.button ) {
|
||||
|
||||
case 0: this.moveForward = true; break;
|
||||
case 2: this.moveBackward = true; break;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.onDocumentMouseUp = function ( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
switch ( event.button ) {
|
||||
|
||||
case 0: this.moveForward = false; break;
|
||||
case 2: this.moveBackward = false; break;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.onDocumentMouseMove = function (event) {
|
||||
|
||||
this.mouseX = event.clientX - this.windowHalfX;
|
||||
this.mouseY = event.clientY - this.windowHalfY;
|
||||
|
||||
};
|
||||
|
||||
this.onDocumentKeyDown = function ( event ) {
|
||||
|
||||
switch( event.keyCode ) {
|
||||
|
||||
case 38: /*up*/
|
||||
case 87: /*W*/ this.moveForward = true; break;
|
||||
|
||||
case 37: /*left*/
|
||||
case 65: /*A*/ this.moveLeft = true; break;
|
||||
|
||||
case 40: /*down*/
|
||||
case 83: /*S*/ this.moveBackward = true; break;
|
||||
|
||||
case 39: /*right*/
|
||||
case 68: /*D*/ this.moveRight = true; break;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.onDocumentKeyUp = function ( event ) {
|
||||
|
||||
switch( event.keyCode ) {
|
||||
|
||||
case 38: /*up*/
|
||||
case 87: /*W*/ this.moveForward = false; break;
|
||||
|
||||
case 37: /*left*/
|
||||
case 65: /*A*/ this.moveLeft = false; break;
|
||||
|
||||
case 40: /*down*/
|
||||
case 83: /*S*/ this.moveBackward = false; break;
|
||||
|
||||
case 39: /*right*/
|
||||
case 68: /*D*/ this.moveRight = false; break;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.update = function() {
|
||||
|
||||
if ( this.moveForward ) this.camera.translateZ( - this.movement_speed, this.nofly );
|
||||
if ( this.moveBackward ) this.camera.translateZ( this.movement_speed, this.nofly );
|
||||
if ( this.moveLeft ) this.camera.translateX( - this.movement_speed, this.nofly );
|
||||
if ( this.moveRight ) this.camera.translateX( this.movement_speed, this.nofly );
|
||||
|
||||
this.lon += this.mouseX * this.look_speed;
|
||||
if( this.look_vertical ) this.lat -= this.mouseY * this.look_speed;
|
||||
|
||||
this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
|
||||
this.phi = ( 90 - this.lat ) * Math.PI / 180;
|
||||
this.theta = this.lon * Math.PI / 180;
|
||||
|
||||
this.camera.target.position.x = 100 * Math.sin( this.phi ) * Math.cos( this.theta ) + this.camera.position.x;
|
||||
this.camera.target.position.y = 100 * Math.cos( this.phi ) + this.camera.position.y;
|
||||
this.camera.target.position.z = 100 * Math.sin( this.phi ) * Math.sin( this.theta ) + this.camera.position.z;
|
||||
|
||||
};
|
||||
|
||||
|
||||
document.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
|
||||
|
||||
document.addEventListener( 'mousemove', bind( this, this.onDocumentMouseMove ), false );
|
||||
document.addEventListener( 'mousedown', bind( this, this.onDocumentMouseDown ), false );
|
||||
document.addEventListener( 'mouseup', bind( this, this.onDocumentMouseUp ), false );
|
||||
document.addEventListener( 'keydown', bind( this, this.onDocumentKeyDown ), false );
|
||||
document.addEventListener( 'keyup', bind( this, this.onDocumentKeyUp ), false );
|
||||
|
||||
};
|
||||
@@ -16,7 +16,7 @@ var ShaderExtras = {
|
||||
maxblur: { type: "f", value: 1.0 },
|
||||
},
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
@@ -29,7 +29,7 @@ var ShaderExtras = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>three.js - materials - multi-materials - webgl</title>
|
||||
<title>three.js misc - materials - multi-materials</title>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
body {
|
||||
@@ -99,9 +99,9 @@
|
||||
sphere = new Sphere( 100, 16, 8 );
|
||||
for (var i=0; i<10; i++) {
|
||||
//mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( ) );
|
||||
mesh = new THREE.Mesh( sphere, [ new THREE.MeshLambertMaterial( { color: 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframe_linewidth: 1.5 } ) ] );
|
||||
//mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( { color: 0x00aa00, wireframe: true, wireframe_linewidth: 1.5 } ) );
|
||||
//mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { wireframe: true, wireframe_linewidth: 2.5 } ) );
|
||||
mesh = new THREE.Mesh( sphere, [ new THREE.MeshLambertMaterial( { color: 0xffffff } ), new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 1.5 } ) ] );
|
||||
//mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( { color: 0x00aa00, wireframe: true, wireframeLinewidth: 1.5 } ) );
|
||||
//mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { wireframe: true, wireframeLinewidth: 2.5 } ) );
|
||||
mesh.position.x = 500 * ( Math.random() - 0.5 );
|
||||
mesh.position.y = 500 * ( Math.random() - 0.5 );
|
||||
mesh.position.z = 500 * ( Math.random() - 0.5 );
|
||||
@@ -211,7 +211,7 @@
|
||||
var materials = [ new THREE.MeshFaceMaterial() ];
|
||||
|
||||
// full-mesh wireframe overlay
|
||||
//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true, wireframe_linewidth: 1.5 } ) );
|
||||
//materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true, wireframeLinewidth: 1.5 } ) );
|
||||
|
||||
// full-mesh color overlay
|
||||
//materials.push( new THREE.MeshBasicMaterial { color: 0xff0000, opacity: 0.5 } ) );
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
scene.fog = new THREE.FogExp2( 0x000000, 0.0035 );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 50, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
|
||||
movement_speed: 1, look_speed: 0.002, nofly: true, look_vertical: false } );
|
||||
movementSpeed: 1, lookSpeed: 0.002, noFly: true, lookVertical: false } );
|
||||
|
||||
camera.position.set( 0, 25, 0 );
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
// ground
|
||||
|
||||
var material_wireframe = new THREE.MeshLambertMaterial( { color: 0xffaa00, wireframe: true, wireframe_linewidth: 1 } );
|
||||
var material_wireframe = new THREE.MeshLambertMaterial( { color: 0xffaa00, wireframe: true, wireframeLinewidth: 1 } );
|
||||
material_wireframe.color.setHSV( 0.1, 0.2, 0.25 );
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
|
||||
postprocessing.camera.position.z = 100;
|
||||
|
||||
var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
|
||||
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
|
||||
postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
|
||||
postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
|
||||
postprocessing.rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
|
||||
@@ -174,8 +174,8 @@
|
||||
postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: screen_uniforms,
|
||||
vertex_shader: screen_shader.vertex_shader,
|
||||
fragment_shader: screen_shader.fragment_shader,
|
||||
vertexShader: screen_shader.vertexShader,
|
||||
fragmentShader: screen_shader.fragmentShader,
|
||||
blending: THREE.AdditiveBlending
|
||||
|
||||
} );
|
||||
@@ -193,8 +193,8 @@
|
||||
postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: convolution_uniforms,
|
||||
vertex_shader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
|
||||
fragment_shader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragment_shader
|
||||
vertexShader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
|
||||
fragmentShader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>three.js - geometry - canvas polyfield</title>
|
||||
<title>three.js misc - geometry - polyfield</title>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
body {
|
||||
@@ -195,7 +195,7 @@
|
||||
geometry.computeCentroids();
|
||||
geometry.sortFacesByMaterial();
|
||||
|
||||
mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, wireframe: true, wireframe_linewidth: 10 } ) ] );
|
||||
mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, wireframe: true, wireframeLinewidth: 10 } ) ] );
|
||||
mesh.doubleSided = true;
|
||||
mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
|
||||
scene.addObject( mesh );
|
||||
|
||||
@@ -129,8 +129,8 @@ var scene = {
|
||||
"width" : 10,
|
||||
"height": 10,
|
||||
"depth" : 10,
|
||||
"segments_width" : 1,
|
||||
"segments_height" : 1,
|
||||
"segmentsWidth" : 1,
|
||||
"segmentsHeight" : 1,
|
||||
"flipped" : false,
|
||||
"sides" : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
|
||||
},
|
||||
@@ -139,23 +139,23 @@ var scene = {
|
||||
"type" : "plane",
|
||||
"width" : 10,
|
||||
"height" : 10,
|
||||
"segments_width" : 50,
|
||||
"segments_height" : 50
|
||||
"segmentsWidth" : 50,
|
||||
"segmentsHeight" : 50
|
||||
},
|
||||
|
||||
"quad": {
|
||||
"type" : "plane",
|
||||
"width" : 10,
|
||||
"height" : 10,
|
||||
"segments_width" : 1,
|
||||
"segments_height" : 1
|
||||
"segmentsWidth" : 1,
|
||||
"segmentsHeight" : 1
|
||||
},
|
||||
|
||||
"sphere": {
|
||||
"type" : "sphere",
|
||||
"radius" : 5,
|
||||
"segments_width" : 32,
|
||||
"segments_height" : 16
|
||||
"segmentsWidth" : 32,
|
||||
"segmentsHeight" : 16
|
||||
},
|
||||
|
||||
"icosahedron": {
|
||||
@@ -270,27 +270,27 @@ var scene = {
|
||||
|
||||
"basic_refraction": {
|
||||
"type": "MeshBasicMaterial",
|
||||
"parameters": { color: 0xffffff, env_map: "cube_refraction", refraction_ratio: 0.95 }
|
||||
"parameters": { color: 0xffffff, envMap: "cube_refraction", refractionRatio: 0.95 }
|
||||
},
|
||||
|
||||
"lambert_cube": {
|
||||
"type": "MeshLambertMaterial",
|
||||
"parameters": { color: 0xff6600, env_map: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
|
||||
"parameters": { color: 0xff6600, envMap: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
|
||||
},
|
||||
|
||||
"chrome": {
|
||||
"type": "MeshLambertMaterial",
|
||||
"parameters": { color: 0xffffff, env_map: "cube_reflection" }
|
||||
"parameters": { color: 0xffffff, envMap: "cube_reflection" }
|
||||
},
|
||||
|
||||
"darkerchrome": {
|
||||
"type": "MeshLambertMaterial",
|
||||
"parameters": { color: 0x222222, env_map: "cube_reflection" }
|
||||
"parameters": { color: 0x222222, envMap: "cube_reflection" }
|
||||
},
|
||||
|
||||
"glass": {
|
||||
"type": "MeshLambertMaterial",
|
||||
"parameters": { color: 0x101046, env_map: "cube_reflection", opacity: 0.25 }
|
||||
"parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25 }
|
||||
},
|
||||
|
||||
"interior": {
|
||||
@@ -355,8 +355,8 @@ var scene = {
|
||||
|
||||
"texture_minecraft": {
|
||||
"url": "textures/minecraft/grass.png",
|
||||
"mag_filter": "NearestFilter",
|
||||
"min_filter": "LinearMipMapLinearFilter"
|
||||
"magFilter": "NearestFilter",
|
||||
"minFilter": "LinearMipMapLinearFilter"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
geometry.materials[0][0].shading = THREE.FlatShading;
|
||||
|
||||
var material = [ new THREE.MeshFaceMaterial(), new THREE.MeshLambertMaterial( { color: 0xffffff, opacity:0.9, shading:THREE.FlatShading, wireframe: true, wireframe_linewidth: 2 } ) ];
|
||||
var material = [ new THREE.MeshFaceMaterial(), new THREE.MeshLambertMaterial( { color: 0xffffff, opacity:0.9, shading:THREE.FlatShading, wireframe: true, wireframeLinewidth: 2 } ) ];
|
||||
|
||||
mesh = SceneUtils.addMesh( scene, geometry, 250, 0, 0, 0, 0, 0, 0, material );
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
var materials = [
|
||||
|
||||
new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertex_colors: true } ),
|
||||
new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: true } ),
|
||||
new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
|
||||
|
||||
];
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
|
||||
movement_speed: 10, look_speed: 0.004, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 10, lookSpeed: 0.004, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
geometry.computeVertexNormals();
|
||||
|
||||
var texture = ImageUtils.loadTexture( "textures/water.jpg" );
|
||||
texture.wrap_s = texture.wrap_t = THREE.RepeatWrapping;
|
||||
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
||||
material = new THREE.MeshBasicMaterial( { color:0x0044ff, opacity:1, map: texture } );
|
||||
|
||||
mesh = new THREE.Mesh( geometry, material );
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
|
||||
movement_speed: 15, look_speed: 0.005, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
|
||||
movement_speed: 15, look_speed: 0.005, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 15, lookSpeed: 0.005, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
|
||||
movement_speed: 15, look_speed: 0.004, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 15, lookSpeed: 0.004, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 20000,
|
||||
movement_speed: 10, look_speed: 0.004, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 10, lookSpeed: 0.004, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
container = document.getElementById( 'container' );
|
||||
|
||||
camera = new THREE.QuakeCamera( { fov: 60, aspect: window.innerWidth / window.innerHeight, near: 1, far: 10000,
|
||||
movement_speed: 5, look_speed: 0.004, nofly: false, look_vertical: true } );
|
||||
movementSpeed: 5, lookSpeed: 0.004, noFly: false, lookVertical: true } );
|
||||
|
||||
camera.target.position.z = - 100;
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
scene.addLight( directionalLight );
|
||||
|
||||
var texture = ImageUtils.loadTexture( "textures/memorial.png" );
|
||||
texture.min_filter = THREE.LinearFilter;
|
||||
texture.mag_filter = THREE.NearestFilter;
|
||||
texture.minFilter = THREE.LinearFilter;
|
||||
texture.magFilter = THREE.NearestFilter;
|
||||
|
||||
materialHDR = new THREE.MeshShaderMaterial( {
|
||||
|
||||
@@ -138,8 +138,8 @@
|
||||
exposure: { type: "f", value: 0.125 },
|
||||
brightMax: { type: "f", value: 0.5 }
|
||||
},
|
||||
vertex_shader: getText( 'vs-hdr' ),
|
||||
fragment_shader: getText( 'fs-hdr' )
|
||||
vertexShader: getText( 'vs-hdr' ),
|
||||
fragmentShader: getText( 'fs-hdr' )
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
[ material, scale*1.5, [0,0,0], geometry2 ],
|
||||
[ material, scale*1.5, [d,0,0], geometry3 ] ];
|
||||
|
||||
material.vertex_colors = true;
|
||||
material.vertexColors = true;
|
||||
|
||||
for ( i = 0; i < parameters.length; ++i ) {
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
|
||||
sceneScreen = new THREE.Scene();
|
||||
|
||||
var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
|
||||
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
|
||||
rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
|
||||
rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
|
||||
rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
|
||||
@@ -154,8 +154,8 @@
|
||||
materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: screen_uniforms,
|
||||
vertex_shader: screen_shader.vertex_shader,
|
||||
fragment_shader: screen_shader.fragment_shader,
|
||||
vertexShader: screen_shader.vertexShader,
|
||||
fragmentShader: screen_shader.fragmentShader,
|
||||
blending: THREE.AdditiveBlending
|
||||
|
||||
} );
|
||||
@@ -173,8 +173,8 @@
|
||||
materialConvolution = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: convolution_uniforms,
|
||||
vertex_shader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
|
||||
fragment_shader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragment_shader
|
||||
vertexShader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
|
||||
fragmentShader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -227,31 +227,31 @@
|
||||
|
||||
var mlib = {
|
||||
|
||||
"Orange": new THREE.MeshLambertMaterial( { color: 0xff6600, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ),
|
||||
"Blue": new THREE.MeshLambertMaterial( { color: 0x001133, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ),
|
||||
"Red": new THREE.MeshLambertMaterial( { color: 0x660000, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Black": new THREE.MeshLambertMaterial( { color: 0x000000, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.15 } ),
|
||||
"White": new THREE.MeshLambertMaterial( { color: 0xffffff, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Orange": new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ),
|
||||
"Blue": new THREE.MeshLambertMaterial( { color: 0x001133, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ),
|
||||
"Red": new THREE.MeshLambertMaterial( { color: 0x660000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Black": new THREE.MeshLambertMaterial( { color: 0x000000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.15 } ),
|
||||
"White": new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
|
||||
"Carmine": new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Gold": new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Bronze": new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Chrome": new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, env_map: textureCube, combine: THREE.Multiply } ),
|
||||
"Carmine": new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Gold": new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Bronze": new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Chrome": new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.Multiply } ),
|
||||
|
||||
"Orange metal": new THREE.MeshLambertMaterial( { color: 0xff6600, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Blue metal": new THREE.MeshLambertMaterial( { color: 0x001133, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Red metal": new THREE.MeshLambertMaterial( { color: 0x770000, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Green metal": new THREE.MeshLambertMaterial( { color: 0x007711, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Black metal": new THREE.MeshLambertMaterial( { color: 0x222222, env_map: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Orange metal": new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Blue metal": new THREE.MeshLambertMaterial( { color: 0x001133, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Red metal": new THREE.MeshLambertMaterial( { color: 0x770000, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Green metal": new THREE.MeshLambertMaterial( { color: 0x007711, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
"Black metal": new THREE.MeshLambertMaterial( { color: 0x222222, envMap: textureCube, combine: THREE.MultiplyOperation } ),
|
||||
|
||||
"Pure chrome": new THREE.MeshLambertMaterial( { color: 0xffffff, env_map: textureCube } ),
|
||||
"Dark chrome": new THREE.MeshLambertMaterial( { color: 0x444444, env_map: textureCube } ),
|
||||
"Darker chrome":new THREE.MeshLambertMaterial( { color: 0x222222, env_map: textureCube } ),
|
||||
"Pure chrome": new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
|
||||
"Dark chrome": new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
|
||||
"Darker chrome":new THREE.MeshLambertMaterial( { color: 0x222222, envMap: textureCube } ),
|
||||
|
||||
"Black glass": new THREE.MeshLambertMaterial( { color: 0x101016, env_map: textureCube, opacity: 0.975 } ),
|
||||
"Dark glass": new THREE.MeshLambertMaterial( { color: 0x101046, env_map: textureCube, opacity: 0.25 } ),
|
||||
"Blue glass": new THREE.MeshLambertMaterial( { color: 0x668899, env_map: textureCube, opacity: 0.75 } ),
|
||||
"Light glass": new THREE.MeshBasicMaterial( { color: 0x223344, env_map: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
"Black glass": new THREE.MeshLambertMaterial( { color: 0x101016, envMap: textureCube, opacity: 0.975 } ),
|
||||
"Dark glass": new THREE.MeshLambertMaterial( { color: 0x101046, envMap: textureCube, opacity: 0.25 } ),
|
||||
"Blue glass": new THREE.MeshLambertMaterial( { color: 0x668899, envMap: textureCube, opacity: 0.75 } ),
|
||||
"Light glass": new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
|
||||
"Red glass": new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.75 } ),
|
||||
"Yellow glass": new THREE.MeshLambertMaterial( { color: 0xffffaa, opacity: 0.75 } ),
|
||||
|
||||
@@ -124,25 +124,25 @@
|
||||
var camaroMaterials = {
|
||||
|
||||
body: [],
|
||||
chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, env_map: textureCube } ),
|
||||
darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, env_map: textureCube } ),
|
||||
glass: new THREE.MeshBasicMaterial( { color: 0x223344, env_map: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
chrome: new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube } ),
|
||||
darkchrome: new THREE.MeshLambertMaterial( { color: 0x444444, envMap: textureCube } ),
|
||||
glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25 } ),
|
||||
tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
|
||||
interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
|
||||
black: new THREE.MeshLambertMaterial( { color: 0x000000 } )
|
||||
|
||||
}
|
||||
|
||||
camaroMaterials.body.push( [ "Orange", new THREE.MeshLambertMaterial( { color: 0xff6600, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
|
||||
camaroMaterials.body.push( [ "Blue", new THREE.MeshLambertMaterial( { color: 0x226699, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
|
||||
camaroMaterials.body.push( [ "Red", new THREE.MeshLambertMaterial( { color: 0x660000, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "Black", new THREE.MeshLambertMaterial( { color: 0x000000, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "White", new THREE.MeshLambertMaterial( { color: 0xffffff, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "Orange", new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
|
||||
camaroMaterials.body.push( [ "Blue", new THREE.MeshLambertMaterial( { color: 0x226699, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.3 } ) ] );
|
||||
camaroMaterials.body.push( [ "Red", new THREE.MeshLambertMaterial( { color: 0x660000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "Black", new THREE.MeshLambertMaterial( { color: 0x000000, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "White", new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
|
||||
camaroMaterials.body.push( [ "Carmine", new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, env_map: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
camaroMaterials.body.push( [ "Gold", new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, env_map: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
camaroMaterials.body.push( [ "Bronze", new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, env_map: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "Chrome", new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, env_map: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
camaroMaterials.body.push( [ "Carmine", new THREE.MeshPhongMaterial( { color: 0x770000, specular:0xffaaaa, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
camaroMaterials.body.push( [ "Gold", new THREE.MeshPhongMaterial( { color: 0xaa9944, specular:0xbbaa99, shininess:50, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
camaroMaterials.body.push( [ "Bronze", new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
|
||||
camaroMaterials.body.push( [ "Chrome", new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
|
||||
|
||||
var loader = new THREE.Loader();
|
||||
loader.loadBinary( { model: "obj/camaro/CamaroNoUv_bin.js", callback: function( geometry ) { createScene( geometry, camaroMaterials ) } } );
|
||||
|
||||
@@ -107,10 +107,10 @@
|
||||
var reflectionCube = ImageUtils.loadTextureCube( urls );
|
||||
var refractionCube = new THREE.Texture( reflectionCube.image, new THREE.CubeRefractionMapping() );
|
||||
|
||||
//var cubeMaterial3 = new THREE.MeshPhongMaterial( { color: 0x000000, specular:0xaa0000, env_map: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.25 } );
|
||||
var cubeMaterial3 = new THREE.MeshLambertMaterial( { color: 0xff6600, env_map: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
|
||||
var cubeMaterial2 = new THREE.MeshLambertMaterial( { color: 0xffee00, env_map: refractionCube, refraction_ratio: 0.95 } );
|
||||
var cubeMaterial1 = new THREE.MeshLambertMaterial( { color: 0xffffff, env_map: reflectionCube } )
|
||||
//var cubeMaterial3 = new THREE.MeshPhongMaterial( { color: 0x000000, specular:0xaa0000, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.25 } );
|
||||
var cubeMaterial3 = new THREE.MeshLambertMaterial( { color: 0xff6600, envMap: reflectionCube, combine: THREE.MixOperation, reflectivity: 0.3 } );
|
||||
var cubeMaterial2 = new THREE.MeshLambertMaterial( { color: 0xffee00, envMap: refractionCube, refractionRatio: 0.95 } );
|
||||
var cubeMaterial1 = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: reflectionCube } )
|
||||
|
||||
SceneUtils.addPanoramaCubeWebGL( sceneCube, 100000, reflectionCube );
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
];
|
||||
|
||||
var textureCube = ImageUtils.loadTextureCube( urls );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube } );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } );
|
||||
|
||||
for ( var i = 0; i < 200; i ++ ) {
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
];
|
||||
|
||||
var textureCube = ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube, refraction_ratio: 0.95 } );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
for ( var i = 0; i < 200; i ++ ) {
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
r + "pz.jpg", r + "nz.jpg" ];
|
||||
|
||||
var textureCube = ImageUtils.loadTextureCube( urls );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube } )
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } )
|
||||
var geometry = new Sphere( 100, 96, 64 );
|
||||
|
||||
var mesh = new THREE.Mesh( geometry, material );
|
||||
|
||||
@@ -104,9 +104,9 @@
|
||||
|
||||
var textureCube = ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
|
||||
var cubeMaterial3 = new THREE.MeshBasicMaterial( { color: 0xccddff, env_map: textureCube, refraction_ratio: 0.98, reflectivity:0.9 } );
|
||||
var cubeMaterial2 = new THREE.MeshBasicMaterial( { color: 0xccfffd, env_map: textureCube, refraction_ratio: 0.985 } );
|
||||
var cubeMaterial1 = new THREE.MeshBasicMaterial( { color: 0xffffff, env_map: textureCube, refraction_ratio: 0.98 } )
|
||||
var cubeMaterial3 = new THREE.MeshBasicMaterial( { color: 0xccddff, envMap: textureCube, refractionRatio: 0.98, reflectivity:0.9 } );
|
||||
var cubeMaterial2 = new THREE.MeshBasicMaterial( { color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 } );
|
||||
var cubeMaterial1 = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 } )
|
||||
|
||||
//SceneUtils.addPanoramaCubePlanes( sceneCube, 100000, images );
|
||||
//SceneUtils.addPanoramaCube( sceneCube, 100000, images );
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
uniforms[ "uShininess" ].value = shininess;
|
||||
|
||||
var parameters = { fragment_shader: shader.fragment_shader, vertex_shader: shader.vertex_shader, uniforms: uniforms };
|
||||
var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
|
||||
var material1 = new THREE.MeshShaderMaterial( parameters );
|
||||
|
||||
var material2 = new THREE.MeshPhongMaterial( { color: diffuse, specular: specular, ambient: ambient, shininess: shininess } );
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
uniforms[ "uShininess" ].value = shininess;
|
||||
|
||||
var parameters = { fragment_shader: shader.fragment_shader, vertex_shader: shader.vertex_shader, uniforms: uniforms };
|
||||
var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
|
||||
var material = new THREE.MeshShaderMaterial( parameters );
|
||||
|
||||
loader = new THREE.Loader( true );
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
uniforms["tCube"].texture = textureCube;
|
||||
|
||||
var parameters = { fragment_shader: shader.fragment_shader, vertex_shader: shader.vertex_shader, uniforms: uniforms };
|
||||
var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
|
||||
var material = new THREE.MeshShaderMaterial( parameters );
|
||||
|
||||
for ( var i = 0; i < 200; i ++ ) {
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
//video.muted = true;
|
||||
|
||||
texture = new THREE.Texture( video );
|
||||
texture.min_filter = THREE.LinearFilter;
|
||||
texture.mag_filter = THREE.LinearFilter;
|
||||
texture.minFilter = THREE.LinearFilter;
|
||||
texture.magFilter = THREE.LinearFilter;
|
||||
|
||||
//
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
|
||||
postprocessing.camera.position.z = 100;
|
||||
|
||||
var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
|
||||
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
|
||||
postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
|
||||
postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
|
||||
postprocessing.rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
|
||||
@@ -218,8 +218,8 @@
|
||||
postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: screen_uniforms,
|
||||
vertex_shader: screen_shader.vertex_shader,
|
||||
fragment_shader: screen_shader.fragment_shader,
|
||||
vertexShader: screen_shader.vertexShader,
|
||||
fragmentShader: screen_shader.fragmentShader,
|
||||
blending: THREE.AdditiveBlending
|
||||
|
||||
} );
|
||||
@@ -237,8 +237,8 @@
|
||||
postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: convolution_uniforms,
|
||||
vertex_shader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
|
||||
fragment_shader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragment_shader
|
||||
vertexShader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
|
||||
fragmentShader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
geometry.colors = colors;
|
||||
|
||||
material = new THREE.ParticleBasicMaterial( { size: 35, map: sprite, blending: THREE.BillboardBlending, vertex_colors: true } );
|
||||
material = new THREE.ParticleBasicMaterial( { size: 35, map: sprite, blending: THREE.BillboardBlending, vertexColors: true } );
|
||||
material.color.setHSV( 1.0, 0.2, 0.8 );
|
||||
|
||||
particles = new THREE.ParticleSystem( geometry, material );
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
sprite = parameters[i][1];
|
||||
size = parameters[i][2];
|
||||
|
||||
materials[i] = new THREE.ParticleBasicMaterial( { size: size, map: sprite, blending: THREE.AdditiveBlending, depth_test: false } );
|
||||
materials[i] = new THREE.ParticleBasicMaterial( { size: size, map: sprite, blending: THREE.AdditiveBlending, depthTest: false } );
|
||||
materials[i].color.setHSV( color[0], color[1], color[2] );
|
||||
|
||||
particles = new THREE.ParticleSystem( geometry, materials[i] );
|
||||
|
||||
@@ -107,16 +107,16 @@
|
||||
directionalLight.position.normalize();
|
||||
sceneModel.addLight( directionalLight );
|
||||
|
||||
rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, { min_filter: THREE.LinearFilter, mag_filter: THREE.NearestFilter } );
|
||||
rtTexture2 = new THREE.RenderTarget( 256, 512, { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter } );
|
||||
rtTexture3 = new THREE.RenderTarget( 512, 256, { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter } );
|
||||
rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
|
||||
rtTexture2 = new THREE.RenderTarget( 256, 512, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
|
||||
rtTexture3 = new THREE.RenderTarget( 512, 256, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
|
||||
|
||||
materialColor = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: { time: { type: "f", value: 0.0 } },
|
||||
vertex_shader: getText( 'vs-generic' ),
|
||||
fragment_shader: getText( 'fs-colors' ),
|
||||
depth_test: false
|
||||
vertexShader: getText( 'vs-generic' ),
|
||||
fragmentShader: getText( 'fs-colors' ),
|
||||
depthTest: false
|
||||
|
||||
} );
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: screen_uniforms,
|
||||
vertex_shader: screen_shader.vertex_shader,
|
||||
fragment_shader: screen_shader.fragment_shader,
|
||||
vertexShader: screen_shader.vertexShader,
|
||||
fragmentShader: screen_shader.fragmentShader,
|
||||
blending: THREE.AdditiveBlending
|
||||
|
||||
} );
|
||||
@@ -145,8 +145,8 @@
|
||||
materialFilm = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: film_uniforms,
|
||||
vertex_shader: film_shader.vertex_shader,
|
||||
fragment_shader: film_shader.fragment_shader
|
||||
vertexShader: film_shader.vertexShader,
|
||||
fragmentShader: film_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
@@ -165,8 +165,8 @@
|
||||
materialConvolution = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: convolution_uniforms,
|
||||
vertex_shader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
|
||||
fragment_shader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragment_shader
|
||||
vertexShader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
|
||||
fragmentShader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
|
||||
uniforms[ "uShininess" ].value = shininess;
|
||||
|
||||
var parameters = { fragment_shader: shader.fragment_shader, vertex_shader: shader.vertex_shader, uniforms: uniforms };
|
||||
var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms };
|
||||
var mat2 = new THREE.MeshShaderMaterial( parameters );
|
||||
|
||||
mesh = new THREE.Mesh( geometry, mat2 );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>three.js - postprocessing - depth-of-field - webgl</title>
|
||||
<title>three.js webgl - postprocessing - depth-of-field</title>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
body {
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
var textureCube = ImageUtils.loadTextureCube( urls );
|
||||
|
||||
parameters = { color: 0xff1100, env_map: textureCube, shading: THREE.FlatShading };
|
||||
parameters = { color: 0xff1100, envMap: textureCube, shading: THREE.FlatShading };
|
||||
//parameters = { color: 0xff1100, shading: THREE.FlatShading };
|
||||
cubeMaterial = new THREE.MeshBasicMaterial( parameters );
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
|
||||
postprocessing.camera.position.z = 100;
|
||||
|
||||
var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
|
||||
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
|
||||
postprocessing.rtTextureDepth = new THREE.RenderTarget( window.innerWidth, height, pars );
|
||||
postprocessing.rtTextureColor = new THREE.RenderTarget( window.innerWidth, height, pars );
|
||||
|
||||
@@ -257,8 +257,8 @@
|
||||
postprocessing.materialBokeh = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: postprocessing.bokeh_uniforms,
|
||||
vertex_shader: bokeh_shader.vertex_shader,
|
||||
fragment_shader: bokeh_shader.fragment_shader
|
||||
vertexShader: bokeh_shader.vertexShader,
|
||||
fragmentShader: bokeh_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
var tmpRot = new THREE.Matrix4();
|
||||
tmpRot.setRotAxis( new THREE.Vector3( 1, 0, 0 ), 1.57 );
|
||||
|
||||
var material_base = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
|
||||
var material_base = new THREE.MeshBasicMaterial( { color:0xffffff, vertexColors:true } );
|
||||
|
||||
renderer.initMaterial( material_base, scene.lights, scene.fog );
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
for ( i = 0; i < xgrid; i++ )
|
||||
for ( j = 0; j < ygrid; j++ ) {
|
||||
|
||||
materials[c] = new THREE.MeshBasicMaterial( { color:0xffffff, vertex_colors:true } );
|
||||
materials[c] = new THREE.MeshBasicMaterial( { color:0xffffff, vertexColors:true } );
|
||||
materials[c].program = material_base.program;
|
||||
materials[c].uniforms = Uniforms.clone( THREE.ShaderLib[ 'basic' ].uniforms );
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
|
||||
postprocessing.camera.position.z = 100;
|
||||
|
||||
var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
|
||||
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
|
||||
postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
|
||||
postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
|
||||
postprocessing.rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
|
||||
@@ -246,8 +246,8 @@
|
||||
postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: screen_uniforms,
|
||||
vertex_shader: screen_shader.vertex_shader,
|
||||
fragment_shader: screen_shader.fragment_shader,
|
||||
vertexShader: screen_shader.vertexShader,
|
||||
fragmentShader: screen_shader.fragmentShader,
|
||||
blending: THREE.AdditiveBlending
|
||||
|
||||
} );
|
||||
@@ -265,8 +265,8 @@
|
||||
postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: convolution_uniforms,
|
||||
vertex_shader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
|
||||
fragment_shader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragment_shader
|
||||
vertexShader: "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertexShader,
|
||||
fragmentShader: "#define KERNEL_SIZE 25\n" + convolution_shader.fragmentShader
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="vertex_shader" type="x-shader/x-vertex">
|
||||
<script id="vertexShader" type="x-shader/x-vertex">
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
@@ -130,21 +130,21 @@
|
||||
light.position.normalize();
|
||||
sceneRTT.addLight( light );
|
||||
|
||||
rtTexture = new THREE.RenderTarget( window.innerWidth, window.innerHeight, { min_filter: THREE.LinearFilter, mag_filter: THREE.NearestFilter } );
|
||||
rtTexture = new THREE.RenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
|
||||
|
||||
material = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: { time: { type: "f", value: 0.0 } },
|
||||
vertex_shader: document.getElementById( 'vertex_shader' ).textContent,
|
||||
fragment_shader: document.getElementById( 'fragment_shader_pass_1' ).textContent
|
||||
vertexShader: document.getElementById( 'vertexShader' ).textContent,
|
||||
fragmentShader: document.getElementById( 'fragment_shader_pass_1' ).textContent
|
||||
|
||||
} );
|
||||
|
||||
var materialScreen = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: { tDiffuse: { type: "t", value: 0, texture: rtTexture } },
|
||||
vertex_shader: document.getElementById( 'vertex_shader' ).textContent,
|
||||
fragment_shader: document.getElementById( 'fragment_shader_screen' ).textContent
|
||||
vertexShader: document.getElementById( 'vertexShader' ).textContent,
|
||||
fragmentShader: document.getElementById( 'fragment_shader_screen' ).textContent
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -145,8 +145,8 @@
|
||||
var geometry = new Sphere( 50, 32, 16 );
|
||||
|
||||
var uniforms = ShaderUtils.lib[ 'basic' ].uniforms;
|
||||
var vertex_shader = ShaderUtils.lib[ 'basic' ].vertex_shader;
|
||||
var fragment_shader = ShaderUtils.lib[ 'basic' ].fragment_shader;
|
||||
var vertexShader = ShaderUtils.lib[ 'basic' ].vertexShader;
|
||||
var fragmentShader = ShaderUtils.lib[ 'basic' ].fragmentShader;
|
||||
|
||||
var texture = new THREE.Texture( generateTexture( 0, 0.5, 1 ), new THREE.UVMapping() );
|
||||
var texture2 = new THREE.Texture( generateTexture( 0, 1, 0 ), new THREE.SphericalReflectionMapping() );
|
||||
@@ -158,8 +158,8 @@
|
||||
new THREE.MeshBasicMaterial( { color: 0x0066ff, blending: THREE.AdditiveBlending } ),
|
||||
new THREE.MeshBasicMaterial( { map: texture, fog: false } ),
|
||||
new THREE.MeshBasicMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ),
|
||||
new THREE.MeshBasicMaterial( { map: texture2, env_map: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
|
||||
new THREE.MeshShaderMaterial( { uniforms: uniforms, vertex_shader: vertex_shader, fragment_shader: fragment_shader } )
|
||||
new THREE.MeshBasicMaterial( { map: texture2, envMap: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
|
||||
new THREE.MeshShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader } )
|
||||
|
||||
/*
|
||||
new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading } ),
|
||||
@@ -169,10 +169,10 @@
|
||||
new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } ),
|
||||
new THREE.MeshBasicMaterial( { color: 0xffaa00, wireframe: true } ),
|
||||
new THREE.MeshBasicMaterial( { map: texture, fog: false } ),
|
||||
new THREE.MeshBasicMaterial( { env_map: texture2, fog: false } ),
|
||||
new THREE.MeshBasicMaterial( { envMap: texture2, fog: false } ),
|
||||
new THREE.MeshLambertMaterial( { map: ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ),
|
||||
new THREE.MeshLambertMaterial( { map: texture2, env_map: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
|
||||
new THREE.MeshShaderMaterial( { uniforms: uniforms, vertex_shader: vertex_shader, fragment_shader: fragment_shader } )
|
||||
new THREE.MeshLambertMaterial( { map: texture2, envMap: ImageUtils.loadTexture( 'textures/envmap.png', new THREE.SphericalReflectionMapping() ) } ),
|
||||
new THREE.MeshShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader } )
|
||||
*/
|
||||
|
||||
];
|
||||
@@ -186,7 +186,7 @@
|
||||
|
||||
materials.push( new THREE.MeshFaceMaterial() );
|
||||
|
||||
// materials = [ new THREE.MeshBasicMaterial( { map: texture, env_map: texture2 } ) ];
|
||||
// materials = [ new THREE.MeshBasicMaterial( { map: texture, envMap: texture2 } ) ];
|
||||
|
||||
for ( var i = 0; i < 5000; i ++ ) {
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
|
||||
<script type="text/javascript" src="js/Stats.js"></script>
|
||||
|
||||
<script id="vertex_shader" type="x-shader/x-vertex">
|
||||
<script id="vertexShader" type="x-shader/x-vertex">
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4( position, 1.0 );
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id="fragment_shader" type="x-shader/x-fragment">
|
||||
<script id="fragmentShader" type="x-shader/x-fragment">
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
@@ -120,8 +120,8 @@
|
||||
material = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: uniforms,
|
||||
vertex_shader: document.getElementById( 'vertex_shader' ).textContent,
|
||||
fragment_shader: document.getElementById( 'fragment_shader' ).textContent
|
||||
vertexShader: document.getElementById( 'vertexShader' ).textContent,
|
||||
fragmentShader: document.getElementById( 'fragmentShader' ).textContent
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script id="vertex_shader" type="x-shader/x-vertex">
|
||||
<script id="vertexShader" type="x-shader/x-vertex">
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
texture: { type: "t", value: 0, texture: ImageUtils.loadTexture( "textures/disturb.jpg" ) }
|
||||
};
|
||||
|
||||
uniforms2.texture.texture.wrap_s = uniforms2.texture.texture.wrap_t = THREE.Repeat;
|
||||
uniforms2.texture.texture.wrapS = uniforms2.texture.texture.wrapT = THREE.Repeat;
|
||||
|
||||
var size = 0.75, mlib = [],
|
||||
params = [ [ 'fragment_shader1', uniforms1 ], [ 'fragment_shader2', uniforms2 ], [ 'fragment_shader3', uniforms1 ], [ 'fragment_shader4', uniforms1 ] ];
|
||||
@@ -221,8 +221,8 @@
|
||||
material = new THREE.MeshShaderMaterial( {
|
||||
|
||||
uniforms: params[ i ][ 1 ],
|
||||
vertex_shader: document.getElementById( 'vertex_shader' ).textContent,
|
||||
fragment_shader: document.getElementById( params[ i ][ 0 ] ).textContent
|
||||
vertexShader: document.getElementById( 'vertexShader' ).textContent,
|
||||
fragmentShader: document.getElementById( params[ i ][ 0 ] ).textContent
|
||||
|
||||
} );
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ THREE.Camera = function( fov, aspect, near, far, target ) {
|
||||
|
||||
this.tmpVec = new THREE.Vector3();
|
||||
|
||||
this.translateX = function ( amount, nofly ) {
|
||||
this.translateX = function ( amount, noFly ) {
|
||||
|
||||
this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
|
||||
this.tmpVec.crossSelf( this.up );
|
||||
|
||||
if ( nofly ) this.tmpVec.y = 0;
|
||||
if ( noFly ) this.tmpVec.y = 0;
|
||||
|
||||
this.position.addSelf( this.tmpVec );
|
||||
this.target.position.addSelf( this.tmpVec );
|
||||
@@ -45,11 +45,11 @@ THREE.Camera = function( fov, aspect, near, far, target ) {
|
||||
};
|
||||
*/
|
||||
|
||||
this.translateZ = function ( amount, nofly ) {
|
||||
this.translateZ = function ( amount, noFly ) {
|
||||
|
||||
this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
|
||||
|
||||
if ( nofly ) this.tmpVec.y = 0;
|
||||
if ( noFly ) this.tmpVec.y = 0;
|
||||
|
||||
this.position.subSelf( this.tmpVec );
|
||||
this.target.position.subSelf( this.tmpVec );
|
||||
|
||||
+35
-18
@@ -2,6 +2,22 @@
|
||||
* @author mrdoob / http://mrdoob.com/
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
* @author paulirish / http://paulirish.com/
|
||||
*
|
||||
* parameters = {
|
||||
* fov: <float>,
|
||||
* aspect: <float>,
|
||||
* near: <float>,
|
||||
* far: <float>,
|
||||
* target: <THREE.Object3D>,
|
||||
|
||||
* movementSpeed: <float>,
|
||||
* lookSpeed: <float>,
|
||||
|
||||
* noFly: <bool>,
|
||||
* lookVertical: <bool>,
|
||||
|
||||
* domElement: <HTMLElement>,
|
||||
* }
|
||||
*/
|
||||
|
||||
function bind( scope, fn ) {
|
||||
@@ -14,24 +30,25 @@ function bind( scope, fn ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
THREE.QuakeCamera = function ( parameters ) {
|
||||
|
||||
THREE.Camera.call( this, parameters.fov, parameters.aspect, parameters.near, parameters.far, parameters.target );
|
||||
|
||||
this.movement_speed = 1.0;
|
||||
this.look_speed = 0.005;
|
||||
this.movementSpeed = 1.0;
|
||||
this.lookSpeed = 0.005;
|
||||
|
||||
this.nofly = false;
|
||||
this.look_vertical = true;
|
||||
this.noFly = false;
|
||||
this.lookVertical = true;
|
||||
|
||||
this.domElement = document;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
if ( parameters.movement_speed !== undefined ) this.movement_speed = parameters.movement_speed;
|
||||
if ( parameters.look_speed !== undefined ) this.look_speed = parameters.look_speed;
|
||||
if ( parameters.nofly !== undefined ) this.nofly = parameters.nofly;
|
||||
if ( parameters.look_vertical !== undefined ) this.look_vertical = parameters.look_vertical;
|
||||
if ( parameters.movementSpeed !== undefined ) this.movementSpeed = parameters.movementSpeed;
|
||||
if ( parameters.lookSpeed !== undefined ) this.lookSpeed = parameters.lookSpeed;
|
||||
if ( parameters.noFly !== undefined ) this.noFly = parameters.noFly;
|
||||
if ( parameters.lookVertical !== undefined ) this.lookVertical = parameters.lookVertical;
|
||||
|
||||
if ( parameters.domElement !== undefined ) this.domElement = parameters.domElement;
|
||||
|
||||
@@ -130,24 +147,24 @@ THREE.QuakeCamera = function ( parameters ) {
|
||||
|
||||
this.update = function() {
|
||||
|
||||
if ( this.moveForward ) this.translateZ( - this.movement_speed, this.nofly );
|
||||
if ( this.moveBackward ) this.translateZ( this.movement_speed, this.nofly );
|
||||
if ( this.moveLeft ) this.translateX( - this.movement_speed, this.nofly );
|
||||
if ( this.moveRight ) this.translateX( this.movement_speed, this.nofly );
|
||||
if ( this.moveForward ) this.translateZ( - this.movementSpeed, this.noFly );
|
||||
if ( this.moveBackward ) this.translateZ( this.movementSpeed, this.noFly );
|
||||
if ( this.moveLeft ) this.translateX( - this.movementSpeed, this.noFly );
|
||||
if ( this.moveRight ) this.translateX( this.movementSpeed, this.noFly );
|
||||
|
||||
this.lon += this.mouseX * this.look_speed;
|
||||
if( this.look_vertical ) this.lat -= this.mouseY * this.look_speed;
|
||||
this.lon += this.mouseX * this.lookSpeed;
|
||||
if( this.lookVertical ) this.lat -= this.mouseY * this.lookSpeed;
|
||||
|
||||
this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
|
||||
this.phi = ( 90 - this.lat ) * Math.PI / 180;
|
||||
this.theta = this.lon * Math.PI / 180;
|
||||
|
||||
var target_position = this.target.position,
|
||||
var targetPosition = this.target.position,
|
||||
position = this.position;
|
||||
|
||||
target_position.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
|
||||
target_position.y = position.y + 100 * Math.cos( this.phi );
|
||||
target_position.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
|
||||
targetPosition.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
|
||||
targetPosition.y = position.y + 100 * Math.cos( this.phi );
|
||||
targetPosition.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
|
||||
|
||||
this.supr.update.call( this );
|
||||
|
||||
|
||||
+14
-10
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
var SceneUtils = {
|
||||
|
||||
loadScene : function( url, callback_sync, callback_async, callback_progress ) {
|
||||
@@ -256,17 +260,17 @@ var SceneUtils = {
|
||||
|
||||
if ( g.type == "cube" ) {
|
||||
|
||||
geometry = new Cube( g.width, g.height, g.depth, g.segments_width, g.segments_height, null, g.flipped, g.sides );
|
||||
geometry = new Cube( g.width, g.height, g.depth, g.segmentsWidth, g.segmentsHeight, null, g.flipped, g.sides );
|
||||
result.geometries[ dg ] = geometry;
|
||||
|
||||
} else if ( g.type == "plane" ) {
|
||||
|
||||
geometry = new Plane( g.width, g.height, g.segments_width, g.segments_height );
|
||||
geometry = new Plane( g.width, g.height, g.segmentsWidth, g.segmentsHeight );
|
||||
result.geometries[ dg ] = geometry;
|
||||
|
||||
} else if ( g.type == "sphere" ) {
|
||||
|
||||
geometry = new Sphere( g.radius, g.segments_width, g.segments_height );
|
||||
geometry = new Sphere( g.radius, g.segmentsWidth, g.segmentsHeight );
|
||||
result.geometries[ dg ] = geometry;
|
||||
|
||||
} else if ( g.type == "cylinder" ) {
|
||||
@@ -340,11 +344,11 @@ var SceneUtils = {
|
||||
|
||||
texture = ImageUtils.loadTexture( tt.url, tt.mapping, callback_texture );
|
||||
|
||||
if ( THREE[ tt.min_filter ] != undefined )
|
||||
texture.min_filter = THREE[ tt.min_filter ];
|
||||
if ( THREE[ tt.minFilter ] != undefined )
|
||||
texture.minFilter = THREE[ tt.minFilter ];
|
||||
|
||||
if ( THREE[ tt.mag_filter ] != undefined )
|
||||
texture.mag_filter = THREE[ tt.mag_filter ];
|
||||
if ( THREE[ tt.magFilter ] != undefined )
|
||||
texture.magFilter = THREE[ tt.magFilter ];
|
||||
|
||||
}
|
||||
|
||||
@@ -360,7 +364,7 @@ var SceneUtils = {
|
||||
|
||||
for( pp in m.parameters ) {
|
||||
|
||||
if ( pp == "env_map" || pp == "map" || pp == "light_map" ) {
|
||||
if ( pp == "envMap" || pp == "map" || pp == "lightMap" ) {
|
||||
|
||||
m.parameters[ pp ] = result.textures[ m.parameters[ pp ] ];
|
||||
|
||||
@@ -418,8 +422,8 @@ var SceneUtils = {
|
||||
var shader = ShaderUtils.lib["cube"];
|
||||
shader.uniforms["tCube"].texture = textureCube;
|
||||
|
||||
var material = new THREE.MeshShaderMaterial( { fragment_shader: shader.fragment_shader,
|
||||
vertex_shader: shader.vertex_shader,
|
||||
var material = new THREE.MeshShaderMaterial( { fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms
|
||||
} ),
|
||||
|
||||
|
||||
+20
-15
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
* @author mr.doob / http://mrdoob.com/
|
||||
*/
|
||||
|
||||
var ShaderUtils = {
|
||||
|
||||
lib: {
|
||||
@@ -19,7 +24,7 @@ var ShaderUtils = {
|
||||
|
||||
},
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform samplerCube tCube;",
|
||||
|
||||
@@ -43,7 +48,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"uniform float mRefractionRatio;",
|
||||
"uniform float mFresnelBias;",
|
||||
@@ -116,7 +121,7 @@ var ShaderUtils = {
|
||||
|
||||
},
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform vec3 uDirLightPos;",
|
||||
|
||||
@@ -216,7 +221,7 @@ var ShaderUtils = {
|
||||
"}"
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"attribute vec4 tangent;",
|
||||
|
||||
@@ -289,7 +294,7 @@ var ShaderUtils = {
|
||||
|
||||
uniforms: { "tCube": { type: "t", value: 1, texture: null } },
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec3 vViewPosition;",
|
||||
|
||||
@@ -304,7 +309,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform samplerCube tCube;",
|
||||
|
||||
@@ -336,7 +341,7 @@ var ShaderUtils = {
|
||||
"cKernel" : { type: "fv1", value: [] }
|
||||
},
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
@@ -352,7 +357,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
@@ -410,7 +415,7 @@ var ShaderUtils = {
|
||||
grayscale: { type: "i", value: 1 }
|
||||
},
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
@@ -423,7 +428,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
"uniform sampler2D tDiffuse;",
|
||||
@@ -487,7 +492,7 @@ var ShaderUtils = {
|
||||
opacity: { type: "f", value: 1.0 }
|
||||
},
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
|
||||
@@ -500,7 +505,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"varying vec2 vUv;",
|
||||
"uniform sampler2D tDiffuse;",
|
||||
@@ -526,7 +531,7 @@ var ShaderUtils = {
|
||||
|
||||
uniforms: {},
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"void main() {",
|
||||
|
||||
@@ -536,7 +541,7 @@ var ShaderUtils = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"void main() {",
|
||||
|
||||
@@ -579,7 +584,7 @@ var ShaderUtils = {
|
||||
for( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
|
||||
|
||||
return values;
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -1238,7 +1238,7 @@ THREE.Loader.prototype = {
|
||||
// defaults
|
||||
|
||||
mtype = "MeshLambertMaterial";
|
||||
mpars = { color: 0xeeeeee, opacity: 1.0, map: null, light_map: null, vertex_colors: m.vertex_colors };
|
||||
mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, vertexColors: m.vertex_colors };
|
||||
|
||||
// parameters from model file
|
||||
|
||||
@@ -1269,9 +1269,9 @@ THREE.Loader.prototype = {
|
||||
if ( m.map_lightmap && texture_path ) {
|
||||
|
||||
texture = document.createElement( 'canvas' );
|
||||
mpars.light_map = new THREE.Texture( texture );
|
||||
mpars.lightMap = new THREE.Texture( texture );
|
||||
|
||||
load_image( mpars.light_map, texture_path + "/" + m.map_lightmap );
|
||||
load_image( mpars.lightMap, texture_path + "/" + m.map_lightmap );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as
|
||||
*/
|
||||
|
||||
var Cube = function ( width, height, depth, segments_width, segments_height, materials, flipped, sides ) {
|
||||
var Cube = function ( width, height, depth, segmentsWidth, segmentsHeight, materials, flipped, sides ) {
|
||||
|
||||
THREE.Geometry.call( this );
|
||||
|
||||
@@ -65,8 +65,8 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
|
||||
function buildPlane( u, v, udir, vdir, width, height, depth, material ) {
|
||||
|
||||
var w, ix, iy,
|
||||
gridX = segments_width || 1,
|
||||
gridY = segments_height || 1,
|
||||
gridX = segmentsWidth || 1,
|
||||
gridY = segmentsHeight || 1,
|
||||
gridX1 = gridX + 1,
|
||||
gridY1 = gridY + 1,
|
||||
width_half = width / 2,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @author oosmoxiecode
|
||||
|
||||
* uvs are messed up in this one, and commented away for now. There is an ugly "seam" by the shared vertices
|
||||
* when it "wraps" around, that needs to be fixed. It´s because they share the first and the last vertices
|
||||
* so it draws the entire texture on the seam-faces, I think...
|
||||
|
||||
@@ -3,42 +3,65 @@
|
||||
*/
|
||||
|
||||
function LathedObject( verts, nsteps, latheAngle ) {
|
||||
THREE.Geometry.call( this );
|
||||
nsteps = nsteps || 12;
|
||||
latheAngle = latheAngle || 2 * Math.PI;
|
||||
var stepSize = latheAngle / nsteps;
|
||||
var newV = [], oldInds = [], newInds = [], startInds = [];
|
||||
for ( var j = 0; j < verts.length; j ++ ) {
|
||||
this.vertices.push( new THREE.Vertex( verts[ j ] ) );
|
||||
oldInds[ j ] = this.vertices.length - 1;
|
||||
newV[ j ] = new THREE.Vector3( verts[ j ].x, verts[ j ].y, verts[ j ].z );
|
||||
}
|
||||
var m = THREE.Matrix4.rotationZMatrix( stepSize );
|
||||
for ( var r = 0; r <= latheAngle + 0.001; r += stepSize ) { // need the +0.001 for it go up to latheAngle
|
||||
for ( var j = 0; j < newV.length; j ++ ) {
|
||||
if ( r < latheAngle ) {
|
||||
newV[ j ] = m.multiplyVector3( newV[ j ].clone() );
|
||||
this.vertices.push( new THREE.Vertex( newV[ j ] ) );
|
||||
newInds[ j ] = this.vertices.length - 1;
|
||||
} else {
|
||||
newInds = startInds; // wrap it up!
|
||||
}
|
||||
}
|
||||
if ( r == 0 ) startInds = oldInds;
|
||||
for ( var j = 0; j < oldInds.length - 1; j ++ ) {
|
||||
this.faces.push( new THREE.Face4( newInds[ j ], newInds[ j + 1 ], oldInds[ j + 1 ], oldInds[ j ] ) );
|
||||
this.uvs.push( [ new THREE.UV( r / latheAngle, j / verts.length ),
|
||||
new THREE.UV( r / latheAngle, ( j + 1 ) / verts.length ),
|
||||
new THREE.UV( ( r - stepSize ) / latheAngle, ( j + 1 ) / verts.length ),
|
||||
new THREE.UV( ( r - stepSize ) / latheAngle, j / verts.length ) ] );
|
||||
}
|
||||
oldInds = newInds;
|
||||
newInds = [];
|
||||
}
|
||||
this.computeCentroids();
|
||||
this.computeFaceNormals();
|
||||
this.computeVertexNormals();
|
||||
this.sortFacesByMaterial();
|
||||
|
||||
THREE.Geometry.call( this );
|
||||
|
||||
this.nsteps = nsteps || 12;
|
||||
this.latheAngle = latheAngle || 2 * Math.PI;
|
||||
|
||||
var stepSize = this.latheAngle / this.nsteps;
|
||||
|
||||
var newV = [], oldInds = [], newInds = [], startInds = [];
|
||||
|
||||
for ( var j = 0; j < verts.length; j ++ ) {
|
||||
|
||||
this.vertices.push( new THREE.Vertex( verts[ j ] ) );
|
||||
oldInds[ j ] = this.vertices.length - 1;
|
||||
newV[ j ] = new THREE.Vector3( verts[ j ].x, verts[ j ].y, verts[ j ].z );
|
||||
|
||||
}
|
||||
|
||||
var m = THREE.Matrix4.rotationZMatrix( this.stepSize );
|
||||
|
||||
for ( var r = 0; r <= this.latheAngle + 0.001; r += this.stepSize ) { // need the +0.001 for it go up to latheAngle
|
||||
|
||||
for ( var j = 0; j < newV.length; j ++ ) {
|
||||
|
||||
if ( r < latheAngle ) {
|
||||
|
||||
newV[ j ] = m.multiplyVector3( newV[ j ].clone() );
|
||||
this.vertices.push( new THREE.Vertex( newV[ j ] ) );
|
||||
newInds[ j ] = this.vertices.length - 1;
|
||||
|
||||
} else {
|
||||
|
||||
newInds = startInds; // wrap it up!
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( r == 0 ) startInds = oldInds;
|
||||
|
||||
for ( var j = 0; j < oldInds.length - 1; j ++ ) {
|
||||
|
||||
this.faces.push( new THREE.Face4( newInds[ j ], newInds[ j + 1 ], oldInds[ j + 1 ], oldInds[ j ] ) );
|
||||
this.uvs.push( [ new THREE.UV( r / latheAngle, j / verts.length ),
|
||||
new THREE.UV( r / latheAngle, ( j + 1 ) / verts.length ),
|
||||
new THREE.UV( ( r - stepSize ) / latheAngle, ( j + 1 ) / verts.length ),
|
||||
new THREE.UV( ( r - stepSize ) / latheAngle, j / verts.length ) ] );
|
||||
|
||||
}
|
||||
|
||||
oldInds = newInds;
|
||||
newInds = [];
|
||||
}
|
||||
|
||||
this.computeCentroids();
|
||||
this.computeFaceNormals();
|
||||
this.computeVertexNormals();
|
||||
this.sortFacesByMaterial();
|
||||
|
||||
};
|
||||
|
||||
LathedObject.prototype = new THREE.Geometry();
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
|
||||
*/
|
||||
|
||||
var Plane = function ( width, height, segments_width, segments_height ) {
|
||||
var Plane = function ( width, height, segmentsWidth, segmentsHeight ) {
|
||||
|
||||
THREE.Geometry.call( this );
|
||||
|
||||
var ix, iy,
|
||||
width_half = width / 2,
|
||||
height_half = height / 2,
|
||||
gridX = segments_width || 1,
|
||||
gridY = segments_height || 1,
|
||||
gridX = segmentsWidth || 1,
|
||||
gridY = segmentsHeight || 1,
|
||||
gridX1 = gridX + 1,
|
||||
gridY1 = gridY + 1,
|
||||
segment_width = width / gridX,
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Sphere.as
|
||||
*/
|
||||
|
||||
var Sphere = function ( radius, segments_width, segments_height ) {
|
||||
var Sphere = function ( radius, segmentsWidth, segmentsHeight ) {
|
||||
|
||||
THREE.Geometry.call( this );
|
||||
|
||||
var gridX = segments_width || 8,
|
||||
gridY = segments_height || 6;
|
||||
var gridX = segmentsWidth || 8,
|
||||
gridY = segmentsHeight || 6;
|
||||
|
||||
var i, j, pi = Math.PI;
|
||||
var iHor = Math.max( 3, gridX );
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
* opacity: <float>,
|
||||
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* linewidth: <float>,
|
||||
* linecap: "round",
|
||||
* linejoin: "round",
|
||||
|
||||
* vertex_colors: <bool>
|
||||
* vertexColors: <bool>
|
||||
* }
|
||||
*/
|
||||
|
||||
@@ -25,13 +25,13 @@ THREE.LineBasicMaterial = function ( parameters ) {
|
||||
this.opacity = 1.0;
|
||||
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.linewidth = 1.0;
|
||||
this.linecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.linejoin = 'round'; // implemented just in CanvasRenderer
|
||||
|
||||
this.vertex_colors = false;
|
||||
this.vertexColors = false;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
@@ -39,13 +39,13 @@ THREE.LineBasicMaterial = function ( parameters ) {
|
||||
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
||||
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.linewidth !== undefined ) this.linewidth = parameters.linewidth;
|
||||
if ( parameters.linecap !== undefined ) this.linecap = parameters.linecap;
|
||||
if ( parameters.linejoin !== undefined ) this.linejoin = parameters.linejoin;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
* opacity: <float>,
|
||||
* map: new THREE.Texture( <Image> ),
|
||||
|
||||
* light_map: new THREE.Texture( <Image> ),
|
||||
* lightMap: new THREE.Texture( <Image> ),
|
||||
|
||||
* env_map: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* combine: THREE.Multiply,
|
||||
* reflectivity: <float>,
|
||||
* refraction_ratio: <float>,
|
||||
* refractionRatio: <float>,
|
||||
|
||||
* shading: THREE.SmoothShading,
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>,
|
||||
* wireframeLinewidth: <float>,
|
||||
|
||||
* vertex_colors: <bool>,
|
||||
* vertexColors: <bool>,
|
||||
* skinning: <bool>
|
||||
* }
|
||||
*/
|
||||
@@ -34,52 +34,52 @@ THREE.MeshBasicMaterial = function ( parameters ) {
|
||||
this.opacity = 1.0;
|
||||
this.map = null;
|
||||
|
||||
this.light_map = null;
|
||||
this.lightMap = null;
|
||||
|
||||
this.env_map = null;
|
||||
this.envMap = null;
|
||||
this.combine = THREE.MultiplyOperation;
|
||||
this.reflectivity = 1.0;
|
||||
this.refraction_ratio = 0.98;
|
||||
this.refractionRatio = 0.98;
|
||||
|
||||
this.fog = true; // implemented just in WebGLRenderer2
|
||||
|
||||
this.shading = THREE.SmoothShading;
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinewidth = 1.0;
|
||||
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
|
||||
|
||||
this.vertex_colors = false;
|
||||
this.vertexColors = false;
|
||||
this.skinning = false;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
|
||||
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
||||
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
||||
if ( parameters.map !== undefined ) this.map = parameters.map;
|
||||
|
||||
if ( parameters.light_map !== undefined ) this.light_map = parameters.light_map;
|
||||
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
|
||||
|
||||
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
|
||||
if ( parameters.envMap !== undefined ) this.envMap = parameters.envMap;
|
||||
if ( parameters.combine !== undefined ) this.combine = parameters.combine;
|
||||
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
|
||||
if ( parameters.refraction_ratio !== undefined ) this.refraction_ratio = parameters.refraction_ratio;
|
||||
if ( parameters.refractionRatio !== undefined ) this.refractionRatio = parameters.refractionRatio;
|
||||
|
||||
if ( parameters.fog !== undefined ) this.fog = parameters.fog;
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
|
||||
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap;
|
||||
if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
* opacity: <float>,
|
||||
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>
|
||||
* wireframeLinewidth: <float>
|
||||
* }
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,10 @@ THREE.MeshDepthMaterial = function ( parameters ) {
|
||||
|
||||
this.shading = THREE.SmoothShading; // doesn't really apply here, normals are not used
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframeLinewidth = 1.0;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
@@ -32,10 +32,10 @@ THREE.MeshDepthMaterial = function ( parameters ) {
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
* opacity: <float>,
|
||||
* map: new THREE.Texture( <Image> ),
|
||||
|
||||
* light_map: new THREE.Texture( <Image> ),
|
||||
* lightMap: new THREE.Texture( <Image> ),
|
||||
|
||||
* env_map: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* combine: THREE.Multiply,
|
||||
* reflectivity: <float>,
|
||||
* refraction_ratio: <float>,
|
||||
* refractionRatio: <float>,
|
||||
|
||||
* shading: THREE.SmoothShading,
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>,
|
||||
* wireframeLinewidth: <float>,
|
||||
|
||||
* vertex_colors: <bool>,
|
||||
* vertexColors: <bool>,
|
||||
* skinning: <bool>
|
||||
* }
|
||||
*/
|
||||
@@ -34,25 +34,25 @@ THREE.MeshLambertMaterial = function ( parameters ) {
|
||||
this.opacity = 1.0;
|
||||
this.map = null;
|
||||
|
||||
this.light_map = null;
|
||||
this.lightMap = null;
|
||||
|
||||
this.env_map = null;
|
||||
this.envMap = null;
|
||||
this.combine = THREE.MultiplyOperation;
|
||||
this.reflectivity = 1.0;
|
||||
this.refraction_ratio = 0.98;
|
||||
this.refractionRatio = 0.98;
|
||||
|
||||
this.fog = true; // implemented just in WebGLRenderer2
|
||||
|
||||
this.shading = THREE.SmoothShading;
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinewidth = 1.0;
|
||||
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
|
||||
|
||||
this.vertex_colors = false;
|
||||
this.vertexColors = false;
|
||||
this.skinning = false;
|
||||
|
||||
if ( parameters ) {
|
||||
@@ -61,25 +61,25 @@ THREE.MeshLambertMaterial = function ( parameters ) {
|
||||
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
||||
if ( parameters.map !== undefined ) this.map = parameters.map;
|
||||
|
||||
if ( parameters.light_map !== undefined ) this.light_map = parameters.light_map;
|
||||
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
|
||||
|
||||
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
|
||||
if ( parameters.envMap !== undefined ) this.envMap = parameters.envMap;
|
||||
if ( parameters.combine !== undefined ) this.combine = parameters.combine;
|
||||
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
|
||||
if ( parameters.refraction_ratio !== undefined ) this.refraction_ratio = parameters.refraction_ratio;
|
||||
if ( parameters.refractionRatio !== undefined ) this.refractionRatio = parameters.refractionRatio;
|
||||
|
||||
if ( parameters.fog !== undefined ) this.fog = parameters.fog;
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
|
||||
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap;
|
||||
if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
* shading: THREE.FlatShading,
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>
|
||||
* wireframeLinewidth: <float>
|
||||
* }
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,10 @@ THREE.MeshNormalMaterial = function ( parameters ) {
|
||||
|
||||
this.shading = THREE.FlatShading;
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframeLinewidth = 1.0;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
@@ -32,10 +32,10 @@ THREE.MeshNormalMaterial = function ( parameters ) {
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,21 +11,21 @@
|
||||
|
||||
* map: new THREE.Texture( <Image> ),
|
||||
|
||||
* light_map: new THREE.Texture( <Image> ),
|
||||
* lightMap: new THREE.Texture( <Image> ),
|
||||
|
||||
* env_map: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
|
||||
* combine: THREE.Multiply,
|
||||
* reflectivity: <float>,
|
||||
* refraction_ratio: <float>,
|
||||
* refractionRatio: <float>,
|
||||
|
||||
* shading: THREE.SmoothShading,
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>,
|
||||
* wireframeLinewidth: <float>,
|
||||
|
||||
* vertex_colors: <bool>,
|
||||
* vertexColors: <bool>,
|
||||
* skinning: <bool>
|
||||
* }
|
||||
*/
|
||||
@@ -42,25 +42,25 @@ THREE.MeshPhongMaterial = function ( parameters ) {
|
||||
|
||||
this.map = null;
|
||||
|
||||
this.light_map = null;
|
||||
this.lightMap = null;
|
||||
|
||||
this.env_map = null;
|
||||
this.envMap = null;
|
||||
this.combine = THREE.MultiplyOperation;
|
||||
this.reflectivity = 1.0;
|
||||
this.refraction_ratio = 0.98;
|
||||
this.refractionRatio = 0.98;
|
||||
|
||||
this.fog = true; // implemented just in WebGLRenderer2
|
||||
|
||||
this.shading = THREE.SmoothShading;
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinewidth = 1.0;
|
||||
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
|
||||
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
|
||||
|
||||
this.vertex_colors = false;
|
||||
this.vertexColors = false;
|
||||
this.skinning = false;
|
||||
|
||||
if ( parameters ) {
|
||||
@@ -71,27 +71,27 @@ THREE.MeshPhongMaterial = function ( parameters ) {
|
||||
if ( parameters.shininess !== undefined ) this.shininess = parameters.shininess;
|
||||
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
|
||||
|
||||
if ( parameters.light_map !== undefined ) this.light_map = parameters.light_map;
|
||||
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
|
||||
|
||||
if ( parameters.map !== undefined ) this.map = parameters.map;
|
||||
|
||||
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
|
||||
if ( parameters.envMap !== undefined ) this.envMap = parameters.envMap;
|
||||
if ( parameters.combine !== undefined ) this.combine = parameters.combine;
|
||||
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
|
||||
if ( parameters.refraction_ratio !== undefined ) this.refraction_ratio = parameters.refraction_ratio;
|
||||
if ( parameters.refractionRatio !== undefined ) this.refractionRatio = parameters.refractionRatio;
|
||||
|
||||
if ( parameters.fog !== undefined ) this.fog = parameters.fog;
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
|
||||
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap;
|
||||
if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*
|
||||
* parameters = {
|
||||
* fragment_shader: <string>,
|
||||
* vertex_shader: <string>,
|
||||
* fragmentShader: <string>,
|
||||
* vertexShader: <string>,
|
||||
|
||||
* uniforms: { "parameter1": { type: "f", value: 1.0 }, "parameter2": { type: "i" value2: 2 } },
|
||||
|
||||
* shading: THREE.SmoothShading,
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* wireframe: <boolean>,
|
||||
* wireframe_linewidth: <float>,
|
||||
* wireframeLinewidth: <float>,
|
||||
|
||||
* vertex_colors: <bool>,
|
||||
* vertexColors: <bool>,
|
||||
* skinning: <bool>
|
||||
* }
|
||||
*/
|
||||
@@ -23,28 +23,28 @@ THREE.MeshShaderMaterial = function ( parameters ) {
|
||||
|
||||
this.id = THREE.MaterialCounter.value ++;
|
||||
|
||||
this.fragment_shader = "void main() {}";
|
||||
this.vertex_shader = "void main() {}";
|
||||
this.fragmentShader = "void main() {}";
|
||||
this.vertexShader = "void main() {}";
|
||||
this.uniforms = {};
|
||||
|
||||
this.opacity = 1.0; // set to < 1.0 to renderer in transparent batch
|
||||
|
||||
this.shading = THREE.SmoothShading;
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.wireframe = false;
|
||||
this.wireframe_linewidth = 1.0;
|
||||
this.wireframe_linecap = 'round'; // doesn't make sense here
|
||||
this.wireframe_linejoin = 'round'; // not implemented in WebGLRenderer (and this material doesn't make sense in CanvasRenderer)
|
||||
this.wireframeLinewidth = 1.0;
|
||||
this.wireframeLinecap = 'round'; // doesn't make sense here
|
||||
this.wireframeLinejoin = 'round'; // not implemented in WebGLRenderer (and this material doesn't make sense in CanvasRenderer)
|
||||
|
||||
this.vertex_colors = false; // must set this if shader wants to use "color" attribute stream
|
||||
this.vertexColors = false; // must set this if shader wants to use "color" attribute stream
|
||||
this.skinning = false; // must set this is shader wants to use skinning attribute streams
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
if ( parameters.fragment_shader !== undefined ) this.fragment_shader = parameters.fragment_shader;
|
||||
if ( parameters.vertex_shader !== undefined ) this.vertex_shader = parameters.vertex_shader;
|
||||
if ( parameters.fragmentShader !== undefined ) this.fragmentShader = parameters.fragmentShader;
|
||||
if ( parameters.vertexShader !== undefined ) this.vertexShader = parameters.vertexShader;
|
||||
|
||||
if ( parameters.uniforms !== undefined ) this.uniforms = parameters.uniforms;
|
||||
|
||||
@@ -52,14 +52,14 @@ THREE.MeshShaderMaterial = function ( parameters ) {
|
||||
|
||||
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
|
||||
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
|
||||
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
|
||||
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
|
||||
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
|
||||
if ( parameters.wireframeLinecap !== undefined ) this.wireframeLinecap = parameters.wireframeLinecap;
|
||||
if ( parameters.wireframeLinejoin !== undefined ) this.wireframeLinejoin = parameters.wireframeLinejoin;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* size: <float>,
|
||||
|
||||
* blending: THREE.NormalBlending,
|
||||
* depth_test: <bool>,
|
||||
* depthTest: <bool>,
|
||||
|
||||
* vertex_colors: <bool>
|
||||
* vertexColors: <bool>
|
||||
* }
|
||||
*/
|
||||
|
||||
@@ -27,11 +27,11 @@ THREE.ParticleBasicMaterial = function ( parameters ) {
|
||||
this.size = 1.0;
|
||||
|
||||
this.blending = THREE.NormalBlending;
|
||||
this.depth_test = true;
|
||||
this.depthTest = true;
|
||||
|
||||
this.offset = new THREE.Vector2(); // TODO: expose to parameters (implemented just in CanvasRenderer)
|
||||
|
||||
this.vertex_colors = false;
|
||||
this.vertexColors = false;
|
||||
|
||||
if ( parameters ) {
|
||||
|
||||
@@ -42,9 +42,9 @@ THREE.ParticleBasicMaterial = function ( parameters ) {
|
||||
if ( parameters.size !== undefined ) this.size = parameters.size;
|
||||
|
||||
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
|
||||
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
|
||||
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
|
||||
|
||||
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
|
||||
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ THREE.RenderTarget = function ( width, height, options ) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
this.wrap_s = options.wrap_s !== undefined ? options.wrap_s : THREE.ClampToEdgeWrapping;
|
||||
this.wrap_t = options.wrap_t !== undefined ? options.wrap_t : THREE.ClampToEdgeWrapping;
|
||||
this.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping;
|
||||
this.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping;
|
||||
|
||||
this.mag_filter = options.mag_filter !== undefined ? options.mag_filter : THREE.LinearFilter;
|
||||
this.min_filter = options.min_filter !== undefined ? options.min_filter : THREE.LinearMipMapLinearFilter;
|
||||
this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;
|
||||
this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;
|
||||
|
||||
this.format = options.format !== undefined ? options.format : THREE.RGBFormat;
|
||||
this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
* @author szimek / https://github.com/szimek/
|
||||
*/
|
||||
|
||||
THREE.Texture = function ( image, mapping, wrap_s, wrap_t, mag_filter, min_filter ) {
|
||||
THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter ) {
|
||||
|
||||
this.image = image;
|
||||
|
||||
this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
|
||||
|
||||
this.wrap_s = wrap_s !== undefined ? wrap_s : THREE.ClampToEdgeWrapping;
|
||||
this.wrap_t = wrap_t !== undefined ? wrap_t : THREE.ClampToEdgeWrapping;
|
||||
this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;
|
||||
this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;
|
||||
|
||||
this.mag_filter = mag_filter !== undefined ? mag_filter : THREE.LinearFilter;
|
||||
this.min_filter = min_filter !== undefined ? min_filter : THREE.LinearMipMapLinearFilter;
|
||||
this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
|
||||
this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
|
||||
|
||||
this.needsUpdate = false;
|
||||
|
||||
@@ -24,7 +24,7 @@ THREE.Texture.prototype = {
|
||||
|
||||
clone: function () {
|
||||
|
||||
return new THREE.Texture( this.image, this.mapping, this.wrap_s, this.wrap_t, this.mag_filter, this.min_filter );
|
||||
return new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
var Uniforms = {
|
||||
|
||||
clone: function( uniforms_src ) {
|
||||
|
||||
@@ -519,10 +519,10 @@ THREE.CanvasRenderer = function () {
|
||||
}
|
||||
|
||||
|
||||
} else if ( material.env_map ) {
|
||||
} else if ( material.envMap ) {
|
||||
|
||||
|
||||
if ( material.env_map.mapping instanceof THREE.SphericalReflectionMapping ) {
|
||||
if ( material.envMap.mapping instanceof THREE.SphericalReflectionMapping ) {
|
||||
|
||||
var cameraMatrix = camera.matrixWorld;
|
||||
|
||||
@@ -538,9 +538,9 @@ THREE.CanvasRenderer = function () {
|
||||
_uv3x = ( _vector3.x * cameraMatrix.n11 + _vector3.y * cameraMatrix.n12 + _vector3.z * cameraMatrix.n13 ) * 0.5 + 0.5;
|
||||
_uv3y = - ( _vector3.x * cameraMatrix.n21 + _vector3.y * cameraMatrix.n22 + _vector3.z * cameraMatrix.n23 ) * 0.5 + 0.5;
|
||||
|
||||
texturePath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, material.env_map.image, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y );
|
||||
texturePath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, material.envMap.image, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y );
|
||||
|
||||
}/* else if ( material.env_map.mapping == THREE.RefractionMapping ) {
|
||||
}/* else if ( material.envMap.mapping == THREE.RefractionMapping ) {
|
||||
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@ THREE.CanvasRenderer = function () {
|
||||
|
||||
} else {
|
||||
|
||||
material.wireframe ? strokePath( material.color.__styleString, material.wireframe_linewidth ) : fillPath( material.color.__styleString );
|
||||
material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
|
||||
|
||||
}
|
||||
|
||||
@@ -600,13 +600,13 @@ THREE.CanvasRenderer = function () {
|
||||
_color.b = material.color.b * _light.b;
|
||||
|
||||
_color.updateStyleString();
|
||||
material.wireframe ? strokePath( _color.__styleString, material.wireframe_linewidth ) : fillPath( _color.__styleString );
|
||||
material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
material.wireframe ? strokePath( material.color.__styleString, material.wireframe_linewidth ) : fillPath( material.color.__styleString );
|
||||
material.wireframe ? strokePath( material.color.__styleString, material.wireframeLinewidth ) : fillPath( material.color.__styleString );
|
||||
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ THREE.CanvasRenderer = function () {
|
||||
_color.b = normalToComponent( element.normalWorld.z );
|
||||
_color.updateStyleString();
|
||||
|
||||
material.wireframe ? strokePath( _color.__styleString, material.wireframe_linewidth ) : fillPath( _color.__styleString );
|
||||
material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ THREE.SVGRenderer = function () {
|
||||
|
||||
if ( material.wireframe ) {
|
||||
|
||||
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframe_linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframe_linecap + '; stroke-linejoin: ' + material.wireframe_linejoin );
|
||||
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
|
||||
|
||||
} else {
|
||||
|
||||
@@ -462,7 +462,7 @@ THREE.SVGRenderer = function () {
|
||||
|
||||
if ( material.wireframe ) {
|
||||
|
||||
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframe_linewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframe_linecap + '; stroke-linejoin: ' + material.wireframe_linejoin );
|
||||
_svgNode.setAttribute( 'style', 'fill: none; stroke: ' + _color.__styleString + '; stroke-width: ' + material.wireframeLinewidth + '; stroke-opacity: ' + material.opacity + '; stroke-linecap: ' + material.wireframeLinecap + '; stroke-linejoin: ' + material.wireframeLinejoin );
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -1225,8 +1225,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
function setMaterialShaders( material, shaders ) {
|
||||
|
||||
material.fragment_shader = shaders.fragment_shader;
|
||||
material.vertex_shader = shaders.vertex_shader;
|
||||
material.fragmentShader = shaders.fragmentShader;
|
||||
material.vertexShader = shaders.vertexShader;
|
||||
material.uniforms = Uniforms.clone( shaders.uniforms );
|
||||
|
||||
};
|
||||
@@ -1242,13 +1242,13 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
uniforms.opacity.value = material.opacity;
|
||||
uniforms.map.texture = material.map;
|
||||
|
||||
uniforms.light_map.texture = material.light_map;
|
||||
uniforms.lightMap.texture = material.lightMap;
|
||||
|
||||
uniforms.env_map.texture = material.env_map;
|
||||
uniforms.envMap.texture = material.envMap;
|
||||
uniforms.reflectivity.value = material.reflectivity;
|
||||
uniforms.refraction_ratio.value = material.refraction_ratio;
|
||||
uniforms.refractionRatio.value = material.refractionRatio;
|
||||
uniforms.combine.value = material.combine;
|
||||
uniforms.useRefract.value = material.env_map && material.env_map.mapping instanceof THREE.CubeRefractionMapping;
|
||||
uniforms.useRefract.value = material.envMap && material.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
||||
|
||||
};
|
||||
|
||||
@@ -1346,11 +1346,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
maxLightCount = allocateLights( lights, 4 );
|
||||
|
||||
parameters = { fog: fog, map: material.map, env_map: material.env_map, light_map: material.light_map, vertex_colors: material.vertex_colors,
|
||||
parameters = { fog: fog, map: material.map, envMap: material.envMap, lightMap: material.lightMap, vertexColors: material.vertexColors,
|
||||
skinning: material.skinning,
|
||||
maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point };
|
||||
|
||||
material.program = buildProgram( material.fragment_shader, material.vertex_shader, parameters );
|
||||
material.program = buildProgram( material.fragmentShader, material.vertexShader, parameters );
|
||||
|
||||
identifiers = [ 'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'objectMatrix', 'cameraPosition',
|
||||
'cameraInverseMatrix', 'boneGlobalMatrices'
|
||||
@@ -1470,14 +1470,14 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
if ( material instanceof THREE.MeshShaderMaterial ||
|
||||
material instanceof THREE.MeshPhongMaterial ||
|
||||
material.env_map ) {
|
||||
material.envMap ) {
|
||||
|
||||
_gl.uniform3f( p_uniforms.cameraPosition, camera.position.x, camera.position.y, camera.position.z );
|
||||
|
||||
}
|
||||
|
||||
if ( material instanceof THREE.MeshShaderMaterial ||
|
||||
material.env_map ||
|
||||
material.envMap ||
|
||||
material.skinning ) {
|
||||
|
||||
_gl.uniformMatrix4fv( p_uniforms.objectMatrix, false, object._objectMatrixArray );
|
||||
@@ -1605,7 +1605,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
if ( material.wireframe ) {
|
||||
|
||||
_gl.lineWidth( material.wireframe_linewidth );
|
||||
_gl.lineWidth( material.wireframeLinewidth );
|
||||
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryChunk.__webGLLineBuffer );
|
||||
_gl.drawElements( _gl.LINES, geometryChunk.__webGLLineCount, _gl.UNSIGNED_SHORT, 0 );
|
||||
|
||||
@@ -1972,7 +1972,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
material = opaque.list[ i ];
|
||||
|
||||
setDepthTest( material.depth_test );
|
||||
setDepthTest( material.depthTest );
|
||||
renderBuffer( camera, lights, fog, material, buffer, object );
|
||||
|
||||
}
|
||||
@@ -1998,7 +1998,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
material = opaque.list[ i ];
|
||||
|
||||
setDepthTest( material.depth_test );
|
||||
setDepthTest( material.depthTest );
|
||||
|
||||
program = setProgram( camera, lights, fog, material, object );
|
||||
object.render( function( object ) { renderBufferImmediate( object, program ); } );
|
||||
@@ -2028,7 +2028,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
material = transparent.list[ i ];
|
||||
|
||||
setBlending( material.blending );
|
||||
setDepthTest( material.depth_test );
|
||||
setDepthTest( material.depthTest );
|
||||
|
||||
renderBuffer( camera, lights, fog, material, buffer, object );
|
||||
|
||||
@@ -2056,7 +2056,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
material = transparent.list[ i ];
|
||||
|
||||
setBlending( material.blending );
|
||||
setDepthTest( material.depth_test );
|
||||
setDepthTest( material.depthTest );
|
||||
|
||||
program = setProgram( camera, lights, fog, material, object );
|
||||
object.render( function( object ) { renderBufferImmediate( object, program ); } );
|
||||
@@ -2069,7 +2069,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
// Generate mipmap if we're using any kind of mipmap filtering
|
||||
|
||||
if ( renderTarget && renderTarget.min_filter !== THREE.NearestFilter && renderTarget.min_filter !== THREE.LinearFilter ) {
|
||||
if ( renderTarget && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {
|
||||
|
||||
updateRenderTargetMipmap( renderTarget );
|
||||
|
||||
@@ -2385,7 +2385,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
};
|
||||
|
||||
function buildProgram( fragment_shader, vertex_shader, parameters ) {
|
||||
function buildProgram( fragmentShader, vertexShader, parameters ) {
|
||||
|
||||
var program = _gl.createProgram(),
|
||||
|
||||
@@ -2401,9 +2401,9 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
parameters.fog instanceof THREE.FogExp2 ? "#define FOG_EXP2" : "",
|
||||
|
||||
parameters.map ? "#define USE_MAP" : "",
|
||||
parameters.env_map ? "#define USE_ENVMAP" : "",
|
||||
parameters.light_map ? "#define USE_LIGHTMAP" : "",
|
||||
parameters.vertex_colors ? "#define USE_COLOR" : "",
|
||||
parameters.envMap ? "#define USE_ENVMAP" : "",
|
||||
parameters.lightMap ? "#define USE_LIGHTMAP" : "",
|
||||
parameters.vertexColors ? "#define USE_COLOR" : "",
|
||||
|
||||
"uniform mat4 viewMatrix;",
|
||||
"uniform vec3 cameraPosition;",
|
||||
@@ -2417,9 +2417,9 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
"#define MAX_POINT_LIGHTS " + parameters.maxPointLights,
|
||||
|
||||
parameters.map ? "#define USE_MAP" : "",
|
||||
parameters.env_map ? "#define USE_ENVMAP" : "",
|
||||
parameters.light_map ? "#define USE_LIGHTMAP" : "",
|
||||
parameters.vertex_colors ? "#define USE_COLOR" : "",
|
||||
parameters.envMap ? "#define USE_ENVMAP" : "",
|
||||
parameters.lightMap ? "#define USE_LIGHTMAP" : "",
|
||||
parameters.vertexColors ? "#define USE_COLOR" : "",
|
||||
parameters.skinning ? "#define USE_SKINNING" : "",
|
||||
|
||||
"uniform mat4 objectMatrix;",
|
||||
@@ -2444,8 +2444,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
""
|
||||
].join("\n");
|
||||
|
||||
_gl.attachShader( program, getShader( "fragment", prefix_fragment + fragment_shader ) );
|
||||
_gl.attachShader( program, getShader( "vertex", prefix_vertex + vertex_shader ) );
|
||||
_gl.attachShader( program, getShader( "fragment", prefix_fragment + fragmentShader ) );
|
||||
_gl.attachShader( program, getShader( "vertex", prefix_vertex + vertexShader ) );
|
||||
|
||||
_gl.linkProgram( program );
|
||||
|
||||
@@ -2454,13 +2454,13 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
alert( "Could not initialise shaders\n"+
|
||||
"VALIDATE_STATUS: " + _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ) + ", gl error [" + _gl.getError() + "]" );
|
||||
|
||||
//console.log( prefix_fragment + fragment_shader );
|
||||
//console.log( prefix_vertex + vertex_shader );
|
||||
//console.log( prefix_fragment + fragmentShader );
|
||||
//console.log( prefix_vertex + vertexShader );
|
||||
|
||||
}
|
||||
|
||||
//console.log( prefix_fragment + fragment_shader );
|
||||
//console.log( prefix_vertex + vertex_shader );
|
||||
//console.log( prefix_fragment + fragmentShader );
|
||||
//console.log( prefix_vertex + vertexShader );
|
||||
|
||||
program.uniforms = {};
|
||||
program.attributes = {};
|
||||
@@ -2649,11 +2649,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
|
||||
_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrap_s ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrap_t ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.mag_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.min_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
|
||||
_gl.generateMipmap( _gl.TEXTURE_2D );
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, null );
|
||||
|
||||
@@ -2664,11 +2664,11 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
|
||||
_gl.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrap_s ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrap_t ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.mag_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.min_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
|
||||
_gl.generateMipmap( _gl.TEXTURE_2D );
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, null );
|
||||
|
||||
@@ -2699,10 +2699,10 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
// Setup texture
|
||||
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, renderTexture.__webGLTexture );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( renderTexture.wrap_s ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( renderTexture.wrap_t ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( renderTexture.mag_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( renderTexture.min_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( renderTexture.wrapS ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( renderTexture.wrapT ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( renderTexture.magFilter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( renderTexture.minFilter ) );
|
||||
_gl.texImage2D( _gl.TEXTURE_2D, 0, paramThreeToGL( renderTexture.format ), renderTexture.width, renderTexture.height, 0, paramThreeToGL( renderTexture.format ), paramThreeToGL( renderTexture.type ), null );
|
||||
|
||||
// Setup framebuffer
|
||||
@@ -3009,7 +3009,7 @@ THREE.Snippets = {
|
||||
|
||||
"varying vec3 vReflect;",
|
||||
"uniform float reflectivity;",
|
||||
"uniform samplerCube env_map;",
|
||||
"uniform samplerCube envMap;",
|
||||
"uniform int combine;",
|
||||
|
||||
"#endif"
|
||||
@@ -3020,7 +3020,7 @@ THREE.Snippets = {
|
||||
|
||||
"#ifdef USE_ENVMAP",
|
||||
|
||||
"vec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );",
|
||||
"vec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );",
|
||||
|
||||
"if ( combine == 1 ) {",
|
||||
|
||||
@@ -3042,7 +3042,7 @@ THREE.Snippets = {
|
||||
"#ifdef USE_ENVMAP",
|
||||
|
||||
"varying vec3 vReflect;",
|
||||
"uniform float refraction_ratio;",
|
||||
"uniform float refractionRatio;",
|
||||
"uniform bool useRefract;",
|
||||
|
||||
"#endif"
|
||||
@@ -3058,7 +3058,7 @@ THREE.Snippets = {
|
||||
|
||||
"if ( useRefract ) {",
|
||||
|
||||
"vReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );",
|
||||
"vReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );",
|
||||
|
||||
"} else {",
|
||||
|
||||
@@ -3143,7 +3143,7 @@ THREE.Snippets = {
|
||||
"#ifdef USE_LIGHTMAP",
|
||||
|
||||
"varying vec2 vUv2;",
|
||||
"uniform sampler2D light_map;",
|
||||
"uniform sampler2D lightMap;",
|
||||
|
||||
"#endif"
|
||||
|
||||
@@ -3163,7 +3163,7 @@ THREE.Snippets = {
|
||||
|
||||
"#ifdef USE_LIGHTMAP",
|
||||
|
||||
"gl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );",
|
||||
"gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );",
|
||||
|
||||
"#endif"
|
||||
|
||||
@@ -3423,12 +3423,12 @@ THREE.UniformsLib = {
|
||||
"opacity" : { type: "f", value: 1.0 },
|
||||
"map" : { type: "t", value: 0, texture: null },
|
||||
|
||||
"light_map" : { type: "t", value: 2, texture: null },
|
||||
"lightMap" : { type: "t", value: 2, texture: null },
|
||||
|
||||
"env_map" : { type: "t", value: 1, texture: null },
|
||||
"envMap" : { type: "t", value: 1, texture: null },
|
||||
"useRefract" : { type: "i", value: 0 },
|
||||
"reflectivity" : { type: "f", value: 1.0 },
|
||||
"refraction_ratio": { type: "f", value: 0.98 },
|
||||
"refractionRatio": { type: "f", value: 0.98 },
|
||||
"combine" : { type: "i", value: 0 },
|
||||
|
||||
"fogDensity": { type: "f", value: 0.00025 },
|
||||
@@ -3474,7 +3474,7 @@ THREE.ShaderLib = {
|
||||
"opacity" : { type: "f", value: 1.0 }
|
||||
},
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform float mNear;",
|
||||
"uniform float mFar;",
|
||||
@@ -3490,7 +3490,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"void main() {",
|
||||
|
||||
@@ -3506,7 +3506,7 @@ THREE.ShaderLib = {
|
||||
|
||||
uniforms: { "opacity" : { type: "f", value: 1.0 } },
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform float opacity;",
|
||||
"varying vec3 vNormal;",
|
||||
@@ -3519,7 +3519,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec3 vNormal;",
|
||||
|
||||
@@ -3540,7 +3540,7 @@ THREE.ShaderLib = {
|
||||
|
||||
uniforms: THREE.UniformsLib[ "common" ],
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform vec3 diffuse;",
|
||||
"uniform float opacity;",
|
||||
@@ -3565,7 +3565,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
THREE.Snippets[ "map_pars_vertex" ],
|
||||
THREE.Snippets[ "lightmap_pars_vertex" ],
|
||||
@@ -3594,7 +3594,7 @@ THREE.ShaderLib = {
|
||||
uniforms: Uniforms.merge( [ THREE.UniformsLib[ "common" ],
|
||||
THREE.UniformsLib[ "lights" ] ] ),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform vec3 diffuse;",
|
||||
"uniform float opacity;",
|
||||
@@ -3622,7 +3622,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"varying vec3 vLightWeighting;",
|
||||
|
||||
@@ -3665,7 +3665,7 @@ THREE.ShaderLib = {
|
||||
|
||||
] ),
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform vec3 diffuse;",
|
||||
"uniform float opacity;",
|
||||
@@ -3698,7 +3698,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"#define PHONG",
|
||||
|
||||
@@ -3744,7 +3744,7 @@ THREE.ShaderLib = {
|
||||
|
||||
uniforms: THREE.UniformsLib[ "particle" ],
|
||||
|
||||
fragment_shader: [
|
||||
fragmentShader: [
|
||||
|
||||
"uniform vec3 psColor;",
|
||||
"uniform float opacity;",
|
||||
@@ -3765,7 +3765,7 @@ THREE.ShaderLib = {
|
||||
|
||||
].join("\n"),
|
||||
|
||||
vertex_shader: [
|
||||
vertexShader: [
|
||||
|
||||
"uniform float size;",
|
||||
|
||||
|
||||
@@ -202,9 +202,9 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
}
|
||||
|
||||
if ( material.env_map ) {
|
||||
if ( material.envMap ) {
|
||||
|
||||
setTexture( material.env_map, 1 );
|
||||
setTexture( material.envMap, 1 );
|
||||
_gl.uniform1i( uniforms.tSpherical, 1 );
|
||||
|
||||
}
|
||||
@@ -282,7 +282,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
} else {
|
||||
|
||||
_gl.lineWidth( material.wireframe_linewidth );
|
||||
_gl.lineWidth( material.wireframeLinewidth );
|
||||
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, buffer.lines );
|
||||
_gl.drawElements( _gl.LINES, buffer.lineCount, _gl.UNSIGNED_SHORT, 0 );
|
||||
|
||||
@@ -516,19 +516,19 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
vs = [
|
||||
material.map ? 'varying vec2 vUv;' : null,
|
||||
material.env_map ? 'varying vec2 vSpherical;' : null,
|
||||
material.envMap ? 'varying vec2 vSpherical;' : null,
|
||||
|
||||
'void main() {',
|
||||
'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
|
||||
|
||||
material.map ? 'vUv = uv;' : null,
|
||||
|
||||
material.env_map ? 'vec3 u = normalize( modelViewMatrix * vec4( position, 1.0 ) ).xyz;' : null,
|
||||
material.env_map ? 'vec3 n = normalize( normalMatrix * normal );' : null,
|
||||
material.env_map ? 'vec3 r = reflect( u, n );' : null,
|
||||
material.env_map ? 'float m = 2.0 * sqrt( r.x * r.x + r.y * r.y + ( r.z + 1.0 ) * ( r.z + 1.0 ) );' : null,
|
||||
material.env_map ? 'vSpherical.x = r.x / m + 0.5;' : null,
|
||||
material.env_map ? 'vSpherical.y = - r.y / m + 0.5;' : null,
|
||||
material.envMap ? 'vec3 u = normalize( modelViewMatrix * vec4( position, 1.0 ) ).xyz;' : null,
|
||||
material.envMap ? 'vec3 n = normalize( normalMatrix * normal );' : null,
|
||||
material.envMap ? 'vec3 r = reflect( u, n );' : null,
|
||||
material.envMap ? 'float m = 2.0 * sqrt( r.x * r.x + r.y * r.y + ( r.z + 1.0 ) * ( r.z + 1.0 ) );' : null,
|
||||
material.envMap ? 'vSpherical.x = r.x / m + 0.5;' : null,
|
||||
material.envMap ? 'vSpherical.y = - r.y / m + 0.5;' : null,
|
||||
|
||||
'}'
|
||||
].filter( removeNull ).join( '\n' );
|
||||
@@ -540,8 +540,8 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
material.map ? 'uniform sampler2D tMap;' : null,
|
||||
material.map ? 'varying vec2 vUv;' : null,
|
||||
|
||||
material.env_map ? 'uniform sampler2D tSpherical;' : null,
|
||||
material.env_map ? 'varying vec2 vSpherical;' : null,
|
||||
material.envMap ? 'uniform sampler2D tSpherical;' : null,
|
||||
material.envMap ? 'varying vec2 vSpherical;' : null,
|
||||
|
||||
material.fog ? 'uniform float fog;' : null,
|
||||
material.fog ? 'uniform float fogNear;' : null,
|
||||
@@ -558,7 +558,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
material.map ? 'gl_FragColor *= texture2D( tMap, vUv );' : null,
|
||||
|
||||
material.env_map ? 'gl_FragColor += texture2D( tSpherical, vSpherical );' : null,
|
||||
material.envMap ? 'gl_FragColor += texture2D( tSpherical, vSpherical );' : null,
|
||||
|
||||
material.fog ? 'float depth = gl_FragCoord.z / gl_FragCoord.w;' : null,
|
||||
material.fog ? 'float fogFactor = fog * smoothstep( fogNear, fogFar, depth );' : null,
|
||||
@@ -569,7 +569,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
identifiers.push( 'mColor', 'mOpacity' );
|
||||
|
||||
if ( material.map ) identifiers.push( 'tMap' );
|
||||
if ( material.env_map ) identifiers.push( 'tSpherical' );
|
||||
if ( material.envMap ) identifiers.push( 'tSpherical' );
|
||||
if ( material.fog ) identifiers.push( 'fog', 'fogColor', 'fogNear', 'fogFar' );
|
||||
|
||||
|
||||
@@ -620,8 +620,8 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
} else if ( material instanceof THREE.MeshShaderMaterial ) {
|
||||
|
||||
vs = material.vertex_shader;
|
||||
fs = material.fragment_shader;
|
||||
vs = material.vertexShader;
|
||||
fs = material.fragmentShader;
|
||||
|
||||
for( uniform in material.uniforms ) {
|
||||
|
||||
@@ -644,7 +644,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
|
||||
}
|
||||
|
||||
function compileProgram( vertex_shader, fragment_shader ) {
|
||||
function compileProgram( vertexShader, fragmentShader ) {
|
||||
|
||||
var program = _gl.createProgram(), shader, prefix_vertex, prefix_fragment;
|
||||
|
||||
@@ -674,7 +674,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
// Vertex shader
|
||||
|
||||
shader = _gl.createShader( _gl.VERTEX_SHADER );
|
||||
_gl.shaderSource( shader, prefix_vertex + vertex_shader );
|
||||
_gl.shaderSource( shader, prefix_vertex + vertexShader );
|
||||
_gl.compileShader( shader );
|
||||
_gl.attachShader( program, shader );
|
||||
|
||||
@@ -688,7 +688,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
// Fragment Shader
|
||||
|
||||
shader = _gl.createShader( _gl.FRAGMENT_SHADER );
|
||||
_gl.shaderSource( shader, prefix_fragment + fragment_shader );
|
||||
_gl.shaderSource( shader, prefix_fragment + fragmentShader );
|
||||
_gl.compileShader( shader );
|
||||
_gl.attachShader( program, shader );
|
||||
|
||||
@@ -706,8 +706,8 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
alert( "Could not initialise shaders.\n" +
|
||||
"VALIDATE_STATUS: " + _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ) + "\n" +
|
||||
"ERROR: " + _gl.getError() + "\n\n" +
|
||||
"- Vertex Shader -\n" + prefix_vertex + vertex_shader + "\n\n" +
|
||||
"- Fragment Shader -\n" + prefix_fragment + fragment_shader );
|
||||
"- Vertex Shader -\n" + prefix_vertex + vertexShader + "\n\n" +
|
||||
"- Fragment Shader -\n" + prefix_fragment + fragmentShader );
|
||||
|
||||
}
|
||||
|
||||
@@ -765,11 +765,11 @@ THREE.WebGLRenderer2 = function ( antialias ) {
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
|
||||
_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrap_s ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrap_t ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
|
||||
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.mag_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.min_filter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
|
||||
_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
|
||||
_gl.generateMipmap( _gl.TEXTURE_2D );
|
||||
_gl.bindTexture( _gl.TEXTURE_2D, null );
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ COLORS = [0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee, 0xeeee00, 0x00eeee, 0xee00ee]
|
||||
# #####################################################
|
||||
TEMPLATE_FILE_ASCII = """\
|
||||
/*
|
||||
* File generated with Blender 2.55 Exporter
|
||||
* File generated with Blender 2.56 Exporter
|
||||
* https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/
|
||||
*
|
||||
* vertices: %(nvertex)d
|
||||
|
||||
Reference in New Issue
Block a user