提交 36cd3807 编写于 作者: A alteredq

Synced with mrdoob's branch.

此差异已折叠。
......@@ -83,29 +83,22 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=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.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;this.morphTargets=!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;
if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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;this.morphTargets=
!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;
if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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;this.morphTargets=!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;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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.sizeAttenuation=!0;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.sizeAttenuation!==undefined)this.sizeAttenuation=
a.sizeAttenuation;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.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=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){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==undefined?a.linewidth:1;this.linecap=a.linecap!==undefined?a.linecap:"round";this.linejoin=a.linejoin!==undefined?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
a.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==undefined?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==undefined?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==undefined?a.shininess:30;this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?
a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=
a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==undefined?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;
THREE.Texture=function(a,b,c,e,d,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=d!==undefined?d: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;
......
......@@ -72,7 +72,7 @@ THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarc
THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};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;
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};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.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;
THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
......
......@@ -83,28 +83,22 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};THREE.PointLight.prototype=new THREE.Light;
THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=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.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;this.morphTargets=!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;
if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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;this.morphTargets=
!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;
if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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;this.morphTargets=!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;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
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.sizeAttenuation=!0;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.sizeAttenuation!==undefined)this.sizeAttenuation=
a.sizeAttenuation;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.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.PointLight.prototype.constructor=THREE.PointLight;THREE.Material=function(a){this.id=THREE.MaterialCounter.value++;a=a||{};this.opacity=a.opacity!==undefined?a.opacity:1;this.transparent=a.transparent!==undefined?a.transparent:!1;this.blending=a.blending!==undefined?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==undefined?a.depthTest:!0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;
THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};
THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==undefined?a.linewidth:1;this.linecap=a.linecap!==undefined?a.linecap:"round";this.linejoin=a.linejoin!==undefined?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
a.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=
a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?
a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==undefined?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==undefined?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==undefined?a.shininess:30;this.map=a.map!==undefined?a.map:null;this.lightMap=a.lightMap!==undefined?a.lightMap:null;this.envMap=a.envMap!==undefined?
a.envMap:null;this.combine=a.combine!==undefined?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==undefined?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==undefined?a.refractionRatio:0.98;this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==undefined?a.wireframeLinecap:"round";this.wireframeLinejoin=
a.wireframeLinejoin!==undefined?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1;this.skinning=a.skinning!==undefined?a.skinning:!1;this.morphTargets=a.morphTargets!==undefined?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==undefined?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==undefined?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==undefined?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==undefined?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==undefined?a.map:null;this.size=a.size!==undefined?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==undefined?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==undefined?a.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
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;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
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;
......
此差异已折叠。
......@@ -161,9 +161,9 @@
postprocessing.camera.position.z = 100;
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 );
postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
var screen_shader = ShaderUtils.lib["screen"];
var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
......@@ -176,7 +176,8 @@
uniforms: screen_uniforms,
vertexShader: screen_shader.vertexShader,
fragmentShader: screen_shader.fragmentShader,
blending: THREE.AdditiveBlending
blending: THREE.AdditiveBlending,
transparent: true
} );
......
......@@ -259,7 +259,7 @@ var scene = {
"lambert_green": {
"type": "MeshLambertMaterial",
"parameters": { color: 0x007711, blending: "AdditiveBlending" }
"parameters": { color: 0x007711, blending: "AdditiveBlending", transparent: true }
},
"lambert_blue": {
......@@ -294,7 +294,7 @@ var scene = {
"glass": {
"type": "MeshLambertMaterial",
"parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25 }
"parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25, transparent: true }
},
"interior": {
......@@ -440,4 +440,4 @@ var scene = {
};
postMessage( scene );
\ No newline at end of file
postMessage( scene );
......@@ -62,7 +62,7 @@
// roll-over helpers
rollOverGeo = new Cube( 50, 50, 50 );
rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5 } );
rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial );
scene.addObject( rollOverMesh );
......@@ -70,7 +70,7 @@
// cubes
cubeGeo = new Cube( 50, 50, 50 );
cubeMaterial = new THREE.MeshLambertMaterial( { color: 0x00ff80, opacity: 1, shading: THREE.FlatShading, map: ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
cubeMaterial = new THREE.MeshLambertMaterial( { color: 0x00ff80, shading: THREE.FlatShading, map: ImageUtils.loadTexture( "textures/square-outline-textured.png" ) } );
cubeMaterial.color.setHSV( 0.1, 0.7, 1.0 );
// picking
......
......@@ -141,9 +141,9 @@
sceneScreen = new THREE.Scene();
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 );
rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
var screen_shader = ShaderUtils.lib["screen"];
var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
......@@ -156,7 +156,8 @@
uniforms: screen_uniforms,
vertexShader: screen_shader.vertexShader,
fragmentShader: screen_shader.fragmentShader,
blending: THREE.AdditiveBlending
blending: THREE.AdditiveBlending,
transparent: true
} );
......
......@@ -92,9 +92,9 @@
// lines
var line, p, scale = 0.3, d = 125, c1 = 0x553300, c2 = 0x555555, c3 = 0x992800, g1 = geometry,
m1 = new THREE.LineBasicMaterial( { color: c1, opacity: 1, blending: THREE.AdditiveBlending } ),
m2 = new THREE.LineBasicMaterial( { color: c2, opacity: 1, blending: THREE.AdditiveBlending } ),
m3 = new THREE.LineBasicMaterial( { color: c3, opacity: 1, blending: THREE.AdditiveBlending } ),
m1 = new THREE.LineBasicMaterial( { color: c1, opacity: 1, blending: THREE.AdditiveBlending, transparent: true } ),
m2 = new THREE.LineBasicMaterial( { color: c2, opacity: 1, blending: THREE.AdditiveBlending, transparent: true } ),
m3 = new THREE.LineBasicMaterial( { color: c3, opacity: 1, blending: THREE.AdditiveBlending, transparent: true } ),
parameters = [ [ m3, scale*0.5, [0,0,0], g1 ], [ m2, scale*0.5, [d, 0, 0], g1 ], [ m2, scale*0.5, [-d, 0, 0], g1 ],
[ m2, scale*0.5, [0,d,0], g1 ], [ m2, scale*0.5, [d, d, 0], g1 ], [ m2, scale*0.5, [-d, d, 0], g1 ],
[ m2, scale*0.5, [0,-d,0], g1 ], [ m2, scale*0.5, [d, -d, 0], g1 ], [ m2, scale*0.5, [-d, -d, 0], g1 ],
......
......@@ -154,9 +154,9 @@
sceneScreen = new THREE.Scene();
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 );
rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
var screen_shader = ShaderUtils.lib["screen"];
var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
......
......@@ -248,17 +248,17 @@
"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, 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 } ),
"Black glass": new THREE.MeshLambertMaterial( { color: 0x101016, envMap: textureCube, opacity: 0.975, transparent: true } ),
"Dark glass": new THREE.MeshLambertMaterial( { color: 0x101046, envMap: textureCube, opacity: 0.25, transparent: true } ),
"Blue glass": new THREE.MeshLambertMaterial( { color: 0x668899, envMap: textureCube, opacity: 0.75, transparent: true } ),
"Light glass": new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, transparent: true, 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 } ),
"Orange glass": new THREE.MeshLambertMaterial( { color: 0x995500, opacity: 0.75 } ),
"Red glass": new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.75, transparent: true } ),
"Yellow glass": new THREE.MeshLambertMaterial( { color: 0xffffaa, opacity: 0.75, transparent: true } ),
"Orange glass": new THREE.MeshLambertMaterial( { color: 0x995500, opacity: 0.75, transparent: true } ),
"Orange glass 50": new THREE.MeshLambertMaterial( { color: 0xffbb00, opacity: 0.5 } ),
"Red glass 50": new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5 } ),
"Orange glass 50": new THREE.MeshLambertMaterial( { color: 0xffbb00, opacity: 0.5, transparent: true } ),
"Red glass 50": new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } ),
"Fullblack rough": new THREE.MeshLambertMaterial( { color: 0x000000 } ),
"Black rough": new THREE.MeshLambertMaterial( { color: 0x050505 } ),
......
......@@ -126,7 +126,7 @@
body: [],
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 } ),
glass: new THREE.MeshBasicMaterial( { color: 0x223344, envMap: textureCube, opacity: 0.25, combine: THREE.MixOperation, reflectivity: 0.25, transparent: true } ),
tire: new THREE.MeshLambertMaterial( { color: 0x050505 } ),
interior: new THREE.MeshPhongMaterial( { color: 0x050505, shininess: 20 } ),
black: new THREE.MeshLambertMaterial( { color: 0x000000 } )
......
......@@ -45,17 +45,17 @@
var texture = generateTextureBase();
texture.needsUpdate = true;
for ( var i = 0; i < 10; i ++ ) {
for ( var i = 0; i < 20; i ++ ) {
mesh = levels[ i ] = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTextureLevel( texture ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping ) } ) );
mesh.materials[0].map.needsUpdate = true;
mesh.rotation.x = - 90 * ( Math.PI / 180 );
mesh.position.y = i * 0.5;
mesh.position.y = i * 0.25;
scene.addObject( mesh );
}
renderer = new THREE.WebGLRenderer();
renderer = new THREE.WebGLRenderer( { antialias: false } );
renderer.sortObjects = false;
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
......@@ -80,7 +80,7 @@
}
context.globalAlpha = 0.1;
context.globalAlpha = 0.05;
context.globalCompositeOperation = 'lighter';
return canvas;
......@@ -114,16 +114,8 @@
var time = new Date().getTime() / 6000;
camera.position.x = 100 * Math.cos( time );
camera.position.z = 100 * Math.sin( time );
for ( var i = 0, l = levels.length; i < l; i ++ ) {
mesh = levels[ i ];
mesh.position.x = Math.sin( time * 4 ) * i * i * 0.02;
mesh.position.z = Math.cos( time * 6 ) * i * i * 0.02;
}
camera.position.x = 80 * Math.cos( time );
camera.position.z = 80 * Math.sin( time );
renderer.render( scene, camera );
......
......@@ -204,9 +204,9 @@
postprocessing.camera.position.z = 100;
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 );
postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
var screen_shader = ShaderUtils.lib["screen"];
var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
......@@ -219,7 +219,8 @@
uniforms: screen_uniforms,
vertexShader: screen_shader.vertexShader,
fragmentShader: screen_shader.fragmentShader,
blending: THREE.AdditiveBlending
blending: THREE.AdditiveBlending,
transparent: true
} );
......
......@@ -91,7 +91,7 @@
sprite = parameters[i][1];
size = parameters[i][2];
materials[i] = new THREE.ParticleBasicMaterial( { size: size, map: sprite, blending: THREE.AdditiveBlending, depthTest: false } );
materials[i] = new THREE.ParticleBasicMaterial( { size: size, map: sprite, blending: THREE.AdditiveBlending, depthTest: false, transparent : true } );
materials[i].color.setHSV( color[0], color[1], color[2] );
particles = new THREE.ParticleSystem( geometry, materials[i] );
......
......@@ -107,9 +107,9 @@
directionalLight.position.normalize();
sceneModel.addLight( directionalLight );
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 } );
rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
rtTexture2 = new THREE.WebGLRenderTarget( 256, 512, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
rtTexture3 = new THREE.WebGLRenderTarget( 512, 256, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter } );
materialColor = new THREE.MeshShaderMaterial( {
......@@ -131,7 +131,8 @@
uniforms: screen_uniforms,
vertexShader: screen_shader.vertexShader,
fragmentShader: screen_shader.fragmentShader,
blending: THREE.AdditiveBlending
blending: THREE.AdditiveBlending,
transparent: true
} );
......
......@@ -241,8 +241,8 @@
postprocessing.camera.position.z = 100;
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 );
postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
var bokeh_shader = ShaderExtras["bokeh"];
......
......@@ -232,9 +232,9 @@
postprocessing.camera.position.z = 100;
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 );
postprocessing.rtTexture1 = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
postprocessing.rtTexture2 = new THREE.WebGLRenderTarget( 512, 512, pars );
postprocessing.rtTexture3 = new THREE.WebGLRenderTarget( 512, 512, pars );
var screen_shader = ShaderUtils.lib["screen"];
var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
......@@ -247,7 +247,8 @@
uniforms: screen_uniforms,
vertexShader: screen_shader.vertexShader,
fragmentShader: screen_shader.fragmentShader,
blending: THREE.AdditiveBlending
blending: THREE.AdditiveBlending,
transparent: true
} );
......
......@@ -122,7 +122,7 @@
light.position.z = 1;
light.position.normalize();
sceneRTT.addLight( light );
light = new THREE.DirectionalLight( 0xffaaaa, 1.5 );
light.position.x = 0;
light.position.y = 0;
......@@ -130,7 +130,7 @@
light.position.normalize();
sceneRTT.addLight( light );
rtTexture = new THREE.RenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter } );
material = new THREE.MeshShaderMaterial( {
......
......@@ -74,7 +74,6 @@
<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
<script type="text/javascript" src="../src/materials/Texture.js"></script>
<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
<script type="text/javascript" src="../src/objects/Particle.js"></script>
<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
......@@ -95,6 +94,7 @@
<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderTarget.js"></script>
<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
......
......@@ -19,34 +19,19 @@
THREE.LineBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
parameters = parameters || {};
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.linewidth = 1.0;
this.linecap = 'round'; // implemented just in CanvasRenderer
this.linejoin = 'round'; // implemented just in CanvasRenderer
this.linewidth = parameters.linewidth !== undefined ? parameters.linewidth : 1;
this.linecap = parameters.linecap !== undefined ? parameters.linecap : 'round';
this.linejoin = parameters.linejoin !== undefined ? parameters.linejoin : 'round';
this.vertexColors = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
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.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
}
this.vertexColors = parameters.vertexColors ? parameters.vertexColors : false;
};
THREE.LineBasicMaterial.prototype = new THREE.Material();
THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;
......@@ -2,6 +2,21 @@
* @author mr.doob / http://mrdoob.com/
*/
THREE.Material = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
parameters = parameters || {};
this.opacity = parameters.opacity !== undefined ? parameters.opacity : 1;
this.transparent = parameters.transparent !== undefined ? parameters.transparent : false;
this.blending = parameters.blending !== undefined ? parameters.blending : THREE.NormalBlending;
this.depthTest = parameters.depthTest !== undefined ? parameters.depthTest : true;
}
THREE.NoShading = 0;
THREE.FlatShading = 1;
THREE.SmoothShading = 2;
......
......@@ -6,21 +6,21 @@
* color: <hex>,
* opacity: <float>,
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
*
* shading: THREE.SmoothShading,
* blending: THREE.NormalBlending,
* depthTest: <bool>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
*
* vertexColors: false / THREE.VertexColors / THREE.FaceColors,
* skinning: <bool>
* }
......@@ -28,63 +28,36 @@
THREE.MeshBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
THREE.Material.call( this, parameters );
this.lightMap = null;
parameters = parameters || {};
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
this.refractionRatio = 0.98;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.fog = true; // implemented just in WebGLRenderer2
this.map = parameters.map !== undefined ? parameters.map : null;
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
this.vertexColors = false;
// this.enableFog = parameters.enableFog ? parameters.enableFog : true;
this.skinning = false;
this.morphTargets = false;
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
if ( parameters ) {
this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.map !== undefined ) this.map = parameters.map;
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
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.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.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
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.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets;
}
this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
};
THREE.MeshBasicMaterial.prototype = new THREE.Material();
THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;
......@@ -15,28 +15,16 @@
THREE.MeshDepthMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.opacity = 1.0;
parameters = parameters || {};
this.shading = THREE.SmoothShading; // doesn't really apply here, normals are not used
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading; // doesn't really apply here, normals are not used
this.wireframe = false;
this.wireframeLinewidth = 1.0;
if ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
}
this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
};
THREE.MeshDepthMaterial.prototype = new THREE.Material();
THREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial;
......@@ -6,84 +6,58 @@
* color: <hex>,
* opacity: <float>,
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
*
* shading: THREE.SmoothShading,
* blending: THREE.NormalBlending,
* depthTest: <bool>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
* vertexColors: <bool>,
*
* vertexColors: false / THREE.VertexColors / THREE.FaceColors,
* skinning: <bool>
* }
*/
THREE.MeshLambertMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
THREE.Material.call( this, parameters );
this.lightMap = null;
parameters = parameters || {};
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
this.refractionRatio = 0.98;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.fog = true; // implemented just in WebGLRenderer2
this.map = parameters.map !== undefined ? parameters.map : null;
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
this.vertexColors = false;
this.skinning = false;
this.morphTargets = false;
// this.enableFog = parameters.enableFog ? parameters.enableFog : true;
if ( parameters ) {
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.map !== undefined ) this.map = parameters.map;
this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
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.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.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
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.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets;
}
this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
};
THREE.MeshLambertMaterial.prototype = new THREE.Material();
THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;
......@@ -15,28 +15,16 @@
THREE.MeshNormalMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.opacity = 1.0;
parameters = parameters || {};
this.shading = THREE.FlatShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.shading = parameters.shading ? parameters.shading : THREE.FlatShading;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
if ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframeLinewidth !== undefined ) this.wireframeLinewidth = parameters.wireframeLinewidth;
}
this.wireframe = parameters.wireframe ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth ? parameters.wireframeLinewidth : 1;
};
THREE.MeshNormalMaterial.prototype = new THREE.Material();
THREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial;
......@@ -8,94 +8,63 @@
* specular: <hex>,
* shininess: <float>,
* opacity: <float>,
*
* map: new THREE.Texture( <Image> ),
*
* lightMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
*
* shading: THREE.SmoothShading,
* blending: THREE.NormalBlending,
* depthTest: <bool>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
* vertexColors: <bool>,
*
* vertexColors: false / THREE.VertexColors / THREE.FaceColors,
* skinning: <bool>
* }
*/
THREE.MeshPhongMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.color = new THREE.Color( 0xffffff );
this.ambient = new THREE.Color( 0x050505 );
this.specular = new THREE.Color( 0x111111 );
this.shininess = 30.0;
this.opacity = 1.0;
parameters = parameters || {};
this.map = null;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.ambient = parameters.ambient !== undefined ? new THREE.Color( parameters.ambient ) : new THREE.Color( 0x050505 );
this.specular = parameters.specular !== undefined ? new THREE.Color( parameters.specular ) : new THREE.Color( 0x111111 );
this.shininess = parameters.shininess !== undefined ? parameters.shininess : 30;
this.lightMap = null;
this.map = parameters.map !== undefined ? parameters.map : null;
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
this.refractionRatio = 0.98;
this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
this.fog = true; // implemented just in WebGLRenderer2
this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
// this.enableFog = parameters.enableFog ? parameters.enableFog : true;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
this.vertexColors = false;
this.skinning = false;
this.morphTargets = false;
this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
if ( parameters ) {
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
if ( parameters.color !== undefined ) this.color = new THREE.Color( parameters.color );
if ( parameters.ambient !== undefined ) this.ambient = new THREE.Color( parameters.ambient );
if ( parameters.specular !== undefined ) this.specular = new THREE.Color( parameters.specular );
if ( parameters.shininess !== undefined ) this.shininess = parameters.shininess;
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.lightMap !== undefined ) this.lightMap = parameters.lightMap;
if ( parameters.map !== undefined ) this.map = parameters.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.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.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
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.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets;
}
this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
};
THREE.MeshPhongMaterial.prototype = new THREE.Material();
THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial;
......@@ -23,51 +23,25 @@
THREE.MeshShaderMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.fragmentShader = "void main() {}";
this.vertexShader = "void main() {}";
this.uniforms = {};
parameters = parameters || {};
this.opacity = 1.0; // set to < 1.0 to renderer in transparent batch
this.fragmentShader = parameters.fragmentShader !== undefined ? parameters.fragmentShader : "void main() {}";
this.vertexShader = parameters.vertexShader !== undefined ? parameters.vertexShader : "void main() {}";
this.uniforms = parameters.uniforms !== undefined ? parameters.uniforms : {};
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
this.wireframe = false;
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.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
this.lights = false; // set to use scene lights
this.vertexColors = false; // set to use "color" attribute stream
this.skinning = false; // set to use skinning attribute streams
this.morphTargets = false; // set to use morph targets
if ( parameters ) {
if ( parameters.fragmentShader !== undefined ) this.fragmentShader = parameters.fragmentShader;
if ( parameters.vertexShader !== undefined ) this.vertexShader = parameters.vertexShader;
if ( parameters.uniforms !== undefined ) this.uniforms = parameters.uniforms;
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
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.lights !== undefined ) this.lights = parameters.lights;
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
if ( parameters.morphTargets !== undefined ) this.morphTargets = parameters.morphTargets;
}
this.lights = parameters.lights !== undefined ? parameters.lights : false; // set to use scene lights
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false; // set to use "color" attribute stream
this.skinning = parameters.skinning !== undefined ? parameters.skinning : false; // set to use skinning attribute streams
this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false; // set to use morph targets
};
THREE.MeshShaderMaterial.prototype = new THREE.Material();
THREE.MeshShaderMaterial.prototype.constructor = THREE.MeshShaderMaterial;
......@@ -18,36 +18,20 @@
THREE.ParticleBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
parameters = parameters || {};
this.size = 1.0;
this.sizeAttenuation = true;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.map = parameters.map !== undefined ? parameters.map : null;
this.offset = new THREE.Vector2(); // TODO: expose to parameters (implemented just in CanvasRenderer)
this.size = parameters.size !== undefined ? parameters.size : 1;
this.sizeAttenuation = parameters.sizeAttenuation !== undefined ? parameters.sizeAttenuation : true;
this.vertexColors = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.map !== undefined ) this.map = parameters.map;
if ( parameters.size !== undefined ) this.size = parameters.size;
if ( parameters.sizeAttenuation !== undefined ) this.sizeAttenuation = parameters.sizeAttenuation;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depthTest !== undefined ) this.depthTest = parameters.depthTest;
if ( parameters.vertexColors !== undefined ) this.vertexColors = parameters.vertexColors;
}
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
};
THREE.ParticleBasicMaterial.prototype = new THREE.Material();
THREE.ParticleBasicMaterial.prototype.constructor = THREE.ParticleBasicMaterial;
......@@ -11,20 +11,14 @@
THREE.ParticleCanvasMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.color = new THREE.Color( 0xffffff );
this.program = function ( context, color ) {};
this.opacity = 1;
this.blending = THREE.NormalBlending;
parameters = parameters || {};
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.program !== undefined ) this.program = parameters.program;
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
}
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.program = parameters.program !== undefined ? parameters.program : function ( context, color ) {};
};
THREE.ParticleCanvasMaterial.prototype = new THREE.Material();
THREE.ParticleCanvasMaterial.prototype.constructor = THREE.ParticleCanvasMaterial;
......@@ -4,7 +4,7 @@
THREE.ParticleDOMMaterial = function ( domElement ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this );
this.domElement = domElement;
......
......@@ -28,32 +28,36 @@
THREE.ShadowVolumeDynamicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
THREE.Material.call( this, parameters );
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
parameters = parameters || {};
this.lightMap = null;
this.color = parameters.color !== undefined ? new THREE.Color( parameters.color ) : new THREE.Color( 0xffffff );
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
this.refractionRatio = 0.98;
this.map = parameters.map !== undefined ? parameters.map : null;
this.fog = true; // implemented just in WebGLRenderer2
this.lightMap = parameters.lightMap !== undefined ? parameters.lightMap : null;
this.shading = THREE.FlatShading;
this.blending = THREE.NormalBlending;
this.depthTest = true;
this.envMap = parameters.envMap !== undefined ? parameters.envMap : null;
this.combine = parameters.combine !== undefined ? parameters.combine : THREE.MultiplyOperation;
this.reflectivity = parameters.reflectivity !== undefined ? parameters.reflectivity : 1;
this.refractionRatio = parameters.refractionRatio !== undefined ? parameters.refractionRatio : 0.98;
this.wireframe = false;
this.wireframeLinewidth = 1.0;
this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
// this.enableFog = parameters.enableFog ? parameters.enableFog : true;
this.vertexColors = false;
this.skinning = false;
this.morphTargets = false;
this.shading = parameters.shading !== undefined ? parameters.shading : THREE.SmoothShading;
this.wireframe = parameters.wireframe !== undefined ? parameters.wireframe : false;
this.wireframeLinewidth = parameters.wireframeLinewidth !== undefined ? parameters.wireframeLinewidth : 1;
this.wireframeLinecap = parameters.wireframeLinecap !== undefined ? parameters.wireframeLinecap : 'round';
this.wireframeLinejoin = parameters.wireframeLinejoin !== undefined ? parameters.wireframeLinejoin : 'round';
this.vertexColors = parameters.vertexColors !== undefined ? parameters.vertexColors : false;
this.skinning = parameters.skinning !== undefined ? parameters.skinning : false;
this.morphTargets = parameters.morphTargets !== undefined ? parameters.morphTargets : false;
};
THREE.ShadowVolumeDynamicMaterial.prototype = new THREE.Material();
THREE.ShadowVolumeDynamicMaterial.prototype.constructor = THREE.ShadowVolumeDynamicMaterial;
......@@ -17,7 +17,6 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter )
this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
this.needsUpdate = false;
//this.needsUpdate = ( image!== undefined && image.getContext ) ? true : false; // true by default for <canvas> element
};
......
......@@ -63,11 +63,10 @@ THREE.Mesh.prototype.supr = THREE.Object3D.prototype;
THREE.Mesh.prototype.getMorphTargetIndexByName = function( name ) {
if( this.morphTargetDictionary[ name ] !== undefined ) {
if ( this.morphTargetDictionary[ name ] !== undefined ) {
return this.morphTargetDictionary[ name ];
}
console.log( "THREE.Mesh.getMorphTargetIndexByName: morph target " + name + " does not exist. Returning 0." );
return 0;
......
......@@ -2,7 +2,7 @@
* @author szimek / https://github.com/szimek/
*/
THREE.RenderTarget = function ( width, height, options ) {
THREE.WebGLRenderTarget = function ( width, height, options ) {
this.width = width;
this.height = height;
......
......@@ -2376,11 +2376,7 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( m = 0, ml = object.materials.length; m < ml; m++ ) {
material = object.materials[ m ];
if ( ( material.opacity && material.opacity < 1.0 ) || material.blending != THREE.NormalBlending )
addToFixedArray( transparent, material );
else
addToFixedArray( opaque, material );
material.transparent ? addToFixedArray( transparent, material ) : addToFixedArray( opaque, material );
}
......@@ -2406,31 +2402,14 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( i = 0, l = buffer.materials.length; i < l; i++ ) {
material = buffer.materials[ i ];
if ( material ) {
if ( ( material.opacity && material.opacity < 1.0 ) || material.blending != THREE.NormalBlending )
addToFixedArray( transparent, material );
else
addToFixedArray( opaque, material );
}
if ( material ) material.transparent ? addToFixedArray( transparent, material ) : addToFixedArray( opaque, material );
}
} else {
material = meshMaterial;
if ( ( material.opacity && material.opacity < 1.0 ) || material.blending != THREE.NormalBlending ) {
addToFixedArray( transparent, material );
} else {
addToFixedArray( opaque, material );
}
if ( material ) material.transparent ? addToFixedArray( transparent, material ) : addToFixedArray( opaque, material );
}
......@@ -2549,7 +2528,7 @@ THREE.WebGLRenderer = function ( parameters ) {
setBlending( THREE.NormalBlending );
for ( o = 0; o < ol; o++ ) {
for ( o = 0; o < ol; o ++ ) {
webglObject = scene.__webglObjects[ o ];
......@@ -2561,7 +2540,7 @@ THREE.WebGLRenderer = function ( parameters ) {
setObjectFaces( object );
for( i = 0; i < opaque.count; i++ ) {
for ( i = 0; i < opaque.count; i ++ ) {
material = opaque.list[ i ];
......@@ -2604,7 +2583,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// transparent pass
for ( o = 0; o < ol; o++ ) {
for ( o = 0; o < ol; o ++ ) {
webglObject = scene.__webglObjects[ o ];
......@@ -2616,7 +2595,7 @@ THREE.WebGLRenderer = function ( parameters ) {
setObjectFaces( object );
for( i = 0; i < transparent.count; i++ ) {
for ( i = 0; i < transparent.count; i ++ ) {
material = transparent.list[ i ];
......@@ -2644,7 +2623,7 @@ THREE.WebGLRenderer = function ( parameters ) {
setObjectFaces( object );
for( i = 0; i < transparent.count; i++ ) {
for ( i = 0; i < transparent.count; i ++ ) {
material = transparent.list[ i ];
......@@ -2662,18 +2641,18 @@ THREE.WebGLRenderer = function ( parameters ) {
// render stencil shadows
if( stencil && scene.__webglShadowVolumes.length && scene.lights.length ) {
if ( stencil && scene.__webglShadowVolumes.length && scene.lights.length ) {
renderStencilShadows( scene );
}
// render lens flares
if( scene.__webglLensFlares.length ) {
if ( scene.__webglLensFlares.length ) {
renderLensFlares( scene, camera );
}
......@@ -2688,8 +2667,6 @@ THREE.WebGLRenderer = function ( parameters ) {
};
/*
* Stencil Shadows
......@@ -2701,7 +2678,7 @@ THREE.WebGLRenderer = function ( parameters ) {
*/
function renderStencilShadows( scene ) {
// setup stencil
_gl.enable( _gl.POLYGON_OFFSET_FILL );
......@@ -2709,40 +2686,39 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.enable( _gl.STENCIL_TEST );
_gl.depthMask( false );
_gl.colorMask( false, false, false, false );
_gl.stencilFunc( _gl.ALWAYS, 1, 0xFF );
_gl.stencilOpSeparate( _gl.BACK, _gl.KEEP, _gl.INCR, _gl.KEEP );
_gl.stencilOpSeparate( _gl.FRONT, _gl.KEEP, _gl.DECR, _gl.KEEP );
// loop through all directional lights
var l, ll = scene.lights.length;
var p;
var light, lights = scene.lights;
var dirLight = [];
var dirLight = [];
var object, geometryGroup, material;
var program;
var program;
var p_uniforms;
var m_uniforms;
var attributes;
var m_uniforms;
var attributes;
var o, ol = scene.__webglShadowVolumes.length;
for( l = 0; l < ll; l++ ) {
for ( l = 0; l < ll; l++ ) {
light = scene.lights[ l ];
if( light instanceof THREE.DirectionalLight ) {
if ( light instanceof THREE.DirectionalLight ) {
dirLight[ 0 ] = -light.position.x;
dirLight[ 1 ] = -light.position.y;
dirLight[ 2 ] = -light.position.z;
// render all volumes
for( o = 0; o < ol; o++ ) {
for ( o = 0; o < ol; o++ ) {
object = scene.__webglShadowVolumes[ o ].object;
geometryGroup = scene.__webglShadowVolumes[ o ].buffer;
material = object.materials[ 0 ];
......@@ -2751,12 +2727,11 @@ THREE.WebGLRenderer = function ( parameters ) {
program = material.program,
p_uniforms = program.uniforms,
m_uniforms = material.uniforms,
attributes = program.attributes;
m_uniforms = material.uniforms,
attributes = program.attributes;
if ( _currentProgram !== program ) {
if( _currentProgram !== program ) {
_gl.useProgram( program );
_currentProgram = program;
......@@ -2783,7 +2758,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.cullFace( _gl.BACK );
_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 );
}
}
......@@ -2797,10 +2772,10 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.colorMask( true, true, true, true );
_gl.stencilFunc( _gl.NOTEQUAL, 0, 0xFF );
_gl.stencilOp( _gl.KEEP, _gl.KEEP, _gl.KEEP );
_gl.disable( _gl.DEPTH_TEST );
_gl.disable( _gl.DEPTH_TEST );
// draw darkening polygon
// draw darkening polygon
_oldBlending = "";
_currentProgram = _stencilShadow.program;
......@@ -2808,23 +2783,24 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.useProgram( _stencilShadow.program );
_gl.uniformMatrix4fv( _stencilShadow.projectionLocation, false, _projectionMatrixArray );
_gl.uniform1f( _stencilShadow.darknessLocation, _stencilShadow.darkness );
_gl.bindBuffer( _gl.ARRAY_BUFFER, _stencilShadow.vertexBuffer );
_gl.vertexAttribPointer( _stencilShadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
_gl.enableVertexAttribArray( _stencilShadow.vertexLocation );
_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
_gl.blendEquation( _gl.FUNC_ADD );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.elementBuffer );
_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
// disable stencil
_gl.disable ( _gl.STENCIL_TEST );
_gl.enable ( _gl.DEPTH_TEST );
_gl.depthMask( _currentDepthMask );
_gl.disable( _gl.STENCIL_TEST );
_gl.enable( _gl.DEPTH_TEST );
_gl.depthMask( _currentDepthMask );
}
/*
......@@ -2837,7 +2813,7 @@ THREE.WebGLRenderer = function ( parameters ) {
*/
function renderLensFlares( scene, camera ) {
var object, objectZ, geometryGroup, material;
var o, ol = scene.__webglLensFlares.length;
var f, fl, flare;
......@@ -2869,7 +2845,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.uniform1i( uniforms.map, 0 );
_gl.activeTexture( _gl.TEXTURE0 );
_gl.uniform1f( uniforms.opacity, 1 );
_gl.uniform1f( uniforms.rotation, 0 );
_gl.uniform2fv( uniforms.scale, scale );
......@@ -2886,34 +2862,34 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl.depthMask( false );
for( o = 0; o < ol; o++ ) {
for ( o = 0; o < ol; o ++ ) {
// calc object screen position
object = scene.__webglLensFlares[ o ].object;
tempPosition.set( object.matrixWorld.n14, object.matrixWorld.n24, object.matrixWorld.n34 );
camera.matrixWorldInverse.multiplyVector3( tempPosition );
objectZ = tempPosition.z;
camera.projectionMatrix.multiplyVector3( tempPosition );
// setup arrays for gl programs
screenPosition[ 0 ] = tempPosition.x;
screenPosition[ 1 ] = tempPosition.y;
screenPosition[ 2 ] = tempPosition.z;
screenPositionPixels[ 0 ] = screenPosition[ 0 ] * halfViewportWidth + halfViewportWidth;
screenPositionPixels[ 1 ] = screenPosition[ 1 ] * halfViewportHeight + halfViewportHeight;
// save current RGB to temp texture
_gl.copyTexSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, screenPositionPixels[ 0 ] - 8, screenPositionPixels[ 1 ] - 8, 16, 16 );
// render pink quad
_gl.uniform3fv( uniforms.screenPosition, screenPosition );
......@@ -2927,17 +2903,16 @@ THREE.WebGLRenderer = function ( parameters ) {
// read back
try {
_gl.readPixels( screenPositionPixels[ 0 ] - 8, screenPositionPixels[ 1 ] - 8, 16, 16, _gl.RGBA, _gl.UNSIGNED_BYTE, _lensFlare.readBackPixels );
}
catch( error ) {
} catch( error ) {
console.log( "WebGLRenderer.renderLensFlare: readPixels failed!" );
}
if( _gl.getError()) {
if ( _gl.getError() ) {
console.log( "WebGLRenderer.renderLensFlare: readPixels failed!" );
}
......@@ -2953,99 +2928,98 @@ THREE.WebGLRenderer = function ( parameters ) {
sampleIndex = ( sampleMidX - sampleX ) + ( sampleMidY - sampleY ); // upper left
if( _lensFlare.readBackPixels[ sampleIndex + 0 ] === 255 &&
_lensFlare.readBackPixels[ sampleIndex + 1 ] === 0 &&
_lensFlare.readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
_lensFlare.readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
sampleIndex = ( sampleMidX + sampleX ) + ( sampleMidY - sampleY ); // upper right
if( readBackPixels[ sampleIndex + 0 ] === 255 &&
readBackPixels[ sampleIndex + 1 ] === 0 &&
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
sampleIndex = ( sampleMidX + sampleX ) + ( sampleMidY + sampleY ); // lower right
if( readBackPixels[ sampleIndex + 0 ] === 255 &&
readBackPixels[ sampleIndex + 1 ] === 0 &&
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
sampleIndex = ( sampleMidX - sampleX ) + ( sampleMidY + sampleY ); // lower left
if( readBackPixels[ sampleIndex + 0 ] === 255 &&
readBackPixels[ sampleIndex + 1 ] === 0 &&
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
sampleIndex = sampleMidX + sampleMidY; // center
if( readBackPixels[ sampleIndex + 0 ] === 255 &&
readBackPixels[ sampleIndex + 1 ] === 0 &&
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;
object.positionScreen.x = screenPosition[ 0 ];
object.positionScreen.y = screenPosition[ 1 ];
object.positionScreen.z = screenPosition[ 2 ];
if( object.customUpdateCallback ) {
if ( object.customUpdateCallback ) {
object.customUpdateCallback( visibility, object );
} else {
object.updateLensFlares( visibility );
}
// restore graphics
_gl.uniform1i( uniforms.renderPink, 0 );
_gl.disable( _gl.DEPTH_TEST );
_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
}
// loop through all lens flares and draw their flares
// setup gl
for( o = 0; o < ol; o++ ) {
for ( o = 0; o < ol; o ++ ) {
object = scene.__webglLensFlares[ o ].object;
for( f = 0, fl = object.lensFlares.length; f < fl; f++ ) {
for ( f = 0, fl = object.lensFlares.length; f < fl; f ++ ) {
flare = object.lensFlares[ f ];
if( flare.opacity > 0.001 && flare.scale > 0.001 ) {
if ( flare.opacity > 0.001 && flare.scale > 0.001 ) {
screenPosition[ 0 ] = flare.x;
screenPosition[ 1 ] = flare.y;
screenPosition[ 2 ] = flare.z;
size = flare.size * flare.scale / _viewportHeight;
scale[ 0 ] = size * invAspect;
scale[ 1 ] = size;
_gl.uniform3fv( uniforms.screenPosition, screenPosition );
_gl.uniform1f( uniforms.rotation, flare.rotation );
_gl.uniform2fv( uniforms.scale, scale );
_gl.uniform1f( uniforms.opacity, flare.opacity );
setBlending( flare.blending );
setTexture( flare.texture, 0 );
// todo: only draw if loaded
_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
}
}
}
// restore gl
_gl.enable( _gl.CULL_FACE );
_gl.enable( _gl.DEPTH_TEST );
_gl.depthMask( _currentDepthMask );
}
}
function setupMatrices ( object, camera ) {
......@@ -3053,7 +3027,7 @@ THREE.WebGLRenderer = function ( parameters ) {
object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray );
};
}
this.initWebGLObjects = function ( scene ) {
......@@ -3092,7 +3066,7 @@ THREE.WebGLRenderer = function ( parameters ) {
updateObject( scene.__webglShadowVolumes[ o ].object, scene );
}
for ( var o = 0, ol = scene.__webglLensFlares.length; o < ol; o ++ ) {
updateObject( scene.__webglLensFlares[ o ].object, scene );
......@@ -3165,9 +3139,9 @@ THREE.WebGLRenderer = function ( parameters ) {
}
} else if ( object instanceof THREE.LensFlare ) {
addBuffer( scene.__webglLensFlares, undefined, object );
} else if ( object instanceof THREE.Ribbon ) {
geometry = object.geometry;
......@@ -3404,19 +3378,21 @@ THREE.WebGLRenderer = function ( parameters ) {
function addBuffer ( objlist, buffer, object ) {
objlist.push( { buffer: buffer, object: object,
opaque: { list: [], count: 0 },
transparent: { list: [], count: 0 }
} );
objlist.push( {
buffer: buffer, object: object,
opaque: { list: [], count: 0 },
transparent: { list: [], count: 0 }
} );
};
function addBufferImmediate ( objlist, object ) {
objlist.push( { object: object,
opaque: { list: [], count: 0 },
transparent: { list: [], count: 0 }
} );
objlist.push( {
object: object,
opaque: { list: [], count: 0 },
transparent: { list: [], count: 0 }
} );
};
......@@ -3566,13 +3542,13 @@ THREE.WebGLRenderer = function ( parameters ) {
"attribute vec2 uv2;",
"#ifdef USE_COLOR",
"attribute vec3 color;",
"#endif",
"#ifdef USE_MORPHTARGETS",
"attribute vec3 morphTarget0;",
"attribute vec3 morphTarget1;",
"attribute vec3 morphTarget2;",
......@@ -3581,18 +3557,18 @@ THREE.WebGLRenderer = function ( parameters ) {
"attribute vec3 morphTarget5;",
"attribute vec3 morphTarget6;",
"attribute vec3 morphTarget7;",
"#endif",
"#ifdef USE_SKINNING",
"attribute vec4 skinVertexA;",
"attribute vec4 skinVertexB;",
"attribute vec4 skinIndex;",
"attribute vec4 skinWeight;",
"#endif",
""
].join("\n");
......@@ -3705,10 +3681,10 @@ THREE.WebGLRenderer = function ( parameters ) {
switch ( blending ) {
case THREE.AdditiveAlphaBlending:
_gl.blendEquation( _gl.FUNC_ADD );
_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE );
break;
case THREE.AdditiveBlending:
......
......@@ -52,7 +52,6 @@ COMMON_FILES = [
'materials/ParticleCanvasMaterial.js',
'materials/ParticleDOMMaterial.js',
'materials/Texture.js',
'materials/RenderTarget.js',
'materials/Uniforms.js',
'objects/Particle.js',
'objects/ParticleSystem.js',
......@@ -73,6 +72,7 @@ COMMON_FILES = [
'renderers/SVGRenderer.js',
'renderers/WebGLShaders.js',
'renderers/WebGLRenderer.js',
'renderers/WebGLRenderTarget.js',
'renderers/SoundRenderer.js',
'renderers/renderables/RenderableVertex.js',
'renderers/renderables/RenderableFace3.js',
......@@ -273,7 +273,6 @@ WEBGL_FILES = [
'materials/ParticleBasicMaterial.js',
'materials/ShadowVolumeDynamicMaterial.js',
'materials/Texture.js',
'materials/RenderTarget.js',
'materials/Uniforms.js',
'objects/Particle.js',
'objects/ParticleSystem.js',
......@@ -291,7 +290,8 @@ WEBGL_FILES = [
'renderers/Projector.js',
'renderers/SoundRenderer.js',
'renderers/WebGLShaders.js',
'renderers/WebGLRenderer.js'
'renderers/WebGLRenderer.js',
'renderers/WebGLRenderTarget.js'
]
def merge(files):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册